* [RFC] FEC patches @ 2009-01-14 16:09 Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: remove unused #else branches Sascha Hauer 2009-01-15 4:06 ` [RFC] FEC patches Greg Ungerer 0 siblings, 2 replies; 21+ messages in thread From: Sascha Hauer @ 2009-01-14 16:09 UTC (permalink / raw) To: netdev; +Cc: Sebastian Siewior, Greg Ungerer Hi, The following patches apply to the FEC driver (drivers/net/fec.c). While found on several Freescale/Motorola chips, this driver is currently only used for Coldfire. These patches add support for the ARM based i.MX27 SoC. I'm almost sure I break the driver for some (all?) Coldfire guys, but I do not have any Coldfire based board to test the patches on. The first 4 patches should be ok as is, comments? The other patches are somewhat work in progress, but they show which changes I need for my hardware. The driver could use quite some cleanup patches for coding style, turn it into a platform device driver and add exit functions. I'm sure I could find some time to work on these topics, but first I need the patches to support my board to be able to test my changes. Any comments welcome Sascha PS Greg, Sebastian: I'm sending this again because I got the list address wrong. I put you on cc because you were the last persons committing patches to this driver ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] fec: remove unused #else branches 2009-01-14 16:09 [RFC] FEC patches Sascha Hauer @ 2009-01-14 16:09 ` Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: remove empty functions Sascha Hauer 2009-01-15 3:43 ` [PATCH] fec: remove unused #else branches Greg Ungerer 2009-01-15 4:06 ` [RFC] FEC patches Greg Ungerer 1 sibling, 2 replies; 21+ messages in thread From: Sascha Hauer @ 2009-01-14 16:09 UTC (permalink / raw) To: netdev; +Cc: Sebastian Siewior, Greg Ungerer, Sascha Hauer 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 | 94 ----------------------------------------------------- 1 files changed, 0 insertions(+), 94 deletions(-) diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 7e33c12..95785ef 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 }; @@ -95,8 +93,6 @@ static unsigned char fec_mac_default[] = { #define FEC_FLASHMAC (0xffe04000 + 4) #elif defined(CONFIG_MOD5272) #define FEC_FLASHMAC 0xffc0406b -#else -#define FEC_FLASHMAC 0 #endif /* Forward declarations of some structures to support different PHYs @@ -1760,96 +1756,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 = - ((bd->bi_busfreq * 1000000) / 2500000) & 0x7e; -} - -static void __inline__ fec_enable_phy_intr(void) -{ - volatile fec_t *fecp; - - fecp = fep->hwp; - - /* Enable MII command finished interrupt - */ - fecp->fec_ivec = (FEC_INTERRUPT/2) << 29; -} - -static void __inline__ fec_disable_phy_intr(void) -{ -} - -static void __inline__ fec_phy_ack_intr(void) -{ -} - -static void __inline__ fec_localhw_setup(void) -{ - volatile fec_t *fecp; - - fecp = fep->hwp; - fecp->fec_r_hash = PKT_MAXBUF_SIZE; - /* Enable big endian and don't care about SDMA FC. - */ - fecp->fec_fun_code = 0x78000000; -} - -static void __inline__ fec_uncache(unsigned long addr) -{ - pte_t *pte; - pte = va_to_pte(mem_addr); - pte_val(*pte) |= _PAGE_NO_CACHE; - flush_tlb_page(init_mm.mmap, mem_addr); -} - #endif /* ------------------------------------------------------------------------- */ -- 1.5.6.5 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] fec: remove empty functions 2009-01-14 16:09 ` [PATCH] fec: remove unused #else branches Sascha Hauer @ 2009-01-14 16:09 ` Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer 2009-01-15 3:54 ` [PATCH] fec: remove empty functions Greg Ungerer 2009-01-15 3:43 ` [PATCH] fec: remove unused #else branches Greg Ungerer 1 sibling, 2 replies; 21+ messages in thread From: Sascha Hauer @ 2009-01-14 16:09 UTC (permalink / raw) To: netdev; +Cc: Sebastian Siewior, Greg Ungerer, Sascha Hauer 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 95785ef..812d8be 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c @@ -1304,10 +1304,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; @@ -1323,17 +1319,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) @@ -1473,10 +1458,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) { } @@ -1485,17 +1466,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) @@ -1594,10 +1564,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) { } @@ -1606,14 +1572,6 @@ static void __inline__ fec_phy_ack_intr(void) { } -static void __inline__ fec_localhw_setup(void) -{ -} - -static void __inline__ fec_uncache(unsigned long addr) -{ -} - /* ------------------------------------------------------------------------- */ #elif defined(CONFIG_M532x) @@ -1733,10 +1691,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) { } @@ -1745,17 +1699,6 @@ static void __inline__ fec_phy_ack_intr(void) { } -static void __inline__ fec_localhw_setup(void) -{ -} - -/* - * Do not need to make region uncached on 532x. - */ -static void __inline__ fec_uncache(unsigned long addr) -{ -} - #endif /* ------------------------------------------------------------------------- */ @@ -2197,8 +2140,6 @@ int __init fec_enet_init(struct net_device *dev) cbd_base = (cbd_t *)mem_addr; /* XXX: missing check for allocation failure */ - fec_uncache(mem_addr); - /* Set receive and transmit descriptor base. */ fep->rx_bd_base = cbd_base; @@ -2219,8 +2160,6 @@ int __init fec_enet_init(struct net_device *dev) mem_addr = __get_free_page(GFP_KERNEL); /* XXX: missing check for allocation failure */ - fec_uncache(mem_addr); - /* Initialize the BD for every fragment in the page. */ for (j=0; j<FEC_ENET_RX_FRPPG; j++) { @@ -2336,7 +2275,6 @@ fec_restart(struct net_device *dev, int duplex) /* Clear any outstanding interrupt. */ fecp->fec_ievent = 0xffc00000; - fec_enable_phy_intr(); /* Set station address. */ @@ -2351,8 +2289,6 @@ fec_restart(struct net_device *dev, int duplex) */ fecp->fec_r_buff_size = PKT_MAXBLR_SIZE; - fec_localhw_setup(); - /* Set receive and transmit descriptor base. */ fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base)); @@ -2458,7 +2394,6 @@ fec_stop(struct net_device *dev) /* Clear outstanding MII command interrupts. */ fecp->fec_ievent = FEC_ENET_MII; - fec_enable_phy_intr(); fecp->fec_imask = FEC_ENET_MII; fecp->fec_mii_speed = fep->phy_speed; -- 1.5.6.5 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] fec: use linux/*.h instead of asm/*.h 2009-01-14 16:09 ` [PATCH] fec: remove empty functions Sascha Hauer @ 2009-01-14 16:09 ` Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer 2009-01-15 3:55 ` [PATCH] fec: use linux/*.h instead of asm/*.h Greg Ungerer 2009-01-15 3:54 ` [PATCH] fec: remove empty functions Greg Ungerer 1 sibling, 2 replies; 21+ messages in thread From: Sascha Hauer @ 2009-01-14 16:09 UTC (permalink / raw) To: netdev; +Cc: Sebastian Siewior, Greg Ungerer, Sascha Hauer 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 812d8be..1a07d56 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] fec: do not use memcpy on physical addresses 2009-01-14 16:09 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer @ 2009-01-14 16:09 ` Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer 2009-01-15 3:55 ` [PATCH] fec: do not use memcpy on physical addresses Greg Ungerer 2009-01-15 3:55 ` [PATCH] fec: use linux/*.h instead of asm/*.h Greg Ungerer 1 sibling, 2 replies; 21+ messages in thread From: Sascha Hauer @ 2009-01-14 16:09 UTC (permalink / raw) To: netdev; +Cc: Sebastian Siewior, Greg Ungerer, Sascha Hauer 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 1a07d56..29df0df 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c @@ -339,7 +339,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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] fec: use dma_alloc_coherent for descriptor ring 2009-01-14 16:09 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer @ 2009-01-14 16:09 ` Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: Add mx2 support (WIP) Sascha Hauer 2009-01-15 5:20 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Greg Ungerer 2009-01-15 3:55 ` [PATCH] fec: do not use memcpy on physical addresses Greg Ungerer 1 sibling, 2 replies; 21+ messages in thread From: Sascha Hauer @ 2009-01-14 16:09 UTC (permalink / raw) To: netdev; +Cc: Sebastian Siewior, Greg Ungerer, Sascha Hauer Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/net/fec.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 29df0df..81c8e11 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c @@ -184,6 +184,7 @@ struct fec_enet_private { /* CPM dual port RAM relative addresses. */ + dma_addr_t bd_dma; cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */ cbd_t *tx_bd_base; cbd_t *cur_rx, *cur_tx; /* The next free ring entry */ @@ -2105,7 +2106,7 @@ int __init fec_enet_init(struct net_device *dev) /* Allocate memory for buffer descriptors. */ - mem_addr = __get_free_page(GFP_KERNEL); + mem_addr = (unsigned long)dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, GFP_KERNEL); if (mem_addr == 0) { printk("FEC: allocate descriptor memory failed?\n"); return -ENOMEM; @@ -2200,8 +2201,8 @@ int __init fec_enet_init(struct net_device *dev) /* Set receive and transmit descriptor base. */ - fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base)); - fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base)); + fecp->fec_r_des_start = fep->bd_dma; + fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t) * RX_RING_SIZE; /* Install our interrupt handlers. This varies depending on * the architecture. @@ -2289,8 +2290,8 @@ fec_restart(struct net_device *dev, int duplex) /* Set receive and transmit descriptor base. */ - fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base)); - fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base)); + fecp->fec_r_des_start = fep->bd_dma; + fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t) * RX_RING_SIZE; fep->dirty_tx = fep->cur_tx = fep->tx_bd_base; fep->cur_rx = fep->rx_bd_base; -- 1.5.6.5 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] fec: Add mx2 support (WIP) 2009-01-14 16:09 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer @ 2009-01-14 16:09 ` Sascha Hauer 2009-01-15 7:22 ` Greg Ungerer 2009-01-15 5:20 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Greg Ungerer 1 sibling, 1 reply; 21+ messages in thread From: Sascha Hauer @ 2009-01-14 16:09 UTC (permalink / raw) To: netdev; +Cc: Sebastian Siewior, Greg Ungerer, Sascha Hauer Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/net/Kconfig | 2 +- drivers/net/fec.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++-- drivers/net/fec.h | 11 ++++- 3 files changed, 127 insertions(+), 7 deletions(-) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 9fe8cb7..5333e65 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -1829,7 +1829,7 @@ config 68360_ENET config FEC bool "FEC ethernet controller (of ColdFire CPUs)" - depends on M523x || M527x || M5272 || M528x || M520x + depends on M523x || M527x || M5272 || M528x || M520x || ARCH_MX2 help Say Y here if you want to use the built-in 10/100 Fast ethernet controller on some Motorola ColdFire processors. diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 81c8e11..a3e5b63 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_MX2 #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_MX2 +#include <mach/hardware.h> +#define FEC_ALIGNMENT 0xf +#else +#define FEC_ALIGNMENT 0x3 +#endif + #if defined(CONFIG_M5272) #define HAVE_mii_link_interrupt #endif @@ -70,6 +81,8 @@ static unsigned int fec_hw[] = { (MCF_MBAR+0x30000), #elif defined(CONFIG_M532x) (MCF_MBAR+0xfc030000), +#elif defined(CONFIG_ARCH_MX2) + (unsigned int)IO_ADDRESS(FEC_BASE_ADDR), #endif }; @@ -156,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_MX2) #define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16) #else #define OPT_FRAME_SIZE 0 @@ -337,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. */ - 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); @@ -354,8 +367,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. @@ -628,6 +641,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 @@ -1109,7 +1125,14 @@ static phy_info_t const phy_info_am79c874 = { /* register definitions for the 8721 */ #define MII_KS8721BL_RXERCR 21 +#ifdef CONFIG_ARCH_MX2 + /* FIXME: is this a bug or board specific? + * 27 was found somewhere in the Freescale code + */ +#define MII_KS8721BL_ICSR 27 +#else #define MII_KS8721BL_ICSR 22 +#endif #define MII_KS8721BL_PHYCR 31 static phy_cmd_t const phy_cmd_ks8721bl_config[] = { @@ -1698,6 +1721,95 @@ static void __inline__ fec_phy_ack_intr(void) { } +#elif defined(CONFIG_ARCH_MX2) + +/* + * do some initializtion based architecture of this chip + */ +static void inline fec_arch_init(void) +{ + struct clk *clk; + clk = clk_get(NULL, "fec_clk"); + clk_enable(clk); + clk_put(clk); + return; +} + +/* + * Code specific to Freescale i.MXC + */ +static void inline fec_request_intrs(struct net_device *dev) +{ + /* Setup interrupt handlers. */ + if (request_irq(MXC_INT_FEC, fec_enet_interrupt, 0, "fec", dev) != 0) + panic("FEC: Could not allocate FEC IRQ(%d)!\n", MXC_INT_FEC); +} + +static void inline fec_set_mii(struct net_device *dev, + struct fec_enet_private *fep) +{ + u32 rate; + struct clk *clk; + volatile fec_t *fecp; + fecp = fep->hwp; + fecp->fec_r_cntrl = OPT_FRAME_SIZE | 0x04; + fecp->fec_x_cntrl = 0x00; + + /* + * Set MII speed to 2.5 MHz + */ + clk = clk_get(NULL, "fec_clk"); + rate = clk_get_rate(clk); + clk_put(clk); + + fep->phy_speed = ((((rate / 2 + 4999999) / 2500000) / 2) & 0x3F) << 1; + fecp->fec_mii_speed = fep->phy_speed; + fec_restart(dev, 0); +} + +static void inline fec_get_mac(struct net_device *dev) +{ + struct fec_enet_private *fep = netdev_priv(dev); + volatile fec_t *fecp; + unsigned char *iap, tmpaddr[ETH_ALEN]; + int i; + unsigned long l; + unsigned char mac_preinitialized = 0; + fecp = fep->hwp; + + /* check if mac address was already initialized by firmware */ + l = fecp->fec_addr_low; + tmpaddr[0] = (unsigned char)((l & 0xFF000000) >> 24); + tmpaddr[1] = (unsigned char)((l & 0x00FF0000) >> 16); + tmpaddr[2] = (unsigned char)((l & 0x0000FF00) >> 8); + tmpaddr[3] = (unsigned char)((l & 0x000000FF) >> 0); + l = fecp->fec_addr_high; + tmpaddr[4] = (unsigned char)((l & 0xFF000000) >> 24); + tmpaddr[5] = (unsigned char)((l & 0x00FF0000) >> 16); + + for (i = 0; i < ETH_ALEN; i++) + mac_preinitialized |= tmpaddr[i]; + + if (mac_preinitialized) { + iap = &tmpaddr[0]; + memcpy(dev->dev_addr, iap, ETH_ALEN); + } +} + +static void inline fec_disable_phy_intr(void) +{ +} + +static void inline fec_phy_ack_intr(void) +{ +} + +static void inline fec_localhw_setup(void) +{ +} + +/* ------------------------------------------------------------------------- */ + #endif /* ------------------------------------------------------------------------- */ @@ -2404,6 +2516,7 @@ static int __init fec_enet_module_init(void) int i, err; printk("FEC ENET Version 0.2\n"); + fec_arch_init(); for (i = 0; (i < FEC_MAX_PORTS); i++) { dev = alloc_etherdev(sizeof(struct fec_enet_private)); diff --git a/drivers/net/fec.h b/drivers/net/fec.h index 292719d..ca36ea0 100644 --- a/drivers/net/fec.h +++ b/drivers/net/fec.h @@ -14,7 +14,7 @@ /****************************************************************************/ #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_MX2) /* * 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. */ +#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; - +#endif /* * The following definitions courtesy of commproc.h, which where -- 1.5.6.5 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] fec: Add mx2 support (WIP) 2009-01-14 16:09 ` [PATCH] fec: Add mx2 support (WIP) Sascha Hauer @ 2009-01-15 7:22 ` Greg Ungerer 2009-01-15 10:15 ` Sascha Hauer 0 siblings, 1 reply; 21+ messages in thread From: Greg Ungerer @ 2009-01-15 7:22 UTC (permalink / raw) To: Sascha Hauer; +Cc: netdev, Sebastian Siewior Hi Sascha, Sascha Hauer wrote: > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- > drivers/net/Kconfig | 2 +- > drivers/net/fec.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++-- > drivers/net/fec.h | 11 ++++- > 3 files changed, 127 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig > index 9fe8cb7..5333e65 100644 > --- a/drivers/net/Kconfig > +++ b/drivers/net/Kconfig > @@ -1829,7 +1829,7 @@ config 68360_ENET > > config FEC > bool "FEC ethernet controller (of ColdFire CPUs)" > - depends on M523x || M527x || M5272 || M528x || M520x > + depends on M523x || M527x || M5272 || M528x || M520x || ARCH_MX2 > help > Say Y here if you want to use the built-in 10/100 Fast ethernet > controller on some Motorola ColdFire processors. > diff --git a/drivers/net/fec.c b/drivers/net/fec.c > index 81c8e11..a3e5b63 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_MX2 > #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_MX2 > +#include <mach/hardware.h> > +#define FEC_ALIGNMENT 0xf > +#else > +#define FEC_ALIGNMENT 0x3 > +#endif > + > #if defined(CONFIG_M5272) > #define HAVE_mii_link_interrupt > #endif > @@ -70,6 +81,8 @@ static unsigned int fec_hw[] = { > (MCF_MBAR+0x30000), > #elif defined(CONFIG_M532x) > (MCF_MBAR+0xfc030000), > +#elif defined(CONFIG_ARCH_MX2) > + (unsigned int)IO_ADDRESS(FEC_BASE_ADDR), > #endif > }; > > @@ -156,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_MX2) > #define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16) > #else > #define OPT_FRAME_SIZE 0 > @@ -337,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. > */ > - 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); > @@ -354,8 +367,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. > @@ -628,6 +641,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 > @@ -1109,7 +1125,14 @@ static phy_info_t const phy_info_am79c874 = { > /* register definitions for the 8721 */ > > #define MII_KS8721BL_RXERCR 21 > +#ifdef CONFIG_ARCH_MX2 > + /* FIXME: is this a bug or board specific? > + * 27 was found somewhere in the Freescale code > + */ > +#define MII_KS8721BL_ICSR 27 > +#else > #define MII_KS8721BL_ICSR 22 > +#endif > #define MII_KS8721BL_PHYCR 31 > > static phy_cmd_t const phy_cmd_ks8721bl_config[] = { > @@ -1698,6 +1721,95 @@ static void __inline__ fec_phy_ack_intr(void) > { > } > > +#elif defined(CONFIG_ARCH_MX2) > + > +/* > + * do some initializtion based architecture of this chip > + */ > +static void inline fec_arch_init(void) > +{ > + struct clk *clk; > + clk = clk_get(NULL, "fec_clk"); > + clk_enable(clk); > + clk_put(clk); > + return; > +} ColdFire builds break on fec_arch_init(), since it is only defined for ARCH_MX2. Regards Greg > +/* > + * Code specific to Freescale i.MXC > + */ > +static void inline fec_request_intrs(struct net_device *dev) > +{ > + /* Setup interrupt handlers. */ > + if (request_irq(MXC_INT_FEC, fec_enet_interrupt, 0, "fec", dev) != 0) > + panic("FEC: Could not allocate FEC IRQ(%d)!\n", MXC_INT_FEC); > +} > + > +static void inline fec_set_mii(struct net_device *dev, > + struct fec_enet_private *fep) > +{ > + u32 rate; > + struct clk *clk; > + volatile fec_t *fecp; > + fecp = fep->hwp; > + fecp->fec_r_cntrl = OPT_FRAME_SIZE | 0x04; > + fecp->fec_x_cntrl = 0x00; > + > + /* > + * Set MII speed to 2.5 MHz > + */ > + clk = clk_get(NULL, "fec_clk"); > + rate = clk_get_rate(clk); > + clk_put(clk); > + > + fep->phy_speed = ((((rate / 2 + 4999999) / 2500000) / 2) & 0x3F) << 1; > + fecp->fec_mii_speed = fep->phy_speed; > + fec_restart(dev, 0); > +} > + > +static void inline fec_get_mac(struct net_device *dev) > +{ > + struct fec_enet_private *fep = netdev_priv(dev); > + volatile fec_t *fecp; > + unsigned char *iap, tmpaddr[ETH_ALEN]; > + int i; > + unsigned long l; > + unsigned char mac_preinitialized = 0; > + fecp = fep->hwp; > + > + /* check if mac address was already initialized by firmware */ > + l = fecp->fec_addr_low; > + tmpaddr[0] = (unsigned char)((l & 0xFF000000) >> 24); > + tmpaddr[1] = (unsigned char)((l & 0x00FF0000) >> 16); > + tmpaddr[2] = (unsigned char)((l & 0x0000FF00) >> 8); > + tmpaddr[3] = (unsigned char)((l & 0x000000FF) >> 0); > + l = fecp->fec_addr_high; > + tmpaddr[4] = (unsigned char)((l & 0xFF000000) >> 24); > + tmpaddr[5] = (unsigned char)((l & 0x00FF0000) >> 16); > + > + for (i = 0; i < ETH_ALEN; i++) > + mac_preinitialized |= tmpaddr[i]; > + > + if (mac_preinitialized) { > + iap = &tmpaddr[0]; > + memcpy(dev->dev_addr, iap, ETH_ALEN); > + } > +} > + > +static void inline fec_disable_phy_intr(void) > +{ > +} > + > +static void inline fec_phy_ack_intr(void) > +{ > +} > + > +static void inline fec_localhw_setup(void) > +{ > +} > + > +/* ------------------------------------------------------------------------- */ > + > #endif > > /* ------------------------------------------------------------------------- */ > @@ -2404,6 +2516,7 @@ static int __init fec_enet_module_init(void) > int i, err; > > printk("FEC ENET Version 0.2\n"); > + fec_arch_init(); > > for (i = 0; (i < FEC_MAX_PORTS); i++) { > dev = alloc_etherdev(sizeof(struct fec_enet_private)); > diff --git a/drivers/net/fec.h b/drivers/net/fec.h > index 292719d..ca36ea0 100644 > --- a/drivers/net/fec.h > +++ b/drivers/net/fec.h > @@ -14,7 +14,7 @@ > /****************************************************************************/ > > #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_MX2) > /* > * 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. > */ > +#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; > - > +#endif > > /* > * The following definitions courtesy of commproc.h, which where -- ------------------------------------------------------------------------ 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] fec: Add mx2 support (WIP) 2009-01-15 7:22 ` Greg Ungerer @ 2009-01-15 10:15 ` Sascha Hauer 0 siblings, 0 replies; 21+ messages in thread From: Sascha Hauer @ 2009-01-15 10:15 UTC (permalink / raw) To: Greg Ungerer; +Cc: netdev, Sebastian Siewior Hi Greg, On Thu, Jan 15, 2009 at 05:22:21PM +1000, Greg Ungerer wrote: > Hi Sascha, > > Sascha Hauer wrote: >> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> >> --- >> drivers/net/Kconfig | 2 +- >> drivers/net/fec.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++-- >> drivers/net/fec.h | 11 ++++- >> 3 files changed, 127 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig >> @@ -1109,7 +1125,14 @@ static phy_info_t const phy_info_am79c874 = { >> /* register definitions for the 8721 */ >> #define MII_KS8721BL_RXERCR 21 >> +#ifdef CONFIG_ARCH_MX2 >> + /* FIXME: is this a bug or board specific? >> + * 27 was found somewhere in the Freescale code >> + */ >> +#define MII_KS8721BL_ICSR 27 >> +#else >> #define MII_KS8721BL_ICSR 22 >> +#endif I have just found the datasheet for this chip. The ICSR register is indeed on 27, not on 22. So this is a bug in the driver. I will make a seperate patch from this hunk. >> #define MII_KS8721BL_PHYCR 31 >> static phy_cmd_t const phy_cmd_ks8721bl_config[] = { >> @@ -1698,6 +1721,95 @@ static void __inline__ fec_phy_ack_intr(void) >> { >> } >> +#elif defined(CONFIG_ARCH_MX2) >> + >> +/* >> + * do some initializtion based architecture of this chip >> + */ >> +static void inline fec_arch_init(void) >> +{ >> + struct clk *clk; >> + clk = clk_get(NULL, "fec_clk"); >> + clk_enable(clk); >> + clk_put(clk); >> + return; >> +} > > ColdFire builds break on fec_arch_init(), since it is only > defined for ARCH_MX2. Ok, I'll leave this one out and put it in my board file for now. Regards Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] fec: use dma_alloc_coherent for descriptor ring 2009-01-14 16:09 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: Add mx2 support (WIP) Sascha Hauer @ 2009-01-15 5:20 ` Greg Ungerer 1 sibling, 0 replies; 21+ messages in thread From: Greg Ungerer @ 2009-01-15 5:20 UTC (permalink / raw) To: Sascha Hauer; +Cc: netdev, Sebastian Siewior Hi Sascha, Sascha Hauer wrote: > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- I found a problem in the ColdFire ZONE_DMA setup that was causing this patch to break. Fixed that now, and it is working fine. Acked-by: Greg Ungerer <gerg@uclinux.org> Regards Greg > drivers/net/fec.c | 11 ++++++----- > 1 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/fec.c b/drivers/net/fec.c > index 29df0df..81c8e11 100644 > --- a/drivers/net/fec.c > +++ b/drivers/net/fec.c > @@ -184,6 +184,7 @@ struct fec_enet_private { > > /* CPM dual port RAM relative addresses. > */ > + dma_addr_t bd_dma; > cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */ > cbd_t *tx_bd_base; > cbd_t *cur_rx, *cur_tx; /* The next free ring entry */ > @@ -2105,7 +2106,7 @@ int __init fec_enet_init(struct net_device *dev) > > /* Allocate memory for buffer descriptors. > */ > - mem_addr = __get_free_page(GFP_KERNEL); > + mem_addr = (unsigned long)dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, GFP_KERNEL); > if (mem_addr == 0) { > printk("FEC: allocate descriptor memory failed?\n"); > return -ENOMEM; > @@ -2200,8 +2201,8 @@ int __init fec_enet_init(struct net_device *dev) > > /* Set receive and transmit descriptor base. > */ > - fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base)); > - fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base)); > + fecp->fec_r_des_start = fep->bd_dma; > + fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t) * RX_RING_SIZE; > > /* Install our interrupt handlers. This varies depending on > * the architecture. > @@ -2289,8 +2290,8 @@ fec_restart(struct net_device *dev, int duplex) > > /* Set receive and transmit descriptor base. > */ > - fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base)); > - fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base)); > + fecp->fec_r_des_start = fep->bd_dma; > + fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t) * RX_RING_SIZE; > > fep->dirty_tx = fep->cur_tx = fep->tx_bd_base; > fep->cur_rx = fep->rx_bd_base; -- ------------------------------------------------------------------------ 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] fec: do not use memcpy on physical addresses 2009-01-14 16:09 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer @ 2009-01-15 3:55 ` Greg Ungerer 1 sibling, 0 replies; 21+ messages in thread From: Greg Ungerer @ 2009-01-15 3:55 UTC (permalink / raw) To: Sascha Hauer; +Cc: netdev, Sebastian Siewior Hi Sacha, Sascha Hauer wrote: > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- Also fine for ColdFire. Acked-by: Greg Ungerer <gerg@uclinux.org> > 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 1a07d56..29df0df 100644 > --- a/drivers/net/fec.c > +++ b/drivers/net/fec.c > @@ -339,7 +339,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]); > } > -- ------------------------------------------------------------------------ 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] fec: use linux/*.h instead of asm/*.h 2009-01-14 16:09 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer @ 2009-01-15 3:55 ` Greg Ungerer 1 sibling, 0 replies; 21+ messages in thread From: Greg Ungerer @ 2009-01-15 3:55 UTC (permalink / raw) To: Sascha Hauer; +Cc: netdev, Sebastian Siewior Hi Sacha, Sascha Hauer wrote: > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- No problems with this either for ColdFire, Acked-by: Greg Ungerer <gerg@uclinux.org> > 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 812d8be..1a07d56 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) -- ------------------------------------------------------------------------ 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] fec: remove empty functions 2009-01-14 16:09 ` [PATCH] fec: remove empty functions Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer @ 2009-01-15 3:54 ` Greg Ungerer 1 sibling, 0 replies; 21+ messages in thread From: Greg Ungerer @ 2009-01-15 3:54 UTC (permalink / raw) To: Sascha Hauer; +Cc: netdev, Sebastian Siewior Hi Sascha, Sascha Hauer wrote: > There are some architecture specific functions which are all > empty. Remove them. > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> No problems with this one for ColdFire, so Acked-by: Greg Ungerer <gerg@uclinux.org> > --- > 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 95785ef..812d8be 100644 > --- a/drivers/net/fec.c > +++ b/drivers/net/fec.c > @@ -1304,10 +1304,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; > @@ -1323,17 +1319,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) > @@ -1473,10 +1458,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) > { > } > @@ -1485,17 +1466,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) > @@ -1594,10 +1564,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) > { > } > @@ -1606,14 +1572,6 @@ static void __inline__ fec_phy_ack_intr(void) > { > } > > -static void __inline__ fec_localhw_setup(void) > -{ > -} > - > -static void __inline__ fec_uncache(unsigned long addr) > -{ > -} > - > /* ------------------------------------------------------------------------- */ > > #elif defined(CONFIG_M532x) > @@ -1733,10 +1691,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) > { > } > @@ -1745,17 +1699,6 @@ static void __inline__ fec_phy_ack_intr(void) > { > } > > -static void __inline__ fec_localhw_setup(void) > -{ > -} > - > -/* > - * Do not need to make region uncached on 532x. > - */ > -static void __inline__ fec_uncache(unsigned long addr) > -{ > -} > - > #endif > > /* ------------------------------------------------------------------------- */ > @@ -2197,8 +2140,6 @@ int __init fec_enet_init(struct net_device *dev) > cbd_base = (cbd_t *)mem_addr; > /* XXX: missing check for allocation failure */ > > - fec_uncache(mem_addr); > - > /* Set receive and transmit descriptor base. > */ > fep->rx_bd_base = cbd_base; > @@ -2219,8 +2160,6 @@ int __init fec_enet_init(struct net_device *dev) > mem_addr = __get_free_page(GFP_KERNEL); > /* XXX: missing check for allocation failure */ > > - fec_uncache(mem_addr); > - > /* Initialize the BD for every fragment in the page. > */ > for (j=0; j<FEC_ENET_RX_FRPPG; j++) { > @@ -2336,7 +2275,6 @@ fec_restart(struct net_device *dev, int duplex) > /* Clear any outstanding interrupt. > */ > fecp->fec_ievent = 0xffc00000; > - fec_enable_phy_intr(); > > /* Set station address. > */ > @@ -2351,8 +2289,6 @@ fec_restart(struct net_device *dev, int duplex) > */ > fecp->fec_r_buff_size = PKT_MAXBLR_SIZE; > > - fec_localhw_setup(); > - > /* Set receive and transmit descriptor base. > */ > fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base)); > @@ -2458,7 +2394,6 @@ fec_stop(struct net_device *dev) > /* Clear outstanding MII command interrupts. > */ > fecp->fec_ievent = FEC_ENET_MII; > - fec_enable_phy_intr(); > > fecp->fec_imask = FEC_ENET_MII; > fecp->fec_mii_speed = fep->phy_speed; -- ------------------------------------------------------------------------ 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] fec: remove unused #else branches 2009-01-14 16:09 ` [PATCH] fec: remove unused #else branches Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: remove empty functions Sascha Hauer @ 2009-01-15 3:43 ` Greg Ungerer 2009-01-15 10:17 ` Sascha Hauer 1 sibling, 1 reply; 21+ messages in thread From: Greg Ungerer @ 2009-01-15 3:43 UTC (permalink / raw) To: Sascha Hauer; +Cc: netdev, Sebastian Siewior Hi Sascha, Sascha Hauer wrote: > 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 | 94 ----------------------------------------------------- > 1 files changed, 0 insertions(+), 94 deletions(-) > > diff --git a/drivers/net/fec.c b/drivers/net/fec.c > index 7e33c12..95785ef 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 > }; > > @@ -95,8 +93,6 @@ static unsigned char fec_mac_default[] = { > #define FEC_FLASHMAC (0xffe04000 + 4) > #elif defined(CONFIG_MOD5272) > #define FEC_FLASHMAC 0xffc0406b > -#else > -#define FEC_FLASHMAC 0 > #endif The breaks building for a few of the ColdFire targets. They expect FEC_FLASHMAC to be defined to something. Those cases could be fixed with "#ifdef"s around them, or by leaving this "#else" in place (simpler). > /* Forward declarations of some structures to support different PHYs > @@ -1760,96 +1756,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 = > - ((bd->bi_busfreq * 1000000) / 2500000) & 0x7e; > -} > - > -static void __inline__ fec_enable_phy_intr(void) > -{ > - volatile fec_t *fecp; > - > - fecp = fep->hwp; > - > - /* Enable MII command finished interrupt > - */ > - fecp->fec_ivec = (FEC_INTERRUPT/2) << 29; > -} > - > -static void __inline__ fec_disable_phy_intr(void) > -{ > -} > - > -static void __inline__ fec_phy_ack_intr(void) > -{ > -} > - > -static void __inline__ fec_localhw_setup(void) > -{ > - volatile fec_t *fecp; > - > - fecp = fep->hwp; > - fecp->fec_r_hash = PKT_MAXBUF_SIZE; > - /* Enable big endian and don't care about SDMA FC. > - */ > - fecp->fec_fun_code = 0x78000000; > -} > - > -static void __inline__ fec_uncache(unsigned long addr) > -{ > - pte_t *pte; > - pte = va_to_pte(mem_addr); > - pte_val(*pte) |= _PAGE_NO_CACHE; > - flush_tlb_page(init_mm.mmap, mem_addr); > -} > - > #endif > > /* ------------------------------------------------------------------------- */ I don't see any problems with the rest of this patch. Regards Greg ------------------------------------------------------------------------ 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] fec: remove unused #else branches 2009-01-15 3:43 ` [PATCH] fec: remove unused #else branches Greg Ungerer @ 2009-01-15 10:17 ` Sascha Hauer 0 siblings, 0 replies; 21+ messages in thread From: Sascha Hauer @ 2009-01-15 10:17 UTC (permalink / raw) To: Greg Ungerer; +Cc: netdev, Sebastian Siewior On Thu, Jan 15, 2009 at 01:43:24PM +1000, Greg Ungerer wrote: > Hi Sascha, > > Sascha Hauer wrote: >> 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 | 94 ----------------------------------------------------- >> 1 files changed, 0 insertions(+), 94 deletions(-) >> >> diff --git a/drivers/net/fec.c b/drivers/net/fec.c >> index 7e33c12..95785ef 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 >> }; >> @@ -95,8 +93,6 @@ static unsigned char fec_mac_default[] = { >> #define FEC_FLASHMAC (0xffe04000 + 4) >> #elif defined(CONFIG_MOD5272) >> #define FEC_FLASHMAC 0xffc0406b >> -#else >> -#define FEC_FLASHMAC 0 >> #endif > > The breaks building for a few of the ColdFire targets. They > expect FEC_FLASHMAC to be defined to something. > > Those cases could be fixed with "#ifdef"s around them, > or by leaving this "#else" in place (simpler). Ok, I'll leave this #else in. Regards, Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC] FEC patches 2009-01-14 16:09 [RFC] FEC patches Sascha Hauer 2009-01-14 16:09 ` [PATCH] fec: remove unused #else branches Sascha Hauer @ 2009-01-15 4:06 ` Greg Ungerer 2009-01-15 10:24 ` Sascha Hauer 1 sibling, 1 reply; 21+ messages in thread From: Greg Ungerer @ 2009-01-15 4:06 UTC (permalink / raw) To: Sascha Hauer; +Cc: netdev, Sebastian Siewior Hi Sacha, Sascha Hauer wrote: > The following patches apply to the FEC driver (drivers/net/fec.c). While > found on several Freescale/Motorola chips, this driver is currently only > used for Coldfire. These patches add support for the ARM based i.MX27 > SoC. > > I'm almost sure I break the driver for some (all?) Coldfire guys, but I > do not have any Coldfire based board to test the patches on. I can test patches on most ColdFire boards. > The first 4 patches should be ok as is, comments? Only the one that I commented on with FEC_FLASHMAC. Otherwise the first 4 apply and work for ColdFire. > The other patches are somewhat work in progress, but they show which > changes I need for my hardware. Currently the change to use dma_alloc_coherent breaks ColdFire. I need to debug that and see why that is the case. Otherwise they look ok to me. > The driver could use quite some cleanup patches for coding style, turn > it into a platform device driver and add exit functions. I'm sure I Yes, it does badly need this. I have been meaning to extract the ColdFire platform specifics for some time. That would improve it quite a bit. Regards Greg > could find some time to work on these topics, but first I need the > patches to support my board to be able to test my changes. > > Any comments welcome > > Sascha > > PS Greg, Sebastian: I'm sending this again because I got the list > address wrong. I put you on cc because you were the last persons > committing patches to this driver > > > -- ------------------------------------------------------------------------ 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC] FEC patches 2009-01-15 4:06 ` [RFC] FEC patches Greg Ungerer @ 2009-01-15 10:24 ` Sascha Hauer 2009-01-16 0:10 ` Greg Ungerer 0 siblings, 1 reply; 21+ messages in thread From: Sascha Hauer @ 2009-01-15 10:24 UTC (permalink / raw) To: Greg Ungerer; +Cc: netdev, Sebastian Siewior On Thu, Jan 15, 2009 at 02:06:55PM +1000, Greg Ungerer wrote: > Hi Sacha, > > Sascha Hauer wrote: >> The following patches apply to the FEC driver (drivers/net/fec.c). While >> found on several Freescale/Motorola chips, this driver is currently only >> used for Coldfire. These patches add support for the ARM based i.MX27 >> SoC. >> >> I'm almost sure I break the driver for some (all?) Coldfire guys, but I >> do not have any Coldfire based board to test the patches on. > > I can test patches on most ColdFire boards. > > >> The first 4 patches should be ok as is, comments? > > Only the one that I commented on with FEC_FLASHMAC. > Otherwise the first 4 apply and work for ColdFire. > > >> The other patches are somewhat work in progress, but they show which >> changes I need for my hardware. > > Currently the change to use dma_alloc_coherent breaks ColdFire. > I need to debug that and see why that is the case. > > Otherwise they look ok to me. > > >> The driver could use quite some cleanup patches for coding style, turn >> it into a platform device driver and add exit functions. I'm sure I > > Yes, it does badly need this. I have been meaning to extract > the ColdFire platform specifics for some time. That would improve > it quite a bit. > My plan is to put the current static initialization code into some kind of #ifdef FEC_LEGACY and use a proper platform device driver otherwise. This would leave the code in place for now and it could be ported over to platform devices per platform. Is this ok for you? Regards Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC] FEC patches 2009-01-15 10:24 ` Sascha Hauer @ 2009-01-16 0:10 ` Greg Ungerer 0 siblings, 0 replies; 21+ messages in thread From: Greg Ungerer @ 2009-01-16 0:10 UTC (permalink / raw) To: Sascha Hauer; +Cc: netdev, Sebastian Siewior Hi Sascha, Sascha Hauer wrote: > On Thu, Jan 15, 2009 at 02:06:55PM +1000, Greg Ungerer wrote: >> Hi Sacha, >> >> Sascha Hauer wrote: >>> The following patches apply to the FEC driver (drivers/net/fec.c). While >>> found on several Freescale/Motorola chips, this driver is currently only >>> used for Coldfire. These patches add support for the ARM based i.MX27 >>> SoC. >>> >>> I'm almost sure I break the driver for some (all?) Coldfire guys, but I >>> do not have any Coldfire based board to test the patches on. >> I can test patches on most ColdFire boards. >> >> >>> The first 4 patches should be ok as is, comments? >> Only the one that I commented on with FEC_FLASHMAC. >> Otherwise the first 4 apply and work for ColdFire. >> >> >>> The other patches are somewhat work in progress, but they show which >>> changes I need for my hardware. >> Currently the change to use dma_alloc_coherent breaks ColdFire. >> I need to debug that and see why that is the case. >> >> Otherwise they look ok to me. >> >> >>> The driver could use quite some cleanup patches for coding style, turn >>> it into a platform device driver and add exit functions. I'm sure I >> Yes, it does badly need this. I have been meaning to extract >> the ColdFire platform specifics for some time. That would improve >> it quite a bit. >> > > My plan is to put the current static initialization code into some kind > of #ifdef FEC_LEGACY and use a proper platform device driver otherwise. > This would leave the code in place for now and it could be ported over > to platform devices per platform. Is this ok for you? Yeah, that is ok by me. Regards Greg ------------------------------------------------------------------------ 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <1233051848-5994-1-git-send-email-y>]
[parent not found: <1233051848-5994-2-git-send-email-y>]
[parent not found: <1233051848-5994-3-git-send-email-y>]
* [PATCH] fec: use linux/*.h instead of asm/*.h [not found] ` <1233051848-5994-3-git-send-email-y> @ 2009-01-27 10:24 ` y 0 siblings, 0 replies; 21+ messages in thread From: y @ 2009-01-27 10:24 UTC (permalink / raw) To: netdev; +Cc: Greg Ungerer, Sascha Hauer 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* FEC Patches @ 2009-01-27 10:39 Sascha Hauer 2009-01-27 10:39 ` [PATCH] fec: remove unused #else branches Sascha Hauer 0 siblings, 1 reply; 21+ messages in thread From: Sascha Hauer @ 2009-01-27 10:39 UTC (permalink / raw) To: netdev; +Cc: Greg Ungerer, frederic rodo Hi all, hi Greg, Sorry guys, sending this again. Of course I'm not 'y', just playing git-send-email: Who should the emails appear to be from? [Sascha Hauer <s.hauer@pengutronix.de>] y[es] Emails will be sent from: y 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 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH] fec: remove unused #else branches 2009-01-27 10:39 FEC Patches Sascha Hauer @ 2009-01-27 10:39 ` Sascha Hauer 2009-01-27 10:39 ` [PATCH] fec: remove empty functions Sascha Hauer 0 siblings, 1 reply; 21+ messages in thread From: Sascha Hauer @ 2009-01-27 10:39 UTC (permalink / raw) To: netdev; +Cc: Greg Ungerer, frederic rodo, Sascha Hauer 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 = - ((bd->bi_busfreq * 1000000) / 2500000) & 0x7e; -} - -static void __inline__ fec_enable_phy_intr(void) -{ - volatile fec_t *fecp; - - fecp = fep->hwp; - - /* Enable MII command finished interrupt - */ - fecp->fec_ivec = (FEC_INTERRUPT/2) << 29; -} - -static void __inline__ fec_disable_phy_intr(void) -{ -} - -static void __inline__ fec_phy_ack_intr(void) -{ -} - -static void __inline__ fec_localhw_setup(void) -{ - volatile fec_t *fecp; - - fecp = fep->hwp; - fecp->fec_r_hash = PKT_MAXBUF_SIZE; - /* Enable big endian and don't care about SDMA FC. - */ - fecp->fec_fun_code = 0x78000000; -} - -static void __inline__ fec_uncache(unsigned long addr) -{ - pte_t *pte; - pte = va_to_pte(mem_addr); - pte_val(*pte) |= _PAGE_NO_CACHE; - flush_tlb_page(init_mm.mmap, mem_addr); -} - #endif /* ------------------------------------------------------------------------- */ -- 1.5.6.5 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] fec: remove empty functions 2009-01-27 10:39 ` [PATCH] fec: remove unused #else branches Sascha Hauer @ 2009-01-27 10:39 ` Sascha Hauer 2009-01-27 10:39 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer 0 siblings, 1 reply; 21+ messages in thread From: Sascha Hauer @ 2009-01-27 10:39 UTC (permalink / raw) To: netdev; +Cc: Greg Ungerer, frederic rodo, Sascha Hauer 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] + fep->index; } -static void __inline__ fec_enable_phy_intr(void) -{ -} - static void __inline__ fec_disable_phy_intr(void) { } @@ -1608,14 +1574,6 @@ static void __inline__ fec_phy_ack_intr(void) { } -static void __inline__ fec_localhw_setup(void) -{ -} - -static void __inline__ fec_uncache(unsigned long addr) -{ -} - /* ------------------------------------------------------------------------- */ #elif defined(CONFIG_M532x) @@ -1735,10 +1693,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) { } @@ -1747,17 +1701,6 @@ static void __inline__ fec_phy_ack_intr(void) { } -static void __inline__ fec_localhw_setup(void) -{ -} - -/* - * Do not need to make region uncached on 532x. - */ -static void __inline__ fec_uncache(unsigned long addr) -{ -} - #endif /* ------------------------------------------------------------------------- */ @@ -2199,8 +2142,6 @@ int __init fec_enet_init(struct net_device *dev) cbd_base = (cbd_t *)mem_addr; /* XXX: missing check for allocation failure */ - fec_uncache(mem_addr); - /* Set receive and transmit descriptor base. */ fep->rx_bd_base = cbd_base; @@ -2221,8 +2162,6 @@ int __init fec_enet_init(struct net_device *dev) mem_addr = __get_free_page(GFP_KERNEL); /* XXX: missing check for allocation failure */ - fec_uncache(mem_addr); - /* Initialize the BD for every fragment in the page. */ for (j=0; j<FEC_ENET_RX_FRPPG; j++) { @@ -2338,7 +2277,6 @@ fec_restart(struct net_device *dev, int duplex) /* Clear any outstanding interrupt. */ fecp->fec_ievent = 0xffc00000; - fec_enable_phy_intr(); /* Set station address. */ @@ -2353,8 +2291,6 @@ fec_restart(struct net_device *dev, int duplex) */ fecp->fec_r_buff_size = PKT_MAXBLR_SIZE; - fec_localhw_setup(); - /* Set receive and transmit descriptor base. */ fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base)); @@ -2460,7 +2396,6 @@ fec_stop(struct net_device *dev) /* Clear outstanding MII command interrupts. */ fecp->fec_ievent = FEC_ENET_MII; - fec_enable_phy_intr(); fecp->fec_imask = FEC_ENET_MII; fecp->fec_mii_speed = fep->phy_speed; -- 1.5.6.5 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] fec: use linux/*.h instead of asm/*.h 2009-01-27 10:39 ` [PATCH] fec: remove empty functions Sascha Hauer @ 2009-01-27 10:39 ` Sascha Hauer 0 siblings, 0 replies; 21+ messages in thread From: Sascha Hauer @ 2009-01-27 10:39 UTC (permalink / raw) To: netdev; +Cc: Greg Ungerer, frederic rodo, Sascha Hauer 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* FEC patches
@ 2009-01-29 9:03 Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: remove unused #else branches Sascha Hauer
0 siblings, 1 reply; 21+ messages in thread
From: Sascha Hauer @ 2009-01-29 9:03 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Greg Ungerer
Hi David,
Please merge the following patches. The only change since I last sent
them is that I added CONFIG_M520x to the list of supported architectures
as Greg requested.
Regards
Sascha
If you prefer to pull them via git, you can do it here:
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://pasiphae.extern.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 | 446 ++++++++++++++++++++++++++++-----------------------
drivers/net/fec.h | 11 +-
3 files changed, 260 insertions(+), 203 deletions(-)
^ permalink raw reply [flat|nested] 21+ messages in thread* [PATCH] fec: remove unused #else branches 2009-01-29 9:03 FEC patches Sascha Hauer @ 2009-01-29 9:03 ` Sascha Hauer 2009-01-29 9:03 ` [PATCH] fec: remove empty functions Sascha Hauer 0 siblings, 1 reply; 21+ messages in thread From: Sascha Hauer @ 2009-01-29 9:03 UTC (permalink / raw) To: netdev; +Cc: David Miller, Greg Ungerer, Sascha Hauer 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> Acked-by: Greg Ungerer <gerg@uclinux.org> --- 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 = - ((bd->bi_busfreq * 1000000) / 2500000) & 0x7e; -} - -static void __inline__ fec_enable_phy_intr(void) -{ - volatile fec_t *fecp; - - fecp = fep->hwp; - - /* Enable MII command finished interrupt - */ - fecp->fec_ivec = (FEC_INTERRUPT/2) << 29; -} - -static void __inline__ fec_disable_phy_intr(void) -{ -} - -static void __inline__ fec_phy_ack_intr(void) -{ -} - -static void __inline__ fec_localhw_setup(void) -{ - volatile fec_t *fecp; - - fecp = fep->hwp; - fecp->fec_r_hash = PKT_MAXBUF_SIZE; - /* Enable big endian and don't care about SDMA FC. - */ - fecp->fec_fun_code = 0x78000000; -} - -static void __inline__ fec_uncache(unsigned long addr) -{ - pte_t *pte; - pte = va_to_pte(mem_addr); - pte_val(*pte) |= _PAGE_NO_CACHE; - flush_tlb_page(init_mm.mmap, mem_addr); -} - #endif /* ------------------------------------------------------------------------- */ -- 1.5.6.5 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] fec: remove empty functions 2009-01-29 9:03 ` [PATCH] fec: remove unused #else branches Sascha Hauer @ 2009-01-29 9:03 ` Sascha Hauer 2009-01-29 9:03 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer 0 siblings, 1 reply; 21+ messages in thread From: Sascha Hauer @ 2009-01-29 9:03 UTC (permalink / raw) To: netdev; +Cc: David Miller, Greg Ungerer, Sascha Hauer There are some architecture specific functions which are all empty. Remove them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Greg Ungerer <gerg@uclinux.org> --- 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] + fep->index; } -static void __inline__ fec_enable_phy_intr(void) -{ -} - static void __inline__ fec_disable_phy_intr(void) { } @@ -1608,14 +1574,6 @@ static void __inline__ fec_phy_ack_intr(void) { } -static void __inline__ fec_localhw_setup(void) -{ -} - -static void __inline__ fec_uncache(unsigned long addr) -{ -} - /* ------------------------------------------------------------------------- */ #elif defined(CONFIG_M532x) @@ -1735,10 +1693,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) { } @@ -1747,17 +1701,6 @@ static void __inline__ fec_phy_ack_intr(void) { } -static void __inline__ fec_localhw_setup(void) -{ -} - -/* - * Do not need to make region uncached on 532x. - */ -static void __inline__ fec_uncache(unsigned long addr) -{ -} - #endif /* ------------------------------------------------------------------------- */ @@ -2199,8 +2142,6 @@ int __init fec_enet_init(struct net_device *dev) cbd_base = (cbd_t *)mem_addr; /* XXX: missing check for allocation failure */ - fec_uncache(mem_addr); - /* Set receive and transmit descriptor base. */ fep->rx_bd_base = cbd_base; @@ -2221,8 +2162,6 @@ int __init fec_enet_init(struct net_device *dev) mem_addr = __get_free_page(GFP_KERNEL); /* XXX: missing check for allocation failure */ - fec_uncache(mem_addr); - /* Initialize the BD for every fragment in the page. */ for (j=0; j<FEC_ENET_RX_FRPPG; j++) { @@ -2338,7 +2277,6 @@ fec_restart(struct net_device *dev, int duplex) /* Clear any outstanding interrupt. */ fecp->fec_ievent = 0xffc00000; - fec_enable_phy_intr(); /* Set station address. */ @@ -2353,8 +2291,6 @@ fec_restart(struct net_device *dev, int duplex) */ fecp->fec_r_buff_size = PKT_MAXBLR_SIZE; - fec_localhw_setup(); - /* Set receive and transmit descriptor base. */ fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base)); @@ -2460,7 +2396,6 @@ fec_stop(struct net_device *dev) /* Clear outstanding MII command interrupts. */ fecp->fec_ievent = FEC_ENET_MII; - fec_enable_phy_intr(); fecp->fec_imask = FEC_ENET_MII; fecp->fec_mii_speed = fep->phy_speed; -- 1.5.6.5 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] fec: use linux/*.h instead of asm/*.h 2009-01-29 9:03 ` [PATCH] fec: remove empty functions Sascha Hauer @ 2009-01-29 9:03 ` Sascha Hauer 0 siblings, 0 replies; 21+ messages in thread From: Sascha Hauer @ 2009-01-29 9:03 UTC (permalink / raw) To: netdev; +Cc: David Miller, Greg Ungerer, Sascha Hauer Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Greg Ungerer <gerg@uclinux.org> --- 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 ^ permalink raw reply related [flat|nested] 21+ messages in thread
end of thread, other threads:[~2009-01-29 9:06 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-14 16:09 [RFC] FEC patches Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: remove unused #else branches Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: remove empty functions Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer
2009-01-14 16:09 ` [PATCH] fec: Add mx2 support (WIP) Sascha Hauer
2009-01-15 7:22 ` Greg Ungerer
2009-01-15 10:15 ` Sascha Hauer
2009-01-15 5:20 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Greg Ungerer
2009-01-15 3:55 ` [PATCH] fec: do not use memcpy on physical addresses Greg Ungerer
2009-01-15 3:55 ` [PATCH] fec: use linux/*.h instead of asm/*.h Greg Ungerer
2009-01-15 3:54 ` [PATCH] fec: remove empty functions Greg Ungerer
2009-01-15 3:43 ` [PATCH] fec: remove unused #else branches Greg Ungerer
2009-01-15 10:17 ` Sascha Hauer
2009-01-15 4:06 ` [RFC] FEC patches Greg Ungerer
2009-01-15 10:24 ` Sascha Hauer
2009-01-16 0:10 ` Greg Ungerer
[not found] <1233051848-5994-1-git-send-email-y>
[not found] ` <1233051848-5994-2-git-send-email-y>
[not found] ` <1233051848-5994-3-git-send-email-y>
2009-01-27 10:24 ` [PATCH] fec: use linux/*.h instead of asm/*.h y
-- strict thread matches above, loose matches on Subject: below --
2009-01-27 10:39 FEC Patches Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: remove unused #else branches Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: remove empty functions Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer
2009-01-29 9:03 FEC patches Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: remove unused #else branches Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: remove empty functions Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).