diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-01-28 18:03:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-01 03:58:26 -0500 |
commit | 196719ecec0c526de273dcb902f0be956a193232 (patch) | |
tree | fc134667f844daf2a4015621d0f881e887e99d54 | |
parent | ccdc4f198193eb4956b8dbc00745270525c4cd6e (diff) |
fec: Add support for Freescale MX27
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>
-rw-r--r-- | drivers/net/Kconfig | 6 | ||||
-rw-r--r-- | drivers/net/fec.c | 15 | ||||
-rw-r--r-- | drivers/net/fec.h | 11 |
3 files changed, 25 insertions, 7 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index c4776a2adf00..0ec01e42e9b1 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1828,11 +1828,11 @@ config 68360_ENET | |||
1828 | the Motorola 68360 processor. | 1828 | the Motorola 68360 processor. |
1829 | 1829 | ||
1830 | config FEC | 1830 | config FEC |
1831 | bool "FEC ethernet controller (of ColdFire CPUs)" | 1831 | bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)" |
1832 | depends on M523x || M527x || M5272 || M528x || M520x | 1832 | depends on M523x || M527x || M5272 || M528x || M520x || MACH_MX27 |
1833 | help | 1833 | help |
1834 | Say Y here if you want to use the built-in 10/100 Fast ethernet | 1834 | Say Y here if you want to use the built-in 10/100 Fast ethernet |
1835 | controller on some Motorola ColdFire processors. | 1835 | controller on some Motorola ColdFire and Freescale i.MX processors. |
1836 | 1836 | ||
1837 | config FEC2 | 1837 | config FEC2 |
1838 | bool "Second FEC ethernet controller (on some ColdFire CPUs)" | 1838 | bool "Second FEC ethernet controller (on some ColdFire CPUs)" |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index a17dc6af30c3..7631062cd44d 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -38,10 +38,14 @@ | |||
38 | #include <linux/bitops.h> | 38 | #include <linux/bitops.h> |
39 | #include <linux/io.h> | 39 | #include <linux/io.h> |
40 | #include <linux/irq.h> | 40 | #include <linux/irq.h> |
41 | #include <linux/clk.h> | ||
41 | 42 | ||
42 | #include <asm/cacheflush.h> | 43 | #include <asm/cacheflush.h> |
44 | |||
45 | #ifndef CONFIG_ARCH_MXC | ||
43 | #include <asm/coldfire.h> | 46 | #include <asm/coldfire.h> |
44 | #include <asm/mcfsim.h> | 47 | #include <asm/mcfsim.h> |
48 | #endif | ||
45 | 49 | ||
46 | #include "fec.h" | 50 | #include "fec.h" |
47 | 51 | ||
@@ -51,6 +55,13 @@ | |||
51 | #define FEC_MAX_PORTS 1 | 55 | #define FEC_MAX_PORTS 1 |
52 | #endif | 56 | #endif |
53 | 57 | ||
58 | #ifdef CONFIG_ARCH_MXC | ||
59 | #include <mach/hardware.h> | ||
60 | #define FEC_ALIGNMENT 0xf | ||
61 | #else | ||
62 | #define FEC_ALIGNMENT 0x3 | ||
63 | #endif | ||
64 | |||
54 | #if defined(CONFIG_M5272) | 65 | #if defined(CONFIG_M5272) |
55 | #define HAVE_mii_link_interrupt | 66 | #define HAVE_mii_link_interrupt |
56 | #endif | 67 | #endif |
@@ -158,7 +169,7 @@ typedef struct { | |||
158 | * account when setting it. | 169 | * account when setting it. |
159 | */ | 170 | */ |
160 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ | 171 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ |
161 | defined(CONFIG_M520x) || defined(CONFIG_M532x) | 172 | defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARCH_MXC) |
162 | #define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16) | 173 | #define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16) |
163 | #else | 174 | #else |
164 | #define OPT_FRAME_SIZE 0 | 175 | #define OPT_FRAME_SIZE 0 |
@@ -339,7 +350,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
339 | * 4-byte boundaries. Use bounce buffers to copy data | 350 | * 4-byte boundaries. Use bounce buffers to copy data |
340 | * and get it aligned. Ugh. | 351 | * and get it aligned. Ugh. |
341 | */ | 352 | */ |
342 | if (bdp->cbd_bufaddr & 0x3) { | 353 | if (bdp->cbd_bufaddr & FEC_ALIGNMENT) { |
343 | unsigned int index; | 354 | unsigned int index; |
344 | index = bdp - fep->tx_bd_base; | 355 | index = bdp - fep->tx_bd_base; |
345 | memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len); | 356 | memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len); |
diff --git a/drivers/net/fec.h b/drivers/net/fec.h index 292719daceff..76c64c92e190 100644 --- a/drivers/net/fec.h +++ b/drivers/net/fec.h | |||
@@ -14,7 +14,7 @@ | |||
14 | /****************************************************************************/ | 14 | /****************************************************************************/ |
15 | 15 | ||
16 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ | 16 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ |
17 | defined(CONFIG_M520x) || defined(CONFIG_M532x) | 17 | defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARCH_MXC) |
18 | /* | 18 | /* |
19 | * Just figures, Motorola would have to change the offsets for | 19 | * Just figures, Motorola would have to change the offsets for |
20 | * registers in the same peripheral device on different models | 20 | * registers in the same peripheral device on different models |
@@ -103,12 +103,19 @@ typedef struct fec { | |||
103 | /* | 103 | /* |
104 | * Define the buffer descriptor structure. | 104 | * Define the buffer descriptor structure. |
105 | */ | 105 | */ |
106 | #ifdef CONFIG_ARCH_MXC | ||
107 | typedef struct bufdesc { | ||
108 | unsigned short cbd_datlen; /* Data length */ | ||
109 | unsigned short cbd_sc; /* Control and status info */ | ||
110 | unsigned long cbd_bufaddr; /* Buffer address */ | ||
111 | } cbd_t; | ||
112 | #else | ||
106 | typedef struct bufdesc { | 113 | typedef struct bufdesc { |
107 | unsigned short cbd_sc; /* Control and status info */ | 114 | unsigned short cbd_sc; /* Control and status info */ |
108 | unsigned short cbd_datlen; /* Data length */ | 115 | unsigned short cbd_datlen; /* Data length */ |
109 | unsigned long cbd_bufaddr; /* Buffer address */ | 116 | unsigned long cbd_bufaddr; /* Buffer address */ |
110 | } cbd_t; | 117 | } cbd_t; |
111 | 118 | #endif | |
112 | 119 | ||
113 | /* | 120 | /* |
114 | * The following definitions courtesy of commproc.h, which where | 121 | * The following definitions courtesy of commproc.h, which where |