4xx: cleanup ethernet phy initialization on PMC440 boards
PATCH 1/1 4xx: cleanup ethernet phy initialization on PMC440 boards
This patch moves phy initialization for VSC8601 ethernet phys that are used on early board revisions into a separate setup function.
--- board/esd/pmc440/pmc440.c | 45 ++++++++++++++++++++++----------------------- 1 files changed, 22 insertions(+), 23 deletions(-)
board/esd/pmc440/pmc440.c +22 -23
@@ -643,6 +643,23 @@ int is_pci_host(struct pci_controller *hose)#endif /* defined(CONFIG_PCI) */ #ifdef CONFIG_RESET_PHY_R +int pmc440_setup_vsc8601 (char *devname,int phy_addr, +unsigned short behavior,unsigned short method) +{ +/* adjust LED behavior */ +if (miiphy_write (devname, phy_addr,0x1f ,0x0001 ) !=0 ) { +printf ("Phy%d: register write access failed\n" , phy_addr); +return -1 ; + } + +miiphy_write (devname, phy_addr,0x11 ,0x0010 ); +miiphy_write (devname, phy_addr,0x11 , behavior); +miiphy_write (devname, phy_addr,0x10 , method); +miiphy_write (devname, phy_addr,0x1f ,0x0000 ); + +return 0 ; +} +int pmc440_setup_ksz9031 (char *devname,int phy_addr) {unsigned short id1, id2;
@@ -683,29 +700,11 @@ void reset_phy(void) val_behavior =0x0cf0 ; } -if (miiphy_write ("ppc_4xx_eth0" , -CONFIG_PHY_ADDR ,0x1f ,0x0001 ) ==0 ) { -miiphy_write ("ppc_4xx_eth0" , -CONFIG_PHY_ADDR ,0x11 ,0x0010 ); -miiphy_write ("ppc_4xx_eth0" , -CONFIG_PHY_ADDR ,0x11 , val_behavior); -miiphy_write ("ppc_4xx_eth0" , -CONFIG_PHY_ADDR ,0x10 , val_method); -miiphy_write ("ppc_4xx_eth0" , -CONFIG_PHY_ADDR ,0x1f ,0x0000 ); - } - -if (miiphy_write ("ppc_4xx_eth1" , -CONFIG_PHY1_ADDR ,0x1f ,0x0001 ) ==0 ) { -miiphy_write ("ppc_4xx_eth1" , -CONFIG_PHY1_ADDR ,0x11 ,0x0010 ); -miiphy_write ("ppc_4xx_eth1" , -CONFIG_PHY1_ADDR ,0x11 , val_behavior); -miiphy_write ("ppc_4xx_eth1" , -CONFIG_PHY1_ADDR ,0x10 , val_method); -miiphy_write ("ppc_4xx_eth1" , -CONFIG_PHY1_ADDR ,0x1f ,0x0000 ); - } +/* boards up to rev. 1.3 use Vitesse VSC8601 phys */ +pmc440_setup_vsc8601 ("ppc_4xx_eth0" ,CONFIG_PHY_ADDR , + val_method, val_behavior); +pmc440_setup_vsc8601 ("ppc_4xx_eth1" ,CONFIG_PHY1_ADDR , + val_method, val_behavior); }else {/* rev. 1.4 uses a Micrel KSZ9031 */ pmc440_setup_ksz9031 ("ppc_4xx_eth0" ,CONFIG_PHY_ADDR );
Signature · 1 line
1.6.1
PATCH 1/1 4xx: cleanup ethernet phy initialization on PMC440 boards
Hi Matthias,
Quoted 3 lines · Matthias Fuchs
This patch moves phy initialization for VSC8601 ethernet phys that are used on early board revisions into a separate setup function.
Thanks for working on this. Some additional comments though.
Quoted 10 lines
Signed-off-by Matthias Fuchs <[email protected]>--- board/esd/pmc440/pmc440.c | 45 ++++++++++++++++++++++----------------------- 1 files changed, 22 insertions(+), 23 deletions(-)board/esd/pmc440/pmc440.c +0
-0
board/esd/pmc440/pmc440.c int is_pci_host(struct pci_controller *hose) · line 647
Quoted 5 lines
board/esd/pmc440/pmc440.c +2
-0@@ -643,6 +643,23 @@ int is_pci_host(struct pci_controller *hose)#endif /* defined(CONFIG_PCI) */ #ifdef CONFIG_RESET_PHY_R +int pmc440_setup_vsc8601 (char *devname,int phy_addr, +unsigned short behavior,unsigned short method)
static int pmc440_...
Quoted 4 lines
board/esd/pmc440/pmc440.c +4
-0+{ +/* adjust LED behavior */ +if (miiphy_write (devname, phy_addr,0x1f ,0x0001 ) !=0 ) { +printf ("Phy%d: register write access failed\n" , phy_addr);
board/esd/pmc440/pmc440.c int is_pci_host(struct pci_controller *hose) · line 661
Quoted 10 lines
board/esd/pmc440/pmc440.c +10
-0+return -1 ; + } + +miiphy_write (devname, phy_addr,0x11 ,0x0010 ); +miiphy_write (devname, phy_addr,0x11 , behavior); +miiphy_write (devname, phy_addr,0x10 , method); +miiphy_write (devname, phy_addr,0x1f ,0x0000 ); + +return 0 ; +}
Look much nicer with less indentation. :)
board/esd/pmc440/pmc440.c int is_pci_host(struct pci_controller *hose) · line 663
Quoted 1 line
board/esd/pmc440/pmc440.c +0
-0int pmc440_setup_ksz9031 (char *devname,int phy_addr)
And now I notice that this should also be:
static int pmc440_...
A new patch-set would be best to handle this. Or a new patch with both changes squashed together would be fine as well. Whatever you prefer.
Thanks,
Stefan