According to the datasheet the ICSR register is at offset 27, not 22.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/fec.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index d7ba07c..f36ee43 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -1111,7 +1111,7 @@ static phy_info_t const phy_info_am79c874 = {
/* register definitions for the 8721 */
#define MII_KS8721BL_RXERCR 21
-#define MII_KS8721BL_ICSR 22
+#define MII_KS8721BL_ICSR 27
#define MII_KS8721BL_PHYCR 31
static phy_cmd_t const phy_cmd_ks8721bl_config[] = {
--
1.5.6.5
--
flush_dcache_range is not portable across architectures. Use
dma_sync_single instead. Also, the memory must be synchronised in the
receive path aswell.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/fec.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index f36ee43..6a54d1f 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -356,8 +356,8 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Push the data cache so the CPM does not get stale memory
* data.
*/
- flush_dcache_range((unsigned long)skb->data,
- (unsigned long)skb->data + skb->len);
+ dma_sync_single(NULL, bdp->cbd_bufaddr,
+ bdp->cbd_datlen, DMA_TO_DEVICE);
/* Send it on its way. Tell FEC it's ready, interrupt when done,
* it's the last BD of the frame, and to put the CRC on the end.
@@ -630,6 +630,9 @@ while (!((status = bdp->cbd_sc) & BD_ENET_RX_EMPTY)) {
dev->stats.rx_bytes += pkt_len;
data = (__u8*)__va(bdp->cbd_bufaddr);
+ dma_sync_single(NULL, (unsigned long)__pa(data),
+ pkt_len - 4, DMA_FROM_DEVICE);
+
/* This does 16 byte alignment, exactly what we need.
* The packet length includes FCS, but we don't want to
* include that when passing upstream as it messes up
--
1.5.6.5
--
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/Kconfig | 6 +++---
drivers/net/fec.c | 15 +++++++++++++--
drivers/net/fec.h | 11 +++++++++--
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 9fe8cb7..fcdab51 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1828,11 +1828,11 @@ config 68360_ENET
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 || ARCH_MXC
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)"
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 6a54d1f..2c8783a 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -38,10 +38,14 @@
#include <linux/bitops.h>
#include <linux/io.h>
#include <linux/irq.h>
+#include <linux/clk.h>
#include <asm/cacheflush.h>
+
+#ifndef CONFIG_ARCH_MXC
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
+#endif
#include "fec.h"
@@ -51,6 +55,13 @@
#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
@@ -158,7 +169,7 @@ typedef struct {
* 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
@@ ...This turns the fec driver into a platform device driver for new
platforms. Old platforms are still supported through a FEC_LEGACY define
till they are also ported.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/fec.c | 249 ++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 220 insertions(+), 29 deletions(-)
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 2c8783a..ed4825b 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -39,6 +39,7 @@
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/clk.h>
+#include <linux/platform_device.h>
#include <asm/cacheflush.h>
@@ -49,12 +50,6 @@
#include "fec.h"
-#if defined(CONFIG_FEC2)
-#define FEC_MAX_PORTS 2
-#else
-#define FEC_MAX_PORTS 1
-#endif
-
#ifdef CONFIG_ARCH_MXC
#include <mach/hardware.h>
#define FEC_ALIGNMENT 0xf
@@ -62,13 +57,22 @@
#define FEC_ALIGNMENT 0x3
#endif
+#if defined CONFIG_M5272 || defined CONFIG_M527x || defined CONFIG_M523x \
+ || defined CONFIG_M528x || defined CONFIG_M532x
+#define FEC_LEGACY
+/*
+ * Define the fixed address of the FEC hardware.
+ */
#if defined(CONFIG_M5272)
#define HAVE_mii_link_interrupt
#endif
-/*
- * Define the fixed address of the FEC hardware.
- */
+#if defined(CONFIG_FEC2)
+#define FEC_MAX_PORTS 2
+#else
+#define FEC_MAX_PORTS 1
+#endif
+
static unsigned int fec_hw[] = {
#if defined(CONFIG_M5272)
(MCF_MBAR + 0x840),
@@ -106,6 +110,8 @@ static unsigned char fec_mac_default[] = {
#define FEC_FLASHMAC 0
#endif
+#endif /* FEC_LEGACY */
+
/* Forward declarations of some structures to support different PHYs
*/
@@ -189,6 +195,8 @@ struct fec_enet_private {
struct net_device *netdev;
+ struct clk *clk;
+
/* The saved address of a sent-in-place packet/buffer, for skfree(). */
unsigned char *tx_bounce[TX_RING_SIZE];
struct sk_buff* tx_skbuff[TX_RING_SIZE];
@@ -1919,7 +1927,9 @@ mii_discover_phy(uint mii_reg, struct net_device *dev)
...Hi Sascha, This list needs to include a "defined CONFIG_M520x" as well. Aside from this it builds and runs fine on the ColdFire parts I tried it on. Regards -- ------------------------------------------------------------------------ Greg Ungerer -- Principal Engineer EMAIL: gerg@snapgear.com SnapGear, a McAfee Company PHONE: +61 7 3435 2888 825 Stanley St, FAX: +61 7 3891 3630 Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com --
