Skip to contentSkip to conversation

TI Ethernet PHY changes

PATCH Superseded Dan Murphy 2 participants 10 messages Apr 28, 2020 – Apr 30, 2020

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

v2 cover TI Ethernet PHY changes

Hello

The addition of the DP83867 driver to uboot was done in a generic way that made it a bit difficult to bring in new PHY drivers. The difficulty came in the config flags and the phy_init function. The change is to make the flags and init for the DP83867 more specific to the DP83867 device to make way to add more TI PHYs to uBoot.

In addition the DP8382X PHY is a generic PHY driver that does not need any special handling to establish a link. Customers have requested that at the very least there be a way to know if the PHY attached is the PHY that is connected as "Generic PHY" is not really descriptive. These patches adds the registrations for TI Generic PHYs to associcate a TI PHY ID with a PHY name.

Porting PHY helper routines to set and clear bits to facilitate easier side porting of ethernet kernel drivers to uBoot.

Dan

Dan Murphy (3):
net: phy: Add helper routines to set and clear bits
net: phy: Add support for TI PHY init
net: phy: Add DP8382x phy registration to TI PHY init

*Note: I dropped the DP83869 patch for now.

 configs/am65x_evm_a53_defconfig      |   2 +-
 configs/am65x_hs_evm_a53_defconfig   |   2 +-
 configs/dra7xx_evm_defconfig         |   2 +-
 configs/dra7xx_hs_evm_defconfig      |   2 +-
 configs/dra7xx_hs_evm_usb_defconfig  |   2 +-
 configs/j721e_evm_a72_defconfig      |   2 +-
 configs/j721e_hs_evm_a72_defconfig   |   2 +-
 configs/k2g_evm_defconfig            |   2 +-
 configs/xilinx_versal_virt_defconfig |   2 +-
 configs/xilinx_zynqmp_virt_defconfig |   2 +-
 drivers/net/phy/Kconfig              |  15 ++++
 drivers/net/phy/Makefile             |   3 +-
 drivers/net/phy/dp83867.c            |   3 +-
 drivers/net/phy/ti_phy_init.c        | 109 +++++++++++++++++++++++++++
 drivers/net/phy/ti_phy_init.h        |  15 ++++
 include/phy.h                        |  80 ++++++++++++++++++++
 16 files changed, 233 insertions(+), 12 deletions(-)
 create mode 100644 drivers/net/phy/ti_phy_init.c
 create mode 100644 drivers/net/phy/ti_phy_init.h
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 1/3 net: phy: Add helper routines to set and clear bits

Add phy_set/clear_bit helper routines so that ported drivers from the kernel can use these functions.

---
 include/phy.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
include/phy.h +80 -0
index b5de14cbfc29..1a875b96edb7 100644
@@ -170,6 +170,12 @@ struct fixed_link {
 	int asym_pause;
 };
 
+/**
+ * phy_read - Convenience function for reading a given PHY register
+ * @phydev: the phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: register number to read
+ */
 static inline int phy_read(struct phy_device *phydev, int devad, int regnum)
 {
 	struct mii_dev *bus = phydev->bus;
@@ -182,6 +188,13 @@ static inline int phy_read(struct phy_device *phydev, int devad, int regnum)
 	return bus->read(bus, phydev->addr, devad, regnum);
 }
 
+/**
+ * phy_write - Convenience function for writing a given PHY register
+ * @phydev: the phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: register number to write
+ * @val: value to write to @regnum
+ */
 static inline int phy_write(struct phy_device *phydev, int devad, int regnum,
 			u16 val)
 {
@@ -209,6 +222,13 @@ static inline void phy_mmd_start_indirect(struct phy_device *phydev, int devad,
 		  (devad | MII_MMD_CTRL_NOINCR));
 }
 
+/**
+ * phy_read_mmd - Convenience function for reading a register
+ * from an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ */
 static inline int phy_read_mmd(struct phy_device *phydev, int devad,
 			       int regnum)
 {
@@ -233,6 +253,14 @@ static inline int phy_read_mmd(struct phy_device *phydev, int devad,
 	return phy_read(phydev, MDIO_DEVAD_NONE, MII_MMD_DATA);
 }
 
+/**
+ * phy_write_mmd - Convenience function for writing a register
+ * on an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ * @val: value to write to @regnum
+ */
 static inline int phy_write_mmd(struct phy_device *phydev, int devad,
 				int regnum, u16 val)
 {
@@ -257,6 +285,58 @@ static inline int phy_write_mmd(struct phy_device *phydev, int devad,
 	return phy_write(phydev, MDIO_DEVAD_NONE, MII_MMD_DATA, val);
 }
 
+/**
+ * phy_set_bits_mmd - Convenience function for setting bits in a register
+ * on MMD
+ * @phydev: the phy_device struct
+ * @devad: the MMD containing register to modify
+ * @regnum: register number to modify
+ * @val: bits to set
+ */
+static inline int phy_set_bits_mmd(struct phy_device *phydev, int devad,
+				   u32 regnum, u16 val)
+{
+	int value, ret;
+
+	value = phy_read_mmd(phydev, devad, regnum);
+	if (value < 0)
+		return value;
+
+	value |= val;
+
+	ret = phy_write_mmd(phydev, devad, regnum, value);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
+/**
+ * phy_clear_bits_mmd - Convenience function for clearing bits in a register
+ * on MMD
+ * @phydev: the phy_device struct
+ * @devad: the MMD containing register to modify
+ * @regnum: register number to modify
+ * @val: bits to clear
+ */
+static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad,
+				     u32 regnum, u16 val)
+{
+	int value, ret;
+
+	value = phy_read_mmd(phydev, devad, regnum);
+	if (value < 0)
+		return value;
+
+	value &= ~val;
+
+	ret = phy_write_mmd(phydev, devad, regnum, value);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
 #ifdef CONFIG_PHYLIB_10G
 extern struct phy_driver gen10g_driver;
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 1/3 net: phy: Add helper routines to set and clear bits

Quoted 118 lines · Dan Murphy

Add phy_set/clear_bit helper routines so that ported drivers from the kernel can use these functions.

---
 include/phy.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
include/phy.h +73 -0
index b5de14cbfc29..1a875b96edb7 100644
@@ -170,6 +170,12 @@ struct fixed_link {
 	int asym_pause;
 };
 
+/**
+ * phy_read - Convenience function for reading a given PHY register
+ * @phydev: the phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: register number to read
+ */
 static inline int phy_read(struct phy_device *phydev, int devad, int regnum)
 {
 	struct mii_dev *bus = phydev->bus;
@@ -182,6 +188,13 @@ static inline int phy_read(struct phy_device *phydev, int devad, int regnum)
 	return bus->read(bus, phydev->addr, devad, regnum);
 }
 
+/**
+ * phy_write - Convenience function for writing a given PHY register
+ * @phydev: the phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: register number to write
+ * @val: value to write to @regnum
+ */
 static inline int phy_write(struct phy_device *phydev, int devad, int regnum,
 			u16 val)
 {
@@ -209,6 +222,13 @@ static inline void phy_mmd_start_indirect(struct phy_device *phydev, int devad,
 		  (devad | MII_MMD_CTRL_NOINCR));
 }
 
+/**
+ * phy_read_mmd - Convenience function for reading a register
+ * from an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ */
 static inline int phy_read_mmd(struct phy_device *phydev, int devad,
 			       int regnum)
 {
@@ -233,6 +253,14 @@ static inline int phy_read_mmd(struct phy_device *phydev, int devad,
 	return phy_read(phydev, MDIO_DEVAD_NONE, MII_MMD_DATA);
 }
 
+/**
+ * phy_write_mmd - Convenience function for writing a register
+ * on an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ * @val: value to write to @regnum
+ */
 static inline int phy_write_mmd(struct phy_device *phydev, int devad,
 				int regnum, u16 val)
 {
@@ -257,6 +285,58 @@ static inline int phy_write_mmd(struct phy_device *phydev, int devad,
 	return phy_write(phydev, MDIO_DEVAD_NONE, MII_MMD_DATA, val);
 }
 
+/**
+ * phy_set_bits_mmd - Convenience function for setting bits in a register
+ * on MMD
+ * @phydev: the phy_device struct
+ * @devad: the MMD containing register to modify
+ * @regnum: register number to modify
+ * @val: bits to set
+ */
+static inline int phy_set_bits_mmd(struct phy_device *phydev, int devad,
+				   u32 regnum, u16 val)
+{
+	int value, ret;
+
+	value = phy_read_mmd(phydev, devad, regnum);
+	if (value < 0)
+		return value;
+
+	value |= val;
+
+	ret = phy_write_mmd(phydev, devad, regnum, value);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
+/**
+ * phy_clear_bits_mmd - Convenience function for clearing bits in a register
+ * on MMD
+ * @phydev: the phy_device struct
+ * @devad: the MMD containing register to modify
+ * @regnum: register number to modify
+ * @val: bits to clear
+ */
+static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad,
+				     u32 regnum, u16 val)
+{
+	int value, ret;
+
+	value = phy_read_mmd(phydev, devad, regnum);
+	if (value < 0)
+		return value;
+
+	value &= ~val;
+

include/phy.h static inline int phy_write_mmd(struct phy_device *phydev, int devad, · line 342

Quoted 10 lines
include/phy.h +7 -0
+	ret = phy_write_mmd(phydev, devad, regnum, value);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
 #ifdef CONFIG_PHYLIB_10G
 extern struct phy_driver gen10g_driver;
 

Better would be to have one patch just with adding missing kernel-doc. It is not described in commit message too.

And second to add that functions.

And there are errors there.

[u-boot](debian)$ ./scripts/kernel-doc -v -man include/phy.h > /dev/null include/phy.h:174: info: Scanning doc for phy_read include/phy.h:180: warning: No description found for return value of 'phy_read'
include/phy.h:192: info: Scanning doc for phy_write include/phy.h:200: warning: No description found for return value of 'phy_write'
include/phy.h:226: info: Scanning doc for phy_read_mmd include/phy.h:234: warning: No description found for return value of 'phy_read_mmd'
include/phy.h:257: info: Scanning doc for phy_write_mmd include/phy.h:266: warning: No description found for return value of 'phy_write_mmd'
include/phy.h:289: info: Scanning doc for phy_set_bits_mmd include/phy.h:298: warning: No description found for return value of 'phy_set_bits_mmd'
include/phy.h:315: info: Scanning doc for phy_clear_bits_mmd include/phy.h:324: warning: No description found for return value of 'phy_clear_bits_mmd'

Thanks,
Michal

author
#3 lore raw

PATCH v2 1/3 net: phy: Add helper routines to set and clear bits

Michal

Quoted 123 lines · Michal Simek
Quoted 122 lines · Dan Murphy

Add phy_set/clear_bit helper routines so that ported drivers from the kernel can use these functions.

---
  include/phy.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 80 insertions(+)
include/phy.h +78 -0
index b5de14cbfc29..1a875b96edb7 100644
@@ -170,6 +170,12 @@ struct fixed_link {
  	int asym_pause;
  };
 
+/**
+ * phy_read - Convenience function for reading a given PHY register
+ * @phydev: the phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: register number to read
+ */
  static inline int phy_read(struct phy_device *phydev, int devad, int regnum)
  {
  	struct mii_dev *bus = phydev->bus;
@@ -182,6 +188,13 @@ static inline int phy_read(struct phy_device *phydev, int devad, int regnum)
  	return bus->read(bus, phydev->addr, devad, regnum);
  }
 
+/**
+ * phy_write - Convenience function for writing a given PHY register
+ * @phydev: the phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: register number to write
+ * @val: value to write to @regnum
+ */
  static inline int phy_write(struct phy_device *phydev, int devad, int regnum,
  			u16 val)
  {
@@ -209,6 +222,13 @@ static inline void phy_mmd_start_indirect(struct phy_device *phydev, int devad,
  		  (devad | MII_MMD_CTRL_NOINCR));
  }
 
+/**
+ * phy_read_mmd - Convenience function for reading a register
+ * from an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ */
  static inline int phy_read_mmd(struct phy_device *phydev, int devad,
  			       int regnum)
  {
@@ -233,6 +253,14 @@ static inline int phy_read_mmd(struct phy_device *phydev, int devad,
  	return phy_read(phydev, MDIO_DEVAD_NONE, MII_MMD_DATA);
  }
 
+/**
+ * phy_write_mmd - Convenience function for writing a register
+ * on an MMD on a given PHY.
+ * @phydev: The phy_device struct
+ * @devad: The MMD to read from
+ * @regnum: The register on the MMD to read
+ * @val: value to write to @regnum
+ */
  static inline int phy_write_mmd(struct phy_device *phydev, int devad,
  				int regnum, u16 val)
  {
@@ -257,6 +285,58 @@ static inline int phy_write_mmd(struct phy_device *phydev, int devad,
  	return phy_write(phydev, MDIO_DEVAD_NONE, MII_MMD_DATA, val);
  }
 
+/**
+ * phy_set_bits_mmd - Convenience function for setting bits in a register
+ * on MMD
+ * @phydev: the phy_device struct
+ * @devad: the MMD containing register to modify
+ * @regnum: register number to modify
+ * @val: bits to set
+ */
+static inline int phy_set_bits_mmd(struct phy_device *phydev, int devad,
+				   u32 regnum, u16 val)
+{
+	int value, ret;
+
+	value = phy_read_mmd(phydev, devad, regnum);
+	if (value < 0)
+		return value;
+
+	value |= val;
+
+	ret = phy_write_mmd(phydev, devad, regnum, value);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
+/**
+ * phy_clear_bits_mmd - Convenience function for clearing bits in a register
+ * on MMD
+ * @phydev: the phy_device struct
+ * @devad: the MMD containing register to modify
+ * @regnum: register number to modify
+ * @val: bits to clear
+ */
+static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad,
+				     u32 regnum, u16 val)
+{
+	int value, ret;
+
+	value = phy_read_mmd(phydev, devad, regnum);
+	if (value < 0)
+		return value;
+
+	value &= ~val;
+
+	ret = phy_write_mmd(phydev, devad, regnum, value);
+	if (ret < 0)
+		return ret;
+
+	return 0;
Quoted 8 lines

include/phy.h static inline int phy_write_mmd(struct phy_device *phydev, int devad, · line 342

Quoted 6 lines
include/phy.h +2 -0
+}
+
  #ifdef CONFIG_PHYLIB_10G
  extern struct phy_driver gen10g_driver;
 

Better would be to have one patch just with adding missing kernel-doc. It is not described in commit message too.

Yes I was thinking that I should have done 2 patches since the kernel doc to the other functions is completely separate work.

Quoted 6 lines

And second to add that functions.

And there are errors there.

[u-boot](debian)$ ./scripts/kernel-doc -v -man include/phy.h > /dev/null

I learned something new today.? Now I know how to check my kernel doc :)

I will fix these.

Dan

author
#4 lore raw

PATCH v2 2/3 net: phy: Add support for TI PHY init

In reply to Dan Murphy

ti_phy_init function was allocated to the DP83867 PHY. This function name is to generic for a specific PHY. The function can be moved to a TI specific file that can register all TI PHYs that are defined in the defconfig. The ti_phy_init file will contain all TI PHYs initialization so that only phy_ti_init can be called from the framework.

In addition to the above the config flag for the DP83867 needs to be changed in the Kconfig and dependent defconfig files. The config flag that was used for the DP83867 was also generic in nature so a more specific config flag for the DP83867 was created.

---
 configs/am65x_evm_a53_defconfig      |  2 +-
 configs/am65x_hs_evm_a53_defconfig   |  2 +-
 configs/dra7xx_evm_defconfig         |  2 +-
 configs/dra7xx_hs_evm_defconfig      |  2 +-
 configs/dra7xx_hs_evm_usb_defconfig  |  2 +-
 configs/j721e_evm_a72_defconfig      |  2 +-
 configs/j721e_hs_evm_a72_defconfig   |  2 +-
 configs/k2g_evm_defconfig            |  2 +-
 configs/xilinx_versal_virt_defconfig |  2 +-
 configs/xilinx_zynqmp_virt_defconfig |  2 +-
 drivers/net/phy/Kconfig              | 15 +++++++++++++++
 drivers/net/phy/Makefile             |  3 ++-
 drivers/net/phy/dp83867.c            |  3 ++-
 drivers/net/phy/ti_phy_init.c        | 18 ++++++++++++++++++
 drivers/net/phy/ti_phy_init.h        | 15 +++++++++++++++
 15 files changed, 62 insertions(+), 12 deletions(-)
 create mode 100644 drivers/net/phy/ti_phy_init.c
 create mode 100644 drivers/net/phy/ti_phy_init.h
configs/am65x_evm_a53_defconfig +1 -1
index 542bbd992c53..c8cc9b2f7d8d 100644
@@ -101,7 +101,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
configs/am65x_hs_evm_a53_defconfig +1 -1
index 9f43cee39611..738bd01b059f 100644
@@ -103,7 +103,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
configs/dra7xx_evm_defconfig +1 -1
index 4d765da4e052..9ad462cdc6de 100644
@@ -86,7 +86,7 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=76800000
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
configs/dra7xx_hs_evm_defconfig +1 -1
index c25d4ce5c142..9aa452460765 100644
@@ -89,7 +89,7 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=76800000
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
configs/dra7xx_hs_evm_usb_defconfig +1 -1
index 8e74496b2ccd..d282468212e9 100644
@@ -87,7 +87,7 @@ CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=76800000
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
configs/j721e_evm_a72_defconfig +1 -1
index e9e82bb4309d..29ae8d720753 100644
@@ -124,7 +124,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_TI_AM65_CPSW_NUSS=y
configs/j721e_hs_evm_a72_defconfig +1 -1
index a723e2718e5e..7174fda72a01 100644
@@ -114,7 +114,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_TI_AM65_CPSW_NUSS=y
configs/k2g_evm_defconfig +1 -1
index 5abf5faa450e..14cf1b997d91 100644
@@ -58,7 +58,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_MARVELL=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ8XXX=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_KEYSTONE_NET=y
configs/xilinx_versal_virt_defconfig +1 -1
index e8c349261207..dcd841b8e299 100644
@@ -61,7 +61,7 @@ CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_PHY_MARVELL=y
 CONFIG_PHY_NATSEMI=y
 CONFIG_PHY_REALTEK=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_VITESSE=y
 CONFIG_PHY_FIXED=y
 CONFIG_PHY_GIGE=y
configs/xilinx_zynqmp_virt_defconfig +1 -1
index 7b09edd78e1b..b7b671282a87 100644
@@ -101,7 +101,7 @@ CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_PHY_NATSEMI=y
 CONFIG_PHY_REALTEK=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_VITESSE=y
 CONFIG_PHY_XILINX_GMII2RGMII=y
 CONFIG_PHY_FIXED=y
drivers/net/phy/Kconfig +15 -0
index d1f049e62ab7..a8ae1db4afe2 100644
@@ -243,6 +243,21 @@ config PHY_TERANETICS
 
 config PHY_TI
 	bool "Texas Instruments Ethernet PHYs support"
+	---help---
+	  Adds PHY registration support for TI PHYs.
+
+config PHY_TI_GENERIC
+	select PHY_TI
+	bool "Texas Instruments Generic Ethernet PHYs support"
+	---help---
+	  Adds support for Generic TI PHYs that don't need special handling but
+	  the PHY name is associated with a PHY ID.
+
+config PHY_TI_DP83867
+	select PHY_TI
+	bool "Texas Instruments Ethernet DP83867 PHY support"
+	---help---
+	  Adds support for the TI DP83867 1Gbit PHY.
 
 config PHY_VITESSE
 	bool "Vitesse Ethernet PHYs support"
drivers/net/phy/Makefile +2 -1
index 1d81516ecd1d..6e722331f1bf 100644
@@ -25,7 +25,8 @@ obj-$(CONFIG_PHY_NATSEMI) += natsemi.o
 obj-$(CONFIG_PHY_REALTEK) += realtek.o
 obj-$(CONFIG_PHY_SMSC) += smsc.o
 obj-$(CONFIG_PHY_TERANETICS) += teranetics.o
-obj-$(CONFIG_PHY_TI) += dp83867.o
+obj-$(CONFIG_PHY_TI) += ti_phy_init.o
+obj-$(CONFIG_PHY_TI_DP83867) += dp83867.o
 obj-$(CONFIG_PHY_XILINX) += xilinx_phy.o
 obj-$(CONFIG_PHY_XILINX_GMII2RGMII) += xilinx_gmii2rgmii.o
 obj-$(CONFIG_PHY_VITESSE) += vitesse.o
drivers/net/phy/dp83867.c +2 -1
index 50804c130efd..c9ed4a44d4db 100644
@@ -12,6 +12,7 @@
 #include <dm.h>
 #include <dt-bindings/net/ti-dp83867.h>
 
+#include "ti_phy_init.h"
 
 /* TI DP83867 */
 #define DP83867_DEVADDR		0x1f
@@ -428,7 +429,7 @@ static struct phy_driver DP83867_driver = {
 	.shutdown = &genphy_shutdown,
 };
 
-int phy_ti_init(void)
+int phy_dp83867_init(void)
 {
 	phy_register(&DP83867_driver);
 	return 0;
drivers/net/phy/ti_phy_init.c new file +18 -0
new file mode 100644
index 000000000000..277b29a26342
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * TI Generic PHY Init to register any TI Ethernet PHYs
+ *
+ * Author: Dan Murphy <[email protected]>
+ *
+ * Copyright (C) 2019-20 Texas Instruments Inc.
+ */
+
+#include "ti_phy_init.h"
+
+int phy_ti_init(void)
+{
+#ifdef CONFIG_PHY_TI_DP83867
+	phy_dp83867_init();
+#endif
+	return 0;
+}
drivers/net/phy/ti_phy_init.h new file +15 -0
new file mode 100644
index 000000000000..6c7f6c640a79
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * TI Generic Ethernet PHY
+ *
+ * Author: Dan Murphy <[email protected]>
+ *
+ * Copyright (C) 2019-20 Texas Instruments Inc.
+ */
+
+#ifndef _TI_GEN_PHY_H
+#define _TI_GEN_PHY_H
+
+int phy_dp83867_init(void);
+
+#endif /* _TI_GEN_PHY_H */
Signature · 1 line
2.25.1
#5 lore raw

PATCH v2 2/3 net: phy: Add support for TI PHY init

Quoted 259 lines · Dan Murphy

ti_phy_init function was allocated to the DP83867 PHY. This function name is to generic for a specific PHY. The function can be moved to a TI specific file that can register all TI PHYs that are defined in the defconfig. The ti_phy_init file will contain all TI PHYs initialization so that only phy_ti_init can be called from the framework.

In addition to the above the config flag for the DP83867 needs to be changed in the Kconfig and dependent defconfig files. The config flag that was used for the DP83867 was also generic in nature so a more specific config flag for the DP83867 was created.

---
 configs/am65x_evm_a53_defconfig      |  2 +-
 configs/am65x_hs_evm_a53_defconfig   |  2 +-
 configs/dra7xx_evm_defconfig         |  2 +-
 configs/dra7xx_hs_evm_defconfig      |  2 +-
 configs/dra7xx_hs_evm_usb_defconfig  |  2 +-
 configs/j721e_evm_a72_defconfig      |  2 +-
 configs/j721e_hs_evm_a72_defconfig   |  2 +-
 configs/k2g_evm_defconfig            |  2 +-
 configs/xilinx_versal_virt_defconfig |  2 +-
 configs/xilinx_zynqmp_virt_defconfig |  2 +-
 drivers/net/phy/Kconfig              | 15 +++++++++++++++
 drivers/net/phy/Makefile             |  3 ++-
 drivers/net/phy/dp83867.c            |  3 ++-
 drivers/net/phy/ti_phy_init.c        | 18 ++++++++++++++++++
 drivers/net/phy/ti_phy_init.h        | 15 +++++++++++++++
 15 files changed, 62 insertions(+), 12 deletions(-)
 create mode 100644 drivers/net/phy/ti_phy_init.c
 create mode 100644 drivers/net/phy/ti_phy_init.h
configs/am65x_evm_a53_defconfig +1 -1
index 542bbd992c53..c8cc9b2f7d8d 100644
@@ -101,7 +101,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
configs/am65x_hs_evm_a53_defconfig +1 -1
index 9f43cee39611..738bd01b059f 100644
@@ -103,7 +103,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
configs/dra7xx_evm_defconfig +1 -1
index 4d765da4e052..9ad462cdc6de 100644
@@ -86,7 +86,7 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=76800000
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
configs/dra7xx_hs_evm_defconfig +1 -1
index c25d4ce5c142..9aa452460765 100644
@@ -89,7 +89,7 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=76800000
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
configs/dra7xx_hs_evm_usb_defconfig +1 -1
index 8e74496b2ccd..d282468212e9 100644
@@ -87,7 +87,7 @@ CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=76800000
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
configs/j721e_evm_a72_defconfig +1 -1
index e9e82bb4309d..29ae8d720753 100644
@@ -124,7 +124,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_TI_AM65_CPSW_NUSS=y
configs/j721e_hs_evm_a72_defconfig +1 -1
index a723e2718e5e..7174fda72a01 100644
@@ -114,7 +114,7 @@ CONFIG_SPI_FLASH_SFDP_SUPPORT
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_TI_AM65_CPSW_NUSS=y
configs/k2g_evm_defconfig +1 -1
index 5abf5faa450e..14cf1b997d91 100644
@@ -58,7 +58,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_MARVELL=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ8XXX=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_KEYSTONE_NET=y
configs/xilinx_versal_virt_defconfig +1 -1
index e8c349261207..dcd841b8e299 100644
@@ -61,7 +61,7 @@ CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_PHY_MARVELL=y
 CONFIG_PHY_NATSEMI=y
 CONFIG_PHY_REALTEK=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_VITESSE=y
 CONFIG_PHY_FIXED=y
 CONFIG_PHY_GIGE=y
configs/xilinx_zynqmp_virt_defconfig +1 -1
index 7b09edd78e1b..b7b671282a87 100644
@@ -101,7 +101,7 @@ CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_PHY_NATSEMI=y
 CONFIG_PHY_REALTEK=y
-CONFIG_PHY_TI=y
+CONFIG_PHY_TI_DP83867=y
 CONFIG_PHY_VITESSE=y
 CONFIG_PHY_XILINX_GMII2RGMII=y
 CONFIG_PHY_FIXED=y
drivers/net/phy/Kconfig +15 -0
index d1f049e62ab7..a8ae1db4afe2 100644
@@ -243,6 +243,21 @@ config PHY_TERANETICS
 
 config PHY_TI
 	bool "Texas Instruments Ethernet PHYs support"
+	---help---
+	  Adds PHY registration support for TI PHYs.
+
+config PHY_TI_GENERIC
+	select PHY_TI
+	bool "Texas Instruments Generic Ethernet PHYs support"
+	---help---
+	  Adds support for Generic TI PHYs that don't need special handling but
+	  the PHY name is associated with a PHY ID.
+
+config PHY_TI_DP83867
+	select PHY_TI
+	bool "Texas Instruments Ethernet DP83867 PHY support"
+	---help---
+	  Adds support for the TI DP83867 1Gbit PHY.
 
 config PHY_VITESSE
 	bool "Vitesse Ethernet PHYs support"
drivers/net/phy/Makefile +2 -1
index 1d81516ecd1d..6e722331f1bf 100644
@@ -25,7 +25,8 @@ obj-$(CONFIG_PHY_NATSEMI) += natsemi.o
 obj-$(CONFIG_PHY_REALTEK) += realtek.o
 obj-$(CONFIG_PHY_SMSC) += smsc.o
 obj-$(CONFIG_PHY_TERANETICS) += teranetics.o
-obj-$(CONFIG_PHY_TI) += dp83867.o
+obj-$(CONFIG_PHY_TI) += ti_phy_init.o
+obj-$(CONFIG_PHY_TI_DP83867) += dp83867.o
 obj-$(CONFIG_PHY_XILINX) += xilinx_phy.o
 obj-$(CONFIG_PHY_XILINX_GMII2RGMII) += xilinx_gmii2rgmii.o
 obj-$(CONFIG_PHY_VITESSE) += vitesse.o
drivers/net/phy/dp83867.c +2 -1
index 50804c130efd..c9ed4a44d4db 100644
@@ -12,6 +12,7 @@
 #include <dm.h>
 #include <dt-bindings/net/ti-dp83867.h>
 
+#include "ti_phy_init.h"
 
 /* TI DP83867 */
 #define DP83867_DEVADDR		0x1f
@@ -428,7 +429,7 @@ static struct phy_driver DP83867_driver = {
 	.shutdown = &genphy_shutdown,
 };
 
-int phy_ti_init(void)
+int phy_dp83867_init(void)
 {
 	phy_register(&DP83867_driver);
 	return 0;
drivers/net/phy/ti_phy_init.c new file +18 -0
new file mode 100644
index 000000000000..277b29a26342
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * TI Generic PHY Init to register any TI Ethernet PHYs
+ *
+ * Author: Dan Murphy <[email protected]>
+ *
+ * Copyright (C) 2019-20 Texas Instruments Inc.
+ */
+
+#include "ti_phy_init.h"
+
+int phy_ti_init(void)
+{
+#ifdef CONFIG_PHY_TI_DP83867
+	phy_dp83867_init();
+#endif
+	return 0;
+}
drivers/net/phy/ti_phy_init.h new file +5 -0
new file mode 100644
index 000000000000..6c7f6c640a79
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * TI Generic Ethernet PHY
+ *
+ * Author: Dan Murphy <[email protected]>

drivers/net/phy/ti_phy_init.h line 15

Quoted 10 lines
drivers/net/phy/ti_phy_init.h new file +10 -0
+ *
+ * Copyright (C) 2019-20 Texas Instruments Inc.
+ */
+
+#ifndef _TI_GEN_PHY_H
+#define _TI_GEN_PHY_H
+
+int phy_dp83867_init(void);
+
+#endif /* _TI_GEN_PHY_H */

Thanks,
Michal

author
#6 lore raw

PATCH v2 3/3 net: phy: Add DP8382x phy registration to TI PHY init

In reply to Dan Murphy

Add the DP8382X generic PHY registration to the TI PHY init file.

---
 drivers/net/phy/ti_phy_init.c | 91 +++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)
drivers/net/phy/ti_phy_init.c +91 -0
index 277b29a26342..47f32a528361 100644
@@ -7,12 +7,103 @@
  * Copyright (C) 2019-20 Texas Instruments Inc.
  */
 
+
+#include <phy.h>
 #include "ti_phy_init.h"
 
+#define DP83822_PHY_ID	        0x2000a240
+#define DP83825S_PHY_ID		0x2000a140
+#define DP83825I_PHY_ID		0x2000a150
+#define DP83825CM_PHY_ID	0x2000a160
+#define DP83825CS_PHY_ID	0x2000a170
+#define DP83826C_PHY_ID		0x2000a130
+#define DP83826NC_PHY_ID	0x2000a110
+
+#ifdef CONFIG_PHY_TI_GENERIC
+static struct phy_driver dp83822_driver = {
+	.name = "TI DP83822",
+	.uid = DP83822_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825s_driver = {
+	.name = "TI DP83825S",
+	.uid = DP83825S_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825i_driver = {
+	.name = "TI DP83825I",
+	.uid = DP83825I_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825m_driver = {
+	.name = "TI DP83825M",
+	.uid = DP83825CM_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825cs_driver = {
+	.name = "TI DP83825CS",
+	.uid = DP83825CS_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83826c_driver = {
+	.name = "TI DP83826C",
+	.uid = DP83826C_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+static struct phy_driver dp83826nc_driver = {
+	.name = "TI DP83826NC",
+	.uid = DP83826NC_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+#endif /* CONFIG_PHY_TI_GENERIC */
+
 int phy_ti_init(void)
 {
 #ifdef CONFIG_PHY_TI_DP83867
 	phy_dp83867_init();
 #endif
+
+#ifdef CONFIG_PHY_TI_GENERIC
+	phy_register(&dp83822_driver);
+	phy_register(&dp83825s_driver);
+	phy_register(&dp83825i_driver);
+	phy_register(&dp83825m_driver);
+	phy_register(&dp83825cs_driver);
+	phy_register(&dp83826c_driver);
+	phy_register(&dp83826nc_driver);
+#endif
 	return 0;
 }
Signature · 1 line
2.25.1
#7 lore raw

PATCH v2 3/3 net: phy: Add DP8382x phy registration to TI PHY init

Quoted 12 lines · Dan Murphy

Add the DP8382X generic PHY registration to the TI PHY init file.

---
 drivers/net/phy/ti_phy_init.c | 91 +++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)
drivers/net/phy/ti_phy_init.c +0 -0
index 277b29a26342..47f32a528361 100644

drivers/net/phy/ti_phy_init.c line 10

Quoted 4 lines
drivers/net/phy/ti_phy_init.c +1 -0
@@ -7,12 +7,103 @@
  * Copyright (C) 2019-20 Texas Instruments Inc.
  */
 
+

Useless change.

drivers/net/phy/ti_phy_init.c line 20

Quoted 10 lines
drivers/net/phy/ti_phy_init.c +8 -0
+#include <phy.h>
 #include "ti_phy_init.h"
 
+#define DP83822_PHY_ID	        0x2000a240
+#define DP83825S_PHY_ID		0x2000a140
+#define DP83825I_PHY_ID		0x2000a150
+#define DP83825CM_PHY_ID	0x2000a160
+#define DP83825CS_PHY_ID	0x2000a170
+#define DP83826C_PHY_ID		0x2000a130
+#define DP83826NC_PHY_ID	0x2000a110

nit: Can't see value to have these macros here.

Quoted 80 lines
drivers/net/phy/ti_phy_init.c +74 -0
+
+#ifdef CONFIG_PHY_TI_GENERIC
+static struct phy_driver dp83822_driver = {
+	.name = "TI DP83822",
+	.uid = DP83822_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825s_driver = {
+	.name = "TI DP83825S",
+	.uid = DP83825S_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825i_driver = {
+	.name = "TI DP83825I",
+	.uid = DP83825I_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825m_driver = {
+	.name = "TI DP83825M",
+	.uid = DP83825CM_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825cs_driver = {
+	.name = "TI DP83825CS",
+	.uid = DP83825CS_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83826c_driver = {
+	.name = "TI DP83826C",
+	.uid = DP83826C_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+static struct phy_driver dp83826nc_driver = {
+	.name = "TI DP83826NC",
+	.uid = DP83826NC_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+#endif /* CONFIG_PHY_TI_GENERIC */
+
 int phy_ti_init(void)
 {
 #ifdef CONFIG_PHY_TI_DP83867
 	phy_dp83867_init();
 #endif
+
+#ifdef CONFIG_PHY_TI_GENERIC

drivers/net/phy/ti_phy_init.c line 109

Quoted 10 lines
drivers/net/phy/ti_phy_init.c +8 -0
+	phy_register(&dp83822_driver);
+	phy_register(&dp83825s_driver);
+	phy_register(&dp83825i_driver);
+	phy_register(&dp83825m_driver);
+	phy_register(&dp83825cs_driver);
+	phy_register(&dp83826c_driver);
+	phy_register(&dp83826nc_driver);
+#endif
 	return 0;
 }

When you remove that additional empty line feel free to add my

Thanks,
Michal

author
#8 lore raw

PATCH v2 3/3 net: phy: Add DP8382x phy registration to TI PHY init

Michal

Quoted 16 lines · Michal Simek
Quoted 15 lines · Dan Murphy

Add the DP8382X generic PHY registration to the TI PHY init file.

---
  drivers/net/phy/ti_phy_init.c | 91 +++++++++++++++++++++++++++++++++++
  1 file changed, 91 insertions(+)
drivers/net/phy/ti_phy_init.c +0 -0
index 277b29a26342..47f32a528361 100644
@@ -7,12 +7,103 @@
   * Copyright (C) 2019-20 Texas Instruments Inc.
   */
 
Quoted 2 lines

drivers/net/phy/ti_phy_init.c line 10

Quoted 1 line
drivers/net/phy/ti_phy_init.c +1 -0
+

Useless change.

Ack

Quoted 11 lines

drivers/net/phy/ti_phy_init.c line 20

Quoted 10 lines
drivers/net/phy/ti_phy_init.c +8 -0
+#include <phy.h>
  #include "ti_phy_init.h"
 
+#define DP83822_PHY_ID	        0x2000a240
+#define DP83825S_PHY_ID		0x2000a140
+#define DP83825I_PHY_ID		0x2000a150
+#define DP83825CM_PHY_ID	0x2000a160
+#define DP83825CS_PHY_ID	0x2000a170
+#define DP83826C_PHY_ID		0x2000a130
+#define DP83826NC_PHY_ID	0x2000a110

nit: Can't see value to have these macros here.

Are you saying to just add the PHY IDs directly below?

I will make that change as well.

Quoted 92 lines
Quoted 81 lines
drivers/net/phy/ti_phy_init.c +74 -0
+
+#ifdef CONFIG_PHY_TI_GENERIC
+static struct phy_driver dp83822_driver = {
+	.name = "TI DP83822",
+	.uid = DP83822_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825s_driver = {
+	.name = "TI DP83825S",
+	.uid = DP83825S_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825i_driver = {
+	.name = "TI DP83825I",
+	.uid = DP83825I_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825m_driver = {
+	.name = "TI DP83825M",
+	.uid = DP83825CM_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83825cs_driver = {
+	.name = "TI DP83825CS",
+	.uid = DP83825CS_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+
+static struct phy_driver dp83826c_driver = {
+	.name = "TI DP83826C",
+	.uid = DP83826C_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+static struct phy_driver dp83826nc_driver = {
+	.name = "TI DP83826NC",
+	.uid = DP83826NC_PHY_ID,
+	.mask = 0xfffffff0,
+	.features = PHY_BASIC_FEATURES,
+	.config = &genphy_config_aneg,
+	.startup = &genphy_startup,
+	.shutdown = &genphy_shutdown,
+};
+#endif /* CONFIG_PHY_TI_GENERIC */
+
  int phy_ti_init(void)
  {
  #ifdef CONFIG_PHY_TI_DP83867
  	phy_dp83867_init();
  #endif
+
+#ifdef CONFIG_PHY_TI_GENERIC

drivers/net/phy/ti_phy_init.c line 109

Quoted 10 lines
drivers/net/phy/ti_phy_init.c +8 -0
+	phy_register(&dp83822_driver);
+	phy_register(&dp83825s_driver);
+	phy_register(&dp83825i_driver);
+	phy_register(&dp83825m_driver);
+	phy_register(&dp83825cs_driver);
+	phy_register(&dp83826c_driver);
+	phy_register(&dp83826nc_driver);
+#endif
  	return 0;
  }

When you remove that additional empty line feel free to add my

Quoted 1 line

Ack

Dan

Quoted 2 lines

Thanks,
Michal

#9 lore raw

PATCH v2 3/3 net: phy: Add DP8382x phy registration to TI PHY init

Quoted 33 lines · Dan Murphy

Michal

Quoted 8 lines · Michal Simek
Quoted 7 lines · Dan Murphy

Add the DP8382X generic PHY registration to the TI PHY init file.

---
? drivers/net/phy/ti_phy_init.c | 91 +++++++++++++++++++++++++++++++++++ ? 1 file changed, 91 insertions(+)

Quoted 10 lines
Quoted 9 lines
drivers/net/phy/ti_phy_init.c +0 -0
index 277b29a26342..47f32a528361 100644
@@ -7,12 +7,103 @@

?? * Copyright (C) 2019-20 Texas Instruments Inc.
?? */
? +

Useless change.

Ack

Quoted 10 lines

drivers/net/phy/ti_phy_init.c

Quoted 9 lines

+#include <phy.h>
? #include "ti_phy_init.h"
? +#define DP83822_PHY_ID??????????? 0x2000a240

drivers/net/phy/ti_phy_init.c +6 -0
+#define DP83825S_PHY_ID??????? 0x2000a140
+#define DP83825I_PHY_ID??????? 0x2000a150
+#define DP83825CM_PHY_ID??? 0x2000a160
+#define DP83825CS_PHY_ID??? 0x2000a170
+#define DP83826C_PHY_ID??????? 0x2000a130
+#define DP83826NC_PHY_ID??? 0x2000a110

nit: Can't see value to have these macros here.

Quoted 1 line

Are you saying to just add the PHY IDs directly below?

others are doing that that's why I can't see the reason to do it differently. Also normally when you look for phy id you likely want to know what functions are called.

M