linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Add MPC5121 FEC suppport
@ 2008-06-17 23:03 John Rigby
  2008-06-17 23:03 ` [PATCH 1/2] fs_enet: fix checkpatch.pl problems John Rigby
  0 siblings, 1 reply; 9+ messages in thread
From: John Rigby @ 2008-06-17 23:03 UTC (permalink / raw)
  To: Scott Wood, linuxppc-dev, jeff, Sam Ravnborg; +Cc: netdev

Note:  This patch series assumes Kumar's Remove
!CONFIG_PPC_CPM_NEW_BINDING patch has been applied. 
http://patchwork.ozlabs.org/linuxppc/patch?q=kumar&id=18939

Addresses all comments to previous patch.
Split the patch into two parts:

Part 1 fixes all problems reported by checkpatch.pl
and changes instances of fec_t to struct fec.

Part 2 addes 5121 support.  And cleans up the Kconfig
logic based on input from Scott Wood and Sam Ravnborg.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] fs_enet: fix checkpatch.pl problems
  2008-06-17 23:03 [PATCH 0/2] Add MPC5121 FEC suppport John Rigby
@ 2008-06-17 23:03 ` John Rigby
  2008-06-17 23:03   ` [PATCH 2/2] fs_enet: add MPC5121 FEC support John Rigby
                     ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: John Rigby @ 2008-06-17 23:03 UTC (permalink / raw)
  To: Scott Wood, linuxppc-dev, jeff, Sam Ravnborg; +Cc: netdev

Fixed all errors and warnings that checkpatch.pl
reports if this was a new submission.
Also changed instances of fec_t to struct fec in
mac-fec.c and mii-fec.c.

This is in preparation of adding MPC5121 support.

Signed-off-by: John Rigby <jrigby@freescale.com>
---
 drivers/net/fs_enet/fs_enet-main.c |   70 ++++++++++++++++++++---------------
 drivers/net/fs_enet/fs_enet.h      |   15 +++++---
 drivers/net/fs_enet/mac-fcc.c      |    7 ++--
 drivers/net/fs_enet/mac-fec.c      |   40 ++++++++++----------
 drivers/net/fs_enet/mac-scc.c      |   13 ++++---
 drivers/net/fs_enet/mii-bitbang.c  |    4 +-
 drivers/net/fs_enet/mii-fec.c      |   23 +++++++-----
 7 files changed, 95 insertions(+), 77 deletions(-)

diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index a9f9aae..8ebf388 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -41,7 +41,7 @@
 #include <linux/vmalloc.h>
 #include <asm/pgtable.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 #include "fs_enet.h"
@@ -80,7 +80,8 @@ static void skb_align(struct sk_buff *skb, int align)
 /* NAPI receive function */
 static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
 {
-	struct fs_enet_private *fep = container_of(napi, struct fs_enet_private, napi);
+	struct fs_enet_private *fep =
+		container_of(napi, struct fs_enet_private, napi);
 	struct net_device *dev = fep->ndev;
 	const struct fs_platform_info *fpi = fep->fpi;
 	cbd_t __iomem *bdp;
@@ -155,7 +156,8 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
 				/* +2 to make IP header L1 cache aligned */
 				skbn = dev_alloc_skb(pkt_len + 2);
 				if (skbn != NULL) {
-					skb_reserve(skbn, 2);	/* align IP header */
+					/* align IP header */
+					skb_reserve(skbn, 2);
 					skb_copy_from_linear_data(skb,
 						      skbn->data, pkt_len);
 					/* swap */
@@ -177,7 +179,8 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
 				netif_receive_skb(skb);
 			} else {
 				printk(KERN_WARNING DRV_MODULE_NAME
-				       ": %s Memory squeeze, dropping packet.\n",
+				       ": %s Memory squeeze, "
+				       "dropping packet.\n",
 				       dev->name);
 				fep->stats.rx_dropped++;
 				skbn = skb;
@@ -290,7 +293,8 @@ static int fs_enet_rx_non_napi(struct net_device *dev)
 				/* +2 to make IP header L1 cache aligned */
 				skbn = dev_alloc_skb(pkt_len + 2);
 				if (skbn != NULL) {
-					skb_reserve(skbn, 2);	/* align IP header */
+					/* align IP header */
+					skb_reserve(skbn, 2);
 					skb_copy_from_linear_data(skb,
 						      skbn->data, pkt_len);
 					/* swap */
@@ -312,7 +316,8 @@ static int fs_enet_rx_non_napi(struct net_device *dev)
 				netif_rx(skb);
 			} else {
 				printk(KERN_WARNING DRV_MODULE_NAME
-				       ": %s Memory squeeze, dropping packet.\n",
+				       ": %s Memory squeeze, "
+				       "dropping packet.\n",
 				       dev->name);
 				fep->stats.rx_dropped++;
 				skbn = skb;
@@ -379,7 +384,8 @@ static void fs_enet_tx(struct net_device *dev)
 			if (sc & BD_ENET_TX_CSL)	/* Carrier lost */
 				fep->stats.tx_carrier_errors++;
 
-			if (sc & (BD_ENET_TX_LC | BD_ENET_TX_RL | BD_ENET_TX_UN)) {
+			if (sc & (BD_ENET_TX_LC | BD_ENET_TX_RL
+				    | BD_ENET_TX_UN)) {
 				fep->stats.tx_errors++;
 				do_restart = 1;
 			}
@@ -473,10 +479,14 @@ fs_enet_interrupt(int irq, void *dev_id)
 				napi_ok = napi_schedule_prep(&fep->napi);
 
 				(*fep->ops->napi_disable_rx)(dev);
-				(*fep->ops->clear_int_events)(dev, fep->ev_napi_rx);
-
-				/* NOTE: it is possible for FCCs in NAPI mode    */
-				/* to submit a spurious interrupt while in poll  */
+				(*fep->ops->clear_int_events)(dev,
+						    fep->ev_napi_rx);
+
+				/*
+				 * NOTE: It is possible for FCCs
+				 * in NAPI mode to submit a spurious
+				 * interrupt while in poll
+				 */
 				if (napi_ok)
 					__netif_rx_schedule(dev, &fep->napi);
 			}
@@ -554,7 +564,8 @@ void fs_cleanup_bds(struct net_device *dev)
 	 * Reset SKB transmit buffers.
 	 */
 	for (i = 0, bdp = fep->tx_bd_base; i < fep->tx_ring; i++, bdp++) {
-		if ((skb = fep->tx_skbuff[i]) == NULL)
+		skb = fep->tx_skbuff[i];
+		if (!skb)
 			continue;
 
 		/* unmap */
@@ -569,7 +580,8 @@ void fs_cleanup_bds(struct net_device *dev)
 	 * Reset SKB receive buffers
 	 */
 	for (i = 0, bdp = fep->rx_bd_base; i < fep->rx_ring; i++, bdp++) {
-		if ((skb = fep->rx_skbuff[i]) == NULL)
+		skb = fep->rx_skbuff[i];
+		if (!skb)
 			continue;
 
 		/* unmap */
@@ -583,7 +595,7 @@ void fs_cleanup_bds(struct net_device *dev)
 	}
 }
 
-/**********************************************************************************/
+/*******************************************************************************/
 
 static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
@@ -708,7 +720,7 @@ static void fs_timeout(struct net_device *dev)
 
 /*-----------------------------------------------------------------------------
  *  generic link-change handler - should be sufficient for most cases
- *-----------------------------------------------------------------------------*/
+ *---------------------------------------------------------------------------*/
 static void generic_adjust_link(struct  net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
@@ -758,7 +770,7 @@ static void fs_adjust_link(struct net_device *dev)
 
 	spin_lock_irqsave(&fep->lock, flags);
 
-	if(fep->ops->adjust_link)
+	if (fep->ops->adjust_link)
 		fep->ops->adjust_link(dev);
 	else
 		generic_adjust_link(dev);
@@ -774,7 +786,7 @@ static int fs_init_phy(struct net_device *dev)
 	fep->oldlink = 0;
 	fep->oldspeed = 0;
 	fep->oldduplex = -1;
-	if(fep->fpi->bus_id)
+	if (fep->fpi->bus_id)
 		phydev = phy_connect(dev, fep->fpi->bus_id, &fs_adjust_link, 0,
 				PHY_INTERFACE_MODE_MII);
 	else {
@@ -801,7 +813,8 @@ static int fs_enet_open(struct net_device *dev)
 		napi_enable(&fep->napi);
 
 	/* Install our interrupt handler. */
-	r = fs_request_irq(dev, fep->interrupt, "fs_enet-mac", fs_enet_interrupt);
+	r = fs_request_irq(dev, fep->interrupt, "fs_enet-mac",
+		    fs_enet_interrupt);
 	if (r != 0) {
 		printk(KERN_ERR DRV_MODULE_NAME
 		       ": %s Could not allocate FS_ENET IRQ!", dev->name);
@@ -947,13 +960,10 @@ static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	return phy_mii_ioctl(fep->phydev, mii, cmd);
 }
 
-extern int fs_mii_connect(struct net_device *dev);
-extern void fs_mii_disconnect(struct net_device *dev);
-
-/**************************************************************************************/
+/******************************************************************************/
 
 /* handy pointer to the immap */
-void __iomem *fs_enet_immap = NULL;
+void __iomem *fs_enet_immap;
 
 static int setup_immap(void)
 {
@@ -974,10 +984,10 @@ static void cleanup_immap(void)
 #endif
 }
 
-/**************************************************************************************/
+/******************************************************************************/
 
 static int __devinit find_phy(struct device_node *np,
-                              struct fs_platform_info *fpi)
+			      struct fs_platform_info *fpi)
 {
 	struct device_node *phynode, *mdionode;
 	struct resource res;
@@ -1026,7 +1036,7 @@ out_put_phy:
 #endif
 
 static int __devinit fs_enet_probe(struct of_device *ofdev,
-                                   const struct of_device_id *match)
+				   const struct of_device_id *match)
 {
 	struct net_device *ndev;
 	struct fs_enet_private *fep;
@@ -1058,8 +1068,8 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
 		goto out_free_fpi;
 
 	privsize = sizeof(*fep) +
-	           sizeof(struct sk_buff **) *
-	           (fpi->rx_ring + fpi->tx_ring);
+		   sizeof(struct sk_buff **) *
+		   (fpi->rx_ring + fpi->tx_ring);
 
 	ndev = alloc_etherdev(privsize);
 	if (!ndev) {
@@ -1109,7 +1119,7 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
 
 	if (fpi->use_napi)
 		netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi,
-		               fpi->napi_weight);
+			       fpi->napi_weight);
 
 	ndev->ethtool_ops = &fs_ethtool_ops;
 	ndev->do_ioctl = fs_ioctl;
@@ -1217,7 +1227,7 @@ static void fs_enet_netpoll(struct net_device *dev)
 }
 #endif
 
-/**************************************************************************************/
+/******************************************************************************/
 
 module_init(fs_init);
 module_exit(fs_cleanup);
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h
index db46d2e..7bf779a 100644
--- a/drivers/net/fs_enet/fs_enet.h
+++ b/drivers/net/fs_enet/fs_enet.h
@@ -52,9 +52,9 @@ struct fs_ops {
 struct phy_info {
 	unsigned int id;
 	const char *name;
-	void (*startup) (struct net_device * dev);
-	void (*shutdown) (struct net_device * dev);
-	void (*ack_int) (struct net_device * dev);
+	void (*startup) (struct net_device *dev);
+	void (*shutdown) (struct net_device *dev);
+	void (*ack_int) (struct net_device *dev);
 };
 
 /* The FEC stores dest/src/type, data, and checksum for receive packets.
@@ -74,7 +74,8 @@ struct phy_info {
 
 struct fs_enet_private {
 	struct napi_struct napi;
-	struct device *dev;	/* pointer back to the device (must be initialized first) */
+	struct device *dev;	/* pointer back to the device
+				   (must be initialized first) */
 	struct net_device *ndev;
 	spinlock_t lock;	/* during all ops except TX pckt processing */
 	spinlock_t tx_lock;	/* during fs_start_xmit and fs_tx         */
@@ -174,8 +175,10 @@ void fs_enet_platform_cleanup(void);
 
 /* write */
 #define CBDW_SC(_cbd, _sc) 		__cbd_out16(&(_cbd)->cbd_sc, (_sc))
-#define CBDW_DATLEN(_cbd, _datlen)	__cbd_out16(&(_cbd)->cbd_datlen, (_datlen))
-#define CBDW_BUFADDR(_cbd, _bufaddr)	__cbd_out32(&(_cbd)->cbd_bufaddr, (_bufaddr))
+#define CBDW_DATLEN(_cbd, _datlen)	\
+	__cbd_out16(&(_cbd)->cbd_datlen, (_datlen))
+#define CBDW_BUFADDR(_cbd, _bufaddr)	\
+	__cbd_out32(&(_cbd)->cbd_bufaddr, (_bufaddr))
 
 /* read */
 #define CBDR_SC(_cbd) 			__cbd_in16(&(_cbd)->cbd_sc)
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c
index 133125f..ee21f46 100644
--- a/drivers/net/fs_enet/mac-fcc.c
+++ b/drivers/net/fs_enet/mac-fcc.c
@@ -70,7 +70,8 @@
 #define FCC_MAX_MULTICAST_ADDRS	64
 
 #define mk_mii_read(REG)	(0x60020000 | ((REG & 0x1f) << 18))
-#define mk_mii_write(REG, VAL)	(0x50020000 | ((REG & 0x1f) << 18) | (VAL & 0xffff))
+#define mk_mii_write(REG, VAL) \
+	(0x50020000 | ((REG & 0x1f) << 18) | (VAL & 0xffff))
 #define mk_mii_end		0
 
 #define MAX_CR_CMD_LOOPS	10000
@@ -323,8 +324,8 @@ static void restart(struct net_device *dev)
 	W16(ep, fen_tfclen, 0);
 	W32(ep, fen_tfcptr, 0);
 
-	W16(ep, fen_mflr, PKT_MAXBUF_SIZE);	/* maximum frame length register */
-	W16(ep, fen_minflr, PKT_MINBUF_SIZE);	/* minimum frame length register */
+	W16(ep, fen_mflr, PKT_MAXBUF_SIZE);	/* max frame length register */
+	W16(ep, fen_minflr, PKT_MINBUF_SIZE);	/* min frame length register */
 
 	/* set address */
 	mac = dev->dev_addr;
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index 0a7d1c5..cac51b1 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -33,9 +33,9 @@
 #include <linux/fs.h>
 #include <linux/platform_device.h>
 #include <linux/of_device.h>
+#include <linux/uaccess.h>
 
 #include <asm/irq.h>
-#include <asm/uaccess.h>
 
 #ifdef CONFIG_8xx
 #include <asm/8xx_immap.h>
@@ -80,7 +80,7 @@
  */
 #define FEC_RESET_DELAY		50
 
-static int whack_reset(fec_t __iomem *fecp)
+static int whack_reset(struct fec __iomem *fecp)
 {
 	int i;
 
@@ -153,7 +153,7 @@ static void free_bd(struct net_device *dev)
 	struct fs_enet_private *fep = netdev_priv(dev);
 	const struct fs_platform_info *fpi = fep->fpi;
 
-	if(fep->ring_base)
+	if (fep->ring_base)
 		dma_free_coherent(fep->dev, (fpi->tx_ring + fpi->rx_ring)
 					* sizeof(cbd_t),
 					(void __force *)fep->ring_base,
@@ -168,7 +168,7 @@ static void cleanup_data(struct net_device *dev)
 static void set_promiscuous_mode(struct net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
-	fec_t __iomem *fecp = fep->fec.fecp;
+	struct fec __iomem *fecp = fep->fec.fecp;
 
 	FS(fecp, r_cntrl, FEC_RCNTRL_PROM);
 }
@@ -216,7 +216,7 @@ static void set_multicast_one(struct net_device *dev, const u8 *mac)
 static void set_multicast_finish(struct net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
-	fec_t __iomem *fecp = fep->fec.fecp;
+	struct fec __iomem *fecp = fep->fec.fecp;
 
 	/* if all multi or too many multicasts; just enable all */
 	if ((dev->flags & IFF_ALLMULTI) != 0 ||
@@ -250,14 +250,14 @@ static void restart(struct net_device *dev)
 	u32 cptr;
 #endif
 	struct fs_enet_private *fep = netdev_priv(dev);
-	fec_t __iomem *fecp = fep->fec.fecp;
+	struct fec __iomem *fecp = fep->fec.fecp;
 	const struct fs_platform_info *fpi = fep->fpi;
 	dma_addr_t rx_bd_base_phys, tx_bd_base_phys;
 	int r;
 	u32 addrhi, addrlo;
 
-	struct mii_bus* mii = fep->phydev->bus;
-	struct fec_info* fec_inf = mii->priv;
+	struct mii_bus *mii = fep->phydev->bus;
+	struct fec_info *fec_inf = mii->priv;
 
 	r = whack_reset(fep->fec.fecp);
 	if (r != 0)
@@ -378,9 +378,9 @@ static void stop(struct net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
 	const struct fs_platform_info *fpi = fep->fpi;
-	fec_t __iomem *fecp = fep->fec.fecp;
+	struct fec __iomem *fecp = fep->fec.fecp;
 
-	struct fec_info* feci= fep->phydev->bus->priv;
+	struct fec_info *feci = fep->phydev->bus->priv;
 
 	int i;
 
@@ -440,7 +440,7 @@ static void post_free_irq(struct net_device *dev, int irq)
 static void napi_clear_rx_event(struct net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
-	fec_t __iomem *fecp = fep->fec.fecp;
+	struct fec __iomem *fecp = fep->fec.fecp;
 
 	FW(fecp, ievent, FEC_NAPI_RX_EVENT_MSK);
 }
@@ -448,7 +448,7 @@ static void napi_clear_rx_event(struct net_device *dev)
 static void napi_enable_rx(struct net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
-	fec_t __iomem *fecp = fep->fec.fecp;
+	struct fec __iomem *fecp = fep->fec.fecp;
 
 	FS(fecp, imask, FEC_NAPI_RX_EVENT_MSK);
 }
@@ -456,7 +456,7 @@ static void napi_enable_rx(struct net_device *dev)
 static void napi_disable_rx(struct net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
-	fec_t __iomem *fecp = fep->fec.fecp;
+	struct fec __iomem *fecp = fep->fec.fecp;
 
 	FC(fecp, imask, FEC_NAPI_RX_EVENT_MSK);
 }
@@ -464,7 +464,7 @@ static void napi_disable_rx(struct net_device *dev)
 static void rx_bd_done(struct net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
-	fec_t __iomem *fecp = fep->fec.fecp;
+	struct fec __iomem *fecp = fep->fec.fecp;
 
 	FW(fecp, r_des_active, 0x01000000);
 }
@@ -472,7 +472,7 @@ static void rx_bd_done(struct net_device *dev)
 static void tx_kickstart(struct net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
-	fec_t __iomem *fecp = fep->fec.fecp;
+	struct fec __iomem *fecp = fep->fec.fecp;
 
 	FW(fecp, x_des_active, 0x01000000);
 }
@@ -480,7 +480,7 @@ static void tx_kickstart(struct net_device *dev)
 static u32 get_int_events(struct net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
-	fec_t __iomem *fecp = fep->fec.fecp;
+	struct fec __iomem *fecp = fep->fec.fecp;
 
 	return FR(fecp, ievent) & FR(fecp, imask);
 }
@@ -488,7 +488,7 @@ static u32 get_int_events(struct net_device *dev)
 static void clear_int_events(struct net_device *dev, u32 int_events)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
-	fec_t __iomem *fecp = fep->fec.fecp;
+	struct fec __iomem *fecp = fep->fec.fecp;
 
 	FW(fecp, ievent, int_events);
 }
@@ -503,17 +503,17 @@ static int get_regs(struct net_device *dev, void *p, int *sizep)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
 
-	if (*sizep < sizeof(fec_t))
+	if (*sizep < sizeof(struct fec))
 		return -EINVAL;
 
-	memcpy_fromio(p, fep->fec.fecp, sizeof(fec_t));
+	memcpy_fromio(p, fep->fec.fecp, sizeof(struct fec));
 
 	return 0;
 }
 
 static int get_regs_len(struct net_device *dev)
 {
-	return sizeof(fec_t);
+	return sizeof(struct fec);
 }
 
 static void tx_restart(struct net_device *dev)
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index 029b3c7..c8f47ad 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -1,5 +1,6 @@
 /*
- * Ethernet on Serial Communications Controller (SCC) driver for Motorola MPC8xx and MPC82xx.
+ * Ethernet on Serial Communications Controller (SCC) driver for Motorola
+ * MPC8xx and MPC82xx.
  *
  * Copyright (c) 2003 Intracom S.A.
  *  by Pantelis Antoniou <panto@intracom.gr>
@@ -33,9 +34,9 @@
 #include <linux/fs.h>
 #include <linux/platform_device.h>
 #include <linux/of_platform.h>
+#include <linux/uaccess.h>
 
 #include <asm/irq.h>
-#include <asm/uaccess.h>
 
 #ifdef CONFIG_8xx
 #include <asm/8xx_immap.h>
@@ -147,7 +148,7 @@ static int allocate_bd(struct net_device *dev)
 	if (IS_ERR_VALUE(fep->ring_mem_addr))
 		return -ENOMEM;
 
-	fep->ring_base = (void __iomem __force*)
+	fep->ring_base = (void __iomem __force *)
 		cpm_dpram_addr(fep->ring_mem_addr);
 
 	return 0;
@@ -185,7 +186,7 @@ static void set_multicast_start(struct net_device *dev)
 	W16(ep, sen_gaddr4, 0);
 }
 
-static void set_multicast_one(struct net_device *dev, const u8 * mac)
+static void set_multicast_one(struct net_device *dev, const u8 *mac)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
 	scc_enet_t __iomem *ep = fep->scc.ep;
@@ -283,9 +284,9 @@ static void restart(struct net_device *dev)
 	W16(ep, sen_pads, 0x8888);	/* Tx short frame pad character */
 	W16(ep, sen_retlim, 15);	/* Retry limit threshold */
 
-	W16(ep, sen_maxflr, 0x5ee);	/* maximum frame length register */
+	W16(ep, sen_maxflr, 0x5ee);	/* max frame length register */
 
-	W16(ep, sen_minflr, PKT_MINBUF_SIZE);	/* minimum frame length register */
+	W16(ep, sen_minflr, PKT_MINBUF_SIZE);	/* min frame length register */
 
 	W16(ep, sen_maxd1, 0x000005f0);	/* maximum DMA1 length */
 	W16(ep, sen_maxd2, 0x000005f0);	/* maximum DMA2 length */
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c
index be4b72f..daa76d0 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -108,7 +108,7 @@ static struct mdiobb_ops bb_ops = {
 };
 
 static int __devinit fs_mii_bitbang_init(struct mii_bus *bus,
-                                         struct device_node *np)
+					 struct device_node *np)
 {
 	struct resource res;
 	const u32 *data;
@@ -167,7 +167,7 @@ static void __devinit add_phy(struct mii_bus *bus, struct device_node *np)
 }
 
 static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,
-                                        const struct of_device_id *match)
+					const struct of_device_id *match)
 {
 	struct device_node *np = NULL;
 	struct mii_bus *new_bus;
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index 695f74c..5079dcf 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -32,10 +32,10 @@
 #include <linux/bitops.h>
 #include <linux/platform_device.h>
 #include <linux/of_platform.h>
+#include <linux/uaccess.h>
 
 #include <asm/pgtable.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
 
 #include "fs_enet.h"
 #include "fec.h"
@@ -43,15 +43,16 @@
 /* Make MII read/write commands for the FEC.
 */
 #define mk_mii_read(REG)	(0x60020000 | ((REG & 0x1f) << 18))
-#define mk_mii_write(REG, VAL)	(0x50020000 | ((REG & 0x1f) << 18) | (VAL & 0xffff))
+#define mk_mii_write(REG, VAL) \
+	(0x50020000 | ((REG & 0x1f) << 18) | (VAL & 0xffff))
 #define mk_mii_end		0
 
 #define FEC_MII_LOOPS	10000
 
 static int fs_enet_fec_mii_read(struct mii_bus *bus , int phy_id, int location)
 {
-	struct fec_info* fec = bus->priv;
-	fec_t __iomem *fecp = fec->fecp;
+	struct fec_info *fec = bus->priv;
+	struct fec __iomem *fecp = fec->fecp;
 	int i, ret = -1;
 
 	if ((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0)
@@ -72,10 +73,11 @@ static int fs_enet_fec_mii_read(struct mii_bus *bus , int phy_id, int location)
 	return ret;
 }
 
-static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location, u16 val)
+static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location,
+				 u16 val)
 {
-	struct fec_info* fec = bus->priv;
-	fec_t __iomem *fecp = fec->fecp;
+	struct fec_info *fec = bus->priv;
+	struct fec __iomem *fecp = fec->fecp;
 	int i;
 
 	/* this must never happen */
@@ -83,7 +85,8 @@ static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location,
 		BUG();
 
 	/* Add PHY address to register command.  */
-	out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_write(location, val));
+	out_be32(&fecp->fec_mii_data,
+			(phy_id << 23) | mk_mii_write(location, val));
 
 	for (i = 0; i < FEC_MII_LOOPS; i++)
 		if ((in_be32(&fecp->fec_ievent) & FEC_ENET_MII) != 0)
@@ -120,7 +123,7 @@ static void __devinit add_phy(struct mii_bus *bus, struct device_node *np)
 }
 
 static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,
-                                        const struct of_device_id *match)
+					const struct of_device_id *match)
 {
 	struct device_node *np = NULL;
 	struct resource res;
@@ -156,7 +159,7 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,
 
 	setbits32(&fec->fecp->fec_r_cntrl, FEC_RCNTRL_MII_MODE);
 	setbits32(&fec->fecp->fec_ecntrl, FEC_ECNTRL_PINMUX |
-	                                  FEC_ECNTRL_ETHER_EN);
+					  FEC_ECNTRL_ETHER_EN);
 	out_be32(&fec->fecp->fec_ievent, FEC_ENET_MII);
 	out_be32(&fec->fecp->fec_mii_speed, fec->mii_speed);
 
-- 
1.5.6.rc0.46.gd2b3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] fs_enet: add MPC5121 FEC support
  2008-06-17 23:03 ` [PATCH 1/2] fs_enet: fix checkpatch.pl problems John Rigby
@ 2008-06-17 23:03   ` John Rigby
  2008-06-18  3:54   ` [PATCH 1/2] fs_enet: fix checkpatch.pl problems Jeff Garzik
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: John Rigby @ 2008-06-17 23:03 UTC (permalink / raw)
  To: Scott Wood, linuxppc-dev, jeff, Sam Ravnborg; +Cc: netdev

Add support for MPC512x to fs_enet driver

MPC5121 has an FEC core that is nearly identical to the FEC
in 8xx.  The only problem is that the registers locations have
been shuffled.  Because of this shuffling of registers, one needs
a different structure to describe the 5121 FEC. This is not a huge
problem since CPM2 and FEC are mutually exclusive, and therefore
we can use CONFIG_CPM1 to distinguish between 5121 and 8xx.

  arch/powerpc/boot/dts/mpc5121ads.dts
    Fix a typo in the file header and add ethernet and
    mdio nodes.

  drivers/net/fs_enet/Kconfig
    Add PPC_MPC512x to FS_ENET and FS_ENET_HAS_FEC depends.
    Also cleaned up the logic based on input from Scott Wood
    and Sam Ravnborg.

  drivers/net/fs_enet/fec_mpc5121.h
    This contains a struct fec with the appropriate
    order of fields for 5121.

  drivers/net/fs_enet/fs_enet-main.c
    Add a routine for conditionally copying TX skb's that
    are not aligned.  Only do this if fep->fpi->align_tx_packets is set.
    In fs_enet_probe set fpi->align_tx_packets to the value of
    fsl,align-tx-packets property in the device node.
    Add a new entry to match table with compatible set to
    "fsl,mpc5121-fec".

  drivers/net/fs_enet/fs_enet.h
    Include fec_mpc5121.h.

  drivers/net/fs_enet/mac-fec.c
    Any code that is differnet between old 8xx fec
    and 512x fec is ifdef'd with CONFIG_CPM1.
    The file already had CONFIG_CPM1's in it so this isn't
    any more evil than what is already there.

  drivers/net/fs_enet/mii-fec.c
    Add a new entry to match table with compatible set to
    "fsl,mpc5121-fec-mdio".

  include/linux/fs_enet_pd.h
    Add an new field called align_tx_packets to
    struct fs_platform_info which is used in fs_enet_main.c
    as described above.

Signed-off-by: John Rigby <jrigby@freescale.com>
---
 arch/powerpc/boot/dts/mpc5121ads.dts |   24 ++++++++++++-
 drivers/net/fs_enet/Kconfig          |   30 +++++++--------
 drivers/net/fs_enet/fec_mpc5121.h    |   64 ++++++++++++++++++++++++++++++++++
 drivers/net/fs_enet/fs_enet-main.c   |   41 +++++++++++++++++++++
 drivers/net/fs_enet/fs_enet.h        |    7 +++-
 drivers/net/fs_enet/mac-fec.c        |   22 ++++++++++-
 drivers/net/fs_enet/mii-fec.c        |    7 ++++
 include/linux/fs_enet_pd.h           |    2 +
 8 files changed, 177 insertions(+), 20 deletions(-)
 create mode 100644 drivers/net/fs_enet/fec_mpc5121.h

diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts b/arch/powerpc/boot/dts/mpc5121ads.dts
index 94ad7b2..bc9629e 100644
--- a/arch/powerpc/boot/dts/mpc5121ads.dts
+++ b/arch/powerpc/boot/dts/mpc5121ads.dts
@@ -1,5 +1,5 @@
 /*
- * MPC5121E MDS Device Tree Source
+ * MPC5121E ADS Device Tree Source
  *
  * Copyright 2007 Freescale Semiconductor Inc.
  *
@@ -85,6 +85,28 @@
 			reg = <0xc00 0x100>;
 		};
 
+		mdio@2800 {
+			compatible = "fsl,mpc5121-fec-mdio";
+			reg = <0x2800 0x800>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			phy: ethernet-phy@0 {
+				reg = <1>;
+				device_type = "ethernet-phy";
+			};
+		};
+
+		ethernet@2800 {
+			device_type = "network";
+			compatible = "fsl,mpc5121-fec";
+			reg = <0x2800 0x800>;
+			local-mac-address = [ 00 00 00 00 00 00 ];
+			interrupts = <4 0x8>;
+			interrupt-parent = < &ipic >;
+			phy-handle = < &phy >;
+			fsl,align-tx-packets = <4>;
+		};
+
 		// 512x PSCs are not 52xx PSCs compatible
 		// PSC3 serial port A aka ttyPSC0
 		serial@11300 {
diff --git a/drivers/net/fs_enet/Kconfig b/drivers/net/fs_enet/Kconfig
index 562ea68..5806cea 100644
--- a/drivers/net/fs_enet/Kconfig
+++ b/drivers/net/fs_enet/Kconfig
@@ -1,30 +1,28 @@
 config FS_ENET
-       tristate "Freescale Ethernet Driver"
-       depends on CPM1 || CPM2
+       bool
        select MII
        select PHYLIB
 
 config FS_ENET_HAS_SCC
-	bool "Chip has an SCC usable for ethernet"
-	depends on FS_ENET && (CPM1 || CPM2)
-	default y
+	bool "Freescale CPM SCC Ethernet"
+	depends on CPM1 || CPM2
+	select FS_ENET
 
 config FS_ENET_HAS_FCC
-	bool "Chip has an FCC usable for ethernet"
-	depends on FS_ENET && CPM2
-	default y
+	bool "Freescale CPM FCC Ethernet"
+	depends on CPM2
+	select FS_ENET
 
 config FS_ENET_HAS_FEC
-	bool "Chip has an FEC usable for ethernet"
-	depends on FS_ENET && CPM1
-	select FS_ENET_MDIO_FEC
-	default y
+	bool "Freescale Fast Ethernet Controller"
+	depends on CPM1 || PPC_MPC512x
+	select FS_ENET
 
 config FS_ENET_MDIO_FEC
-	tristate "MDIO driver for FEC"
-	depends on FS_ENET && CPM1
+	bool "Freescale FEC MDIO"
+	depends on FS_ENET_HAS_FEC 
 
 config FS_ENET_MDIO_FCC
-	tristate "MDIO driver for FCC"
-	depends on FS_ENET && CPM2
+	bool "Freescale CPM Bitbanged MDIO"
+	depends on CPM2
 	select MDIO_BITBANG
diff --git a/drivers/net/fs_enet/fec_mpc5121.h b/drivers/net/fs_enet/fec_mpc5121.h
new file mode 100644
index 0000000..e28c783
--- /dev/null
+++ b/drivers/net/fs_enet/fec_mpc5121.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2007,2008 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: John Rigby, <jrigby@freescale.com>
+ *
+ * Modified version of drivers/net/fec.h:
+ *
+ *	fec.h  --  Fast Ethernet Controller for Motorola ColdFire SoC
+ *		   processors.
+ *
+ *	(C) Copyright 2000-2005, Greg Ungerer (gerg@snapgear.com)
+ *	(C) Copyright 2000-2001, Lineo (www.lineo.com)
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+#ifndef FEC_MPC5121_H
+#define FEC_MPC5121_H
+
+#include <linux/types.h>
+#include <asm/cpm.h>
+
+struct fec {
+	u32 fec_reserved0;
+	u32 fec_ievent;		/* Interrupt event reg */
+	u32 fec_imask;		/* Interrupt mask reg */
+	u32 fec_reserved1;
+	u32 fec_r_des_active;	/* Receive descriptor reg */
+	u32 fec_x_des_active;	/* Transmit descriptor reg */
+	u32 fec_reserved2[3];
+	u32 fec_ecntrl;		/* Ethernet control reg */
+	u32 fec_reserved3[6];
+	u32 fec_mii_data;		/* MII manage frame reg */
+	u32 fec_mii_speed;		/* MII speed control reg */
+	u32 fec_reserved4[7];
+	u32 fec_mib_ctrlstat;	/* MIB control/status reg */
+	u32 fec_reserved5[7];
+	u32 fec_r_cntrl;		/* Receive control reg */
+	u32 fec_reserved6[15];
+	u32 fec_x_cntrl;		/* Transmit Control reg */
+	u32 fec_reserved7[7];
+	u32 fec_addr_low;		/* Low 32bits MAC address */
+	u32 fec_addr_high;		/* High 16bits MAC address */
+	u32 fec_opd;		/* Opcode + Pause duration */
+	u32 fec_reserved8[10];
+	u32 fec_hash_table_high;	/* High 32bits hash table */
+	u32 fec_hash_table_low;	/* Low 32bits hash table */
+	u32 fec_grp_hash_table_high;/* High 32bits hash table */
+	u32 fec_grp_hash_table_low;	/* Low 32bits hash table */
+	u32 fec_reserved9[7];
+	u32 fec_x_wmrk;		/* FIFO transmit water mark */
+	u32 fec_reserved10;
+	u32 fec_r_bound;		/* FIFO receive bound reg */
+	u32 fec_r_fstart;		/* FIFO receive start reg */
+	u32 fec_reserved11[11];
+	u32 fec_r_des_start;	/* Receive descriptor ring */
+	u32 fec_x_des_start;	/* Transmit descriptor ring */
+	u32 fec_r_buff_size;	/* Maximum receive buff size */
+	u32 fec_dma_control;	/* DMA Endian and other ctrl */
+};
+
+#endif /* FEC_MPC5121_H */
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 8ebf388..f3c3c8e 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -597,6 +597,37 @@ void fs_cleanup_bds(struct net_device *dev)
 
 /*******************************************************************************/
 
+/*
+ * The 5121 FEC doc says transmit buffers must have 4 byte alignment.
+ * We get alignement from the device tree in case this changes on future
+ * platforms.
+ */
+static struct sk_buff *align_tx_skb(struct net_device *dev, struct sk_buff *skb,
+			    int align)
+{
+	struct sk_buff *skbn;
+
+	if ((((unsigned long)skb->data) & (align-1)) == 0)
+		return skb;
+
+	skbn = dev_alloc_skb(ENET_RX_FRSIZE+align);
+	if (skbn)
+		skb_align(skbn, align);
+
+	if (!skbn) {
+		printk(KERN_WARNING DRV_MODULE_NAME
+			": %s Memory squeeze, dropping tx packet.\n",
+			dev->name);
+		dev_kfree_skb_any(skb);
+		return NULL;
+	}
+
+	skb_copy_from_linear_data(skb, skbn->data, skb->len);
+	skb_put(skbn, skb->len);
+	dev_kfree_skb_any(skb);
+	return skbn;
+}
+
 static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct fs_enet_private *fep = netdev_priv(dev);
@@ -605,6 +636,8 @@ static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	u16 sc;
 	unsigned long flags;
 
+	if (fep->fpi->align_tx_packets)
+		skb = align_tx_skb(dev, skb, fep->fpi->align_tx_packets);
 	spin_lock_irqsave(&fep->tx_lock, flags);
 
 	/*
@@ -1057,6 +1090,10 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
 		fpi->cp_command = *data;
 	}
 
+	data = of_get_property(ofdev->node, "fsl,align-tx-packets", &len);
+	if (data && len == 4)
+		fpi->align_tx_packets = *data;
+
 	fpi->rx_ring = 32;
 	fpi->tx_ring = 32;
 	fpi->rx_copybreak = 240;
@@ -1184,6 +1221,10 @@ static struct of_device_id fs_enet_match[] = {
 		.compatible = "fsl,pq1-fec-enet",
 		.data = (void *)&fs_fec_ops,
 	},
+	{
+		.compatible = "fsl,mpc5121-fec",
+		.data = (void *)&fs_fec_ops,
+	},
 #endif
 	{}
 };
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h
index 7bf779a..ea70938 100644
--- a/drivers/net/fs_enet/fs_enet.h
+++ b/drivers/net/fs_enet/fs_enet.h
@@ -10,12 +10,17 @@
 
 #include <linux/fs_enet_pd.h>
 #include <asm/fs_pd.h>
+#ifdef CONFIG_PPC_MPC512x
+#include "fec_mpc5121.h"
+#endif
 
 #ifdef CONFIG_CPM1
 #include <asm/cpm1.h>
+#endif
 
+#if defined(CONFIG_FS_ENET_HAS_FEC)
 struct fec_info {
-	fec_t __iomem *fecp;
+	struct fec __iomem *fecp;
 	u32 mii_speed;
 };
 #endif
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index cac51b1..e2ea216 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -43,6 +43,9 @@
 #include <asm/mpc8xx.h>
 #include <asm/cpm1.h>
 #endif
+#ifdef CONFIG_PPC_MPC512x
+#include "fec_mpc5121.h"
+#endif
 
 #include "fs_enet.h"
 #include "fec.h"
@@ -285,7 +288,9 @@ static void restart(struct net_device *dev)
 	 * Set maximum receive buffer size.
 	 */
 	FW(fecp, r_buff_size, PKT_MAXBLR_SIZE);
+#ifdef CONFIG_CPM1
 	FW(fecp, r_hash, PKT_MAXBUF_SIZE);
+#endif
 
 	/* get physical address */
 	rx_bd_base_phys = fep->ring_mem_addr;
@@ -299,10 +304,17 @@ static void restart(struct net_device *dev)
 
 	fs_init_bds(dev);
 
+#ifdef CONFIG_CPM1
 	/*
 	 * Enable big endian and don't care about SDMA FC.
 	 */
 	FW(fecp, fun_code, 0x78000000);
+#else
+	/*
+	 * Set DATA_BO and DESC_BO and leave the rest unchanged
+	 */
+	FS(fecp, dma_control, 0xc0000000);
+#endif
 
 	/*
 	 * Set MII speed.
@@ -313,11 +325,13 @@ static void restart(struct net_device *dev)
 	 * Clear any outstanding interrupt.
 	 */
 	FW(fecp, ievent, 0xffc0);
+#ifdef CONFIG_CPM1
 #ifndef CONFIG_PPC_MERGE
 	FW(fecp, ivec, (fep->interrupt / 2) << 29);
 #else
 	FW(fecp, ivec, (virq_to_hw(fep->interrupt) / 2) << 29);
 #endif
+#endif
 
 	/*
 	 * adjust to speed (only for DUET & RMII)
@@ -347,9 +361,13 @@ static void restart(struct net_device *dev)
 		out_be32(&immap->im_cpm.cp_cptr, cptr);
 	}
 #endif
-
-
+#ifdef CONFIG_CPM1
 	FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE);	/* MII enable */
+#else
+	FW(fecp, r_cntrl, PKT_MAXBUF_SIZE<<16);	/* max frame size */
+	FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */
+#endif
+
 	/*
 	 * adjust to duplex mode
 	 */
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index 5079dcf..a1bca5f 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -214,9 +214,16 @@ static int fs_enet_mdio_remove(struct of_device *ofdev)
 }
 
 static struct of_device_id fs_enet_mdio_fec_match[] = {
+#ifdef CONFIG_CPM1
 	{
 		.compatible = "fsl,pq1-fec-mdio",
 	},
+#endif
+#ifdef CONFIG_PPC_MPC512x
+	{
+		.compatible = "fsl,mpc5121-fec-mdio",
+	},
+#endif
 	{},
 };
 
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 0ba21ee..28df8d1 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -148,6 +148,8 @@ struct fs_platform_info {
 
 	int use_rmii;		/* use RMII mode 	       */
 	int has_phy;            /* if the network is phy container as well...*/
+
+	int align_tx_packets;	/* align transmit skb's */
 };
 struct fs_mii_fec_platform_info {
 	u32 irq[32];
-- 
1.5.6.rc0.46.gd2b3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] fs_enet: fix checkpatch.pl problems
  2008-06-17 23:03 ` [PATCH 1/2] fs_enet: fix checkpatch.pl problems John Rigby
  2008-06-17 23:03   ` [PATCH 2/2] fs_enet: add MPC5121 FEC support John Rigby
@ 2008-06-18  3:54   ` Jeff Garzik
  2008-06-18  4:12     ` John Rigby
  2008-06-18  5:20   ` Grant Likely
  2008-06-18 15:50   ` Scott Wood
  3 siblings, 1 reply; 9+ messages in thread
From: Jeff Garzik @ 2008-06-18  3:54 UTC (permalink / raw)
  To: John Rigby; +Cc: Scott Wood, linuxppc-dev, Sam Ravnborg, netdev

John Rigby wrote:
> Fixed all errors and warnings that checkpatch.pl
> reports if this was a new submission.
> Also changed instances of fec_t to struct fec in
> mac-fec.c and mii-fec.c.
> 
> This is in preparation of adding MPC5121 support.
> 
> Signed-off-by: John Rigby <jrigby@freescale.com>
> ---
>  drivers/net/fs_enet/fs_enet-main.c |   70 ++++++++++++++++++++---------------
>  drivers/net/fs_enet/fs_enet.h      |   15 +++++---
>  drivers/net/fs_enet/mac-fcc.c      |    7 ++--
>  drivers/net/fs_enet/mac-fec.c      |   40 ++++++++++----------
>  drivers/net/fs_enet/mac-scc.c      |   13 ++++---
>  drivers/net/fs_enet/mii-bitbang.c  |    4 +-
>  drivers/net/fs_enet/mii-fec.c      |   23 +++++++-----
>  7 files changed, 95 insertions(+), 77 deletions(-)

patch does not apply

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] fs_enet: fix checkpatch.pl problems
  2008-06-18  3:54   ` [PATCH 1/2] fs_enet: fix checkpatch.pl problems Jeff Garzik
@ 2008-06-18  4:12     ` John Rigby
  2008-06-18 15:07       ` Kumar Gala
  0 siblings, 1 reply; 9+ messages in thread
From: John Rigby @ 2008-06-18  4:12 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Scott Wood, linuxppc-dev, Sam Ravnborg, netdev

[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]

Sorry, I thought I was doing the right thing to base the patch on Kumar's
patch that removes the CONFIG_PPC_CPM_NEW_BINDING stuff.  That is likely why
it did not apply.

On Tue, Jun 17, 2008 at 9:54 PM, Jeff Garzik <jeff@garzik.org> wrote:

> John Rigby wrote:
>
>> Fixed all errors and warnings that checkpatch.pl
>> reports if this was a new submission.
>> Also changed instances of fec_t to struct fec in
>> mac-fec.c and mii-fec.c.
>>
>> This is in preparation of adding MPC5121 support.
>>
>> Signed-off-by: John Rigby <jrigby@freescale.com>
>> ---
>>  drivers/net/fs_enet/fs_enet-main.c |   70
>> ++++++++++++++++++++---------------
>>  drivers/net/fs_enet/fs_enet.h      |   15 +++++---
>>  drivers/net/fs_enet/mac-fcc.c      |    7 ++--
>>  drivers/net/fs_enet/mac-fec.c      |   40 ++++++++++----------
>>  drivers/net/fs_enet/mac-scc.c      |   13 ++++---
>>  drivers/net/fs_enet/mii-bitbang.c  |    4 +-
>>  drivers/net/fs_enet/mii-fec.c      |   23 +++++++-----
>>  7 files changed, 95 insertions(+), 77 deletions(-)
>>
>
> patch does not apply
>
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>

[-- Attachment #2: Type: text/html, Size: 2074 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] fs_enet: fix checkpatch.pl problems
  2008-06-17 23:03 ` [PATCH 1/2] fs_enet: fix checkpatch.pl problems John Rigby
  2008-06-17 23:03   ` [PATCH 2/2] fs_enet: add MPC5121 FEC support John Rigby
  2008-06-18  3:54   ` [PATCH 1/2] fs_enet: fix checkpatch.pl problems Jeff Garzik
@ 2008-06-18  5:20   ` Grant Likely
  2008-06-18 13:29     ` John Rigby
  2008-06-18 15:50   ` Scott Wood
  3 siblings, 1 reply; 9+ messages in thread
From: Grant Likely @ 2008-06-18  5:20 UTC (permalink / raw)
  To: John Rigby; +Cc: Scott Wood, linuxppc-dev, Sam Ravnborg, jeff, netdev

On Tue, Jun 17, 2008 at 5:03 PM, John Rigby <jrigby@freescale.com> wrote:
> Fixed all errors and warnings that checkpatch.pl
> reports if this was a new submission.
> Also changed instances of fec_t to struct fec in
> mac-fec.c and mii-fec.c.

Nit: checkpatch is not law; particularly in the case of whitespace
change.  Personally, I think cleaning up whitespace in this regard
causes more problems than it solves.  Plus, it makes the important
change (fec_t -> struct fec) get lost in a see of unimportant ones
which makes for hard reviewing.

But I must sleep now; I'll review your other patch tomorrow.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] fs_enet: fix checkpatch.pl problems
  2008-06-18  5:20   ` Grant Likely
@ 2008-06-18 13:29     ` John Rigby
  0 siblings, 0 replies; 9+ messages in thread
From: John Rigby @ 2008-06-18 13:29 UTC (permalink / raw)
  To: Grant Likely; +Cc: Scott Wood, linuxppc-dev, Sam Ravnborg, jeff, netdev

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

I agree, I'll separate the fec_t -> struct fec changes out.

On Tue, Jun 17, 2008 at 11:20 PM, Grant Likely <grant.likely@secretlab.ca>
wrote:

> On Tue, Jun 17, 2008 at 5:03 PM, John Rigby <jrigby@freescale.com> wrote:
> > Fixed all errors and warnings that checkpatch.pl
> > reports if this was a new submission.
> > Also changed instances of fec_t to struct fec in
> > mac-fec.c and mii-fec.c.
>
> Nit: checkpatch is not law; particularly in the case of whitespace
> change.  Personally, I think cleaning up whitespace in this regard
> causes more problems than it solves.  Plus, it makes the important
> change (fec_t -> struct fec) get lost in a see of unimportant ones
> which makes for hard reviewing.
>
> But I must sleep now; I'll review your other patch tomorrow.
>
> Cheers,
> g.
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>

[-- Attachment #2: Type: text/html, Size: 1618 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] fs_enet: fix checkpatch.pl problems
  2008-06-18  4:12     ` John Rigby
@ 2008-06-18 15:07       ` Kumar Gala
  0 siblings, 0 replies; 9+ messages in thread
From: Kumar Gala @ 2008-06-18 15:07 UTC (permalink / raw)
  To: John Rigby; +Cc: Scott Wood, linuxppc-dev, Sam Ravnborg, Jeff Garzik, netdev


On Jun 17, 2008, at 11:12 PM, John Rigby wrote:

> Sorry, I thought I was doing the right thing to base the patch on  
> Kumar's patch that removes the CONFIG_PPC_CPM_NEW_BINDING stuff.   
> That is likely why it did not apply.

It is the right thing, we just need to work out the logistics here.   
Jeff, would you be willing to pull the following patch into your tree:

http://patchwork.ozlabs.org/linuxppc/patch?q=gala&filter=incoming&id=18939

(I can resend it to you if needed.  It seems better for you to have  
this patch in your tree to allow further development on the work John  
is doing)

- k

> On Tue, Jun 17, 2008 at 9:54 PM, Jeff Garzik <jeff@garzik.org> wrote:
> John Rigby wrote:
> Fixed all errors and warnings that checkpatch.pl
> reports if this was a new submission.
> Also changed instances of fec_t to struct fec in
> mac-fec.c and mii-fec.c.
>
> This is in preparation of adding MPC5121 support.
>
> Signed-off-by: John Rigby <jrigby@freescale.com>
> ---
>  drivers/net/fs_enet/fs_enet-main.c |   70 +++++++++++++++++++ 
> +---------------
>  drivers/net/fs_enet/fs_enet.h      |   15 +++++---
>  drivers/net/fs_enet/mac-fcc.c      |    7 ++--
>  drivers/net/fs_enet/mac-fec.c      |   40 ++++++++++----------
>  drivers/net/fs_enet/mac-scc.c      |   13 ++++---
>  drivers/net/fs_enet/mii-bitbang.c  |    4 +-
>  drivers/net/fs_enet/mii-fec.c      |   23 +++++++-----
>  7 files changed, 95 insertions(+), 77 deletions(-)
>
> patch does not apply
>
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] fs_enet: fix checkpatch.pl problems
  2008-06-17 23:03 ` [PATCH 1/2] fs_enet: fix checkpatch.pl problems John Rigby
                     ` (2 preceding siblings ...)
  2008-06-18  5:20   ` Grant Likely
@ 2008-06-18 15:50   ` Scott Wood
  3 siblings, 0 replies; 9+ messages in thread
From: Scott Wood @ 2008-06-18 15:50 UTC (permalink / raw)
  To: John Rigby; +Cc: linuxppc-dev, Sam Ravnborg, jeff, netdev

On Tue, Jun 17, 2008 at 05:03:13PM -0600, John Rigby wrote:
>  static int __devinit find_phy(struct device_node *np,
> -                              struct fs_platform_info *fpi)
> +			      struct fs_platform_info *fpi)

Please don't make this sort of change.  Spaces were used deliberately,
because it's alignment rather than indentation, and using tabs would make
things be unaligned with tab sizes other than 8, and (as can be seen above)
in patches.

Unfortunately, it's non-trivial to make checkpatch tell the difference
between the two (it would need to parse the language rather than do a simple
regex).

-Scott

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-06-18 15:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-17 23:03 [PATCH 0/2] Add MPC5121 FEC suppport John Rigby
2008-06-17 23:03 ` [PATCH 1/2] fs_enet: fix checkpatch.pl problems John Rigby
2008-06-17 23:03   ` [PATCH 2/2] fs_enet: add MPC5121 FEC support John Rigby
2008-06-18  3:54   ` [PATCH 1/2] fs_enet: fix checkpatch.pl problems Jeff Garzik
2008-06-18  4:12     ` John Rigby
2008-06-18 15:07       ` Kumar Gala
2008-06-18  5:20   ` Grant Likely
2008-06-18 13:29     ` John Rigby
2008-06-18 15:50   ` Scott Wood

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).