boards/t1040qds: Adds ethernet support for T1040
authorPrabhakar Kushwaha <prabhakar@freescale.com>
Mon, 27 Jan 2014 10:25:20 +0000 (15:55 +0530)
committerYork Sun <yorksun@freescale.com>
Mon, 3 Feb 2014 16:38:48 +0000 (08:38 -0800)
Enable entherent for T1040QDS. It enables FM1@DTSEC3, FM1@DTSEC4, FM1@DTSEC5
    Define MDIO related configs
    Added eth.c file
    Update t1040.c to support RGMII and SGMII
    Update t1040qds.c to support ethernet
    Define the PHY address

Signed-off-by: Arpit Goel <B44344@freescale.com>
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@freescale.com>
Signed-off-by: Poonam Aggrwal <poonam.aggrwal@freescale.com>
Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
[York Sun: remove dash from commit message]
Signed-off-by: York Sun <yorksun@freescale.com>
arch/powerpc/include/asm/immap_85xx.h
board/freescale/t1040qds/Makefile
board/freescale/t1040qds/eth.c [new file with mode: 0644]
board/freescale/t1040qds/t1040qds.c
drivers/net/fm/t1040.c
include/configs/T1040QDS.h

index 68c3c8245338053b473c57923703d6d7859d1ff0..9d08321f5d3979d2195cd7dc511b0bdbe89287fe 100644 (file)
@@ -1759,6 +1759,17 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
 #define FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT  24
 #define FSL_CORENET2_RCWSR4_SRDS2_PRTCL        0x00fe0000
 #define FSL_CORENET2_RCWSR4_SRDS2_PRTCL_SHIFT  17
+#define FSL_CORENET_RCWSR13_EC1        0x30000000 /* bits 418..419 */
+#define FSL_CORENET_RCWSR13_EC1_FM1_DTSEC4_RGMII       0x00000000
+#define FSL_CORENET_RCWSR13_EC1_FM1_GPIO       0x10000000
+#define FSL_CORENET_RCWSR13_EC1_FM1_DTSEC4_MII 0x20000000
+#define FSL_CORENET_RCWSR13_EC2        0x0c000000 /* bits 420..421 */
+#define FSL_CORENET_RCWSR13_EC2_FM1_DTSEC5_RGMII       0x00000000
+#define FSL_CORENET_RCWSR13_EC2_FM1_GPIO       0x10000000
+#define FSL_CORENET_RCWSR13_EC2_FM1_DTSEC5_MII 0x20000000
+#define FSL_CORENET_RCWSR13_MAC2_GMII_SEL      0x00000080
+#define FSL_CORENET_RCWSR13_MAC2_GMII_SEL_L2_SWITCH    0x00000000
+#define FSL_CORENET_RCWSR13_MAC2_GMII_SEL_ENET_PORT    0x80000000
 #elif defined(CONFIG_PPC_T2080) || defined(CONFIG_PPC_T2081)
 #define FSL_CORENET2_RCWSR4_SRDS1_PRTCL                0xff000000
 #define FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT  24
index 93af9eb6a0632da4e27431bf3201752e14142f6e..c7470d7cbb233bac7afbc272b5841344904d62ec 100644 (file)
@@ -9,3 +9,4 @@ obj-y   += ddr.o
 obj-$(CONFIG_PCI)     += pci.o
 obj-y  += law.o
 obj-y  += tlb.o
+obj-y  += eth.o
diff --git a/board/freescale/t1040qds/eth.c b/board/freescale/t1040qds/eth.c
new file mode 100644 (file)
index 0000000..3077b4a
--- /dev/null
@@ -0,0 +1,492 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+/*
+ * The RGMII PHYs are provided by the two on-board PHY connected to
+ * dTSEC instances 4 and 5. The SGMII PHYs are provided by one on-board
+ * PHY or by the standard four-port SGMII riser card (VSC).
+ */
+
+#include <common.h>
+#include <netdev.h>
+#include <asm/fsl_serdes.h>
+#include <asm/immap_85xx.h>
+#include <fm_eth.h>
+#include <fsl_mdio.h>
+#include <malloc.h>
+#include <asm/fsl_dtsec.h>
+
+#include "../common/fman.h"
+#include "../common/qixis.h"
+
+#include "t1040qds_qixis.h"
+
+#ifdef CONFIG_FMAN_ENET
+ /* - In T1040 there are only 8 SERDES lanes, spread across 2 SERDES banks.
+ *   Bank 1 -> Lanes A, B, C, D
+ *   Bank 2 -> Lanes E, F, G, H
+ */
+
+ /* Mapping of 8 SERDES lanes to T1040 QDS board slots. A value of '0' here
+  * means that the mapping must be determined dynamically, or that the lane
+  * maps to something other than a board slot.
+  */
+static u8 lane_to_slot[] = {
+       0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/* On the Vitesse VSC8234XHG SGMII riser card there are 4 SGMII PHYs
+ * housed.
+ */
+static int riser_phy_addr[] = {
+       CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR,
+       CONFIG_SYS_FM1_DTSEC2_RISER_PHY_ADDR,
+       CONFIG_SYS_FM1_DTSEC3_RISER_PHY_ADDR,
+       CONFIG_SYS_FM1_DTSEC4_RISER_PHY_ADDR,
+};
+
+/* Slot2 does not have EMI connections */
+#define EMI_NONE       0xFFFFFFFF
+#define EMI1_RGMII0    0
+#define EMI1_RGMII1    1
+#define EMI1_SLOT1     2
+#define EMI1_SLOT3     3
+#define EMI1_SLOT4     4
+#define EMI1_SLOT5     5
+#define EMI1_SLOT6     6
+#define EMI1_SLOT7     7
+#define EMI2           8
+
+static int mdio_mux[NUM_FM_PORTS];
+
+static const char * const mdio_names[] = {
+       "T1040_QDS_MDIO0",
+       "T1040_QDS_MDIO1",
+       "T1040_QDS_MDIO2",
+       "T1040_QDS_MDIO3",
+       "T1040_QDS_MDIO4",
+       "T1040_QDS_MDIO5",
+       "T1040_QDS_MDIO6",
+       "T1040_QDS_MDIO7",
+};
+
+struct t1040_qds_mdio {
+       u8 muxval;
+       struct mii_dev *realbus;
+};
+
+static const char *t1040_qds_mdio_name_for_muxval(u8 muxval)
+{
+       return mdio_names[muxval];
+}
+
+struct mii_dev *mii_dev_for_muxval(u8 muxval)
+{
+       struct mii_dev *bus;
+       const char *name = t1040_qds_mdio_name_for_muxval(muxval);
+
+       if (!name) {
+               printf("No bus for muxval %x\n", muxval);
+               return NULL;
+       }
+
+       bus = miiphy_get_dev_by_name(name);
+
+       if (!bus) {
+               printf("No bus by name %s\n", name);
+               return NULL;
+       }
+
+       return bus;
+}
+
+static void t1040_qds_mux_mdio(u8 muxval)
+{
+       u8 brdcfg4;
+       if (muxval <= 7) {
+               brdcfg4 = QIXIS_READ(brdcfg[4]);
+               brdcfg4 &= ~BRDCFG4_EMISEL_MASK;
+               brdcfg4 |= (muxval << BRDCFG4_EMISEL_SHIFT);
+               QIXIS_WRITE(brdcfg[4], brdcfg4);
+       }
+}
+
+static int t1040_qds_mdio_read(struct mii_dev *bus, int addr, int devad,
+                               int regnum)
+{
+       struct t1040_qds_mdio *priv = bus->priv;
+
+       t1040_qds_mux_mdio(priv->muxval);
+
+       return priv->realbus->read(priv->realbus, addr, devad, regnum);
+}
+
+static int t1040_qds_mdio_write(struct mii_dev *bus, int addr, int devad,
+                               int regnum, u16 value)
+{
+       struct t1040_qds_mdio *priv = bus->priv;
+
+       t1040_qds_mux_mdio(priv->muxval);
+
+       return priv->realbus->write(priv->realbus, addr, devad, regnum, value);
+}
+
+static int t1040_qds_mdio_reset(struct mii_dev *bus)
+{
+       struct t1040_qds_mdio *priv = bus->priv;
+
+       return priv->realbus->reset(priv->realbus);
+}
+
+static int t1040_qds_mdio_init(char *realbusname, u8 muxval)
+{
+       struct t1040_qds_mdio *pmdio;
+       struct mii_dev *bus = mdio_alloc();
+
+       if (!bus) {
+               printf("Failed to allocate t1040_qds MDIO bus\n");
+               return -1;
+       }
+
+       pmdio = malloc(sizeof(*pmdio));
+       if (!pmdio) {
+               printf("Failed to allocate t1040_qds private data\n");
+               free(bus);
+               return -1;
+       }
+
+       bus->read = t1040_qds_mdio_read;
+       bus->write = t1040_qds_mdio_write;
+       bus->reset = t1040_qds_mdio_reset;
+       sprintf(bus->name, t1040_qds_mdio_name_for_muxval(muxval));
+
+       pmdio->realbus = miiphy_get_dev_by_name(realbusname);
+
+       if (!pmdio->realbus) {
+               printf("No bus with name %s\n", realbusname);
+               free(bus);
+               free(pmdio);
+               return -1;
+       }
+
+       pmdio->muxval = muxval;
+       bus->priv = pmdio;
+
+       return mdio_register(bus);
+}
+
+/*
+ * Initialize the lane_to_slot[] array.
+ *
+ * On the T1040QDS board the mapping is controlled by ?? register.
+ */
+static void initialize_lane_to_slot(void)
+{
+       ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+       int serdes1_prtcl = (in_be32(&gur->rcwsr[4]) &
+                               FSL_CORENET2_RCWSR4_SRDS1_PRTCL)
+               >> FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT;
+
+       QIXIS_WRITE(cms[0], 0x07);
+
+       switch (serdes1_prtcl) {
+       case 0x60:
+       case 0x66:
+       case 0x67:
+       case 0x69:
+               lane_to_slot[1] = 7;
+               lane_to_slot[2] = 6;
+               lane_to_slot[3] = 5;
+               break;
+       case 0x86:
+               lane_to_slot[1] = 7;
+               lane_to_slot[2] = 7;
+               lane_to_slot[3] = 7;
+               break;
+       case 0x87:
+               lane_to_slot[1] = 7;
+               lane_to_slot[2] = 7;
+               lane_to_slot[3] = 7;
+               lane_to_slot[7] = 7;
+               break;
+       case 0x89:
+               lane_to_slot[1] = 7;
+               lane_to_slot[2] = 7;
+               lane_to_slot[3] = 7;
+               lane_to_slot[7] = 7;
+               break;
+       case 0x8d:
+               lane_to_slot[1] = 7;
+               lane_to_slot[2] = 7;
+               lane_to_slot[3] = 7;
+               lane_to_slot[5] = 3;
+               lane_to_slot[6] = 3;
+               lane_to_slot[7] = 3;
+               break;
+       case 0x8F:
+       case 0x85:
+               lane_to_slot[1] = 7;
+               lane_to_slot[2] = 6;
+               lane_to_slot[3] = 5;
+               lane_to_slot[6] = 3;
+               lane_to_slot[7] = 3;
+               break;
+       case 0xA5:
+               lane_to_slot[1] = 7;
+               lane_to_slot[6] = 3;
+               lane_to_slot[7] = 3;
+               break;
+       case 0xA7:
+               lane_to_slot[1] = 7;
+               lane_to_slot[7] = 7;
+               break;
+       case 0xAA:
+               lane_to_slot[1] = 7;
+               lane_to_slot[6] = 7;
+               lane_to_slot[7] = 7;
+               break;
+       case 0x40:
+               lane_to_slot[2] = 7;
+               lane_to_slot[3] = 7;
+               break;
+       default:
+               printf("qds: Fman: Unsupported SerDes Protocol 0x%02x\n",
+                      serdes1_prtcl);
+               break;
+       }
+}
+
+/*
+ * Given the following ...
+ *
+ * 1) A pointer to an Fman Ethernet node (as identified by the 'compat'
+ * compatible string and 'addr' physical address)
+ *
+ * 2) An Fman port
+ *
+ * ... update the phy-handle property of the Ethernet node to point to the
+ * right PHY. This assumes that we already know the PHY for each port.
+ *
+ * The offset of the Fman Ethernet node is also passed in for convenience, but
+ * it is not used, and we recalculate the offset anyway.
+ *
+ * Note that what we call "Fman ports" (enum fm_port) is really an Fman MAC.
+ * Inside the Fman, "ports" are things that connect to MACs. We only call them
+ * ports in U-Boot because on previous Ethernet devices (e.g. Gianfar), MACs
+ * and ports are the same thing.
+ *
+ */
+void board_ft_fman_fixup_port(void *fdt, char *compat, phys_addr_t addr,
+                             enum fm_port port, int offset)
+{
+       phy_interface_t intf = fm_info_get_enet_if(port);
+       char phy[16];
+
+       /* The RGMII PHY is identified by the MAC connected to it */
+       if (intf == PHY_INTERFACE_MODE_RGMII) {
+               sprintf(phy, "rgmii_phy%u", port == FM1_DTSEC4 ? 1 : 2);
+               fdt_set_phy_handle(fdt, compat, addr, phy);
+       }
+
+       /* The SGMII PHY is identified by the MAC connected to it */
+       if (intf == PHY_INTERFACE_MODE_SGMII) {
+               int lane = serdes_get_first_lane(FSL_SRDS_1, SGMII_FM1_DTSEC1
+                                                + port);
+               u8 slot;
+               if (lane < 0)
+                       return;
+               slot = lane_to_slot[lane];
+               if (slot) {
+                       /* Slot housing a SGMII riser card */
+                       sprintf(phy, "phy_s%x_%02x", slot,
+                               (fm_info_get_phy_address(port - FM1_DTSEC1)-
+                               CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR + 1));
+                       fdt_set_phy_handle(fdt, compat, addr, phy);
+               }
+       }
+}
+
+void fdt_fixup_board_enet(void *fdt)
+{
+       int i, lane, idx;
+
+       for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++) {
+               idx = i - FM1_DTSEC1;
+               switch (fm_info_get_enet_if(i)) {
+               case PHY_INTERFACE_MODE_SGMII:
+                       lane = serdes_get_first_lane(FSL_SRDS_1,
+                                                    SGMII_FM1_DTSEC1 + idx);
+                       if (lane < 0)
+                               break;
+
+                       switch (mdio_mux[i]) {
+                       case EMI1_SLOT3:
+                               fdt_status_okay_by_alias(fdt, "emi1_slot3");
+                               break;
+                       case EMI1_SLOT5:
+                               fdt_status_okay_by_alias(fdt, "emi1_slot5");
+                               break;
+                       case EMI1_SLOT6:
+                               fdt_status_okay_by_alias(fdt, "emi1_slot6");
+                               break;
+                       case EMI1_SLOT7:
+                               fdt_status_okay_by_alias(fdt, "emi1_slot7");
+                               break;
+                       }
+               break;
+               case PHY_INTERFACE_MODE_RGMII:
+                       if (i == FM1_DTSEC4)
+                               fdt_status_okay_by_alias(fdt, "emi1_rgmii0");
+
+                       if (i == FM1_DTSEC5)
+                               fdt_status_okay_by_alias(fdt, "emi1_rgmii1");
+                       break;
+               default:
+                       break;
+               }
+       }
+}
+#endif /* #ifdef CONFIG_FMAN_ENET */
+
+static void set_brdcfg9_for_gtx_clk(void)
+{
+       u8 brdcfg9;
+       brdcfg9 = QIXIS_READ(brdcfg[9]);
+       brdcfg9 |= (1 << 5);
+       QIXIS_WRITE(brdcfg[9], brdcfg9);
+}
+
+void t1040_handle_phy_interface_sgmii(int i)
+{
+       int lane, idx, slot;
+       idx = i - FM1_DTSEC1;
+       lane = serdes_get_first_lane(FSL_SRDS_1,
+                       SGMII_FM1_DTSEC1 + idx);
+
+       if (lane < 0)
+               return;
+       slot = lane_to_slot[lane];
+
+       switch (slot) {
+       case 1:
+               mdio_mux[i] = EMI1_SLOT1;
+               fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
+               break;
+       case 3:
+               if (FM1_DTSEC4 == i)
+                       fm_info_set_phy_address(i, riser_phy_addr[0]);
+               if (FM1_DTSEC5 == i)
+                       fm_info_set_phy_address(i, riser_phy_addr[1]);
+
+               mdio_mux[i] = EMI1_SLOT3;
+
+               fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
+               break;
+       case 4:
+               mdio_mux[i] = EMI1_SLOT4;
+               fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
+               break;
+       case 5:
+               /* Slot housing a SGMII riser card? */
+               fm_info_set_phy_address(i, riser_phy_addr[0]);
+               mdio_mux[i] = EMI1_SLOT5;
+               fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
+               break;
+       case 6:
+               /* Slot housing a SGMII riser card? */
+               fm_info_set_phy_address(i, riser_phy_addr[0]);
+               mdio_mux[i] = EMI1_SLOT6;
+               fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
+               break;
+       case 7:
+               if (FM1_DTSEC1 == i)
+                       fm_info_set_phy_address(i, riser_phy_addr[0]);
+               if (FM1_DTSEC2 == i)
+                       fm_info_set_phy_address(i, riser_phy_addr[1]);
+               if (FM1_DTSEC3 == i)
+                       fm_info_set_phy_address(i, riser_phy_addr[2]);
+
+               mdio_mux[i] = EMI1_SLOT7;
+               fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
+               break;
+       default:
+               break;
+       }
+       fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
+}
+void t1040_handle_phy_interface_rgmii(int i)
+{
+       fm_info_set_phy_address(i, i == FM1_DTSEC5 ?
+                       CONFIG_SYS_FM1_DTSEC5_PHY_ADDR :
+                       CONFIG_SYS_FM1_DTSEC4_PHY_ADDR);
+       mdio_mux[i] = (i == FM1_DTSEC5) ? EMI1_RGMII1 :
+               EMI1_RGMII0;
+       fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
+}
+
+int board_eth_init(bd_t *bis)
+{
+#ifdef CONFIG_FMAN_ENET
+       struct memac_mdio_info memac_mdio_info;
+       unsigned int i;
+
+       printf("Initializing Fman\n");
+       set_brdcfg9_for_gtx_clk();
+
+       initialize_lane_to_slot();
+
+       /* Initialize the mdio_mux array so we can recognize empty elements */
+       for (i = 0; i < NUM_FM_PORTS; i++)
+               mdio_mux[i] = EMI_NONE;
+
+       memac_mdio_info.regs =
+               (struct memac_mdio_controller *)CONFIG_SYS_FM1_DTSEC_MDIO_ADDR;
+       memac_mdio_info.name = DEFAULT_FM_MDIO_NAME;
+
+       /* Register the real 1G MDIO bus */
+       fm_memac_mdio_init(bis, &memac_mdio_info);
+
+       /* Register the muxing front-ends to the MDIO buses */
+       t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_RGMII0);
+       t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_RGMII1);
+       t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT1);
+       t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT3);
+       t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT4);
+       t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT5);
+       t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT6);
+       t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT7);
+
+       /*
+        * Program on board RGMII PHY addresses. If the SGMII Riser
+        * card used, we'll override the PHY address later. For any DTSEC that
+        * is RGMII, we'll also override its PHY address later. We assume that
+        * DTSEC4 and DTSEC5 are used for RGMII.
+        */
+       fm_info_set_phy_address(FM1_DTSEC4, CONFIG_SYS_FM1_DTSEC4_PHY_ADDR);
+       fm_info_set_phy_address(FM1_DTSEC5, CONFIG_SYS_FM1_DTSEC5_PHY_ADDR);
+
+       for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++) {
+               switch (fm_info_get_enet_if(i)) {
+               case PHY_INTERFACE_MODE_QSGMII:
+                       break;
+               case PHY_INTERFACE_MODE_SGMII:
+                       t1040_handle_phy_interface_sgmii(i);
+                       break;
+
+               case PHY_INTERFACE_MODE_RGMII:
+                       /* Only DTSEC4 and DTSEC5 can be routed to RGMII */
+                       t1040_handle_phy_interface_rgmii(i);
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       cpu_eth_init(bis);
+#endif
+
+       return pci_eth_init(bis);
+}
index de3ea5c2aa27abee534eb4679aa55dd42bb07a73..3dec4473e527a6656adb41f64dc3216926a3451b 100644 (file)
@@ -223,6 +223,7 @@ void ft_board_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_SYS_DPAA_FMAN
        fdt_fixup_fman_ethernet(blob);
+       fdt_fixup_board_enet(blob);
 #endif
 }
 
index 83cf081f3d3cccc4c81b4c1a3b51a97c83b66c52..bcc871d8420f7abbf4f954f3c6fa0525d26d9d46 100644 (file)
 
 phy_interface_t fman_port_enet_if(enum fm_port port)
 {
+       ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+       u32 rcwsr13 = in_be32(&gur->rcwsr[13]);
+
+       /* handle RGMII first */
+       if ((port == FM1_DTSEC2) &&
+           ((rcwsr13 & FSL_CORENET_RCWSR13_MAC2_GMII_SEL) ==
+                       FSL_CORENET_RCWSR13_MAC2_GMII_SEL_ENET_PORT)) {
+               if ((rcwsr13 & FSL_CORENET_RCWSR13_EC1) ==
+                               FSL_CORENET_RCWSR13_EC1_FM1_DTSEC4_RGMII)
+                       return PHY_INTERFACE_MODE_RGMII;
+               else if ((rcwsr13 & FSL_CORENET_RCWSR13_EC1) ==
+                               FSL_CORENET_RCWSR13_EC1_FM1_DTSEC4_MII)
+                       return PHY_INTERFACE_MODE_MII;
+               else
+                       return PHY_INTERFACE_MODE_NONE;
+       }
+
+       if ((port == FM1_DTSEC4) &&
+           ((rcwsr13 & FSL_CORENET_RCWSR13_MAC2_GMII_SEL) ==
+                       FSL_CORENET_RCWSR13_MAC2_GMII_SEL_L2_SWITCH)) {
+               if ((rcwsr13 & FSL_CORENET_RCWSR13_EC1) ==
+                               FSL_CORENET_RCWSR13_EC1_FM1_DTSEC4_RGMII)
+                       return PHY_INTERFACE_MODE_RGMII;
+               else if ((rcwsr13 & FSL_CORENET_RCWSR13_EC1) ==
+                               FSL_CORENET_RCWSR13_EC1_FM1_DTSEC4_MII)
+                       return PHY_INTERFACE_MODE_MII;
+               else
+                       return PHY_INTERFACE_MODE_NONE;
+       }
+
+       if (port == FM1_DTSEC5) {
+               if ((rcwsr13 & FSL_CORENET_RCWSR13_EC2) ==
+                               FSL_CORENET_RCWSR13_EC2_FM1_DTSEC5_RGMII)
+                       return PHY_INTERFACE_MODE_RGMII;
+               else if ((rcwsr13 & FSL_CORENET_RCWSR13_EC2) ==
+                               FSL_CORENET_RCWSR13_EC2_FM1_DTSEC5_MII)
+                       return PHY_INTERFACE_MODE_MII;
+               else
+                       return PHY_INTERFACE_MODE_NONE;
+       }
+
+       switch (port) {
+       case FM1_DTSEC1:
+       case FM1_DTSEC2:
+               if (is_serdes_configured(QSGMII_SW1_A + port - FM1_DTSEC1))
+                       return PHY_INTERFACE_MODE_QSGMII;
+       case FM1_DTSEC3:
+       case FM1_DTSEC4:
+       case FM1_DTSEC5:
+               if (is_serdes_configured(SGMII_FM1_DTSEC1 + port - FM1_DTSEC1))
+                       return PHY_INTERFACE_MODE_SGMII;
+               break;
+       default:
+               return PHY_INTERFACE_MODE_NONE;
+       }
+
        return PHY_INTERFACE_MODE_NONE;
 }
index 8234a828dda3a82a0096a80a54c17317ebdc22cc..75ea125f5391108a1583804db1747abc654ba0dd 100644 (file)
@@ -611,9 +611,8 @@ unsigned long get_board_ddr_clk(void);
 #endif
 
 #ifdef CONFIG_FMAN_ENET
-#define CONFIG_SYS_FM1_DTSEC5_PHY_ADDR 0x10
-#define CONFIG_SYS_FM1_DTSEC6_PHY_ADDR 0x11
-#define CONFIG_SYS_FM1_10GEC1_PHY_ADDR 4
+#define CONFIG_SYS_FM1_DTSEC4_PHY_ADDR 0x01
+#define CONFIG_SYS_FM1_DTSEC5_PHY_ADDR 0x02
 
 #define CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR    0x1c
 #define CONFIG_SYS_FM1_DTSEC2_RISER_PHY_ADDR    0x1d