public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Dan Murphy <dmurphy@ti.com>
To: u-boot@lists.denx.de
Subject: [RFC PATCH 1/3] net: phy: Add a generic phy file for TI generic PHYs
Date: Mon, 20 Apr 2020 13:53:08 -0500	[thread overview]
Message-ID: <20200420185310.6630-1-dmurphy@ti.com> (raw)

Add a TI Generic init file that will initialize TI PHYs that follow that
not require special handling.  These PHYs can connect with the standard
MII register set.  This generice file will register the PHY IDs and
names of the PHYs so when the command 'mdio list' is executed the PHY
name will display as opposed to 'Generic PHY'.

The DP8382X PHY series is a generic PHY that requires the generic
registration.

The DP83867 driver was updated to rename the init to a more PHY specific
init call.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 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              |   8 ++
 drivers/net/phy/Makefile             |   3 +-
 drivers/net/phy/dp83867.c            |   3 +-
 drivers/net/phy/ti_phy_init.c        | 106 +++++++++++++++++++++++++++
 drivers/net/phy/ti_phy_init.h        |  16 ++++
 15 files changed, 144 insertions(+), 12 deletions(-)
 create mode 100644 drivers/net/phy/ti_phy_init.c
 create mode 100644 drivers/net/phy/ti_phy_init.h

diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig
index 542bbd992c53..7051d6c40505 100644
--- a/configs/am65x_evm_a53_defconfig
+++ b/configs/am65x_evm_a53_defconfig
@@ -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_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
diff --git a/configs/am65x_hs_evm_a53_defconfig b/configs/am65x_hs_evm_a53_defconfig
index 9f43cee39611..29da3826f12a 100644
--- a/configs/am65x_hs_evm_a53_defconfig
+++ b/configs/am65x_hs_evm_a53_defconfig
@@ -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_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_E1000=y
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 4d765da4e052..19c024889155 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -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_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig
index c25d4ce5c142..e97f1a3ba338 100644
--- a/configs/dra7xx_hs_evm_defconfig
+++ b/configs/dra7xx_hs_evm_defconfig
@@ -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_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
diff --git a/configs/dra7xx_hs_evm_usb_defconfig b/configs/dra7xx_hs_evm_usb_defconfig
index 8e74496b2ccd..46970e31f02e 100644
--- a/configs/dra7xx_hs_evm_usb_defconfig
+++ b/configs/dra7xx_hs_evm_usb_defconfig
@@ -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_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_MII=y
diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
index e9e82bb4309d..784a6ff396c3 100644
--- a/configs/j721e_evm_a72_defconfig
+++ b/configs/j721e_evm_a72_defconfig
@@ -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_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_TI_AM65_CPSW_NUSS=y
diff --git a/configs/j721e_hs_evm_a72_defconfig b/configs/j721e_hs_evm_a72_defconfig
index a723e2718e5e..dd93a955cefd 100644
--- a/configs/j721e_hs_evm_a72_defconfig
+++ b/configs/j721e_hs_evm_a72_defconfig
@@ -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_DP83867=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
 CONFIG_TI_AM65_CPSW_NUSS=y
diff --git a/configs/k2g_evm_defconfig b/configs/k2g_evm_defconfig
index 5abf5faa450e..f47b1cabe9a8 100644
--- a/configs/k2g_evm_defconfig
+++ b/configs/k2g_evm_defconfig
@@ -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_DP83867=y
 CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_KEYSTONE_NET=y
diff --git a/configs/xilinx_versal_virt_defconfig b/configs/xilinx_versal_virt_defconfig
index e8c349261207..eb2a26bc2c7d 100644
--- a/configs/xilinx_versal_virt_defconfig
+++ b/configs/xilinx_versal_virt_defconfig
@@ -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_DP83867=y
 CONFIG_PHY_VITESSE=y
 CONFIG_PHY_FIXED=y
 CONFIG_PHY_GIGE=y
diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig
index 7b09edd78e1b..5c320f93fe5f 100644
--- a/configs/xilinx_zynqmp_virt_defconfig
+++ b/configs/xilinx_zynqmp_virt_defconfig
@@ -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_DP83867=y
 CONFIG_PHY_VITESSE=y
 CONFIG_PHY_XILINX_GMII2RGMII=y
 CONFIG_PHY_FIXED=y
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index d1f049e62ab7..e366f10afc59 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -244,6 +244,14 @@ config PHY_TERANETICS
 config PHY_TI
 	bool "Texas Instruments Ethernet PHYs support"
 
+config PHY_TI_GENERIC
+	select PHY_TI
+	bool "Texas Instruments Ethernet PHYs support"
+
+config PHY_DP83867
+	select PHY_TI
+	bool "Texas Instruments Ethernet DP83867 PHY support"
+
 config PHY_VITESSE
 	bool "Vitesse Ethernet PHYs support"
 
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index 1d81516ecd1d..9c6d31718c00 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -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_DP83867) += dp83867.o
 obj-$(CONFIG_PHY_XILINX) += xilinx_phy.o
 obj-$(CONFIG_PHY_XILINX_GMII2RGMII) += xilinx_gmii2rgmii.o
 obj-$(CONFIG_PHY_VITESSE) += vitesse.o
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 50804c130efd..c9ed4a44d4db 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -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;
diff --git a/drivers/net/phy/ti_phy_init.c b/drivers/net/phy/ti_phy_init.c
new file mode 100644
index 000000000000..11c4c166b2f5
--- /dev/null
+++ b/drivers/net/phy/ti_phy_init.c
@@ -0,0 +1,106 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * TI Generic PHY Init to register all TI Ethernet PHYs
+ *
+ * Author: Dan Murphy <dmurphy@ti.com>
+ *
+ * Copyright (C) 2019 Texas Instruments Inc.
+ */
+
+#include <phy.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
+
+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,
+};
+
+int phy_ti_init(void)
+{
+#ifdef CONFIG_PHY_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;
+}
diff --git a/drivers/net/phy/ti_phy_init.h b/drivers/net/phy/ti_phy_init.h
new file mode 100644
index 000000000000..309da2aacccb
--- /dev/null
+++ b/drivers/net/phy/ti_phy_init.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * TI Generic Ethernet PHY
+ * Based on code in sungem_phy.c and (long-removed) gianfar_phy.c
+ *
+ * Author: Dan Murphy <dmurphy@ti.com>
+ *
+ * Copyright (C) 2019 Texas Instruments Inc.
+ */
+
+#ifndef _TI_GEN_PHY_H
+#define _TI_GEN_PHY_H
+
+int phy_dp83867_init(void);
+
+#endif /* _TI_GEN_PHY_H */
-- 
2.25.1

             reply	other threads:[~2020-04-20 18:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20 18:53 Dan Murphy [this message]
2020-04-20 18:53 ` [RFC PATCH 2/3] net: phy: Add helper routines to set and clear bits Dan Murphy
2020-04-21  8:04   ` Michal Simek
2020-04-21 11:43     ` Dan Murphy
2020-04-21 11:52       ` Michal Simek
2020-04-21 11:54         ` Dan Murphy
2020-04-20 18:53 ` [RFC PATCH 3/3] net: phy: dp83869: Port the kernel driver Dan Murphy
2020-04-21  8:23   ` Michal Simek
2020-04-21 12:04     ` Dan Murphy
2020-04-21 12:39       ` Michal Simek
2020-04-21 14:27         ` Dan Murphy
2021-04-27  7:01           ` Christian Gmeiner
2020-04-21  7:57 ` [RFC PATCH 1/3] net: phy: Add a generic phy file for TI generic PHYs Michal Simek
2020-04-21 11:48   ` Dan Murphy
2020-04-22 16:04     ` Grygorii Strashko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200420185310.6630-1-dmurphy@ti.com \
    --to=dmurphy@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox