FEC Patches V2

Previous thread: Re: [atl2] warn_slowpath in dev_watchdog by Sitsofe Wheeler on Tuesday, January 27, 2009 - 2:30 am. (1 message)

Next thread: [PATCH] fec: use dma_alloc_coherent for descriptor ring by y on Tuesday, January 27, 2009 - 3:24 am. (5 messages)
From: y
Date: Tuesday, January 27, 2009 - 3:23 am

Hi all, hi Greg,

These patches are an updated version from the ones I posted some time ago.
They give the FEC ethernet driver a facelift and turn it into a
platform_device driver. The Coldfire cores are still supported through
legacy ifdefs. The platform driver support has been tested on a
Freescale i.MX27 SoC.

Sascha

The following changes since commit 5ee810072175042775e39bdd3eaaa68884c27805:
  Linus Torvalds (1):
        Fix "multiple definition of `debugfs_create_size_t'"

are available in the git repository at:

  git://git.pengutronix.de/git/imx/linux-2.6.git fec-pu

Sascha Hauer (9):
      fec: remove unused #else branches
      fec: remove empty functions
      fec: use linux/*.h instead of asm/*.h
      fec: do not use memcpy on physical addresses
      fec: use dma_alloc_coherent for descriptor ring
      fec: Fix KS8721BL_ICSR phy register offset
      fec: replace flush_dcache_range with dma_sync_single
      fec: Add support for Freescale MX27
      FEC: Turn FEC driver into platform device driver

 drivers/net/Kconfig |    6 +-
 drivers/net/fec.c   |  443 ++++++++++++++++++++++++++++-----------------------
 drivers/net/fec.h   |   11 +-
 3 files changed, 257 insertions(+), 203 deletions(-)


--

From: y
Date: Tuesday, January 27, 2009 - 3:24 am

From: Sascha Hauer <s.hauer@pengutronix.de>

The #else branches throughout this driver belong to a PowerPC 8xx for
which this driver is not used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/fec.c |   92 -----------------------------------------------------
 1 files changed, 0 insertions(+), 92 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 7e33c12..b754f60 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -72,8 +72,6 @@ static unsigned int fec_hw[] = {
 	(MCF_MBAR+0x30000),
 #elif defined(CONFIG_M532x)
 	(MCF_MBAR+0xfc030000),
-#else
-	&(((immap_t *)IMAP_ADDR)->im_cpm.cp_fec),
 #endif
 };
 
@@ -1760,96 +1758,6 @@ static void __inline__ fec_uncache(unsigned long addr)
 {
 }
 
-/* ------------------------------------------------------------------------- */
-
-
-#else
-
-/*
- *	Code specific to the MPC860T setup.
- */
-static void __inline__ fec_request_intrs(struct net_device *dev)
-{
-	volatile immap_t *immap;
-
-	immap = (immap_t *)IMAP_ADDR;	/* pointer to internal registers */
-
-	if (request_8xxirq(FEC_INTERRUPT, fec_enet_interrupt, 0, "fec", dev) != 0)
-		panic("Could not allocate FEC IRQ!");
-}
-
-static void __inline__ fec_get_mac(struct net_device *dev)
-{
-	bd_t *bd;
-
-	bd = (bd_t *)__res;
-	memcpy(dev->dev_addr, bd->bi_enetaddr, ETH_ALEN);
-}
-
-static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep)
-{
-	extern uint _get_IMMR(void);
-	volatile immap_t *immap;
-	volatile fec_t *fecp;
-
-	fecp = fep->hwp;
-	immap = (immap_t *)IMAP_ADDR;	/* pointer to internal registers */
-
-	/* Configure all of port D for MII.
-	*/
-	immap->im_ioport.iop_pdpar = 0x1fff;
-
-	/* Bits moved from Rev. D onward.
-	*/
-	if ((_get_IMMR() & 0xffff) < 0x0501)
-		immap->im_ioport.iop_pddir = 0x1c58;	/* Pre rev. D */
-	else
-		immap->im_ioport.iop_pddir = 0x1fff;	/* Rev. D and later */
-
-	/* Set MII speed to 2.5 MHz
-	*/
-	fecp->fec_mii_speed = fep->phy_speed ...
From: y
Date: Tuesday, January 27, 2009 - 3:24 am

From: Sascha Hauer <s.hauer@pengutronix.de>

There are some architecture specific functions which are all
empty. Remove them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/fec.c |   65 -----------------------------------------------------
 1 files changed, 0 insertions(+), 65 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index b754f60..f913c97 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -1306,10 +1306,6 @@ static void __inline__ fec_get_mac(struct net_device *dev)
 		 dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index;
 }
 
-static void __inline__ fec_enable_phy_intr(void)
-{
-}
-
 static void __inline__ fec_disable_phy_intr(void)
 {
 	volatile unsigned long *icrp;
@@ -1325,17 +1321,6 @@ static void __inline__ fec_phy_ack_intr(void)
 	*icrp = 0x0d000000;
 }
 
-static void __inline__ fec_localhw_setup(void)
-{
-}
-
-/*
- *	Do not need to make region uncached on 5272.
- */
-static void __inline__ fec_uncache(unsigned long addr)
-{
-}
-
 /* ------------------------------------------------------------------------- */
 
 #elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
@@ -1475,10 +1460,6 @@ static void __inline__ fec_get_mac(struct net_device *dev)
 		dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index;
 }
 
-static void __inline__ fec_enable_phy_intr(void)
-{
-}
-
 static void __inline__ fec_disable_phy_intr(void)
 {
 }
@@ -1487,17 +1468,6 @@ static void __inline__ fec_phy_ack_intr(void)
 {
 }
 
-static void __inline__ fec_localhw_setup(void)
-{
-}
-
-/*
- *	Do not need to make region uncached on 5272.
- */
-static void __inline__ fec_uncache(unsigned long addr)
-{
-}
-
 /* ------------------------------------------------------------------------- */
 
 #elif defined(CONFIG_M520x)
@@ -1596,10 +1566,6 @@ static void __inline__ fec_get_mac(struct net_device *dev)
 		dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + ...
From: y
Date: Tuesday, January 27, 2009 - 3:24 am

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/fec.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index f913c97..a44b4ee 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -36,15 +36,13 @@
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
 #include <linux/bitops.h>
+#include <linux/io.h>
+#include <linux/irq.h>
 
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
-#include <asm/pgtable.h>
 #include <asm/cacheflush.h>
-
 #include <asm/coldfire.h>
 #include <asm/mcfsim.h>
+
 #include "fec.h"
 
 #if defined(CONFIG_FEC2)
-- 
1.5.6.5

--

From: y
Date: Tuesday, January 27, 2009 - 3:24 am

From: Sascha Hauer <s.hauer@pengutronix.de>

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 a44b4ee..1087c4d 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -341,7 +341,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (bdp->cbd_bufaddr & 0x3) {
 		unsigned int index;
 		index = bdp - fep->tx_bd_base;
-		memcpy(fep->tx_bounce[index], (void *) bdp->cbd_bufaddr, bdp->cbd_datlen);
+		memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len);
 		bdp->cbd_bufaddr = __pa(fep->tx_bounce[index]);
 	}
 
-- 
1.5.6.5

--

Previous thread: Re: [atl2] warn_slowpath in dev_watchdog by Sitsofe Wheeler on Tuesday, January 27, 2009 - 2:30 am. (1 message)

Next thread: [PATCH] fec: use dma_alloc_coherent for descriptor ring by y on Tuesday, January 27, 2009 - 3:24 am. (5 messages)