linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] ARM i.MX6q: make sure PHY fixup for KSZ9031 is applied only on one board
@ 2019-12-09  8:44 Oleksij Rempel
  2019-12-09 17:15 ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Oleksij Rempel @ 2019-12-09  8:44 UTC (permalink / raw)
  To: Shawn Guo, Sascha Hauer
  Cc: Oleksij Rempel, kernel, netdev, linux-arm-kernel, linux-kernel,
	linux-imx, Fabio Estevam

Currently all board specific fixups defined in mach-imx*.c are not
working properly. They are applied on all boards with the same iMX SoC
variant and even if:
- PHY needs different settings because of different board design
- PHY needs different settings if it is not connected directly to the SoC.
  For example, the PHY is connected to a switch and the switch is connected
  to the SoC.

Since most PHY drivers don't know about changed default settings, these
settings will not be restored by the PHY driver after reset or
suspend/resume cycle.

This patch changes the MICREL KSZ9031 fixup, which was introduced for
the "Data Modul eDM-QMX6" board in following patch, to be only activated
for this specific board.

|commit dbf6719a4a080669acb5087893704586c791aa41
|Author: Sascha Hauer <s.hauer@pengutronix.de>
|Date:   Thu Jun 20 17:34:33 2013 +0200
|
| ARM: i.MX6: add ethernet phy fixup for KSZ9031
|
| The KSZ9031 is used on the i.MX6 based Data Modul eDM-QMX6
| board. It needs the same fixup to the rx/tx delays as other
| i.MX6 boards.

If some board was working by accident with this fixup, it will probably
break and should be fixed properly by setting related device tree
properties.

To fix this properly the "eDM-QMX6" devicetree:

    arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts

should have board specific *-skew-ps properties. See:

    Documentation/devicetree/bindings/net/micrel-ksz90x1.txt

Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 arch/arm/mach-imx/mach-imx6q.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 6441281cf4f2..2370cb5d8501 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -162,11 +162,19 @@ static int ar8035_phy_fixup(struct phy_device *dev)
 
 static void __init imx6q_enet_phy_init(void)
 {
+	/* Warning: please do not extend this fixup list. This fixups are
+	 * applied even on boards where related PHY is not directly connected
+	 * to the ethernet controller. For example with switch in the middle.
+	 */
 	if (IS_BUILTIN(CONFIG_PHYLIB)) {
 		phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
 				ksz9021rn_phy_fixup);
-		phy_register_fixup_for_uid(PHY_ID_KSZ9031, MICREL_PHY_ID_MASK,
-				ksz9031rn_phy_fixup);
+
+		if (of_machine_is_compatible("dmo,imx6q-edmqmx6"))
+			phy_register_fixup_for_uid(PHY_ID_KSZ9031,
+						   MICREL_PHY_ID_MASK,
+						   ksz9031rn_phy_fixup);
+
 		phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffef,
 				ar8031_phy_fixup);
 		phy_register_fixup_for_uid(PHY_ID_AR8035, 0xffffffef,
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] ARM i.MX6q: make sure PHY fixup for KSZ9031 is applied only on one board
  2019-12-09  8:44 [PATCH v1] ARM i.MX6q: make sure PHY fixup for KSZ9031 is applied only on one board Oleksij Rempel
@ 2019-12-09 17:15 ` Andrew Lunn
  2019-12-09 17:39   ` Oleksij Rempel
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2019-12-09 17:15 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Shawn Guo, Sascha Hauer, netdev, linux-kernel, linux-imx, kernel,
	Fabio Estevam, linux-arm-kernel

Hi Oleksij

> This patch changes the MICREL KSZ9031 fixup, which was introduced for
> the "Data Modul eDM-QMX6" board in following patch, to be only activated
> for this specific board.

...

>  static void __init imx6q_enet_phy_init(void)
>  {
> +	/* Warning: please do not extend this fixup list. This fixups are
> +	 * applied even on boards where related PHY is not directly connected
> +	 * to the ethernet controller. For example with switch in the middle.
> +	 */
>  	if (IS_BUILTIN(CONFIG_PHYLIB)) {
>  		phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
>  				ksz9021rn_phy_fixup);
> -		phy_register_fixup_for_uid(PHY_ID_KSZ9031, MICREL_PHY_ID_MASK,
> -				ksz9031rn_phy_fixup);
> +
> +		if (of_machine_is_compatible("dmo,imx6q-edmqmx6"))
> +			phy_register_fixup_for_uid(PHY_ID_KSZ9031,
> +						   MICREL_PHY_ID_MASK,
> +						   ksz9031rn_phy_fixup);
> +
>  		phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffef,
>  				ar8031_phy_fixup);
>  		phy_register_fixup_for_uid(PHY_ID_AR8035, 0xffffffef,

What about the other 3 fixups? Are they not also equally broken,
applied for all boards, not specific boards?

	Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] ARM i.MX6q: make sure PHY fixup for KSZ9031 is applied only on one board
  2019-12-09 17:15 ` Andrew Lunn
@ 2019-12-09 17:39   ` Oleksij Rempel
  2019-12-09 17:51     ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Oleksij Rempel @ 2019-12-09 17:39 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Fabio Estevam, netdev, Sascha Hauer, linux-kernel, linux-imx,
	kernel, Shawn Guo, linux-arm-kernel

Hi Andrew,

On Mon, Dec 09, 2019 at 06:15:08PM +0100, Andrew Lunn wrote:
> Hi Oleksij
> 
> > This patch changes the MICREL KSZ9031 fixup, which was introduced for
> > the "Data Modul eDM-QMX6" board in following patch, to be only activated
> > for this specific board.
> 
> ...
> 
> >  static void __init imx6q_enet_phy_init(void)
> >  {
> > +	/* Warning: please do not extend this fixup list. This fixups are
> > +	 * applied even on boards where related PHY is not directly connected
> > +	 * to the ethernet controller. For example with switch in the middle.
> > +	 */
> >  	if (IS_BUILTIN(CONFIG_PHYLIB)) {
> >  		phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
> >  				ksz9021rn_phy_fixup);
> > -		phy_register_fixup_for_uid(PHY_ID_KSZ9031, MICREL_PHY_ID_MASK,
> > -				ksz9031rn_phy_fixup);
> > +
> > +		if (of_machine_is_compatible("dmo,imx6q-edmqmx6"))
> > +			phy_register_fixup_for_uid(PHY_ID_KSZ9031,
> > +						   MICREL_PHY_ID_MASK,
> > +						   ksz9031rn_phy_fixup);
> > +
> >  		phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffef,
> >  				ar8031_phy_fixup);
> >  		phy_register_fixup_for_uid(PHY_ID_AR8035, 0xffffffef,
> 
> What about the other 3 fixups? Are they not also equally broken,
> applied for all boards, not specific boards?

Yes. all of them are broken.
I just trying to not wake all wasp at one time. Most probably there are
board working by accident. So, it will be good to have at least separate
patches for each fixup.

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] ARM i.MX6q: make sure PHY fixup for KSZ9031 is applied only on one board
  2019-12-09 17:39   ` Oleksij Rempel
@ 2019-12-09 17:51     ` Andrew Lunn
  2019-12-10  7:54       ` Oleksij Rempel
  2020-01-20  9:50       ` Oleksij Rempel
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Lunn @ 2019-12-09 17:51 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Fabio Estevam, netdev, Sascha Hauer, linux-kernel, linux-imx,
	kernel, Shawn Guo, linux-arm-kernel

> Yes. all of them are broken.
> I just trying to not wake all wasp at one time. Most probably there are
> board working by accident. So, it will be good to have at least separate
> patches for each fixup.

I agree about a patch per fixup. Can you try to generate such patches?
See if there is enough history in git to determine which boards
actually need these fixups?

Thanks
	Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] ARM i.MX6q: make sure PHY fixup for KSZ9031 is applied only on one board
  2019-12-09 17:51     ` Andrew Lunn
@ 2019-12-10  7:54       ` Oleksij Rempel
  2020-01-20  9:50       ` Oleksij Rempel
  1 sibling, 0 replies; 6+ messages in thread
From: Oleksij Rempel @ 2019-12-10  7:54 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Fabio Estevam, netdev, Sascha Hauer, linux-kernel, linux-imx,
	kernel, Shawn Guo, linux-arm-kernel



On 09.12.19 18:51, Andrew Lunn wrote:
>> Yes. all of them are broken.
>> I just trying to not wake all wasp at one time. Most probably there are
>> board working by accident. So, it will be good to have at least separate
>> patches for each fixup.
> 
> I agree about a patch per fixup. Can you try to generate such patches?
> See if there is enough history in git to determine which boards
> actually need these fixups?

Ok,

then please ignore this patch. I'll prepare a series of patches related to imx phy fixups.

Kind regards,
Oleksij Rempel

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] ARM i.MX6q: make sure PHY fixup for KSZ9031 is applied only on one board
  2019-12-09 17:51     ` Andrew Lunn
  2019-12-10  7:54       ` Oleksij Rempel
@ 2020-01-20  9:50       ` Oleksij Rempel
  1 sibling, 0 replies; 6+ messages in thread
From: Oleksij Rempel @ 2020-01-20  9:50 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Fabio Estevam, netdev, Sascha Hauer, linux-kernel, linux-imx,
	kernel, Shawn Guo, linux-arm-kernel



On 09.12.19 18:51, Andrew Lunn wrote:
>> Yes. all of them are broken.
>> I just trying to not wake all wasp at one time. Most probably there are
>> board working by accident. So, it will be good to have at least separate
>> patches for each fixup.
> 
> I agree about a patch per fixup. Can you try to generate such patches?
> See if there is enough history in git to determine which boards
> actually need these fixups?

After some attempts to make it and more discussions, I tend to provide a Kconfig to 
disable/enable this fixups. This will provide an option for users with old devicetree
and possibility to continue development on clean setup.

What do you think about this way and what default state it should be? FIXUPS default on or 
off?

Kind regards,
Oleksij Rempel

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-20  9:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09  8:44 [PATCH v1] ARM i.MX6q: make sure PHY fixup for KSZ9031 is applied only on one board Oleksij Rempel
2019-12-09 17:15 ` Andrew Lunn
2019-12-09 17:39   ` Oleksij Rempel
2019-12-09 17:51     ` Andrew Lunn
2019-12-10  7:54       ` Oleksij Rempel
2020-01-20  9:50       ` Oleksij Rempel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).