fec: Add support for Freescale MX27
authorSascha Hauer <s.hauer@pengutronix.de>
Wed, 28 Jan 2009 23:03:10 +0000 (23:03 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Feb 2009 08:58:26 +0000 (00:58 -0800)
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/Kconfig
drivers/net/fec.c
drivers/net/fec.h

index c4776a2adf008ac8754b972c408b1b6853ec3089..0ec01e42e9b168881c08fba086218214332ba3ba 100644 (file)
@@ -1828,11 +1828,11 @@ config 68360_ENET
          the Motorola 68360 processor.
 
 config FEC
          the Motorola 68360 processor.
 
 config FEC
-       bool "FEC ethernet controller (of ColdFire CPUs)"
-       depends on M523x || M527x || M5272 || M528x || M520x
+       bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)"
+       depends on M523x || M527x || M5272 || M528x || M520x || MACH_MX27
        help
          Say Y here if you want to use the built-in 10/100 Fast ethernet
        help
          Say Y here if you want to use the built-in 10/100 Fast ethernet
-         controller on some Motorola ColdFire processors.
+         controller on some Motorola ColdFire and Freescale i.MX processors.
 
 config FEC2
        bool "Second FEC ethernet controller (on some ColdFire CPUs)"
 
 config FEC2
        bool "Second FEC ethernet controller (on some ColdFire CPUs)"
index a17dc6af30c33211955a08cc10fc4c57eb875b30..7631062cd44d3e838c8e96d4612be2e04fbf95cc 100644 (file)
 #include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/irq.h>
+#include <linux/clk.h>
 
 #include <asm/cacheflush.h>
 
 #include <asm/cacheflush.h>
+
+#ifndef CONFIG_ARCH_MXC
 #include <asm/coldfire.h>
 #include <asm/mcfsim.h>
 #include <asm/coldfire.h>
 #include <asm/mcfsim.h>
+#endif
 
 #include "fec.h"
 
 
 #include "fec.h"
 
 #define        FEC_MAX_PORTS   1
 #endif
 
 #define        FEC_MAX_PORTS   1
 #endif
 
+#ifdef CONFIG_ARCH_MXC
+#include <mach/hardware.h>
+#define FEC_ALIGNMENT  0xf
+#else
+#define FEC_ALIGNMENT  0x3
+#endif
+
 #if defined(CONFIG_M5272)
 #define HAVE_mii_link_interrupt
 #endif
 #if defined(CONFIG_M5272)
 #define HAVE_mii_link_interrupt
 #endif
@@ -158,7 +169,7 @@ typedef struct {
  * account when setting it.
  */
 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
  * account when setting it.
  */
 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
-    defined(CONFIG_M520x) || defined(CONFIG_M532x)
+    defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARCH_MXC)
 #define        OPT_FRAME_SIZE  (PKT_MAXBUF_SIZE << 16)
 #else
 #define        OPT_FRAME_SIZE  0
 #define        OPT_FRAME_SIZE  (PKT_MAXBUF_SIZE << 16)
 #else
 #define        OPT_FRAME_SIZE  0
@@ -339,7 +350,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
         *      4-byte boundaries. Use bounce buffers to copy data
         *      and get it aligned. Ugh.
         */
         *      4-byte boundaries. Use bounce buffers to copy data
         *      and get it aligned. Ugh.
         */
-       if (bdp->cbd_bufaddr & 0x3) {
+       if (bdp->cbd_bufaddr & FEC_ALIGNMENT) {
                unsigned int index;
                index = bdp - fep->tx_bd_base;
                memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len);
                unsigned int index;
                index = bdp - fep->tx_bd_base;
                memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len);
index 292719daceff0e8060aa7ae6ddef7fda0a0bcf31..76c64c92e190980ef5a5d8451412882e410ff722 100644 (file)
@@ -14,7 +14,7 @@
 /****************************************************************************/
 
 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
 /****************************************************************************/
 
 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
-    defined(CONFIG_M520x) || defined(CONFIG_M532x)
+    defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARCH_MXC)
 /*
  *     Just figures, Motorola would have to change the offsets for
  *     registers in the same peripheral device on different models
 /*
  *     Just figures, Motorola would have to change the offsets for
  *     registers in the same peripheral device on different models
@@ -103,12 +103,19 @@ typedef struct fec {
 /*
  *     Define the buffer descriptor structure.
  */
 /*
  *     Define the buffer descriptor structure.
  */
+#ifdef CONFIG_ARCH_MXC
+typedef struct bufdesc {
+       unsigned short cbd_datlen;      /* Data length */
+       unsigned short cbd_sc;  /* Control and status info */
+       unsigned long cbd_bufaddr;      /* Buffer address */
+} cbd_t;
+#else
 typedef struct bufdesc {
        unsigned short  cbd_sc;                 /* Control and status info */
        unsigned short  cbd_datlen;             /* Data length */
        unsigned long   cbd_bufaddr;            /* Buffer address */
 } cbd_t;
 typedef struct bufdesc {
        unsigned short  cbd_sc;                 /* Control and status info */
        unsigned short  cbd_datlen;             /* Data length */
        unsigned long   cbd_bufaddr;            /* Buffer address */
 } cbd_t;
-
+#endif
 
 /*
  *     The following definitions courtesy of commproc.h, which where
 
 /*
  *     The following definitions courtesy of commproc.h, which where
This page took 0.050461 seconds and 5 git commands to generate.