net/phy: enable get_phy_id redefinable
Subsystems (2)
PATCH v4 1/2 net/phy: enable get_phy_id redefinable
As some PHYs have non-standard PHY ID registers, PHY Id can't be read correctly by current get_phy_id function, so we enable get_phy_id redefinable to permit specific PHY driver having own specific get_phy_id function.
---
v4: no change
v3: no change.
v2: use weak style.
drivers/net/phy/phy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +2 -1
@@ -18,6 +18,7 @@#include <phy.h> #include <errno.h> #include <linux/err.h> +#include <linux/compiler.h> /* Generic PHY support and helper functions */
@@ -577,7 +578,7 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,* Description: Reads the ID registers of the PHY at @addr on the * @bus, stores it in @phy_id and returns zero on success. */ -static int get_phy_id (struct mii_dev *bus,int addr,int devad,u32 *phy_id) +int __weak get_phy_id (struct mii_dev *bus,int addr,int devad,u32 *phy_id) {int phy_reg;
Signature · 1 line
1.8.0
PATCH v4 1/1 net/phy: Add support for CS4315/CS4340 PHY
Add support for Cortina CS4315/CS4340 10G PHY.
- This driver loads CS43xx firmware to initialize Cortina PHY.
- To define macro CONFIG_PHY_CORTINA will enable this driver.
- Cortina PHY has non-standard offset of PHY ID registers, so define own get_phy_id().
---
v4: add support for loading cortina phy ucode from NAND/SPI/SD/REMOTE
v3: move devad as '0' in cortina.c instead of in phy.c
v2: no change.
drivers/net/phy/Makefile | 1 + drivers/net/phy/cortina.c | 320 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/net/phy/phy.c | 3 + include/cortina.h | 73 +++++++++++ include/phy.h | 2 + 5 files changed, 399 insertions(+) create mode 100644 drivers/net/phy/cortina.c create mode 100644 include/cortina.h
drivers/net/phy/Makefile +1 -0
@@ -24,3 +24,4 @@ obj-$(CONFIG_PHY_REALTEK) += realtek.o obj-$(CONFIG_PHY_SMSC) += smsc.o obj-$(CONFIG_PHY_TERANETICS) += teranetics.o obj-$(CONFIG_PHY_VITESSE) += vitesse.o +obj-$(CONFIG_PHY_CORTINA) += cortina.o
drivers/net/phy/cortina.c new file +320 -0
320 lines not on this page · raw message
drivers/net/phy/phy.c +3 -0
@@ -481,6 +481,9 @@ int phy_init(void)#ifdef CONFIG_PHY_VITESSE phy_vitesse_init ();#endif +#ifdef CONFIG_PHY_CORTINA +phy_cortina_init (); +#endif return 0 ; }
include/cortina.h new file +73 -0
73 lines not on this page · raw message
include/phy.h +2 -0
@@ -233,8 +233,10 @@ int phy_realtek_init(void);int phy_smsc_init (void );int phy_teranetics_init (void );int phy_vitesse_init (void ); +int phy_cortina_init (void );/* PHY UIDs for various PHYs that are referenced in external code */ #define PHY_UID_TN2020 0x00a19410 +#define PHY_UID_CS4340 0x13e51002#endif
Signature · 1 line
1.8.0
PATCH v4 1/1 net/phy: Add support for CS4315/CS4340 PHY
Quoted 21 lines · Shengzhou Liu
Add support for Cortina CS4315/CS4340 10G PHY.
- This driver loads CS43xx firmware to initialize Cortina PHY.
- To define macroCONFIG_PHY_CORTINAwill enable this driver.
- Cortina PHY has non-standard offset of PHY ID registers, so define ownget_phy_id().Signed-off-by Shengzhou Liu <[email protected]>---
v4: add support for loading cortina phy ucode from NAND/SPI/SD/REMOTE
v3: move devad as '0' incortina.cinstead of inphy.c
v2: no change.drivers/net/phy/Makefile | 1 + drivers/net/phy/cortina.c | 320 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/net/phy/phy.c | 3 + include/cortina.h | 73 +++++++++++ include/phy.h | 2 + 5 files changed, 399 insertions(+) create mode 100644 drivers/net/phy/cortina.c create mode 100644 include/cortina.h
<snip>
Quoted 15 lines
drivers/net/phy/cortina.c new file +15
-0+void cs4340_upload_firmware (struct phy_device *phydev) +{ +char line_temp[0x50 ] = {0 }; +char reg_addr[0x50 ] = {0 }; +char reg_data[0x50 ] = {0 }; +int i =0 ; +int line_cnt =0 ; +int column_cnt =0 ; +struct cortina_reg_config fw_temp; +char *addr =NULL ; + +#if defined(CONFIG_SYS_CORTINA_FW_IN_NOR ) || \ + defined(CONFIG_SYS_CORTINA_FW_IN_REMOTE ) + + addr = (char *)CONFIG_CORTINA_FW_ADDR ;
drivers/net/phy/cortina.c line 148
Quoted 10 lines
drivers/net/phy/cortina.c new file +10
-0+#elif defined(CONFIG_SYS_CORTINA_FW_IN_NAND ) +size_t fw_length =CONFIG_CORTINA_FW_LENGTH ; + + addr =malloc (CONFIG_CORTINA_FW_LENGTH ); + rc =nand_read (&nand_info[0 ], (loff_t )CONFIG_CORTINA_FW_ADDR , + &fw_length, (u_char *)addr); +if (rc == -EUCLEAN ) { +printf ("NAND read of Cortina firmware at 0x%x failed %d\n" , +CONFIG_CORTINA_FW_ADDR , rc); + }
Where is "rc" declared?
York
PATCH v4 1/2 net/phy: enable get_phy_id redefinable
In reply to Shengzhou LiuQuoted 6 lines · Shengzhou Liu
As some PHYs have non-standard PHY ID registers, PHY Id can't be read correctly by current
get_phy_idfunction, so we enableget_phy_idredefinable to permit specific PHY driver having own specificget_phy_idfunction.Signed-off-by Shengzhou Liu <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140512/470d535c/attachment.pgp>