net: phy: Remove TI DP83822 from DP83848 driver
Subsystems (3)
PATCH v2 1/3 net: phy: Remove TI DP83822 from DP83848 driver
Removing the DP83822 device from the DP83848 to
support the TI DP83822 dedicated driver that will
initially support WoL settings.
---
v2 - There was no v1 on this patch this is new.
drivers/net/phy/dp83848.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/phy/dp83848.c +0 -3
@@ -20,7 +20,6 @@#define TI_DP83620_PHY_ID 0x20005ce0#define NS_DP83848C_PHY_ID 0x20005c90#define TLK10X_PHY_ID 0x2000a210 -#define TI_DP83822_PHY_ID 0x2000a240/* Registers */ #define DP83848_MICR 0x11/* MII Interrupt Control Register */
@@ -80,7 +79,6 @@ static struct mdio_device_id __maybe_unused dp83848_tbl[] = { { NS_DP83848C_PHY_ID, 0xfffffff0 }, { TI_DP83620_PHY_ID, 0xfffffff0 }, { TLK10X_PHY_ID, 0xfffffff0 }, - { TI_DP83822_PHY_ID, 0xfffffff0 }, { } };MODULE_DEVICE_TABLE (mdio, dp83848_tbl);
@@ -110,7 +108,6 @@ static struct phy_driver dp83848_driver[] = {DP83848_PHY_DRIVER (NS_DP83848C_PHY_ID ,"NS DP83848C 10/100 Mbps PHY" ),DP83848_PHY_DRIVER (TI_DP83620_PHY_ID ,"TI DP83620 10/100 Mbps PHY" ),DP83848_PHY_DRIVER (TLK10X_PHY_ID ,"TI TLK10X 10/100 Mbps PHY" ), -DP83848_PHY_DRIVER (TI_DP83822_PHY_ID ,"TI DP83822 10/100 Mbps PHY" ), };module_phy_driver (dp83848_driver);
Signature · 1 line
2.14.0
PATCH v2 2/3 net: phy: DP83822 initial driver submission
Add support for the TI DP83822 10/100Mbit ethernet phy.
The DP83822 provides flexibility to connect to a MAC through a standard MII, RMII or RGMII interface.
Datasheet:
http://www.ti.com/product/DP83822I/datasheet
---
v2 - Updated per comments. Removed unnessary parantheis, called genphy_suspend/ resume routines and then performing WoL changes, reworked sopass storage and reduced the number of phy reads, and moved WOL_SECURE_ON -
https://www.mail-archive.com/[email protected]/msg191392.html
drivers/net/phy/Kconfig | 5 + drivers/net/phy/Makefile | 1 + drivers/net/phy/dp83822.c | 306 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 312 insertions(+) create mode 100644 drivers/net/phy/dp83822.c
drivers/net/phy/Kconfig +5 -0
@@ -277,6 +277,11 @@ config DAVICOM_PHY ---help--- Currently supports dm9161e and dm9131 +config DP83822_PHY + tristate "Texas Instruments DP83822 PHY" + ---help--- + Supports the DP83822 PHY. + config DP83848_PHY tristate "Texas Instruments DP83848 PHY" ---help---
drivers/net/phy/Makefile +1 -0
@@ -55,6 +55,7 @@ obj-$(CONFIG_CICADA_PHY) += cicada.o obj-$(CONFIG_CORTINA_PHY) += cortina.o obj-$(CONFIG_DAVICOM_PHY) += davicom.o obj-$(CONFIG_DP83640_PHY) += dp83640.o +obj-$(CONFIG_DP83822_PHY) += dp83822.o obj-$(CONFIG_DP83848_PHY) += dp83848.o obj-$(CONFIG_DP83867_PHY) += dp83867.o obj-$(CONFIG_FIXED_PHY) += fixed_phy.o
drivers/net/phy/dp83822.c new file +306 -0
306 lines not on this page · raw message
Signature · 1 line
2.14.0
PATCH v2 3/3 net: phy: Change error to EINVAL for invalid MAC
In reply to Dan MurphyChange the return error code to EINVAL if the MAC
address is not valid in the set_wol function.
---
v2 - There was no v1 on this patch this is new.
drivers/net/phy/at803x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/at803x.c +1 -1
@@ -167,7 +167,7 @@ static int at803x_set_wol(struct phy_device *phydev, mac = (const u8 *) ndev->dev_addr;if (!is_valid_ether_addr (mac)) -return -EFAULT ; +return -EINVAL ;for (i =0 ; i <3 ; i++) { phy_write(phydev, AT803X_MMD_ACCESS_CONTROL,
Signature · 1 line
2.14.0
RE: [PATCH 2/3 v2] net: phy: DP83822 initial driver submission
In reply to Dan MurphyReview
Quoted 8 lines
drivers/net/phy/dp83822.c new file +6
-0+static int dp83822_suspend (struct phy_device *phydev) +{ +int value; + +mutex_lock (&phydev->lock); + value = phy_read_mmd(phydev, DP83822_DEVADDR,
MII_DP83822_WOL_CFG);(quoted diff) +1
-0+ mutex_unlock(&phydev->lock);
Would we need mutex to access phy_read_mmd()?phy_read_mmd() has mdio_lock for indirect access.
Quoted 18 lines
drivers/net/phy/dp83822.c new file +14
-0+if (!(value &DP83822_WOL_EN )) +genphy_suspend (phydev); + +return 0 ; +} + +static int dp83822_resume (struct phy_device *phydev) +{ +int value; + +genphy_resume (phydev); + +mutex_lock (&phydev->lock); + value = phy_read_mmd(phydev, DP83822_DEVADDR,
MII_DP83822_WOL_CFG);(quoted diff) +2
-0+ + phy_write_mmd(phydev, DP83822_DEVADDR,
MII_DP83822_WOL_CFG, value |
drivers/net/phy/dp83822.c line 272
Quoted 3 lines
drivers/net/phy/dp83822.c new file +3
-0+ DP83822_WOL_CLR_INDICATION); + +mutex_unlock (&phydev->lock);
Same here.
Woojung
Andrew Lunn
maintainerRe: [PATCH 2/3 v2] net: phy: DP83822 initial driver submission
Quoted 11 lines · On Wed, Oct 04, 2017 at 10:44:36PM +0000, [email protected] wrote:
Review
Quoted 8 lines
drivers/net/phy/dp83822.c new file +6
-0+static int dp83822_suspend (struct phy_device *phydev) +{ +int value; + +mutex_lock (&phydev->lock); + value = phy_read_mmd(phydev, DP83822_DEVADDR,
MII_DP83822_WOL_CFG);(quoted diff) +1
-0+ mutex_unlock(&phydev->lock);Would we need mutex to access
phy_read_mmd()?phy_read_mmd()hasmdio_lockfor indirect access.
Hi Woojung
The mdio lock is not sufficient. It protects against two mdio accesses. But here we need to protect against two phy operations. There is a danger something else tries to access the phy during suspend.
Quoted 2 lines
drivers/net/phy/dp83822.c line 255
Quoted 2 lines
drivers/net/phy/dp83822.c new file +2
-0+if (!(value &DP83822_WOL_EN )) +genphy_suspend (phydev);
Releasing the lock before calling genphy_suspend() is not so nice. Maybe add a version which assumes the lock has already been taken?
Andrew
Re: [PATCH 2/3 v2] net: phy: DP83822 initial driver submission
Andrew
Quoted 20 lines · Andrew Lunn
Quoted 11 lines · On Wed, Oct 04, 2017 at 10:44:36PM +0000, [email protected] wrote:
Review
Quoted 8 lines
drivers/net/phy/dp83822.c new file +6
-0+static int dp83822_suspend (struct phy_device *phydev) +{ +int value; + +mutex_lock (&phydev->lock); + value = phy_read_mmd(phydev, DP83822_DEVADDR,
MII_DP83822_WOL_CFG);(quoted diff) +1
-0+ mutex_unlock(&phydev->lock);Would we need mutex to access
phy_read_mmd()?phy_read_mmd()hasmdio_lockfor indirect access.Hi Woojung
The mdio lock is not sufficient. It protects against two mdio accesses. But here we need to protect against two phy operations. There is a danger something else tries to access the phy during suspend.
Quoted 6 lines
Quoted 2 lines
drivers/net/phy/dp83822.c line 255
Quoted 2 lines
drivers/net/phy/dp83822.c new file +2
-0+if (!(value &DP83822_WOL_EN )) +genphy_suspend (phydev);Releasing the lock before calling
genphy_suspend()is not so nice. Maybe add a version which assumes the lock has already been taken?
The marvell driver does not take a lock and calls genphy_suspend/resume so I am wondering if this driver needs to take a lock.
The at803x needs to take the lock because it does not call into the genphy functions.
Dan
Quoted 2 lines
Andrew
Signature · 2 lines
------------------ Dan Murphy
RE: [PATCH 2/3 v2] net: phy: DP83822 initial driver submission
In reply to Andrew LunnQuoted 12 lines
Quoted 11 lines
Review
Quoted 8 lines
drivers/net/phy/dp83822.c new file +6
-0+static int dp83822_suspend (struct phy_device *phydev) +{ +int value; + +mutex_lock (&phydev->lock); + value = phy_read_mmd(phydev, DP83822_DEVADDR,
MII_DP83822_WOL_CFG);(quoted diff) +1
-0+ mutex_unlock(&phydev->lock);Would we need mutex to access
phy_read_mmd()?phy_read_mmd()hasmdio_lockfor indirect access.
Quoted 6 lines
Hi Woojung
The mdio lock is not sufficient. It protects against two mdio accesses. But here we need to protect against two phy operations. There is a danger something else tries to access the phy during suspend.
Hi Andrew,
Thanks for comment. I have question then.phy_read_mmd() is protected by bus->mdio_lock around mmd_indirect & mdio_read. While these operation, other phy_read() & phy_write() will be blocked inside mdiobus_read() & mdiobus_write().
Because this phy_read_mmd(.., DP83822_DEVADDR, MII_DP83822_WOL_CFG) is not read-modify-write operation, I think phydev->lock may not be necessary.
Am I missing something?
Quoted 6 lines
Quoted 2 lines
drivers/net/phy/dp83822.c line 255
Quoted 2 lines
drivers/net/phy/dp83822.c new file +2
-0+if (!(value &DP83822_WOL_EN )) +genphy_suspend (phydev);Releasing the lock before calling
genphy_suspend()is not so nice. Maybe add a version which assumes the lock has already been taken?
We can expand genphy_suspend() per setting by phy_driver->set_wol. When genphy_suspend() acts per wol setting, not many phy driver needs to extra work When WOL is enabled.
How do you think?
- Woojung
Re: [PATCH 2/3 v2] net: phy: DP83822 initial driver submission
In reply to Andrew LunnAndrew
Quoted 20 lines · Andrew Lunn
Quoted 11 lines · On Wed, Oct 04, 2017 at 10:44:36PM +0000, [email protected] wrote:
Review
Quoted 8 lines
drivers/net/phy/dp83822.c new file +6
-0+static int dp83822_suspend (struct phy_device *phydev) +{ +int value; + +mutex_lock (&phydev->lock); + value = phy_read_mmd(phydev, DP83822_DEVADDR,
MII_DP83822_WOL_CFG);(quoted diff) +1
-0+ mutex_unlock(&phydev->lock);Would we need mutex to access
phy_read_mmd()?phy_read_mmd()hasmdio_lockfor indirect access.Hi Woojung
The mdio lock is not sufficient. It protects against two mdio accesses. But here we need to protect against two phy operations. There is a danger something else tries to access the phy during suspend.
Quoted 6 lines
Quoted 2 lines
drivers/net/phy/dp83822.c line 255
Quoted 2 lines
drivers/net/phy/dp83822.c new file +2
-0+if (!(value &DP83822_WOL_EN )) +genphy_suspend (phydev);Releasing the lock before calling
genphy_suspend()is not so nice. Maybe add a version which assumes the lock has already been taken?
The marvell driver does not take a lock and calls genphy_suspend/resume so I am wondering if this driver needs to take a lock.
The at803x needs to take the lock because it does not call into the genphy functions.
I will submit a new version with the lock removed.
Dan
Quoted 2 lines
Andrew
Signature · 2 lines
------------------ Dan Murphy