net: phy: reuse SMSC PHY driver functionality in the meson-gxl PHY driver
Subsystems (4)
Heiner Kallweit
maintainercover net: phy: reuse SMSC PHY driver functionality in the meson-gxl PHY driver
The Amlogic Meson internal PHY's have the same register layout as certain SMSC PHY's (also for non-c22-standard registers). This seems to be more than just coincidence. Apparently they also need the same workaround for EDPD mode (energy detect power down). Therefore let's reuse SMSC PHY driver functionality in the meson-gxl PHY driver.
Heiner Kallweit (2):
net: phy: smsc: export functions for use by meson-gxl PHY driver
net: phy: meson-gxl: reuse functionality of the SMSC PHY driver
drivers/net/phy/Kconfig | 1 + drivers/net/phy/meson-gxl.c | 77 ++++--------------------------------- drivers/net/phy/smsc.c | 20 ++++++---- include/linux/smscphy.h | 6 +++ 4 files changed, 28 insertions(+), 76 deletions(-)
Signature · 1 line
2.39.2
Heiner Kallweit
maintainerPATCH 1/2 net: phy: smsc: export functions for use by meson-gxl PHY driver
The Amlogic Meson internal PHY's have the same register layout as certain SMSC PHY's (also for non-c22-standard registers). This seems to be more than just coincidence. Apparently they also need the same workaround for EDPD mode (energy detect power down). Therefore let's export SMSC PHY driver functionality for use by the meson-gxl PHY driver.
--- drivers/net/phy/smsc.c | 20 +++++++++++++------- include/linux/smscphy.h | 6 ++++++ 2 files changed, 19 insertions(+), 7 deletions(-)
drivers/net/phy/smsc.c +13 -7
@@ -54,7 +54,7 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev)return rc <0 ? rc :0 ; } -static int smsc_phy_config_intr (struct phy_device *phydev) +int smsc_phy_config_intr (struct phy_device *phydev) {int rc;
@@ -75,8 +75,9 @@ static int smsc_phy_config_intr(struct phy_device *phydev)return rc <0 ? rc :0 ; } +EXPORT_SYMBOL_GPL (smsc_phy_config_intr); -static irqreturn_t smsc_phy_handle_interrupt (struct phy_device *phydev) +irqreturn_t smsc_phy_handle_interrupt (struct phy_device *phydev) {int irq_status;
@@ -95,18 +96,20 @@ static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev)return IRQ_HANDLED ; } +EXPORT_SYMBOL_GPL (smsc_phy_handle_interrupt); -static int smsc_phy_config_init (struct phy_device *phydev) +int smsc_phy_config_init (struct phy_device *phydev) {struct smsc_phy_priv *priv = phydev->priv; -if (!priv->energy_enable || phydev->irq !=PHY_POLL ) +if (!priv || !priv->energy_enable || phydev->irq !=PHY_POLL )return 0 ;/* Enable energy detect power down mode */ return phy_set_bits (phydev,MII_LAN83C185_CTRL_STATUS ,MII_LAN83C185_EDPWRDOWN ); } +EXPORT_SYMBOL_GPL (smsc_phy_config_init);static int smsc_phy_reset (struct phy_device *phydev) {
@@ -186,7 +189,7 @@ static int lan95xx_config_aneg_ext(struct phy_device *phydev)* The workaround is only applicable to poll mode. Energy Detect Power-Down may * not be used in interrupt mode lest link change detection becomes unreliable. */ -static int lan87xx_read_status (struct phy_device *phydev) +int lan87xx_read_status (struct phy_device *phydev) {struct smsc_phy_priv *priv = phydev->priv;int err;
@@ -195,7 +198,8 @@ static int lan87xx_read_status(struct phy_device *phydev)if (err)return err; -if (!phydev->link && priv->energy_enable && phydev->irq ==PHY_POLL ) { +if (!phydev->link && priv && priv->energy_enable && + phydev->irq ==PHY_POLL ) {/* Disable EDPD to wake up PHY */ int rc =phy_read (phydev,MII_LAN83C185_CTRL_STATUS );if (rc <0 )
@@ -229,6 +233,7 @@ static int lan87xx_read_status(struct phy_device *phydev)return err; } +EXPORT_SYMBOL_GPL (lan87xx_read_status);static int smsc_get_sset_count (struct phy_device *phydev) {
@@ -269,7 +274,7 @@ static void smsc_get_stats(struct phy_device *phydev, data[i] =smsc_get_stat (phydev, i); } -static int smsc_phy_probe (struct phy_device *phydev) +int smsc_phy_probe (struct phy_device *phydev) {struct device *dev = &phydev->mdio.dev;struct smsc_phy_priv *priv;
@@ -294,6 +299,7 @@ static int smsc_phy_probe(struct phy_device *phydev)return clk_set_rate (refclk,50 *1000 *1000 ); } +EXPORT_SYMBOL_GPL (smsc_phy_probe);static struct phy_driver smsc_phy_driver[] = { {
include/linux/smscphy.h +6 -0
@@ -28,4 +28,10 @@#define MII_LAN83C185_MODE_POWERDOWN 0xC0/* Power Down mode */ #define MII_LAN83C185_MODE_ALL 0xE0/* All capable mode */ +int smsc_phy_config_intr (struct phy_device *phydev); +irqreturn_t smsc_phy_handle_interrupt (struct phy_device *phydev); +int smsc_phy_config_init (struct phy_device *phydev); +int lan87xx_read_status (struct phy_device *phydev); +int smsc_phy_probe (struct phy_device *phydev); +#endif /* __LINUX_SMSCPHY_H__ */
Signature · 1 line
2.39.2
Re: [PATCH net-next 1/2] net: phy: smsc: export functions for use by meson-gxl PHY driver
On a dev board with SMSC LAN8720, this change was tested and confirmed to still operate normally.
Quoted 124 lines · Heiner Kallweit
The Amlogic Meson internal PHY's have the same register layout as certain SMSC PHY's (also for non-c22-standard registers). This seems to be more than just coincidence. Apparently they also need the same workaround for EDPD mode (energy detect power down). Therefore let's export SMSC PHY driver functionality for use by the meson-gxl PHY driver.
Signed-off-by Heiner Kallweit <[email protected]>--- drivers/net/phy/smsc.c | 20 +++++++++++++------- include/linux/smscphy.h | 6 ++++++ 2 files changed, 19 insertions(+), 7 deletions(-)drivers/net/phy/smsc.c +13
-7@@ -54,7 +54,7 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev)return rc <0 ? rc :0 ; } -static int smsc_phy_config_intr (struct phy_device *phydev) +int smsc_phy_config_intr (struct phy_device *phydev) {int rc;@@ -75,8 +75,9 @@ static int smsc_phy_config_intr(struct phy_device *phydev)return rc <0 ? rc :0 ; } +EXPORT_SYMBOL_GPL (smsc_phy_config_intr); -static irqreturn_t smsc_phy_handle_interrupt (struct phy_device *phydev) +irqreturn_t smsc_phy_handle_interrupt (struct phy_device *phydev) {int irq_status;@@ -95,18 +96,20 @@ static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev)return IRQ_HANDLED ; } +EXPORT_SYMBOL_GPL (smsc_phy_handle_interrupt); -static int smsc_phy_config_init (struct phy_device *phydev) +int smsc_phy_config_init (struct phy_device *phydev) {struct smsc_phy_priv *priv = phydev->priv; -if (!priv->energy_enable || phydev->irq !=PHY_POLL ) +if (!priv || !priv->energy_enable || phydev->irq !=PHY_POLL )return 0 ;/* Enable energy detect power down mode */ return phy_set_bits (phydev,MII_LAN83C185_CTRL_STATUS ,MII_LAN83C185_EDPWRDOWN ); } +EXPORT_SYMBOL_GPL (smsc_phy_config_init);static int smsc_phy_reset (struct phy_device *phydev) {@@ -186,7 +189,7 @@ static int lan95xx_config_aneg_ext(struct phy_device *phydev)* The workaround is only applicable to poll mode. Energy Detect Power-Down may * not be used in interrupt mode lest link change detection becomes unreliable. */ -static int lan87xx_read_status (struct phy_device *phydev) +int lan87xx_read_status (struct phy_device *phydev) {struct smsc_phy_priv *priv = phydev->priv;int err;@@ -195,7 +198,8 @@ static int lan87xx_read_status(struct phy_device *phydev)if (err)return err; -if (!phydev->link && priv->energy_enable && phydev->irq ==PHY_POLL ) { +if (!phydev->link && priv && priv->energy_enable && + phydev->irq ==PHY_POLL ) {/* Disable EDPD to wake up PHY */ int rc =phy_read (phydev,MII_LAN83C185_CTRL_STATUS );if (rc <0 )@@ -229,6 +233,7 @@ static int lan87xx_read_status(struct phy_device *phydev)return err; } +EXPORT_SYMBOL_GPL (lan87xx_read_status);static int smsc_get_sset_count (struct phy_device *phydev) {@@ -269,7 +274,7 @@ static void smsc_get_stats(struct phy_device *phydev, data[i] =smsc_get_stat (phydev, i); } -static int smsc_phy_probe (struct phy_device *phydev) +int smsc_phy_probe (struct phy_device *phydev) {struct device *dev = &phydev->mdio.dev;struct smsc_phy_priv *priv;@@ -294,6 +299,7 @@ static int smsc_phy_probe(struct phy_device *phydev)return clk_set_rate (refclk,50 *1000 *1000 ); } +EXPORT_SYMBOL_GPL (smsc_phy_probe);static struct phy_driver smsc_phy_driver[] = { {include/linux/smscphy.h +6
-1@@ -28,4 +28,10 @@#define MII_LAN83C185_MODE_POWERDOWN 0xC0/* Power Down mode */ #define MII_LAN83C185_MODE_ALL 0xE0/* All capable mode */ +int smsc_phy_config_intr (struct phy_device *phydev); +irqreturn_t smsc_phy_handle_interrupt (struct phy_device *phydev); +int smsc_phy_config_init (struct phy_device *phydev); +int lan87xx_read_status (struct phy_device *phydev); +int smsc_phy_probe (struct phy_device *phydev); +#endif /* __LINUX_SMSCPHY_H__ */ --2.39.2
Andrew Lunn
maintainerRe: [PATCH net-next 1/2] net: phy: smsc: export functions for use by meson-gxl PHY driver
Quoted 4 lines · Chris Healy
On a dev board with SMSC LAN8720, this change was tested and confirmed to still operate normally.
Signed-off-by Chris Healy <[email protected]>
Hi Chris
That should be Tested-By:
Andrew
Re: [PATCH net-next 1/2] net: phy: smsc: export functions for use by meson-gxl PHY driver
Quoted 5 lines · Andrew Lunn
Quoted 3 lines · Chris Healy
On a dev board with SMSC LAN8720, this change was tested and confirmed to still operate normally.
Quoted 7 lines
Quoted 1 line
Signed-off-by Chris Healy <[email protected]>Hi Chris
That should be Tested-By:
Andrew
You are correct. This was a mistake on my part. I should have stated "Tested-by" instead of SOB.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Heiner Kallweit
maintainerPATCH 2/2 net: phy: meson-gxl: reuse functionality of the SMSC PHY driver
In reply to Heiner KallweitThe Amlogic Meson internal PHY's have the same register layout as certain SMSC PHY's (also for non-c22-standard registers). This seems to be more than just coincidence. Apparently they also need the same workaround for EDPD mode (energy detect power down). Therefore let's reuse SMSC PHY driver functionality in the meson-gxl PHY driver.
Tested with a G12A internal PHY. I don't have GXL test hw, therefore I replace only the callbacks that are identical in the SMSC PHY driver.
--- drivers/net/phy/Kconfig | 1 + drivers/net/phy/meson-gxl.c | 77 ++++--------------------------------- 2 files changed, 9 insertions(+), 69 deletions(-)
drivers/net/phy/Kconfig +1 -0
@@ -70,6 +70,7 @@ config AMD_PHY config MESON_GXL_PHY tristate "Amlogic Meson GXL Internal PHY" depends on ARCH_MESON || COMPILE_TEST + select SMSC_PHY help Currently has a driver for the Amlogic Meson GXL Internal PHY
drivers/net/phy/meson-gxl.c +8 -69
108 lines not on this page · raw message
Signature · 1 line
2.39.2
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 11 lines · On Sat, 18 Mar 2023 21:30:01 +0100 you wrote:
The Amlogic Meson internal PHY's have the same register layout as certain SMSC PHY's (also for non-c22-standard registers). This seems to be more than just coincidence. Apparently they also need the same workaround for EDPD mode (energy detect power down). Therefore let's reuse SMSC PHY driver functionality in the meson-gxl PHY driver.
Heiner Kallweit (2):
net: phy: smsc: export functions for use by meson-gxl PHY driver
net: phy: meson-gxl: reuse functionality of the SMSC PHY driver[...]
Here is the summary with links:
- [net-next,1/2] net: phy: smsc: export functions for use by meson-gxl PHY driver
https://git.kernel.org/netdev/net-next/c/a69e332b4ef9 - [net-next,2/2] net: phy: meson-gxl: reuse functionality of the SMSC PHY driver https://git.kernel.org/netdev/net-next/c/be66fcc16ce6
You are awesome, thank you!
Signature · 9 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic