net: Conditional COBJS inclusion of network drivers
[platform/kernel/u-boot.git] / drivers / net / fsl_mcdmafec.c
index 0c876f3..f2bdba6 100644 (file)
@@ -31,7 +31,6 @@
 #include <net.h>
 #include <miiphy.h>
 
-#ifdef CONFIG_FSLDMAFEC
 #undef ET_DEBUG
 #undef MII_DEBUG
 
@@ -49,7 +48,6 @@
 #define BD_ENET_RX_ERR (BD_ENET_RX_LG | BD_ENET_RX_NO | BD_ENET_RX_CR | \
                         BD_ENET_RX_OV | BD_ENET_RX_TR)
 
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
 #include <asm/immap.h>
 #include <asm/fsl_mcdmafec.h>
 
@@ -95,7 +93,11 @@ struct fec_info_dma fec_info[] = {
         0,                     /* duplex and speed */
         0,                     /* phy name */
         0,                     /* phy name init */
+#ifdef CFG_DMA_USE_INTSRAM
+        DBUF_LENGTH,           /* RX BD */
+#else
         0,                     /* RX BD */
+#endif
         0,                     /* TX BD */
         0,                     /* rx Index */
         0,                     /* tx Index */
@@ -164,7 +166,8 @@ static void dbg_fec_regs(struct eth_device *dev)
 }
 #endif
 
-static void set_fec_duplex_speed(volatile fecdma_t * fecp, bd_t * bd, int dup_spd)
+static void set_fec_duplex_speed(volatile fecdma_t * fecp, bd_t * bd,
+                                int dup_spd)
 {
        if ((dup_spd >> 16) == FULL) {
                /* Set maximum frame length */
@@ -513,6 +516,9 @@ int mcdmafec_initialize(bd_t * bis)
 {
        struct eth_device *dev;
        int i;
+#ifdef CFG_DMA_USE_INTSRAM
+       u32 tmp = CFG_INTSRAM + 0x2000;
+#endif
 
        for (i = 0; i < sizeof(fec_info) / sizeof(fec_info[0]); i++) {
 
@@ -533,6 +539,17 @@ int mcdmafec_initialize(bd_t * bis)
                dev->recv = fec_recv;
 
                /* setup Receive and Transmit buffer descriptor */
+#ifdef CFG_DMA_USE_INTSRAM
+               fec_info[i].rxbd = (int)fec_info[i].rxbd + tmp;
+               tmp = fec_info[i].rxbd;
+               fec_info[i].txbd =
+                   (int)fec_info[i].txbd + tmp + (PKTBUFSRX * sizeof(cbd_t));
+               tmp = fec_info[i].txbd;
+               fec_info[i].txbuf =
+                   (int)fec_info[i].txbuf + tmp +
+                   (CFG_TX_ETH_BUFFER * sizeof(cbd_t));
+               tmp = fec_info[i].txbuf;
+#else
                fec_info[i].rxbd =
                    (cbd_t *) memalign(CFG_CACHELINE_SIZE,
                                       (PKTBUFSRX * sizeof(cbd_t)));
@@ -541,6 +558,7 @@ int mcdmafec_initialize(bd_t * bis)
                                       (CFG_TX_ETH_BUFFER * sizeof(cbd_t)));
                fec_info[i].txbuf =
                    (char *)memalign(CFG_CACHELINE_SIZE, DBUF_LENGTH);
+#endif
 
 #ifdef ET_DEBUG
                printf("rxbd %x txbd %x\n",
@@ -566,6 +584,3 @@ int mcdmafec_initialize(bd_t * bis)
 
        return 1;
 }
-
-#endif                         /* CONFIG_CMD_NET && CONFIG_NET_MULTI */
-#endif                         /* CONFIG_FSLDMAFEC */