net: phy: DP83811: Add support for the phy
Subsystems (3)
PATCH 1/1 net: phy: DP83811: Add support for the phy
Add support for the DP83811 phy by extending
the DP83822 driver to recognize the PHY IDs.
The DP83811 supports both rgmii and sgmii interfaces. There are 2 part numbers for this the DP83811R does not reliably support the SGMII interface but the DP83811S will.
There is not a way to differentiate these parts from the hardware or register set. So this is controlled via the DT to indicate which phy mode is required. Or the part can be strapped to a certain interface.
Data sheet can be found here:
http://www.ti.com/product/DP83TC811S-Q1/description
http://www.ti.com/product/DP83TC811R-Q1/description
--- drivers/net/phy/dp83822.c | 42 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-)
drivers/net/phy/dp83822.c +39 -3
@@ -23,8 +23,10 @@#include <linux/netdevice.h> #define DP83822_PHY_ID 0x2000a240 +#define DP83811_PHY_ID 0x2000a253#define DP83822_DEVADDR 0x1f +#define MII_DP83811_SGMII_CTRL 0x09#define MII_DP83822_PHYSCR 0x11#define MII_DP83822_MISR1 0x12#define MII_DP83822_MISR2 0x13
@@ -79,6 +81,13 @@#define DP83822_WOL_INDICATION_SEL BIT(8)#define DP83822_WOL_CLR_INDICATION BIT(11) +/* DP83811 SGMII CTRL bits */ +#define DP83811_TDR_AUTO BIT(8) +#define DP83811_SGMII_EN BIT(12) +#define DP83811_SGMII_AUTO_NEG_EN BIT(13) +#define DP83811_SGMII_TX_ERR_DIS BIT(14) +#define DP83811_SGMII_SOFT_RESET BIT(15) +static int dp83822_ack_interrupt (struct phy_device *phydev) {int err;
@@ -267,6 +276,17 @@ static int dp83822_config_init(struct phy_device *phydev)if (err <0 )return err; +if ((phydev->interface ==PHY_INTERFACE_MODE_SGMII && + phydev->phy_id ==DP83811_PHY_ID )) { + value =phy_read (phydev,MII_DP83811_SGMII_CTRL ); +if (!(value &DP83811_SGMII_EN )) { + err =phy_write (phydev,MII_DP83811_SGMII_CTRL , + (DP83811_SGMII_EN | value)); +if (err <0 ) +return err; + } + } + value =DP83822_WOL_MAGIC_EN |DP83822_WOL_SECURE_ON |DP83822_WOL_EN ; return phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
@@ -328,15 +348,31 @@ static struct phy_driver dp83822_driver[] = { .suspend = dp83822_suspend, .resume = dp83822_resume, }, + { + .phy_id = DP83811_PHY_ID, + .phy_id_mask = 0xfffffff0, + .name = "TI DP83811", + .features = PHY_BASIC_FEATURES, + .flags = PHY_HAS_INTERRUPT, + .config_init = genphy_config_init, + .soft_reset = dp83822_phy_reset, + .get_wol = dp83822_get_wol, + .set_wol = dp83822_set_wol, + .ack_interrupt = dp83822_ack_interrupt, + .config_intr = dp83822_config_intr, + .suspend = dp83822_suspend, + .resume = dp83822_resume, + }, };module_phy_driver (dp83822_driver);static struct mdio_device_id __maybe_unused dp83822_tbl[] = { - {DP83822_PHY_ID ,0xfffffff0 }, - { }, + {DP83822_PHY_ID ,0xfffffff0 }, + {DP83811_PHY_ID ,0xfffffff0 }, + {} };MODULE_DEVICE_TABLE (mdio, dp83822_tbl); -MODULE_DESCRIPTION ("Texas Instruments DP83822 PHY driver" ); +MODULE_DESCRIPTION ("Texas Instruments DP83811/22 PHY driver" );MODULE_AUTHOR ("Dan Murphy <[email protected]" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.17.0.252.gfe0a9eaf3
All
Quoted 7 lines · Dan Murphy
Add support for the DP83811 phy by extending
the DP83822 driver to recognize the PHY IDs.The DP83811 supports both rgmii and sgmii interfaces. There are 2 part numbers for this the DP83811R does not reliably support the SGMII interface but the DP83811S will.
Quoted 9 lines
There is not a way to differentiate these parts from the hardware or register set. So this is controlled via the DT to indicate which phy mode is required. Or the part can be strapped to a certain interface.
Data sheet can be found here:
http://www.ti.com/product/DP83TC811S-Q1/description
http://www.ti.com/product/DP83TC811R-Q1/description
I am withdrawing this patch for comment.
Some of the future features have varying register definitions between the DP83811 and DP83822
Quoted 88 lines
Signed-off-by Dan Murphy <[email protected]>--- drivers/net/phy/dp83822.c | 42 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-)drivers/net/phy/dp83822.c +39
-3@@ -23,8 +23,10 @@#include <linux/netdevice.h> #define DP83822_PHY_ID 0x2000a240 +#define DP83811_PHY_ID 0x2000a253#define DP83822_DEVADDR 0x1f +#define MII_DP83811_SGMII_CTRL 0x09#define MII_DP83822_PHYSCR 0x11#define MII_DP83822_MISR1 0x12#define MII_DP83822_MISR2 0x13@@ -79,6 +81,13 @@#define DP83822_WOL_INDICATION_SEL BIT(8)#define DP83822_WOL_CLR_INDICATION BIT(11) +/* DP83811 SGMII CTRL bits */ +#define DP83811_TDR_AUTO BIT(8) +#define DP83811_SGMII_EN BIT(12) +#define DP83811_SGMII_AUTO_NEG_EN BIT(13) +#define DP83811_SGMII_TX_ERR_DIS BIT(14) +#define DP83811_SGMII_SOFT_RESET BIT(15) +static int dp83822_ack_interrupt (struct phy_device *phydev) {int err;@@ -267,6 +276,17 @@ static int dp83822_config_init(struct phy_device *phydev)if (err <0 )return err; +if ((phydev->interface ==PHY_INTERFACE_MODE_SGMII && + phydev->phy_id ==DP83811_PHY_ID )) { + value =phy_read (phydev,MII_DP83811_SGMII_CTRL ); +if (!(value &DP83811_SGMII_EN )) { + err =phy_write (phydev,MII_DP83811_SGMII_CTRL , + (DP83811_SGMII_EN | value)); +if (err <0 ) +return err; + } + } + value =DP83822_WOL_MAGIC_EN |DP83822_WOL_SECURE_ON |DP83822_WOL_EN ; return phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,@@ -328,15 +348,31 @@ static struct phy_driver dp83822_driver[] = { .suspend = dp83822_suspend, .resume = dp83822_resume, }, + { + .phy_id = DP83811_PHY_ID, + .phy_id_mask = 0xfffffff0, + .name = "TI DP83811", + .features = PHY_BASIC_FEATURES, + .flags = PHY_HAS_INTERRUPT, + .config_init = genphy_config_init, + .soft_reset = dp83822_phy_reset, + .get_wol = dp83822_get_wol, + .set_wol = dp83822_set_wol, + .ack_interrupt = dp83822_ack_interrupt, + .config_intr = dp83822_config_intr, + .suspend = dp83822_suspend, + .resume = dp83822_resume, + }, };module_phy_driver (dp83822_driver);static struct mdio_device_id __maybe_unused dp83822_tbl[] = { - {DP83822_PHY_ID ,0xfffffff0 }, - { }, + {DP83822_PHY_ID ,0xfffffff0 }, + {DP83811_PHY_ID ,0xfffffff0 }, + {} };MODULE_DEVICE_TABLE (mdio, dp83822_tbl); -MODULE_DESCRIPTION ("Texas Instruments DP83822 PHY driver" ); +MODULE_DESCRIPTION ("Texas Instruments DP83811/22 PHY driver" );MODULE_AUTHOR ("Dan Murphy <[email protected]" );MODULE_LICENSE ("GPL" );
Signature · 2 lines
------------------ Dan Murphy
Andrew Lunn
maintainerQuoted 15 lines · Dan Murphy
All
Quoted 12 lines · Dan Murphy
Add support for the DP83811 phy by extending
the DP83822 driver to recognize the PHY IDs.The DP83811 supports both rgmii and sgmii interfaces. There are 2 part numbers for this the DP83811R does not reliably support the SGMII interface but the DP83811S will.
There is not a way to differentiate these parts from the hardware or register set. So this is controlled via the DT to indicate which phy mode is required. Or the part can be strapped to a certain interface.
Quoted 8 lines
Quoted 4 lines
Data sheet can be found here:
http://www.ti.com/product/DP83TC811S-Q1/description
http://www.ti.com/product/DP83TC811R-Q1/descriptionI am withdrawing this patch for comment.
Some of the future features have varying register definitions between the DP83811 and DP83822
Hi Dan
It might be worth talking to the ASIC engineers and the test/qualification engineers. There are sometime undocumented registers for testing. You might be able to identify the exact device from these registers.
Andrew
Andrew
Quoted 25 lines · Andrew Lunn
Quoted 15 lines · Dan Murphy
All
Quoted 12 lines · Dan Murphy
Add support for the DP83811 phy by extending
the DP83822 driver to recognize the PHY IDs.The DP83811 supports both rgmii and sgmii interfaces. There are 2 part numbers for this the DP83811R does not reliably support the SGMII interface but the DP83811S will.
There is not a way to differentiate these parts from the hardware or register set. So this is controlled via the DT to indicate which phy mode is required. Or the part can be strapped to a certain interface.
Quoted 8 lines
Quoted 4 lines
Data sheet can be found here:
http://www.ti.com/product/DP83TC811S-Q1/description
http://www.ti.com/product/DP83TC811R-Q1/descriptionI am withdrawing this patch for comment.
Some of the future features have varying register definitions between the DP83811 and DP83822
Quoted 7 lines
Hi Dan
It might be worth talking to the ASIC engineers and the test/qualification engineers. There are sometime undocumented registers for testing. You might be able to identify the exact device from these registers.
Thanks. I talked to them prior to submitting this patch about determining which part is on the board. I will ping them again and poke a little harder.
It turns out that we will probably need a new driver for this part anyway as there are additional features that need to be supported that the 811 just does not support.
They want to support Master/Slave configurations.
The 822 supports fiber and eee while the 811 does not.
The 811 supports the IEEE802.3bw specific fields in MMD1 and MMD3, which are not in the 822.
The 811 does not support auto-negotiation on the MDI so all the auto-neg registers are invalid for the 811 but are valid for the 822.
Our Customer engineers felt that combining these two devices into a single driver may confuse the customer.
Dan
Quoted 2 lines
Andrew
Signature · 2 lines
------------------ Dan Murphy
Quoted 42 lines · Dan Murphy
Andrew
Quoted 25 lines · Andrew Lunn
Quoted 15 lines · Dan Murphy
All
Quoted 12 lines · Dan Murphy
Add support for the DP83811 phy by extending
the DP83822 driver to recognize the PHY IDs.The DP83811 supports both rgmii and sgmii interfaces. There are 2 part numbers for this the DP83811R does not reliably support the SGMII interface but the DP83811S will.
There is not a way to differentiate these parts from the hardware or register set. So this is controlled via the DT to indicate which phy mode is required. Or the part can be strapped to a certain interface.
Quoted 8 lines
Quoted 4 lines
Data sheet can be found here:
http://www.ti.com/product/DP83TC811S-Q1/description
http://www.ti.com/product/DP83TC811R-Q1/descriptionI am withdrawing this patch for comment.
Some of the future features have varying register definitions between the DP83811 and DP83822Quoted 7 lines
Hi Dan
It might be worth talking to the ASIC engineers and the test/qualification engineers. There are sometime undocumented registers for testing. You might be able to identify the exact device from these registers.
Thanks. I talked to them prior to submitting this patch about determining which part is on the board. I will ping them again and poke a little harder.
It turns out that we will probably need a new driver for this part anyway as there are additional features that need to be supported that the 811 just does not support.
Quoted 6 lines
They want to support Master/Slave configurations.
The 822 supports fiber and eee while the 811 does not.
The 811 supports the IEEE802.3bw specific fields in MMD1 and MMD3, which are not in the 822.
The 811 does not support auto-negotiation on the MDI so all the auto-neg registers are invalid for the 811 but are valid for the 822.Our Customer engineers felt that combining these two devices into a single driver may confuse the customer.
Why? Having a single Kconfig option to enable and "automatically" gaining support for new hardware is nice.
Signature · 1 line
Florian
Florian
Quoted 48 lines · Florian Fainelli
Quoted 47 lines · Dan Murphy
Andrew
Quoted 25 lines · Andrew Lunn
Quoted 15 lines · Dan Murphy
All
Quoted 12 lines · Dan Murphy
Add support for the DP83811 phy by extending
the DP83822 driver to recognize the PHY IDs.The DP83811 supports both rgmii and sgmii interfaces. There are 2 part numbers for this the DP83811R does not reliably support the SGMII interface but the DP83811S will.
There is not a way to differentiate these parts from the hardware or register set. So this is controlled via the DT to indicate which phy mode is required. Or the part can be strapped to a certain interface.
Quoted 8 lines
Quoted 4 lines
Data sheet can be found here:
http://www.ti.com/product/DP83TC811S-Q1/description
http://www.ti.com/product/DP83TC811R-Q1/descriptionI am withdrawing this patch for comment.
Some of the future features have varying register definitions between the DP83811 and DP83822Quoted 7 lines
Hi Dan
It might be worth talking to the ASIC engineers and the test/qualification engineers. There are sometime undocumented registers for testing. You might be able to identify the exact device from these registers.
Thanks. I talked to them prior to submitting this patch about determining which part is on the board. I will ping them again and poke a little harder.
It turns out that we will probably need a new driver for this part anyway as there are additional features that need to be supported that the 811 just does not support.
They want to support Master/Slave configurations.
The 822 supports fiber and eee while the 811 does not.
The 811 supports the IEEE802.3bw specific fields in MMD1 and MMD3, which are not in the 822.
The 811 does not support auto-negotiation on the MDI so all the auto-neg registers are invalid for the 811 but are valid for the 822.
Quoted 5 lines
Quoted 1 line
Our Customer engineers felt that combining these two devices into a single driver may confuse the customer.
Why? Having a single
Kconfigoption to enable and "automatically" gaining support for new hardware is nice.
I do agree that it is nice to have. But with additional features or lack of features the driver source will get pretty messy differentiating between devices.
What I added was just the basic if 811 & SGMII check.
Dan
Signature · 2 lines
------------------ Dan Murphy