mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: nitrogen6x: add phy reset timings
@ 2020-03-03 17:46 Marco Felsch
  2020-03-03 17:46 ` [PATCH 2/3] net: phy: micrel: backport finding PHY properties Marco Felsch
  2020-03-03 17:46 ` [PATCH 3/3] ARM: nitrogen6: remove hard coded values Marco Felsch
  0 siblings, 2 replies; 6+ messages in thread
From: Marco Felsch @ 2020-03-03 17:46 UTC (permalink / raw)
  To: barebox

Add reset timings according the datasheet [1]. Due to missing test hw I
added the fix only to the imx6qdl based boards.

[1] http://ww1.microchip.com/downloads/en/DeviceDoc/KSZ9021RL-RN-Data-Sheet-DS00003050A.pdf; page 56

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 arch/arm/dts/imx6qdl-nitrogen6x.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/dts/imx6qdl-nitrogen6x.dtsi
index 5c43b16ab1..d565a26ae4 100644
--- a/arch/arm/dts/imx6qdl-nitrogen6x.dtsi
+++ b/arch/arm/dts/imx6qdl-nitrogen6x.dtsi
@@ -23,6 +23,11 @@
 	};
 };
 
+&fec {
+	phy-reset-duration = <10>;
+	phy-reset-post-delay = <1>;
+};
+
 &flash {
 	#address-cells = <1>;
 	#size-cells = <1>;
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/3] net: phy: micrel: backport finding PHY properties
  2020-03-03 17:46 [PATCH 1/3] ARM: nitrogen6x: add phy reset timings Marco Felsch
@ 2020-03-03 17:46 ` Marco Felsch
  2020-03-09  7:28   ` Sascha Hauer
  2020-03-03 17:46 ` [PATCH 3/3] ARM: nitrogen6: remove hard coded values Marco Felsch
  1 sibling, 1 reply; 6+ messages in thread
From: Marco Felsch @ 2020-03-03 17:46 UTC (permalink / raw)
  To: barebox

This backports linux commit 651df2183543 ("phy: micrel: Fix finding PHY
properties in MAC node."):

8<---------------------------------------------------------------------

    phy: micrel: Fix finding PHY properties in MAC node.

    commit 8b63ec1837fa ("phylib: Make PHYs children of their MDIO bus,
    not the bus' parent.")  changed the parenting of PHY devices, making
    them a child of the MDIO bus, instead of the MAC device. This broken
    the Micrel PHY driver which has a deprecated feature of allowing PHY
    properties to be placed into the MAC node.

    In order to find the MAC node, we need to walk up the tree of devices
    until we find one with an OF node attached.

    Reported-by: Dinh Nguyen <dinguyen@opensource.altera.com>
    Suggested-by: David Daney <david.daney@cavium.com>
    Acked-by: David Daney <david.daney@cavium.com>
    Fixes: 8b63ec1837fa ("phylib: Make PHYs children of their MDIO bus, not the bus' parent.")
    Signed-off-by: Andrew Lunn <andrew@lunn.ch>
    Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>
    Acked-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

8<---------------------------------------------------------------------

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 drivers/net/phy/micrel.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 8f0b81d8fa..b18db0a751 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -115,6 +115,7 @@ static int ksz9021_config_init(struct phy_device *phydev)
 {
 	const struct device_d *dev = &phydev->dev;
 	const struct device_node *of_node = dev->device_node;
+	const struct device_d *dev_walker;
 	const char *clk_pad_skew_names[] = {
 		"txen-skew-ps", "txc-skew-ps",
 		"rxdv-skew-ps", "rxc-skew-ps"
@@ -128,8 +129,15 @@ static int ksz9021_config_init(struct phy_device *phydev)
 		"txd2-skew-ps", "txd3-skew-ps"
 	};
 
-	if (!of_node && dev->parent->device_node)
-		of_node = dev->parent->device_node;
+	/* The Micrel driver has a deprecated option to place phy OF
+	 * properties in the MAC node. Walk up the tree of devices to
+	 * find a device with an OF node.
+	 */
+	dev_walker = &phydev->dev;
+	do {
+		of_node = dev_walker->device_node;
+		dev_walker = dev_walker->parent;
+	} while (!of_node && dev_walker);
 
 	if (of_node) {
 		ksz9021_load_values_from_of(phydev, of_node,
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/3] ARM: nitrogen6: remove hard coded values
  2020-03-03 17:46 [PATCH 1/3] ARM: nitrogen6x: add phy reset timings Marco Felsch
  2020-03-03 17:46 ` [PATCH 2/3] net: phy: micrel: backport finding PHY properties Marco Felsch
@ 2020-03-03 17:46 ` Marco Felsch
  2020-03-06 16:06   ` Stefan Lengfeld
  1 sibling, 1 reply; 6+ messages in thread
From: Marco Felsch @ 2020-03-03 17:46 UTC (permalink / raw)
  To: barebox

Since commit c3f5ce7308 ("net: phy: micrel: Add support for specifying pad
skew values") and commit 2720a02e8a ("net: phy: micrel: backport finding
PHY properties") the phy driver can handle this taking the DT specified
values into account. Those values are exactly the same as the ones
specified here.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 arch/arm/boards/boundarydevices-nitrogen6/board.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/arm/boards/boundarydevices-nitrogen6/board.c b/arch/arm/boards/boundarydevices-nitrogen6/board.c
index d9514d9d48..8c565c74a0 100644
--- a/arch/arm/boards/boundarydevices-nitrogen6/board.c
+++ b/arch/arm/boards/boundarydevices-nitrogen6/board.c
@@ -43,16 +43,6 @@ static int ksz9021rn_phy_fixup(struct phy_device *dev)
 {
 	phy_write(dev, 0x09, 0x0f00);
 
-	/* do same as linux kernel */
-	/* min rx data delay */
-	phy_write(dev, 0x0b, 0x8105);
-	phy_write(dev, 0x0c, 0x0000);
-
-	/* max rx/tx clock delay, min rx/tx control delay */
-	phy_write(dev, 0x0b, 0x8104);
-	phy_write(dev, 0x0c, 0xf0f0);
-	phy_write(dev, 0x0b, 0x104);
-
 	return 0;
 }
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 3/3] ARM: nitrogen6: remove hard coded values
  2020-03-03 17:46 ` [PATCH 3/3] ARM: nitrogen6: remove hard coded values Marco Felsch
@ 2020-03-06 16:06   ` Stefan Lengfeld
  2020-03-09  6:32     ` Marco Felsch
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Lengfeld @ 2020-03-06 16:06 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox

Hi Marco,

my two cents:

On Tue, Mar 03, 2020 at 06:46:16PM +0100, Marco Felsch wrote:
> Since commit c3f5ce7308 ("net: phy: micrel: Add support for specifying pad
> skew values") and commit 2720a02e8a ("net: phy: micrel: backport finding
> PHY properties") the phy driver can handle this taking the DT specified

The first commit id 'c3f5ce7308' is a *stable* commit id, because
Sascha's 'master' branch of the barebox already contains the
patch/commit. It's safe to use it in commit messages and e.g. 'Fixes:'
tags.

The second commit id '2720a02e8a' is not stable, because the patch is
part of your series and therefore not yet in Sascha's master branch.
When Sascha applies the patch to his git tree, the patch will have a
different commit id, because it will have a different parent, committer
and date.

If you want to reference a patch in your series from a commit message,
you mostly just use something like 'and the previous patch (...)'.

Kind regards,
Stefan

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 3/3] ARM: nitrogen6: remove hard coded values
  2020-03-06 16:06   ` Stefan Lengfeld
@ 2020-03-09  6:32     ` Marco Felsch
  0 siblings, 0 replies; 6+ messages in thread
From: Marco Felsch @ 2020-03-09  6:32 UTC (permalink / raw)
  To: Stefan Lengfeld; +Cc: barebox

Hi Stefan,

On 20-03-06 17:06, Stefan Lengfeld wrote:
> Hi Marco,
> 
> my two cents:
> 
> On Tue, Mar 03, 2020 at 06:46:16PM +0100, Marco Felsch wrote:
> > Since commit c3f5ce7308 ("net: phy: micrel: Add support for specifying pad
> > skew values") and commit 2720a02e8a ("net: phy: micrel: backport finding
> > PHY properties") the phy driver can handle this taking the DT specified
> 
> The first commit id 'c3f5ce7308' is a *stable* commit id, because
> Sascha's 'master' branch of the barebox already contains the
> patch/commit. It's safe to use it in commit messages and e.g. 'Fixes:'
> tags.

I don't add such tags for barebox because it doesn't make sense here.

> The second commit id '2720a02e8a' is not stable, because the patch is
> part of your series and therefore not yet in Sascha's master branch.
> When Sascha applies the patch to his git tree, the patch will have a
> different commit id, because it will have a different parent, committer
> and date.

You're right here, I imagined it after I send the patch series..
@Sascha
Pls, can you drop the commit-id or adapt it after you applied the patch?

> If you want to reference a patch in your series from a commit message,
> you mostly just use something like 'and the previous patch (...)'.

I will keep that in mind, thanks :)

Regards,
  Marco

> Kind regards,
> Stefan
> 

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 2/3] net: phy: micrel: backport finding PHY properties
  2020-03-03 17:46 ` [PATCH 2/3] net: phy: micrel: backport finding PHY properties Marco Felsch
@ 2020-03-09  7:28   ` Sascha Hauer
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2020-03-09  7:28 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox

On Tue, Mar 03, 2020 at 06:46:15PM +0100, Marco Felsch wrote:
> This backports linux commit 651df2183543 ("phy: micrel: Fix finding PHY
> properties in MAC node."):
> 
> 8<---------------------------------------------------------------------
> 
>     phy: micrel: Fix finding PHY properties in MAC node.
> 
>     commit 8b63ec1837fa ("phylib: Make PHYs children of their MDIO bus,
>     not the bus' parent.")  changed the parenting of PHY devices, making
>     them a child of the MDIO bus, instead of the MAC device. This broken
>     the Micrel PHY driver which has a deprecated feature of allowing PHY
>     properties to be placed into the MAC node.
> 
>     In order to find the MAC node, we need to walk up the tree of devices
>     until we find one with an OF node attached.
> 
>     Reported-by: Dinh Nguyen <dinguyen@opensource.altera.com>
>     Suggested-by: David Daney <david.daney@cavium.com>
>     Acked-by: David Daney <david.daney@cavium.com>
>     Fixes: 8b63ec1837fa ("phylib: Make PHYs children of their MDIO bus, not the bus' parent.")
>     Signed-off-by: Andrew Lunn <andrew@lunn.ch>
>     Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>
>     Acked-by: Florian Fainelli <f.fainelli@gmail.com>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> 8<---------------------------------------------------------------------
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  drivers/net/phy/micrel.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 8f0b81d8fa..b18db0a751 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -115,6 +115,7 @@ static int ksz9021_config_init(struct phy_device *phydev)
>  {
>  	const struct device_d *dev = &phydev->dev;
>  	const struct device_node *of_node = dev->device_node;
> +	const struct device_d *dev_walker;
>  	const char *clk_pad_skew_names[] = {
>  		"txen-skew-ps", "txc-skew-ps",
>  		"rxdv-skew-ps", "rxc-skew-ps"
> @@ -128,8 +129,15 @@ static int ksz9021_config_init(struct phy_device *phydev)
>  		"txd2-skew-ps", "txd3-skew-ps"
>  	};
>  
> -	if (!of_node && dev->parent->device_node)
> -		of_node = dev->parent->device_node;
> +	/* The Micrel driver has a deprecated option to place phy OF
> +	 * properties in the MAC node. Walk up the tree of devices to
> +	 * find a device with an OF node.
> +	 */
> +	dev_walker = &phydev->dev;
> +	do {
> +		of_node = dev_walker->device_node;
> +		dev_walker = dev_walker->parent;
> +	} while (!of_node && dev_walker);

If that's deprecated that would be a good opportunity to fix it in the
upstream device trees and also to be more noisy here.

Unlike the Kernel we don't have to deal with deprecated device trees in
barebox.

Sascha

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-03-09  7:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 17:46 [PATCH 1/3] ARM: nitrogen6x: add phy reset timings Marco Felsch
2020-03-03 17:46 ` [PATCH 2/3] net: phy: micrel: backport finding PHY properties Marco Felsch
2020-03-09  7:28   ` Sascha Hauer
2020-03-03 17:46 ` [PATCH 3/3] ARM: nitrogen6: remove hard coded values Marco Felsch
2020-03-06 16:06   ` Stefan Lengfeld
2020-03-09  6:32     ` Marco Felsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox