* [PATCH v2 0/2] net: phy: call phy_disable_interrupts() in phy_init_hw()
@ 2020-06-23 7:40 Jisheng Zhang
2020-06-23 7:41 ` [PATCH v2 1/2] net: phy: export phy_disable_interrupts() Jisheng Zhang
2020-06-23 7:41 ` [PATCH v2 2/2] net: phy: call phy_disable_interrupts() in phy_init_hw() Jisheng Zhang
0 siblings, 2 replies; 4+ messages in thread
From: Jisheng Zhang @ 2020-06-23 7:40 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Heiner Kallweit, Russell King,
David S. Miller, Jakub Kicinski
Cc: netdev, linux-kernel
We face an issue with rtl8211f, a pin is shared between INTB and PMEB,
and the PHY Register Accessible Interrupt is enabled by default, so
the INTB/PMEB pin is always active in polling mode case.
As Heiner pointed out "I was thinking about calling
phy_disable_interrupts() in phy_init_hw(), to have a defined init
state as we don't know in which state the PHY is if the PHY driver is
loaded. We shouldn't assume that it's the chip power-on defaults, BIOS
or boot loader could have changed this. Or in case of dual-boot
systems the other OS could leave the PHY in whatever state."
patch1 exports phy_disable_interrupts() so that it could be used in
phy_init_hw() to have a defined init state.
patch2 calls phy_disable_interrupts() in phy_init_hw() to have a
defined init state.
Since v1:
- EXPORT the correct symbol
Jisheng Zhang (2):
net: phy: export phy_disable_interrupts()
net: phy: call phy_disable_interrupts() in phy_init_hw()
drivers/net/phy/phy.c | 3 ++-
drivers/net/phy/phy_device.c | 7 +++++--
include/linux/phy.h | 1 +
3 files changed, 8 insertions(+), 3 deletions(-)
--
2.27.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] net: phy: export phy_disable_interrupts()
2020-06-23 7:40 [PATCH v2 0/2] net: phy: call phy_disable_interrupts() in phy_init_hw() Jisheng Zhang
@ 2020-06-23 7:41 ` Jisheng Zhang
2020-06-23 21:34 ` David Miller
2020-06-23 7:41 ` [PATCH v2 2/2] net: phy: call phy_disable_interrupts() in phy_init_hw() Jisheng Zhang
1 sibling, 1 reply; 4+ messages in thread
From: Jisheng Zhang @ 2020-06-23 7:41 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Heiner Kallweit, Russell King,
David S. Miller, Jakub Kicinski
Cc: netdev, linux-kernel
We face an issue with rtl8211f, a pin is shared between INTB and PMEB,
and the PHY Register Accessible Interrupt is enabled by default, so
the INTB/PMEB pin is always active in polling mode case.
As Heiner pointed out "I was thinking about calling
phy_disable_interrupts() in phy_init_hw(), to have a defined init
state as we don't know in which state the PHY is if the PHY driver is
loaded. We shouldn't assume that it's the chip power-on defaults, BIOS
or boot loader could have changed this. Or in case of dual-boot
systems the other OS could leave the PHY in whatever state."
Export phy_disable_interrupts() so that it could be used in
phy_init_hw() to have a defined init state.
Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
drivers/net/phy/phy.c | 3 ++-
include/linux/phy.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1de3938628f4..cd2dbbdba235 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -840,7 +840,7 @@ static void phy_error(struct phy_device *phydev)
* phy_disable_interrupts - Disable the PHY interrupts from the PHY side
* @phydev: target phy_device struct
*/
-static int phy_disable_interrupts(struct phy_device *phydev)
+int phy_disable_interrupts(struct phy_device *phydev)
{
int err;
@@ -852,6 +852,7 @@ static int phy_disable_interrupts(struct phy_device *phydev)
/* Clear the interrupt */
return phy_clear_interrupt(phydev);
}
+EXPORT_SYMBOL_GPL(phy_disable_interrupts);
/**
* phy_interrupt - PHY interrupt handler
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 8c05d0fb5c00..b693b609b2f5 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1416,6 +1416,7 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
int phy_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
int phy_do_ioctl_running(struct net_device *dev, struct ifreq *ifr, int cmd);
+int phy_disable_interrupts(struct phy_device *phydev);
void phy_request_interrupt(struct phy_device *phydev);
void phy_free_interrupt(struct phy_device *phydev);
void phy_print_status(struct phy_device *phydev);
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] net: phy: call phy_disable_interrupts() in phy_init_hw()
2020-06-23 7:40 [PATCH v2 0/2] net: phy: call phy_disable_interrupts() in phy_init_hw() Jisheng Zhang
2020-06-23 7:41 ` [PATCH v2 1/2] net: phy: export phy_disable_interrupts() Jisheng Zhang
@ 2020-06-23 7:41 ` Jisheng Zhang
1 sibling, 0 replies; 4+ messages in thread
From: Jisheng Zhang @ 2020-06-23 7:41 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Heiner Kallweit, Russell King,
David S. Miller, Jakub Kicinski
Cc: netdev, linux-kernel
Call phy_disable_interrupts() in phy_init_hw() to "have a defined init
state as we don't know in which state the PHY is if the PHY driver is
loaded. We shouldn't assume that it's the chip power-on defaults, BIOS
or boot loader could have changed this. Or in case of dual-boot
systems the other OS could leave the PHY in whatever state." as pointed
out by Heiner.
Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
drivers/net/phy/phy_device.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 04946de74fa0..f17d397ba689 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1090,10 +1090,13 @@ int phy_init_hw(struct phy_device *phydev)
if (ret < 0)
return ret;
- if (phydev->drv->config_init)
+ if (phydev->drv->config_init) {
ret = phydev->drv->config_init(phydev);
+ if (ret < 0)
+ return ret;
+ }
- return ret;
+ return phy_disable_interrupts(phydev);
}
EXPORT_SYMBOL(phy_init_hw);
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] net: phy: export phy_disable_interrupts()
2020-06-23 7:41 ` [PATCH v2 1/2] net: phy: export phy_disable_interrupts() Jisheng Zhang
@ 2020-06-23 21:34 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-06-23 21:34 UTC (permalink / raw)
To: Jisheng.Zhang
Cc: andrew, f.fainelli, hkallweit1, linux, kuba, netdev, linux-kernel
From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Date: Tue, 23 Jun 2020 15:41:04 +0800
> +EXPORT_SYMBOL_GPL(phy_disable_interrupts);
phy.o and phy_device.o are always linked together, therefore you don't
need a module symbol export.
If you plan to use it later in a device, submit the symbol export
with the driver change that uses it.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-06-23 21:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23 7:40 [PATCH v2 0/2] net: phy: call phy_disable_interrupts() in phy_init_hw() Jisheng Zhang
2020-06-23 7:41 ` [PATCH v2 1/2] net: phy: export phy_disable_interrupts() Jisheng Zhang
2020-06-23 21:34 ` David Miller
2020-06-23 7:41 ` [PATCH v2 2/2] net: phy: call phy_disable_interrupts() in phy_init_hw() Jisheng Zhang
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).