[RFC PATCH 1/3] net: phy: Add a generic phy file for TI generic PHYs

Michal Simek michal.simek at xilinx.com
Tue Apr 21 09:57:19 CEST 2020


On 20. 04. 20 20:53, Dan Murphy wrote:
> 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 at ti.com>

I would personally do it with two patches.

> ---
>  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

Don't know why this name was chosen but don't you want to label it with TI?

CONFIG_PHY_TI_DP83867 ?

Kernel is using different symbol anyway.
CONFIG_DP83867_PHY



>  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 at ti.com>
> + *
> + * Copyright (C) 2019 Texas Instruments Inc.

2020?

> + */
> +
> +#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

I would do it in separate patch but up2you.

> +
> +	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 at ti.com>
> + *
> + * Copyright (C) 2019 Texas Instruments Inc.

2020

> + */
> +
> +#ifndef _TI_GEN_PHY_H
> +#define _TI_GEN_PHY_H
> +
> +int phy_dp83867_init(void);
> +
> +#endif /* _TI_GEN_PHY_H */
> 

Thanks,
Michal


More information about the U-Boot mailing list