Merge git://git.denx.de/u-boot-mpc85xx
[oweals/u-boot.git] / board / freescale / b4860qds / eth_b4860qds.c
index aa48b5e654c56d9cc9bd2865d7ae9813366e8240..89a188378277302fc9736803ec05334601c54013 100644 (file)
@@ -26,7 +26,7 @@
 #include <fsl_mdio.h>
 #include <malloc.h>
 #include <fdt_support.h>
-#include <asm/fsl_dtsec.h>
+#include <fsl_dtsec.h>
 
 #include "../common/ngpixis.h"
 #include "../common/fman.h"
@@ -213,7 +213,7 @@ int board_eth_init(bd_t *bis)
                fm_info_set_phy_address(FM1_DTSEC6,
                                CONFIG_SYS_FM1_ONBOARD_PHY2_ADDR);
                break;
-#ifdef CONFIG_PPC_B4420
+#ifdef CONFIG_ARCH_B4420
        case 0x17:
        case 0x18:
                /* Serdes 1: A-D SGMII, Configuring on board dual SGMII Phy */
@@ -269,7 +269,7 @@ int board_eth_init(bd_t *bis)
                fm_info_set_phy_address(FM1_DTSEC4,
                                CONFIG_SYS_FM1_DTSEC2_RISER_PHY_ADDR);
                /*
-                * XFI does not need a PHY to work, but to make U-boot
+                * XFI does not need a PHY to work, but to make U-Boot
                 * happy, assign a fake PHY address for a XFI port.
                 */
                fm_info_set_phy_address(FM1_10GEC1, 0);
@@ -365,6 +365,11 @@ void board_ft_fman_fixup_port(void *fdt, char *compat, phys_addr_t addr,
 {
        int phy;
        char alias[32];
+       struct fixed_link f_link;
+       ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+       u32 prtcl2 = in_be32(&gur->rcwsr[4]) & FSL_CORENET2_RCWSR4_SRDS2_PRTCL;
+
+       prtcl2 >>= FSL_CORENET2_RCWSR4_SRDS2_PRTCL_SHIFT;
 
        if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_SGMII) {
                phy = fm_info_get_phy_address(port);
@@ -372,6 +377,58 @@ void board_ft_fman_fixup_port(void *fdt, char *compat, phys_addr_t addr,
                sprintf(alias, "phy_sgmii_%x", phy);
                fdt_set_phy_handle(fdt, compat, addr, alias);
                fdt_status_okay_by_alias(fdt, alias);
+       } else if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_XGMII) {
+               /* check if it's XFI interface for 10g */
+               switch (prtcl2) {
+               case 0x80:
+               case 0x81:
+               case 0x82:
+               case 0x83:
+               case 0x84:
+               case 0x85:
+               case 0x86:
+               case 0x87:
+               case 0x88:
+               case 0x89:
+               case 0x8a:
+               case 0x8b:
+               case 0x8c:
+               case 0x8d:
+               case 0x8e:
+               case 0xb1:
+               case 0xb2:
+                       f_link.phy_id = port;
+                       f_link.duplex = 1;
+                       f_link.link_speed = 10000;
+                       f_link.pause = 0;
+                       f_link.asym_pause = 0;
+
+                       fdt_delprop(fdt, offset, "phy-handle");
+                       fdt_setprop(fdt, offset, "fixed-link", &f_link,
+                                   sizeof(f_link));
+                       break;
+               case 0x98: /* XAUI interface */
+                       strcpy(alias, "phy_xaui_slot1");
+                       fdt_status_okay_by_alias(fdt, alias);
+
+                       strcpy(alias, "phy_xaui_slot2");
+                       fdt_status_okay_by_alias(fdt, alias);
+                       break;
+               case 0x9e: /* XAUI interface */
+               case 0x9a:
+               case 0x93:
+               case 0x91:
+                       strcpy(alias, "phy_xaui_slot1");
+                       fdt_status_okay_by_alias(fdt, alias);
+                       break;
+               case 0x97: /* XAUI interface */
+               case 0xc3:
+                       strcpy(alias, "phy_xaui_slot2");
+                       fdt_status_okay_by_alias(fdt, alias);
+                       break;
+               default:
+                       break;
+               }
        }
 }