]> err.no Git - linux-2.6/commitdiff
fs_enet: Fix SCC Ethernet on CPM2, and crash in fs_enet_rx_napi()
authorHeiko Schocher <hs@denx.de>
Tue, 26 Aug 2008 01:20:53 +0000 (20:20 -0500)
committerJeff Garzik <jgarzik@redhat.com>
Wed, 27 Aug 2008 09:16:38 +0000 (05:16 -0400)
Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
arch/powerpc/include/asm/cpm2.h
drivers/net/fs_enet/fs_enet-main.c
drivers/net/fs_enet/mac-scc.c

index 2a6fa0183ac9dd67f554aac4a17e6c15598d12a9..0f5e8ff59a855bcace108520e9f95ef9ff0c8901 100644 (file)
@@ -337,6 +337,11 @@ typedef struct scc_param {
        uint    scc_tcrc;       /* Internal */
 } sccp_t;
 
+/* Function code bits.
+*/
+#define SCC_EB ((u_char) 0x10) /* Set big endian byte order */
+#define SCC_GBL        ((u_char) 0x20) /* Snooping enabled */
+
 /* CPM Ethernet through SCC1.
  */
 typedef struct scc_enet {
index 9a51ec8293cc953e0ea32a8df6d7c08a9a7204f3..9d461825bf4ce92e55a9de79921e8ffc94735617 100644 (file)
@@ -792,6 +792,10 @@ static int fs_enet_open(struct net_device *dev)
        int r;
        int err;
 
+       /* to initialize the fep->cur_rx,... */
+       /* not doing this, will cause a crash in fs_enet_rx_napi */
+       fs_init_bds(fep->ndev);
+
        if (fep->fpi->use_napi)
                napi_enable(&fep->napi);
 
@@ -1167,6 +1171,10 @@ static struct of_device_id fs_enet_match[] = {
                .compatible = "fsl,cpm1-scc-enet",
                .data = (void *)&fs_scc_ops,
        },
+       {
+               .compatible = "fsl,cpm2-scc-enet",
+               .data = (void *)&fs_scc_ops,
+       },
 #endif
 #ifdef CONFIG_FS_ENET_HAS_FCC
        {
index 029b3c7ef29ce7dd4cc05c444b6b55d0dbe8289a..22f50dd8b2776adf126f76075d4bf7d8596e7346 100644 (file)
@@ -47,7 +47,6 @@
 #include "fs_enet.h"
 
 /*************************************************/
-
 #if defined(CONFIG_CPM1)
 /* for a 8xx __raw_xxx's are sufficient */
 #define __fs_out32(addr, x)    __raw_writel(x, addr)
@@ -62,6 +61,8 @@
 #define __fs_out16(addr, x)    out_be16(addr, x)
 #define __fs_in32(addr)        in_be32(addr)
 #define __fs_in16(addr)        in_be16(addr)
+#define __fs_out8(addr, x)     out_8(addr, x)
+#define __fs_in8(addr) in_8(addr)
 #endif
 
 /* write, read, set bits, clear bits */
@@ -262,8 +263,13 @@ static void restart(struct net_device *dev)
 
        /* Initialize function code registers for big-endian.
         */
+#ifndef CONFIG_NOT_COHERENT_CACHE
+       W8(ep, sen_genscc.scc_rfcr, SCC_EB | SCC_GBL);
+       W8(ep, sen_genscc.scc_tfcr, SCC_EB | SCC_GBL);
+#else
        W8(ep, sen_genscc.scc_rfcr, SCC_EB);
        W8(ep, sen_genscc.scc_tfcr, SCC_EB);
+#endif
 
        /* Set maximum bytes per receive buffer.
         * This appears to be an Ethernet frame size, not the buffer