net/fman: update 10GEC to fit new SoC
authorShengzhou Liu <Shengzhou.Liu@freescale.com>
Mon, 24 Nov 2014 09:11:57 +0000 (17:11 +0800)
committerYork Sun <yorksun@freescale.com>
Fri, 5 Dec 2014 16:06:15 +0000 (08:06 -0800)
fm_standard_init() initializes each 10G port by FM_TGEC_INFO_INITIALIZER.
but it needs different implementation of FM_TGEC_INFO_INITIALIZER on different SoCs.
on SoCs earlier(e.g. T4240, T2080), the notation between 10GEC and MAC as below:
10GEC1->MAC9, 10GEC2->MAC10, 10GEC3->MAC1, 10GEC4->MAC2
on SoCs later(e.g. T1024, etc), the notation between 10GEC and MAC as below:
10GEC1->MAC1, 10GEC2->MAC2

so we introduce CONFIG_FSL_FM_10GEC_REGULAR_NOTATION to fit the new SoCs on
which 10GEC enumeration is consistent with MAC enumeration.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
arch/powerpc/include/asm/config_mpc85xx.h
arch/powerpc/include/asm/immap_85xx.h
doc/README.fsl-dpaa [new file with mode: 0644]
drivers/net/fm/eth.c
drivers/net/fm/init.c
include/fm_eth.h

index 33f3d039a372656b0b793d75e909f6b1390b07bd..01b09058cc3fb8765622e17379765f6d71031435 100644 (file)
@@ -812,6 +812,7 @@ defined(CONFIG_PPC_T1014) || defined(CONFIG_PPC_T1013)
 #define CONFIG_SYS_NUM_FMAN            1
 #define CONFIG_SYS_NUM_FM1_DTSEC       4
 #define CONFIG_SYS_NUM_FM1_10GEC       1
+#define CONFIG_FSL_FM_10GEC_REGULAR_NOTATION
 #define CONFIG_NUM_DDR_CONTROLLERS     1
 #define CONFIG_USB_MAX_CONTROLLER_COUNT        2
 #define CONFIG_SYS_FSL_DDR_VER  FSL_DDR_VER_5_0
index f58456f541c2024095f9d39a796b74696ee73ad3..361be6f45dfe95c70cebcc4f00d362a902588749 100644 (file)
@@ -1626,10 +1626,15 @@ typedef struct ccsr_gur {
 #define FSL_CORENET_DEVDISR2_DTSEC1_6  0x04000000
 #define FSL_CORENET_DEVDISR2_DTSEC1_9  0x00800000
 #define FSL_CORENET_DEVDISR2_DTSEC1_10 0x00400000
+#ifdef CONFIG_FSL_FM_10GEC_REGULAR_NOTATION
+#define FSL_CORENET_DEVDISR2_10GEC1_1   0x80000000
+#define FSL_CORENET_DEVDISR2_10GEC1_2   0x40000000
+#else
 #define FSL_CORENET_DEVDISR2_10GEC1_1  0x00800000
 #define FSL_CORENET_DEVDISR2_10GEC1_2  0x00400000
 #define FSL_CORENET_DEVDISR2_10GEC1_3  0x80000000
 #define FSL_CORENET_DEVDISR2_10GEC1_4  0x40000000
+#endif
 #define FSL_CORENET_DEVDISR2_DTSEC2_1  0x00080000
 #define FSL_CORENET_DEVDISR2_DTSEC2_2  0x00040000
 #define FSL_CORENET_DEVDISR2_DTSEC2_3  0x00020000
diff --git a/doc/README.fsl-dpaa b/doc/README.fsl-dpaa
new file mode 100644 (file)
index 0000000..0d8d4f6
--- /dev/null
@@ -0,0 +1,10 @@
+This file documents Freescale DPAA-specific options.
+
+FMan (Frame Manager)
+  - CONFIG_FSL_FM_10GEC_REGULAR_NOTATION
+       on SoCs earlier(e.g. T4240, T2080), the notation between 10GEC and MAC as below:
+               10GEC1->MAC9, 10GEC2->MAC10, 10GEC3->MAC1, 10GEC4->MAC2
+       on SoCs later(e.g. T1024, etc), the notation between 10GEC and MAC as below:
+               10GEC1->MAC1, 10GEC2->MAC2
+       so we introduce CONFIG_FSL_FM_10GEC_REGULAR_NOTATION to identify the new SoCs on
+       which 10GEC enumeration is consistent with MAC enumeration.
index 137886c2f3cd5f0d2a74537d51ad1cba0562c103..f1e39b982a2a01091715581ac7280370a8a41c03 100644 (file)
@@ -565,9 +565,11 @@ static int fm_eth_init_mac(struct fm_eth *fm_eth, struct ccsr_fman *reg)
        num = fm_eth->num;
 
 #ifdef CONFIG_SYS_FMAN_V3
+#ifndef CONFIG_FSL_FM_10GEC_REGULAR_NOTATION
        if (fm_eth->type == FM_ETH_10G_E) {
-               /* 10GEC1/10GEC2 use mEMAC9/mEMAC10
-                * 10GEC3/10GEC4 use mEMAC1/mEMAC2
+               /* 10GEC1/10GEC2 use mEMAC9/mEMAC10 on T2080/T4240.
+                * 10GEC3/10GEC4 use mEMAC1/mEMAC2 on T2080.
+                * 10GEC1 uses mEMAC1 on T1024.
                 * so it needs to change the num.
                 */
                if (fm_eth->num >= 2)
@@ -575,6 +577,7 @@ static int fm_eth_init_mac(struct fm_eth *fm_eth, struct ccsr_fman *reg)
                else
                        num += 8;
        }
+#endif
        base = &reg->memac[num].fm_memac;
        phyregs = &reg->memac[num].fm_memac_mdio;
 #else
index 6cf21c6f652f84c08a3f7d59774e7e52b4ca0e4d..5d82f2914d7001bf7db39abd6dd615bf2263c3b1 100644 (file)
@@ -254,8 +254,10 @@ static void ft_fixup_port(void *blob, struct fm_eth_info *info, char *prop)
         */
        if (((info->port == FM1_DTSEC9) && (PORT_IS_ENABLED(FM1_10GEC1)))  ||
            ((info->port == FM1_DTSEC10) && (PORT_IS_ENABLED(FM1_10GEC2))) ||
+           ((info->port == FM1_DTSEC1) && (PORT_IS_ENABLED(FM1_10GEC1)))  ||
            ((info->port == FM1_DTSEC1) && (PORT_IS_ENABLED(FM1_10GEC3)))  ||
            ((info->port == FM1_DTSEC2) && (PORT_IS_ENABLED(FM1_10GEC4)))  ||
+           ((info->port == FM1_10GEC1) && (PORT_IS_ENABLED(FM1_DTSEC1)))  ||
            ((info->port == FM1_10GEC1) && (PORT_IS_ENABLED(FM1_DTSEC9)))  ||
            ((info->port == FM1_10GEC2) && (PORT_IS_ENABLED(FM1_DTSEC10))) ||
            ((info->port == FM1_10GEC3) && (PORT_IS_ENABLED(FM1_DTSEC1)))  ||
index e46a684129d66b0f9bca49ede31db5f5088d48bf..3e1b9f4281ada37d9604e376fcc83c236d181bb9 100644 (file)
@@ -75,6 +75,20 @@ enum fm_eth_type {
                                offsetof(struct ccsr_fman, memac[n-1]),\
 }
 
+#ifdef CONFIG_FSL_FM_10GEC_REGULAR_NOTATION
+#define FM_TGEC_INFO_INITIALIZER(idx, n) \
+{                                                                      \
+       FM_ETH_INFO_INITIALIZER(idx, CONFIG_SYS_FM1_TGEC_MDIO_ADDR)     \
+       .index          = idx,                                          \
+       .num            = n - 1,                                        \
+       .type           = FM_ETH_10G_E,                                 \
+       .port           = FM##idx##_10GEC##n,                           \
+       .rx_port_id     = RX_PORT_10G_BASE2 + n - 1,                    \
+       .tx_port_id     = TX_PORT_10G_BASE2 + n - 1,                    \
+       .compat_offset  = CONFIG_SYS_FSL_FM##idx##_OFFSET +             \
+                                offsetof(struct ccsr_fman, memac[n-1]),\
+}
+#else
 #define FM_TGEC_INFO_INITIALIZER(idx, n) \
 {                                                                      \
        FM_ETH_INFO_INITIALIZER(idx, CONFIG_SYS_FM2_TGEC_MDIO_ADDR)     \
@@ -87,6 +101,7 @@ enum fm_eth_type {
        .compat_offset  = CONFIG_SYS_FSL_FM##idx##_OFFSET +             \
                                offsetof(struct ccsr_fman, memac[n-1+8]),\
 }
+#endif
 
 #if (CONFIG_SYS_NUM_FM1_10GEC >= 3)
 #define FM_TGEC_INFO_INITIALIZER2(idx, n) \