phy: atheros: cleanup and device tree bindings
Subsystems (2)
cover phy: atheros: cleanup and device tree bindings
This series cleans up the Atheros PHY AR803x PHY driver and adds a device tree binding for the most commonly used PHY settings like clock output.
If you're a board maintainer you're getting this mail because you probably use an AR803x PHY on your board. Please have a look at your board specific code and see if you can use the device tree bindings instead. Let me know, if something is missing.
Michael Walle (9):
phy: atheros: introduce debug read and write functions
phy: atheros: move delay config to common function
phy: atheros: ar8035: remove extra delay config
phy: atheros: ar8035: use phy_{read|write}_mmd()
phy: atheros: don't overwrite debug register values
phy: atheros: fix delay configuration
phy: atheros: Add device tree bindings and config
phy: atheros: ar8035: remove static clock config
phy: atheros: consolidate {ar8031|ar8035}_config()
doc/device-tree-bindings/net/phy/atheros.txt | 22 ++ drivers/net/phy/atheros.c | 262 +++++++++++++++---- 2 files changed, 240 insertions(+), 44 deletions(-) create mode 100644 doc/device-tree-bindings/net/phy/atheros.txt
Signature · 1 line
2.20.1
PATCH 1/9 phy: atheros: introduce debug read and write functions
Provide functions to read and write the Atheros debug registers.
--- drivers/net/phy/atheros.c | 72 ++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 19 deletions(-)
drivers/net/phy/atheros.c +53 -19
@@ -17,11 +17,52 @@#define AR803x_DEBUG_REG_0 0x0#define AR803x_RGMII_RX_CLK_DLY 0x8000 +static int ar803x_debug_reg_read (struct phy_device *phydev,u16 reg) +{ +int ret; + + ret =phy_write (phydev,MDIO_DEVAD_NONE , AR803x_PHY_DEBUG_ADDR_REG, + reg); +if (ret <0 ) +return ret; + +return phy_read (phydev,MDIO_DEVAD_NONE , AR803x_PHY_DEBUG_DATA_REG); +} + +static int ar803x_debug_reg_write (struct phy_device *phydev,u16 reg,u16 val) +{ +int ret; + + ret =phy_write (phydev,MDIO_DEVAD_NONE , AR803x_PHY_DEBUG_ADDR_REG, + reg); +if (ret <0 ) +return ret; + +return phy_write (phydev,MDIO_DEVAD_NONE , AR803x_PHY_DEBUG_DATA_REG, + val); +} + +static int ar803x_debug_reg_mask (struct phy_device *phydev,u16 reg, +u16 clear,u16 set) +{ +int val; + + val =ar803x_debug_reg_read (phydev, reg); +if (val <0 ) +return val; + + val &=0xffff ; + val &= ~clear; + val |= set; + +return phy_write (phydev,MDIO_DEVAD_NONE , AR803x_PHY_DEBUG_DATA_REG, + val); +} +static int ar8021_config (struct phy_device *phydev) {phy_write (phydev,MDIO_DEVAD_NONE ,0x00 ,0x1200 ); -phy_write (phydev,MDIO_DEVAD_NONE ,0x1d ,0x05 ); -phy_write (phydev,MDIO_DEVAD_NONE ,0x1e ,0x3D47 ); +ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_5,0x3D47 ); phydev->supported = phydev->drv->features;return 0 ;
@@ -31,18 +72,14 @@ static int ar8031_config(struct phy_device *phydev) {if (phydev->interface ==PHY_INTERFACE_MODE_RGMII_TXID || phydev->interface ==PHY_INTERFACE_MODE_RGMII_ID ) { -phy_write (phydev,MDIO_DEVAD_NONE , AR803x_PHY_DEBUG_ADDR_REG, - AR803x_DEBUG_REG_5); -phy_write (phydev,MDIO_DEVAD_NONE , AR803x_PHY_DEBUG_DATA_REG, - AR803x_RGMII_TX_CLK_DLY); +ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_5, + AR803x_RGMII_TX_CLK_DLY); }if (phydev->interface ==PHY_INTERFACE_MODE_RGMII_RXID || phydev->interface ==PHY_INTERFACE_MODE_RGMII_ID ) { -phy_write (phydev,MDIO_DEVAD_NONE , AR803x_PHY_DEBUG_ADDR_REG, - AR803x_DEBUG_REG_0); -phy_write (phydev,MDIO_DEVAD_NONE , AR803x_PHY_DEBUG_DATA_REG, - AR803x_RGMII_RX_CLK_DLY); +ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_0, + AR803x_RGMII_RX_CLK_DLY); } phydev->supported = phydev->drv->features;
@@ -63,24 +100,21 @@ static int ar8035_config(struct phy_device *phydev) regval =phy_read (phydev,MDIO_DEVAD_NONE ,0xe );phy_write (phydev,MDIO_DEVAD_NONE ,0xe , (regval|0x0018 )); -phy_write (phydev,MDIO_DEVAD_NONE ,0x1d ,0x05 ); - regval =phy_read (phydev,MDIO_DEVAD_NONE ,0x1e ); -phy_write (phydev,MDIO_DEVAD_NONE ,0x1e , (regval|0x0100 )); +ar803x_debug_reg_mask (phydev, AR803x_DEBUG_REG_5, +0 , AR803x_RGMII_TX_CLK_DLY);if ((phydev->interface ==PHY_INTERFACE_MODE_RGMII_ID ) || (phydev->interface ==PHY_INTERFACE_MODE_RGMII_TXID )) { -/* select debug reg 5 */ -phy_write (phydev,MDIO_DEVAD_NONE ,0x1D ,0x5 );/* enable tx delay */ -phy_write (phydev,MDIO_DEVAD_NONE ,0x1E ,0x0100 ); +ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_5, + AR803x_RGMII_TX_CLK_DLY); }if ((phydev->interface ==PHY_INTERFACE_MODE_RGMII_ID ) || (phydev->interface ==PHY_INTERFACE_MODE_RGMII_RXID )) { -/* select debug reg 0 */ -phy_write (phydev,MDIO_DEVAD_NONE ,0x1D ,0x0 );/* enable rx delay */ -phy_write (phydev,MDIO_DEVAD_NONE ,0x1E ,0x8000 ); +ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_0, + AR803x_RGMII_RX_CLK_DLY); } phydev->supported = phydev->drv->features;
Signature · 1 line
2.20.1
PATCH 1/9 phy: atheros: introduce debug read and write functions
Quoted 4 lines · Michael Walle
Provide functions to read and write the Atheros debug registers.
Signed-off-by Michael Walle <[email protected]>
PATCH 1/9 phy: atheros: introduce debug read and write functions
Am 2019-11-30 02:11, schrieb Joe Hershberger:
Quoted 7 lines · Michael Walle
Quoted 4 lines
Provide functions to read and write the Atheros debug registers.
Signed-off-by Michael Walle <[email protected]>Acked-by Joe Hershberger <[email protected]>
Sorry this was superseeded by
https://patchwork.ozlabs.org/project/uboot/list/?series=146771
Unfortunately, I've forgot to add the mailinglist to the original series. So it never ended up in the patchwork system :(
-michael
PATCH 1/9 phy: atheros: introduce debug read and write functions
In reply to Joe HershbergerAm 2019-11-30 02:11, schrieb Joe Hershberger:
Quoted 7 lines · Michael Walle
Quoted 4 lines
Provide functions to read and write the Atheros debug registers.
Signed-off-by Michael Walle <[email protected]>Acked-by Joe Hershberger <[email protected]>
Sorry this series superseeded by
https://patchwork.ozlabs.org/project/uboot/list/?series=146771
Unfortunately, I've forgot to add the mailinglist to the original series. So it never ended up in the patchwork system :(
-michael
PATCH 1/9 phy: atheros: introduce debug read and write functions
In reply to Michael WalleHi Michael,
Quoted 4 lines · Michael Walle
Provide functions to read and write the Atheros debug registers.
Signed-off-by Michael Walle <[email protected]>
This series is adding too much size to several of the boards' SPL it seems.
https://travis-ci.org/jhershbe/u-boot/builds/620804934
Please address this and resend.
Thanks,
-Joe
PATCH 1/9 phy: atheros: introduce debug read and write functions
Hi Joe, Hi Tom,
Am 2019-12-05 16:55, schrieb Joe Hershberger:
Quoted 6 lines
Hi Michael,
Quoted 3 lines · Michael Walle
Provide functions to read and write the Atheros debug registers.
Quoted 8 lines
Quoted 1 line
Signed-off-by Michael Walle <[email protected]>This series is adding too much size to several of the boards' SPL it seems.
https://travis-ci.org/jhershbe/u-boot/builds/620804934
Please address this and resend.
So first of all, this was the old series. There was a v2 series, but unfortunately, I've forgot to add the mailing to the recipients, so it never ended up in the patchwork system. sorry :(
I've resend the v2 series here:
https://patchwork.ozlabs.org/project/uboot/list/?series=146771
Now coming to the real problem here. The sizes, or like some boards handle
the SPL stuff. Btw. I could not reproduce it on the am335x_boneblack_vboot
board with a gcc-8. I've seen the travis ci job uses the gcc-7 so this also
depends on the gcc. gcc-8 seems to produce smaller code, because on the am335x_evm the overflow was only by some 100 bytes.
So taking the am335x_evm board for example. It has the following options set:
CONFIG_DM_ETH=y
CONFIG_SPL_NET_SUPPORT=y
CONFIG_PHY_ATHEROS=y (this one is set in the config.h!)
So adding a new binding for the phy obviously increases the code size. But
the hard question is, how could that be fixed. IMHO the board has wrong settings. I really don't know how that could be "fixed" other than not applying this series. Well, we could make the additions conditional and introduce a new Kconfig setting, but that is a relly ugly hack and won't last long, would it? Doh!
-michael
PATCH 1/9 phy: atheros: introduce debug read and write functions
Quoted 37 lines · Michael Walle
Hi Joe, Hi Tom,
Am 2019-12-05 16:55, schrieb Joe Hershberger:
Quoted 6 lines
Hi Michael,
Quoted 3 lines · Michael Walle
Provide functions to read and write the Atheros debug registers.
Quoted 8 lines
Quoted 1 line
Signed-off-by Michael Walle <[email protected]>This series is adding too much size to several of the boards' SPL it seems.
https://travis-ci.org/jhershbe/u-boot/builds/620804934
Please address this and resend.
So first of all, this was the old series. There was a v2 series, but unfortunately, I've forgot to add the mailing to the recipients, so it never ended up in the patchwork system. sorry :(
I've resend the v2 series here:
https://patchwork.ozlabs.org/project/uboot/list/?series=146771Now coming to the real problem here. The sizes, or like some boards handle the SPL stuff. Btw. I could not reproduce it on the
am335x_boneblack_vbootboard with a gcc-8. I've seen the travis ci job uses the gcc-7 so this also depends on the gcc. gcc-8 seems to produce smaller code, because on theam335x_evmthe overflow was only by some 100 bytes.So taking the
am335x_evmboard for example. It has the following options set:
CONFIG_DM_ETH=y
CONFIG_SPL_NET_SUPPORT=y
CONFIG_PHY_ATHEROS=y(this one is set in theconfig.h!)
Quoted 6 lines
So adding a new binding for the phy obviously increases the code size. But the hard question is, how could that be fixed. IMHO the board has wrong settings. I really don't know how that could be "fixed" other than not applying this series. Well, we could make the additions conditional and introduce a new
Kconfigsetting, but that is a relly ugly hack and won't last long, would it? Doh!
So, the gcc-7 from kernel.org is the min required and must work toolchain. Maybe once gcc-9 is mature enough for people to have made stand-alone toolchains for it we'll move up to that but gcc-8 for everyone ends up being too hard. For the boneblack_vboot config, we could just drop SPL networking, it's not super critical to that particular example. But am335x_evm is the kitchen-sink EVM and it is used and supported there.
That said, looking over the u-boot-spl.map, it looks like nfs stuff doesn't get discarded for some reason, I'm going to look in to that.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191205/7c8cfeb4/attachment.sig>
PATCH 1/9 phy: atheros: introduce debug read and write functions
Hi Tom,
Am 2019-12-06 00:58, schrieb Tom Rini:
Quoted 54 lines · Michael Walle
Quoted 42 lines
Hi Joe, Hi Tom,
Am 2019-12-05 16:55, schrieb Joe Hershberger:
Quoted 6 lines
Hi Michael,
Quoted 3 lines · Michael Walle
Provide functions to read and write the Atheros debug registers.
Quoted 8 lines
Quoted 1 line
Signed-off-by Michael Walle <[email protected]>This series is adding too much size to several of the boards' SPL it seems.
https://travis-ci.org/jhershbe/u-boot/builds/620804934
Please address this and resend.
So first of all, this was the old series. There was a v2 series, but unfortunately, I've forgot to add the mailing to the recipients, so it never ended up in the patchwork system. sorry :(
I've resend the v2 series here:
https://patchwork.ozlabs.org/project/uboot/list/?series=146771Now coming to the real problem here. The sizes, or like some boards handle
the SPL stuff. Btw. I could not reproduce it on theam335x_boneblack_vboot
board with a gcc-8. I've seen the travis ci job uses the gcc-7 so this also
depends on the gcc. gcc-8 seems to produce smaller code, because on theam335x_evmthe overflow was only by some 100 bytes.So taking the
am335x_evmboard for example. It has the following options
set:
CONFIG_DM_ETH=y
CONFIG_SPL_NET_SUPPORT=y
CONFIG_PHY_ATHEROS=y(this one is set in theconfig.h!)Quoted 10 lines
So adding a new binding for the phy obviously increases the code size. But
the hard question is, how could that be fixed. IMHO the board has wrong
settings. I really don't know how that could be "fixed" other than not applying this series. Well, we could make the additions conditional and
introduce a newKconfigsetting, but that is a relly ugly hack and won't
last long, would it? Doh!
Quoted 2 lines
So, the gcc-7 from kernel.org is the min required and must work toolchain.
Ok.
Quoted 9 lines
Maybe once gcc-9 is mature enough for people to have made stand-alone toolchains for it we'll move up to that but gcc-8 for everyone ends up being too hard. For the
boneblack_vbootconfig, we could just drop SPL networking, it's not super critical to that particular example. Butam335x_evmis the kitchen-sink EVM and it is used and supported there.That said, looking over the u-boot-spl.map, it looks like nfs stuff doesn't get discarded for some reason, I'm going to look in to that.
Well but that is just some kind of band aid. These two boards were just an example. There were also other boards which failed. I doubt the DM stuff is getting smaller (I know there is some discussion how to improve the situation). But there seems to be no way to disable the ethernet device model for the SPL, correct? And unfortunately, this also pulls the PHY library (with potential DM bindings).
-michael
PATCH 1/9 phy: atheros: introduce debug read and write functions
Quoted 72 lines · Michael Walle
Hi Tom,
Am 2019-12-06 00:58, schrieb Tom Rini:
Quoted 54 lines · Michael Walle
Quoted 42 lines
Hi Joe, Hi Tom,
Am 2019-12-05 16:55, schrieb Joe Hershberger:
Quoted 6 lines
Hi Michael,
Quoted 3 lines · Michael Walle
Provide functions to read and write the Atheros debug registers.
Quoted 8 lines
Quoted 1 line
Signed-off-by Michael Walle <[email protected]>This series is adding too much size to several of the boards' SPL it seems.
https://travis-ci.org/jhershbe/u-boot/builds/620804934
Please address this and resend.
So first of all, this was the old series. There was a v2 series, but unfortunately, I've forgot to add the mailing to the recipients, so it never ended up in the patchwork system. sorry :(
I've resend the v2 series here:
https://patchwork.ozlabs.org/project/uboot/list/?series=146771Now coming to the real problem here. The sizes, or like some boards handle
the SPL stuff. Btw. I could not reproduce it on theam335x_boneblack_vboot
board with a gcc-8. I've seen the travis ci job uses the gcc-7 so this also
depends on the gcc. gcc-8 seems to produce smaller code, because on theam335x_evmthe overflow was only by some 100 bytes.So taking the
am335x_evmboard for example. It has the following options
set:
CONFIG_DM_ETH=y
CONFIG_SPL_NET_SUPPORT=y
CONFIG_PHY_ATHEROS=y(this one is set in theconfig.h!)Quoted 10 lines
So adding a new binding for the phy obviously increases the code size. But
the hard question is, how could that be fixed. IMHO the board has wrong
settings. I really don't know how that could be "fixed" other than not applying this series. Well, we could make the additions conditional and
introduce a newKconfigsetting, but that is a relly ugly hack and won't
last long, would it? Doh!Quoted 2 lines
So, the gcc-7 from kernel.org is the min required and must work toolchain.
Ok.
Quoted 9 lines
Maybe once gcc-9 is mature enough for people to have made stand-alone toolchains for it we'll move up to that but gcc-8 for everyone ends up being too hard. For the
boneblack_vbootconfig, we could just drop SPL networking, it's not super critical to that particular example. Butam335x_evmis the kitchen-sink EVM and it is used and supported there.That said, looking over the u-boot-spl.map, it looks like nfs stuff doesn't get discarded for some reason, I'm going to look in to that.
Quoted 6 lines
Well but that is just some kind of band aid. These two boards were just an example. There were also other boards which failed. I doubt the DM stuff is getting smaller (I know there is some discussion how to improve the situation). But there seems to be no way to disable the ethernet device model for the SPL, correct? And unfortunately, this also pulls the PHY library (with potential DM bindings).
So, yes, keeping in mind that SPL matters for networking and we need to keep that in mind when adding features. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191205/a6ee7e14/attachment.sig>
PATCH 1/9 phy: atheros: introduce debug read and write functions
In reply to Tom RiniAm 2019-12-06 00:58, schrieb Tom Rini:
Quoted 2 lines
That said, looking over the u-boot-spl.map, it looks like nfs stuff doesn't get discarded for some reason, I'm going to look in to that.
CONFIG_CMD_NFS will pull that. There are also other network related cmds whose code is pulled into the SPL through net/net.c.
-michael
PATCH 1/9 phy: atheros: introduce debug read and write functions
Quoted 6 lines · Michael Walle
Am 2019-12-06 00:58, schrieb Tom Rini:
Quoted 2 lines
That said, looking over the u-boot-spl.map, it looks like nfs stuff doesn't get discarded for some reason, I'm going to look in to that.
CONFIG_CMD_NFSwill pull that. There are also other network related cmds whose code is pulled into the SPL throughnet/net.c.
Right. The way the networking stack behaves today I bet we have other functionality being pulled in to SPL that we would rather be able to discard as it's functionally unused. What I sent to keep NFS out is a little hacky looking but is the best we can do with the current structure. There might be a few other options we can drop out from the loop.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191205/5a9c0699/attachment.sig>
PATCH 1/9 phy: atheros: introduce debug read and write functions
In reply to Tom RiniHi Tom, Hi Joe,
Am 2019-12-06 00:58, schrieb Tom Rini:
Quoted 62 lines · Michael Walle
Quoted 42 lines
Hi Joe, Hi Tom,
Am 2019-12-05 16:55, schrieb Joe Hershberger:
Quoted 6 lines
Hi Michael,
Quoted 3 lines · Michael Walle
Provide functions to read and write the Atheros debug registers.
Quoted 8 lines
Quoted 1 line
Signed-off-by Michael Walle <[email protected]>This series is adding too much size to several of the boards' SPL it seems.
https://travis-ci.org/jhershbe/u-boot/builds/620804934
Please address this and resend.
So first of all, this was the old series. There was a v2 series, but unfortunately, I've forgot to add the mailing to the recipients, so it never ended up in the patchwork system. sorry :(
I've resend the v2 series here:
https://patchwork.ozlabs.org/project/uboot/list/?series=146771Now coming to the real problem here. The sizes, or like some boards handle
the SPL stuff. Btw. I could not reproduce it on theam335x_boneblack_vboot
board with a gcc-8. I've seen the travis ci job uses the gcc-7 so this also
depends on the gcc. gcc-8 seems to produce smaller code, because on theam335x_evmthe overflow was only by some 100 bytes.So taking the
am335x_evmboard for example. It has the following options
set:
CONFIG_DM_ETH=y
CONFIG_SPL_NET_SUPPORT=y
CONFIG_PHY_ATHEROS=y(this one is set in theconfig.h!)Quoted 10 lines
So adding a new binding for the phy obviously increases the code size. But
the hard question is, how could that be fixed. IMHO the board has wrong
settings. I really don't know how that could be "fixed" other than not applying this series. Well, we could make the additions conditional and
introduce a newKconfigsetting, but that is a relly ugly hack and won't
last long, would it? Doh!So, the gcc-7 from kernel.org is the min required and must work toolchain. Maybe once gcc-9 is mature enough for people to have made stand-alone toolchains for it we'll move up to that but gcc-8 for everyone ends up being too hard. For the
boneblack_vbootconfig, we could just drop SPL networking, it's not super critical to that particular example. Butam335x_evmis the kitchen-sink EVM and it is used and supported there.
Quoted 2 lines
That said, looking over the u-boot-spl.map, it looks like nfs stuff doesn't get discarded for some reason, I'm going to look in to that.
So do I need to do something now? I guess removing the NFS stuff will make enough room to fit this. But how do we make sure, it will be applied
with this series?
-michael
PATCH 1/9 phy: atheros: introduce debug read and write functions
Quoted 65 lines · Michael Walle
Hi Tom, Hi Joe,
Am 2019-12-06 00:58, schrieb Tom Rini:
Quoted 62 lines · Michael Walle
Quoted 42 lines
Hi Joe, Hi Tom,
Am 2019-12-05 16:55, schrieb Joe Hershberger:
Quoted 6 lines
Hi Michael,
Quoted 3 lines · Michael Walle
Provide functions to read and write the Atheros debug registers.
Quoted 8 lines
Quoted 1 line
Signed-off-by Michael Walle <[email protected]>This series is adding too much size to several of the boards' SPL it seems.
https://travis-ci.org/jhershbe/u-boot/builds/620804934
Please address this and resend.
So first of all, this was the old series. There was a v2 series, but unfortunately, I've forgot to add the mailing to the recipients, so it never ended up in the patchwork system. sorry :(
I've resend the v2 series here:
https://patchwork.ozlabs.org/project/uboot/list/?series=146771Now coming to the real problem here. The sizes, or like some boards handle
the SPL stuff. Btw. I could not reproduce it on theam335x_boneblack_vboot
board with a gcc-8. I've seen the travis ci job uses the gcc-7 so this also
depends on the gcc. gcc-8 seems to produce smaller code, because on theam335x_evmthe overflow was only by some 100 bytes.So taking the
am335x_evmboard for example. It has the following options
set:
CONFIG_DM_ETH=y
CONFIG_SPL_NET_SUPPORT=y
CONFIG_PHY_ATHEROS=y(this one is set in theconfig.h!)Quoted 10 lines
So adding a new binding for the phy obviously increases the code size. But
the hard question is, how could that be fixed. IMHO the board has wrong
settings. I really don't know how that could be "fixed" other than not applying this series. Well, we could make the additions conditional and
introduce a newKconfigsetting, but that is a relly ugly hack and won't
last long, would it? Doh!So, the gcc-7 from kernel.org is the min required and must work toolchain. Maybe once gcc-9 is mature enough for people to have made stand-alone toolchains for it we'll move up to that but gcc-8 for everyone ends up being too hard. For the
boneblack_vbootconfig, we could just drop SPL networking, it's not super critical to that particular example. Butam335x_evmis the kitchen-sink EVM and it is used and supported there.
Quoted 6 lines
Quoted 2 lines
That said, looking over the u-boot-spl.map, it looks like nfs stuff doesn't get discarded for some reason, I'm going to look in to that.
So do I need to do something now? I guess removing the NFS stuff will make enough room to fit this. But how do we make sure, it will be applied with this series?
In this case, Joe has it in the -net PR right now. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191209/527237a7/attachment.sig>
PATCH 1/9 phy: atheros: introduce debug read and write functions
Hi Tom,
Quoted 67 lines · Tom Rini
Quoted 65 lines · Michael Walle
Hi Tom, Hi Joe,
Am 2019-12-06 00:58, schrieb Tom Rini:
Quoted 62 lines · Michael Walle
Quoted 42 lines
Hi Joe, Hi Tom,
Am 2019-12-05 16:55, schrieb Joe Hershberger:
Quoted 6 lines
Hi Michael,
Quoted 3 lines · Michael Walle
Provide functions to read and write the Atheros debug registers.
Quoted 8 lines
Quoted 1 line
Signed-off-by Michael Walle <[email protected]>This series is adding too much size to several of the boards' SPL it seems.
https://travis-ci.org/jhershbe/u-boot/builds/620804934
Please address this and resend.
So first of all, this was the old series. There was a v2 series, but unfortunately, I've forgot to add the mailing to the recipients, so it never ended up in the patchwork system. sorry :(
I've resend the v2 series here:
https://patchwork.ozlabs.org/project/uboot/list/?series=146771Now coming to the real problem here. The sizes, or like some boards handle
the SPL stuff. Btw. I could not reproduce it on theam335x_boneblack_vboot
board with a gcc-8. I've seen the travis ci job uses the gcc-7 so this also
depends on the gcc. gcc-8 seems to produce smaller code, because on theam335x_evmthe overflow was only by some 100 bytes.So taking the
am335x_evmboard for example. It has the following options
set:
CONFIG_DM_ETH=y
CONFIG_SPL_NET_SUPPORT=y
CONFIG_PHY_ATHEROS=y(this one is set in theconfig.h!)Quoted 10 lines
So adding a new binding for the phy obviously increases the code size. But
the hard question is, how could that be fixed. IMHO the board has wrong
settings. I really don't know how that could be "fixed" other than not applying this series. Well, we could make the additions conditional and
introduce a newKconfigsetting, but that is a relly ugly hack and won't
last long, would it? Doh!So, the gcc-7 from kernel.org is the min required and must work toolchain. Maybe once gcc-9 is mature enough for people to have made stand-alone toolchains for it we'll move up to that but gcc-8 for everyone ends up being too hard. For the
boneblack_vbootconfig, we could just drop SPL networking, it's not super critical to that particular example. Butam335x_evmis the kitchen-sink EVM and it is used and supported there.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
That said, looking over the u-boot-spl.map, it looks like nfs stuff doesn't get discarded for some reason, I'm going to look in to that.
So do I need to do something now? I guess removing the NFS stuff will make enough room to fit this. But how do we make sure, it will be applied with this series?
In this case, Joe has it in the -net PR right now. Thanks!
It's actually excluded from the PR. I need to go back and review the rest of the v2 series.
Cheers,
-Joe
PATCH 1/9 phy: atheros: introduce debug read and write functions
Quoted 73 lines · Joe Hershberger
Hi Tom,
Quoted 70 lines · Tom Rini
Quoted 68 lines · Michael Walle
Hi Tom, Hi Joe,
Am 2019-12-06 00:58, schrieb Tom Rini:
Quoted 64 lines · Michael Walle
Quoted 42 lines
Hi Joe, Hi Tom,
Am 2019-12-05 16:55, schrieb Joe Hershberger:
Quoted 6 lines
Hi Michael,
Quoted 3 lines · Michael Walle
Provide functions to read and write the Atheros debug registers.
Quoted 8 lines
Quoted 1 line
Signed-off-by Michael Walle <[email protected]>This series is adding too much size to several of the boards' SPL it seems.
https://travis-ci.org/jhershbe/u-boot/builds/620804934
Please address this and resend.
So first of all, this was the old series. There was a v2 series, but unfortunately, I've forgot to add the mailing to the recipients, so it never ended up in the patchwork system. sorry :(
I've resend the v2 series here:
https://patchwork.ozlabs.org/project/uboot/list/?series=146771Now coming to the real problem here. The sizes, or like some boards handle
the SPL stuff. Btw. I could not reproduce it on theam335x_boneblack_vboot
board with a gcc-8. I've seen the travis ci job uses the gcc-7 so this also
depends on the gcc. gcc-8 seems to produce smaller code, because on theam335x_evmthe overflow was only by some 100 bytes.So taking the
am335x_evmboard for example. It has the following options
set:
CONFIG_DM_ETH=y
CONFIG_SPL_NET_SUPPORT=y
CONFIG_PHY_ATHEROS=y(this one is set in theconfig.h!)Quoted 10 lines
So adding a new binding for the phy obviously increases the code size. But
the hard question is, how could that be fixed. IMHO the board has wrong
settings. I really don't know how that could be "fixed" other than not applying this series. Well, we could make the additions conditional and
introduce a newKconfigsetting, but that is a relly ugly hack and won't
last long, would it? Doh!So, the gcc-7 from kernel.org is the min required and must work toolchain. Maybe once gcc-9 is mature enough for people to have made stand-alone toolchains for it we'll move up to that but gcc-8 for everyone ends up being too hard. For the
boneblack_vbootconfig, we could just drop SPL networking, it's not super critical to that particular example. Butam335x_evmis the kitchen-sink EVM and it is used and supported there.That said, looking over the u-boot-spl.map, it looks like nfs stuff doesn't get discarded for some reason, I'm going to look in to that.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
So do I need to do something now? I guess removing the NFS stuff will make enough room to fit this. But how do we make sure, it will be applied with this series?
In this case, Joe has it in the -net PR right now. Thanks!
It's actually excluded from the PR. I need to go back and review the rest of the v2 series.
Sorry I meant the NFS patch to reduce size.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191209/d39adc6a/attachment.sig>
PATCH 2/9 phy: atheros: move delay config to common function
In reply to Michael Walle--- drivers/net/phy/atheros.c | 44 +++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 18 deletions(-)
drivers/net/phy/atheros.c +26 -18
@@ -68,20 +68,37 @@ static int ar8021_config(struct phy_device *phydev)return 0 ; } -static int ar8031_config (struct phy_device *phydev) +static int ar803x_delay_config (struct phy_device *phydev) { +int ret; +if (phydev->interface ==PHY_INTERFACE_MODE_RGMII_TXID || phydev->interface ==PHY_INTERFACE_MODE_RGMII_ID ) { -ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_5, - AR803x_RGMII_TX_CLK_DLY); + ret =ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_5, + AR803x_RGMII_TX_CLK_DLY); +if (ret <0 ) +return ret; }if (phydev->interface ==PHY_INTERFACE_MODE_RGMII_RXID || phydev->interface ==PHY_INTERFACE_MODE_RGMII_ID ) { -ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_0, - AR803x_RGMII_RX_CLK_DLY); + ret =ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_0, + AR803x_RGMII_RX_CLK_DLY); +if (ret <0 ) +return ret; } +return 0 ; +} + +static int ar8031_config (struct phy_device *phydev) +{ +int ret; + + ret =ar803x_delay_config (phydev); +if (ret <0 ) +return ret; + phydev->supported = phydev->drv->features;genphy_config_aneg (phydev);
@@ -92,6 +109,7 @@ static int ar8031_config(struct phy_device *phydev)static int ar8035_config (struct phy_device *phydev) { +int ret;int regval;phy_write (phydev,MDIO_DEVAD_NONE ,0xd ,0x0007 );
@@ -103,19 +121,9 @@ static int ar8035_config(struct phy_device *phydev)ar803x_debug_reg_mask (phydev, AR803x_DEBUG_REG_5,0 , AR803x_RGMII_TX_CLK_DLY); -if ((phydev->interface ==PHY_INTERFACE_MODE_RGMII_ID ) || - (phydev->interface ==PHY_INTERFACE_MODE_RGMII_TXID )) { -/* enable tx delay */ -ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_5, - AR803x_RGMII_TX_CLK_DLY); - } - -if ((phydev->interface ==PHY_INTERFACE_MODE_RGMII_ID ) || - (phydev->interface ==PHY_INTERFACE_MODE_RGMII_RXID )) { -/* enable rx delay */ -ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_0, - AR803x_RGMII_RX_CLK_DLY); - } + ret =ar803x_delay_config (phydev); +if (ret <0 ) +return ret; phydev->supported = phydev->drv->features;
Signature · 1 line
2.20.1
PATCH 2/9 phy: atheros: move delay config to common function
Quoted 2 lines · Michael Walle
Signed-off-by Michael Walle <[email protected]>
PATCH 3/9 phy: atheros: ar8035: remove extra delay config
In reply to Michael WalleRemove the hard-coded delay configuration. The AR8035 config() always enabled the TX delay mode, although it will be set according to the PHY interface mode, too.
If bisecting shows that this commit breaks your board you probably have a wrong PHY interface mode. You probably want the PHY_INTERFACE_MODE_RGMII_TXID or PHY_INTERFACE_MODE_RGMII_ID mode.
--- drivers/net/phy/atheros.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/phy/atheros.c +0 -3
@@ -118,9 +118,6 @@ static int ar8035_config(struct phy_device *phydev) regval =phy_read (phydev,MDIO_DEVAD_NONE ,0xe );phy_write (phydev,MDIO_DEVAD_NONE ,0xe , (regval|0x0018 )); -ar803x_debug_reg_mask (phydev, AR803x_DEBUG_REG_5, -0 , AR803x_RGMII_TX_CLK_DLY); - ret =ar803x_delay_config (phydev);if (ret <0 )return ret;
Signature · 1 line
2.20.1
PATCH 3/9 phy: atheros: ar8035: remove extra delay config
Quoted 10 lines · Michael Walle
Remove the hard-coded delay configuration. The AR8035
config()always enabled the TX delay mode, although it will be set according to the PHY interface mode, too.If bisecting shows that this commit breaks your board you probably have a wrong PHY interface mode. You probably want the
PHY_INTERFACE_MODE_RGMII_TXIDorPHY_INTERFACE_MODE_RGMII_IDmode.Signed-off-by Michael Walle <[email protected]>
PATCH 4/9 phy: atheros: ar8035: use phy_{read|write}_mmd()
In reply to Michael Walle--- drivers/net/phy/atheros.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/phy/atheros.c +5 -6
@@ -110,13 +110,12 @@ static int ar8031_config(struct phy_device *phydev)static int ar8035_config (struct phy_device *phydev) {int ret; -int regval; -phy_write (phydev,MDIO_DEVAD_NONE ,0xd ,0x0007 ); -phy_write (phydev,MDIO_DEVAD_NONE ,0xe ,0x8016 ); -phy_write (phydev,MDIO_DEVAD_NONE ,0xd ,0x4007 ); - regval =phy_read (phydev,MDIO_DEVAD_NONE ,0xe ); -phy_write (phydev,MDIO_DEVAD_NONE ,0xe , (regval|0x0018 )); + ret =phy_read_mmd (phydev,7 ,0x8016 ); +if (ret <0 ) +return ret; + ret |=0x0018 ; +phy_write_mmd (phydev,7 ,0x8016 , ret); ret =ar803x_delay_config (phydev);if (ret <0 )
Signature · 1 line
2.20.1
PATCH 4/9 phy: atheros: ar8035: use phy_{read|write}_mmd()
Quoted 2 lines · Michael Walle
Signed-off-by Michael Walle <[email protected]>
PATCH 5/9 phy: atheros: don't overwrite debug register values
In reply to Michael WalleInstead of doing a hard write, do a read-modify-write.
--- drivers/net/phy/atheros.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/phy/atheros.c +6 -6
@@ -12,10 +12,10 @@#define AR803x_PHY_DEBUG_DATA_REG 0x1e#define AR803x_DEBUG_REG_5 0x5 -#define AR803x_RGMII_TX_CLK_DLY 0x100 +#define AR803x_RGMII_TX_CLK_DLY BIT(8)#define AR803x_DEBUG_REG_0 0x0 -#define AR803x_RGMII_RX_CLK_DLY 0x8000 +#define AR803x_RGMII_RX_CLK_DLY BIT(15)static int ar803x_debug_reg_read (struct phy_device *phydev,u16 reg) {
@@ -74,16 +74,16 @@ static int ar803x_delay_config(struct phy_device *phydev)if (phydev->interface ==PHY_INTERFACE_MODE_RGMII_TXID || phydev->interface ==PHY_INTERFACE_MODE_RGMII_ID ) { - ret =ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_5, - AR803x_RGMII_TX_CLK_DLY); + ret =ar803x_debug_reg_mask (phydev, AR803x_DEBUG_REG_5, +0 , AR803x_RGMII_TX_CLK_DLY);if (ret <0 )return ret; }if (phydev->interface ==PHY_INTERFACE_MODE_RGMII_RXID || phydev->interface ==PHY_INTERFACE_MODE_RGMII_ID ) { - ret =ar803x_debug_reg_write (phydev, AR803x_DEBUG_REG_0, - AR803x_RGMII_RX_CLK_DLY); + ret =ar803x_debug_reg_mask (phydev, AR803x_DEBUG_REG_0, +0 , AR803x_RGMII_RX_CLK_DLY);if (ret <0 )return ret; }
Signature · 1 line
2.20.1
PATCH 5/9 phy: atheros: don't overwrite debug register values
Quoted 4 lines · Michael Walle
Instead of doing a hard write, do a read-modify-write.
Signed-off-by Michael Walle <[email protected]>
PATCH 6/9 phy: atheros: fix delay configuration
In reply to Michael WalleThe delay_config() code could only set the delay bit. Thus, it could only enable the delay mode, but not disable it. To make things worse, the RX delay mode is enabled by default after a hardware reset, so it could never be disabled. Fix this, by always setting or clearing the bits. This is also how the linux kernel configures the PHY.
If bisecting shows that this commit breaks your board you probably have a wrong PHY interface mode. You probably want the PHY_INTERFACE_MODE_RGMII_RXID or PHY_INTERFACE_MODE_RGMII_ID mode.
--- drivers/net/phy/atheros.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/phy/atheros.c +10 -0
@@ -78,6 +78,11 @@ static int ar803x_delay_config(struct phy_device *phydev) 0, AR803x_RGMII_TX_CLK_DLY);if (ret <0 )return ret; + }else { + ret =ar803x_debug_reg_mask (phydev, AR803x_DEBUG_REG_5, + AR803x_RGMII_TX_CLK_DLY,0 ); +if (ret <0 ) +return ret; } if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
@@ -86,6 +91,11 @@ static int ar803x_delay_config(struct phy_device *phydev) 0, AR803x_RGMII_RX_CLK_DLY);if (ret <0 )return ret; + }else { + ret =ar803x_debug_reg_mask (phydev, AR803x_DEBUG_REG_0, + AR803x_RGMII_RX_CLK_DLY,0 ); +if (ret <0 ) +return ret; }return 0 ;
Signature · 1 line
2.20.1
PATCH 6/9 phy: atheros: fix delay configuration
Quoted 47 lines · Michael Walle
The
delay_config()code could only set the delay bit. Thus, it could only enable the delay mode, but not disable it. To make things worse, the RX delay mode is enabled by default after a hardware reset, so it could never be disabled. Fix this, by always setting or clearing the bits. This is also how the linux kernel configures the PHY.If bisecting shows that this commit breaks your board you probably have a wrong PHY interface mode. You probably want the
PHY_INTERFACE_MODE_RGMII_RXIDorPHY_INTERFACE_MODE_RGMII_IDmode.Signed-off-by Michael Walle <[email protected]>--- drivers/net/phy/atheros.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/net/phy/atheros.c +10
-1@@ -78,6 +78,11 @@ static int ar803x_delay_config(struct phy_device *phydev) 0, AR803x_RGMII_TX_CLK_DLY);if (ret <0 )return ret; + }else { + ret =ar803x_debug_reg_mask (phydev, AR803x_DEBUG_REG_5, + AR803x_RGMII_TX_CLK_DLY,0 ); +if (ret <0 ) +return ret; } if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||@@ -86,6 +91,11 @@ static int ar803x_delay_config(struct phy_device *phydev) 0, AR803x_RGMII_RX_CLK_DLY);if (ret <0 )return ret; + }else { + ret =ar803x_debug_reg_mask (phydev, AR803x_DEBUG_REG_0, + AR803x_RGMII_RX_CLK_DLY,0 ); +if (ret <0 ) +return ret; }return 0 ; --2.20.1
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Hi Michael,
Are you aware of this discussion thread?
https://www.mail-archive.com/u-boot at lists.denx.de/msg326821.html
Thanks,
-Vladimir
PATCH 6/9 phy: atheros: fix delay configuration
In reply to Michael WalleQuoted 7 lines · Michael Walle
The
delay_config()code could only set the delay bit. Thus, it could only enable the delay mode, but not disable it. To make things worse, the RX delay mode is enabled by default after a hardware reset, so it could never be disabled. Fix this, by always setting or clearing the bits. This is also how the linux kernel configures the PHY.
Quoted 5 lines
If bisecting shows that this commit breaks your board you probably have a wrong PHY interface mode. You probably want the
PHY_INTERFACE_MODE_RGMII_RXIDorPHY_INTERFACE_MODE_RGMII_IDmode.Signed-off-by Michael Walle <[email protected]>
Either the offending dts's are already updated or they will be when this breaks them. It's been 6 months.
PATCH 7/9 phy: atheros: Add device tree bindings and config
In reply to Michael WalleAdd support for configuring the CLK_25M pin as well as the RGMII I/O voltage by the device tree.
By default the AT803x PHYs outputs the 25MHz clock of the XTAL input. But this output can also be changed by software to other frequencies. This commit introduces a generic way to configure this output.
Also the PHY supports different RGMII I/O voltages: 1.5V, 1.8V and 2.5V. An internal LDO is able to provide 1.5V (default) and 1.8V. The 2.5V option needs an external supply voltage. This commit adds support to switch the internal LDO to 1.8V.
--- doc/device-tree-bindings/net/phy/atheros.txt | 22 +++ drivers/net/phy/atheros.c | 160 ++++++++++++++++++- 2 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 doc/device-tree-bindings/net/phy/atheros.txt
doc/device-tree-bindings/net/phy/atheros.txt new file +22 -0
@@ -0,0 +1,22 @@ +* Atheros PHY Device Tree binding + +Required properties: +- reg: PHY address + +Optional properties: +- atheros,clk-out-frequency: Clock frequency of the CLK_25M pin in Hz. + Either 25000000, 50000000, 62500000 or 125000000. +- atheros,clk-out-strength: Clock output buffer driver strength. + Either "full", "half" or "quarter". +- atheros,keep-pll-enabled: Keep the PLL running if no link is present. + Don't go into hibernation mode. +- atheros,rgmii-io-1v8: Use 1.8V as RGMII I/O voltage, the default is 1.5V. + +Example: + + ethernet-phy at 0 { + reg = <0>; + atheros-clk-out-frequency = <125000000>; + atheros,keep-pll-enabled; + atheros,rgmii-io-1v8; + };
drivers/net/phy/atheros.c +158 -2
201 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 7/9 phy: atheros: Add device tree bindings and config
Quoted 8 lines · Michael Walle
Add support for configuring the
CLK_25Mpin as well as the RGMII I/O voltage by the device tree.By default the AT803x PHYs outputs the 25MHz clock of the XTAL input. But this output can also be changed by software to other frequencies. This commit introduces a generic way to configure this output.
Quoted 6 lines
Also the PHY supports different RGMII I/O voltages: 1.5V, 1.8V and 2.5V. An internal LDO is able to provide 1.5V (default) and 1.8V. The 2.5V option needs an external supply voltage. This commit adds support to switch the internal LDO to 1.8V.
Signed-off-by Michael Walle <[email protected]>
PATCH 8/9 phy: atheros: ar8035: remove static clock config
In reply to Michael WalleWe can configure the clock output in the device tree. Disable the hardcoded one in here. This is highly board-specific and should have never been enabled in the PHY driver.
If bisecting shows that this commit breaks your board it probably depends on the clock output of your Atheros AR8035 PHY. Please have a look at doc/device-tree-bindings/net/phy/atheros.txt. You need to set "clk-out-frequency = <125000000>" because that value was the hardcoded value until this commit.
--- drivers/net/phy/atheros.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/net/phy/atheros.c +0 -6
@@ -273,12 +273,6 @@ static int ar8035_config(struct phy_device *phydev)if (ret <0 )return ret; - ret =phy_read_mmd (phydev,7 ,0x8016 ); -if (ret <0 ) -return ret; - ret |=0x0018 ; -phy_write_mmd (phydev,7 ,0x8016 , ret); - ret =ar803x_delay_config (phydev);if (ret <0 )return ret;
Signature · 1 line
2.20.1
PATCH 8/9 phy: atheros: ar8035: remove static clock config
Quoted 5 lines · Michael Walle
We can configure the clock output in the device tree. Disable the hardcoded one in here. This is highly board-specific and should have never been enabled in the PHY driver.
Quoted 7 lines
If bisecting shows that this commit breaks your board it probably depends on the clock output of your Atheros AR8035 PHY. Please have a look at
doc/device-tree-bindings/net/phy/atheros.txt. You need to set "clk-out-frequency = <125000000>" because that value was the hardcoded value until this commit.Signed-off-by Michael Walle <[email protected]>
PATCH 9/9 phy: atheros: consolidate {ar8031|ar8035}_config()
In reply to Michael WalleThe two functions are now exactly the same, remove one of them.
--- drivers/net/phy/atheros.c | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-)
drivers/net/phy/atheros.c +3 -27
@@ -241,31 +241,7 @@ static int ar803x_of_init(struct phy_device *phydev)return 0 ; } -static int ar8031_config (struct phy_device *phydev) -{ -int ret; - - ret =ar803x_of_init (phydev); -if (ret <0 ) -return ret; - - ret =ar803x_delay_config (phydev); -if (ret <0 ) -return ret; - - ret =ar803x_regs_config (phydev); -if (ret <0 ) -return ret; - - phydev->supported = phydev->drv->features; - -genphy_config_aneg (phydev); -genphy_restart_aneg (phydev); - -return 0 ; -} - -static int ar8035_config (struct phy_device *phydev) +static int ar803x_config (struct phy_device *phydev) {int ret;
@@ -304,7 +280,7 @@ static struct phy_driver AR8031_driver = { .uid = 0x4dd074, .mask = 0xffffffef, .features = PHY_GBIT_FEATURES, - .config = ar8031_config, + .config = ar803x_config, .startup = genphy_startup, .shutdown = genphy_shutdown, };
@@ -314,7 +290,7 @@ static struct phy_driver AR8035_driver = { .uid = 0x4dd072, .mask = 0xffffffef, .features = PHY_GBIT_FEATURES, - .config = ar8035_config, + .config = ar803x_config, .startup = genphy_startup, .shutdown = genphy_shutdown, };
Signature · 1 line
2.20.1
PATCH 9/9 phy: atheros: consolidate {ar8031|ar8035}_config()
Quoted 4 lines · Michael Walle
The two functions are now exactly the same, remove one of them.
Signed-off-by Michael Walle <[email protected]>
cover phy: atheros: cleanup and device tree bindings
In reply to Michael WalleQuoted 9 lines · Michael Walle
This series cleans up the Atheros PHY AR803x PHY driver and adds a device tree binding for the most commonly used PHY settings like clock output.
If you're a board maintainer you're getting this mail because you probably use an AR803x PHY on your board. Please have a look at your board specific code and see if you can use the device tree bindings instead. Let me know, if something is missing.
Thank you for this!
I was able to remove board_phy_config and the supporting ar8031_phy_fixup functions to a total of nearly 30 lines of code.
For the whole series...
Quoted 33 lines
Michael Walle (9):
phy: atheros: introduce debug read and write functions
phy: atheros: move delay config to common function
phy: atheros: ar8035: remove extra delay config
phy: atheros: ar8035: use phy_{read|write}_mmd()
phy: atheros: don't overwrite debug register values
phy: atheros: fix delay configuration
phy: atheros: Add device tree bindings and config
phy: atheros: ar8035: remove static clock config
phy: atheros: consolidate {ar8031|ar8035}_config()doc/device-tree-bindings/net/phy/atheros.txt | 22 ++ drivers/net/phy/atheros.c | 262 +++++++++++++++---- 2 files changed, 240 insertions(+), 44 deletions(-) create mode 100644 doc/device-tree-bindings/net/phy/atheros.txtCc: Joe Hershberger <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Adam Ford <[email protected]>
Cc: Otavio Salvador <[email protected]>
Cc: Ian Ray <[email protected]>
Cc: Jason Liu <[email protected]>
Cc: Ye Li <[email protected]>
Cc: Uri Mashiach <[email protected]>
Cc: Nikita Kiryanov <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Vanessa Maegima <[email protected]>
Cc: Eric Bénard <[email protected]>
--
2.20.1
cover phy: atheros: cleanup and device tree bindings
Quoted 12 lines · Adam Ford
Quoted 9 lines · Michael Walle
This series cleans up the Atheros PHY AR803x PHY driver and adds a device tree binding for the most commonly used PHY settings like clock output.
If you're a board maintainer you're getting this mail because you probably use an AR803x PHY on your board. Please have a look at your board specific code and see if you can use the device tree bindings instead. Let me know, if something is missing.
Quoted 4 lines
Thank you for this!
I was able to remove
board_phy_configand the supportingar8031_phy_fixupfunctions to a total of nearly 30 lines of code.
Please disregard my comment. From a cold boot, I cannot remove these lines.
adam
Quoted 37 lines
For the whole series...
Quoted 33 lines
Michael Walle (9):
phy: atheros: introduce debug read and write functions
phy: atheros: move delay config to common function
phy: atheros: ar8035: remove extra delay config
phy: atheros: ar8035: use phy_{read|write}_mmd()
phy: atheros: don't overwrite debug register values
phy: atheros: fix delay configuration
phy: atheros: Add device tree bindings and config
phy: atheros: ar8035: remove static clock config
phy: atheros: consolidate {ar8031|ar8035}_config()doc/device-tree-bindings/net/phy/atheros.txt | 22 ++ drivers/net/phy/atheros.c | 262 +++++++++++++++---- 2 files changed, 240 insertions(+), 44 deletions(-) create mode 100644 doc/device-tree-bindings/net/phy/atheros.txtCc: Joe Hershberger <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Adam Ford <[email protected]>
Cc: Otavio Salvador <[email protected]>
Cc: Ian Ray <[email protected]>
Cc: Jason Liu <[email protected]>
Cc: Ye Li <[email protected]>
Cc: Uri Mashiach <[email protected]>
Cc: Nikita Kiryanov <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Vanessa Maegima <[email protected]>
Cc: Eric Bénard <[email protected]>
--
2.20.1
cover phy: atheros: cleanup and device tree bindings
Hi Adam,
Am 2019-10-26 05:28, schrieb Adam Ford:
Quoted 14 lines · Adam Ford
Quoted 13 lines
Quoted 9 lines · Michael Walle
This series cleans up the Atheros PHY AR803x PHY driver and adds a device tree binding for the most commonly used PHY settings like clock output.
If you're a board maintainer you're getting this mail because you probably use an AR803x PHY on your board. Please have a look at your board specific code and see if you can use the device tree bindings instead. Let me know, if something is missing.
Quoted 7 lines
Quoted 4 lines
Thank you for this!
I was able to remove
board_phy_configand the supportingar8031_phy_fixupfunctions to a total of nearly 30 lines of code.Please disregard my comment. From a cold boot, I cannot remove these lines.
Thank you for testing though. I guess your network drivers needs something like that:
https://patchwork.ozlabs.org/patch/1184523/
So here is a cheap shot (very hacky, doesn't work with CONFIG_FEC_MXC_PHYADDR, completely untested, not even compiled ;). Could you try that? I need to add some debug messages to the Atheros PHY driver, so one could see if the device tree binding is working correctly.
drivers/net/fec_mxc.c +1 -1
@@ -1264,7 +1264,7 @@ static const struct eth_ops fecmxc_ops = { .read_rom_hwaddr = fecmxc_read_rom_hwaddr, }; -static int device_get_phy_addr (struct udevice *dev) +static int device_get_phy_addr(struct udevice *dev, struct ofnode
*phy_node)
{
struct ofnode_phandle_args phandle_args;
int reg;
@@ -1276,6 +1276,7 @@ static int device_get_phy_addr(struct udevice
*dev)
}
reg = ofnode_read_u32_default(phandle_args.node, "reg", 0);+ phy_node = &phandle_args.node;
return reg;
}
@@ -1284,8 +1285,9 @@ static int fec_phy_init(struct fec_priv *priv,
struct udevice *dev)
{
struct phy_device *phydev;
int addr;+ ofnode *phy_node;
- addr = device_get_phy_addr(dev);
+ addr = device_get_phy_addr(dev, &phy_node);
#ifdef CONFIG_FEC_MXC_PHYADDR
addr = CONFIG_FEC_MXC_PHYADDR;
#endif
@@ -1294,6 +1296,7 @@ static int fec_phy_init(struct fec_priv *priv,
struct udevice *dev)
if (!phydev)
return -ENODEV;+ phydev->node = phy_node;
priv->phydev = phydev;
phy_config(phydev);-michael
cover phy: atheros: cleanup and device tree bindings
Quoted 23 lines · Michael Walle
Hi Adam,
Am 2019-10-26 05:28, schrieb Adam Ford:
Quoted 19 lines · Adam Ford
Quoted 17 lines
Quoted 9 lines · Michael Walle
This series cleans up the Atheros PHY AR803x PHY driver and adds a device tree binding for the most commonly used PHY settings like clock output.
If you're a board maintainer you're getting this mail because you probably use an AR803x PHY on your board. Please have a look at your board specific code and see if you can use the device tree bindings instead. Let me know, if something is missing.
Thank you for this!
I was able to remove
board_phy_configand the supportingar8031_phy_fixupfunctions to a total of nearly 30 lines of code.
Quoted 6 lines
Quoted 2 lines
Please disregard my comment. From a cold boot, I cannot remove these lines.
Thank you for testing though. I guess your network drivers needs something like that:
https://patchwork.ozlabs.org/patch/1184523/
I tried with the 2nd series also applied with no luck either on my i.MX6Q.
Quoted 6 lines
So here is a cheap shot (very hacky, doesn't work with
CONFIG_FEC_MXC_PHYADDR, completely untested, not even compiled ;). Could you try that? I need to add some debug messages to the Atheros PHY driver, so one could see if the device tree binding is working correctly.
I will look at the following stuff when I have more time.
Quoted 45 lines
drivers/net/fec_mxc.c +1
-1@@ -1264,7 +1264,7 @@ static const struct eth_ops fecmxc_ops = { .read_rom_hwaddr = fecmxc_read_rom_hwaddr, }; -static int device_get_phy_addr (struct udevice *dev) +static int device_get_phy_addr (struct udevice *dev,struct ofnode *phy_node) {struct ofnode_phandle_args phandle_args;int reg;drivers/net/fec_mxc.c +1
-0@@ -1276,6 +1276,7 @@ static int device_get_phy_addr(struct udevice *dev) } reg =ofnode_read_u32_default (phandle_args.node,"reg" ,0 ); + phy_node = &phandle_args.node;return reg;}drivers/net/fec_mxc.c +2
-1@@ -1284,8 +1285,9 @@ static int fec_phy_init(struct fec_priv *priv, struct udevice *dev) {struct phy_device *phydev;int addr; +ofnode *phy_node; - addr =device_get_phy_addr (dev); + addr =device_get_phy_addr (dev, &phy_node);#ifdef CONFIG_FEC_MXC_PHYADDR addr =CONFIG_FEC_MXC_PHYADDR ;#endifdrivers/net/fec_mxc.c +1
-1@@ -1294,6 +1296,7 @@ static int fec_phy_init(struct fec_priv *priv, struct udevice *dev)if (!phydev)return -ENODEV ; + phydev->node = phy_node; priv->phydev = phydev;phy_config (phydev); -michael
PATCH 1/1 phy: atheros: add some debug output
In reply to Michael WalleThe network driver has to set the PHY node correctly. If that is not the case, ar803x_of_init() will fail. Add some debugging output.
If the device tree binding is not working for you have a look at the
ar803x_of_init: found PHY node: phy at 0
output. In the case above "phy at 0" is the phy node in the device tree. If instead the node of your network device is displayed, you have to set the phydev->node property in your network device driver. For example, the following patch adds it to the fsl_enetc driver:
https://patchwork.ozlabs.org/patch/1184523/
--- drivers/net/phy/atheros.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/phy/atheros.c +5 -0
@@ -191,6 +191,8 @@ static int ar803x_of_init(struct phy_device *phydev)if (!ofnode_valid (node))return -EINVAL ; +debug ("%s: found PHY node: %s\n" , __func__,ofnode_get_name (node)); +if (ofnode_read_bool (node,"atheros,keep-pll-enabled" )) priv->flags |= AR803x_FLAG_KEEP_PLL_ENABLED;if (ofnode_read_bool (node,"atheros,rgmii-io-1v8" ))
@@ -236,6 +238,9 @@ static int ar803x_of_init(struct phy_device *phydev) return -EINVAL; } } + +debug ("%s: flags=%x clk_25m_reg=%04x\n" , __func__, priv->flags, + priv->clk_25m_reg);#endif return 0 ;
Signature · 1 line
2.20.1
PATCH 1/1 phy: atheros: add some debug output
Quoted 12 lines · Michael Walle
The network driver has to set the PHY node correctly. If that is not the case,
ar803x_of_init()will fail. Add some debugging output.If the device tree binding is not working for you have a look at the
ar803x_of_init: found PHY node: phy at 0
output. In the case above "phy at 0" is the phy node in the device tree. If instead the node of your network device is displayed, you have to set thephydev->nodeproperty in your network device driver. For example, the following patch adds it to thefsl_enetcdriver:
https://patchwork.ozlabs.org/patch/1184523/
Quoted 1 line
Signed-off-by Michael Walle <[email protected]>
PATCH 1/1 phy: atheros: add some debug output
In reply to Michael WalleHi Michael,
Quoted 12 lines · Michael Walle
The network driver has to set the PHY node correctly. If that is not the case,
ar803x_of_init()will fail. Add some debugging output.If the device tree binding is not working for you have a look at the
ar803x_of_init: found PHY node: phy at 0
output. In the case above "phy at 0" is the phy node in the device tree. If instead the node of your network device is displayed, you have to set thephydev->nodeproperty in your network device driver. For example, the following patch adds it to thefsl_enetcdriver:
https://patchwork.ozlabs.org/patch/1184523/
Quoted 1 line
Signed-off-by Michael Walle <[email protected]>
This doesn't apply so I assume it's either superseded or not needed any more. If those are not the case, please rebase and resend on top of u-boot-net/master
Thanks,
-Joe