mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: designware patches
@ 2013-09-09 14:53 Sascha Hauer
  2013-09-09 14:53 ` [PATCH 1/6] net: designware: Fix broken cache invalidate Sascha Hauer
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Sascha Hauer @ 2013-09-09 14:53 UTC (permalink / raw)
  To: barebox

Some fixes/improvements for the designware network controller.

----------------------------------------------------------------
Sascha Hauer (6):
      net: designware: Fix broken cache invalidate
      net: designware: drop HAS_DESIGNWARE_ETH
      net: designware: use dma_alloc for descriptors
      net: designware: make alt/enhanced descriptor runtime configurable
      net: designware: Add decvicetree support
      net: designware: remove backspaces from code

 drivers/net/Kconfig      |   6 ---
 drivers/net/designware.c | 135 ++++++++++++++++++++++++++++++-----------------
 drivers/net/designware.h |  62 ++++++++--------------
 include/net/designware.h |   1 +
 4 files changed, 111 insertions(+), 93 deletions(-)

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 1/6] net: designware: Fix broken cache invalidate
  2013-09-09 14:53 [PATCH] net: designware patches Sascha Hauer
@ 2013-09-09 14:53 ` Sascha Hauer
  2013-09-09 14:53 ` [PATCH 2/6] net: designware: drop HAS_DESIGNWARE_ETH Sascha Hauer
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2013-09-09 14:53 UTC (permalink / raw)
  To: barebox

Move the cache invalidation of a received packet before we actually
use it.

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

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index a6b32b9..45de31c 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -337,14 +337,15 @@ static int dwc_ether_rx(struct eth_device *dev)
 	length = (status & DESC_RXSTS_FRMLENMSK) >> \
 		 DESC_RXSTS_FRMLENSHFT;
 
-	net_receive(desc_p->dmamac_addr, length);
-
 	/*
 	 * Make the current descriptor valid again and go to
 	 * the next one
 	 */
 	dma_inv_range((unsigned long)desc_p->dmamac_addr,
 		      (unsigned long)desc_p->dmamac_addr + length);
+
+	net_receive(desc_p->dmamac_addr, length);
+
 	desc_p->txrx_status |= DESC_RXSTS_OWNBYDMA;
 
 	/* Test the wrap-around condition. */
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/6] net: designware: drop HAS_DESIGNWARE_ETH
  2013-09-09 14:53 [PATCH] net: designware patches Sascha Hauer
  2013-09-09 14:53 ` [PATCH 1/6] net: designware: Fix broken cache invalidate Sascha Hauer
@ 2013-09-09 14:53 ` Sascha Hauer
  2013-09-09 14:53 ` [PATCH 3/6] net: designware: use dma_alloc for descriptors Sascha Hauer
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2013-09-09 14:53 UTC (permalink / raw)
  To: barebox

To let the driver just compile when needed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 5ad3e4d..bd04531 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -130,7 +130,6 @@ config DRIVER_NET_KS8851_MLL
 config DRIVER_NET_DESIGNWARE
 	bool "Designware Universal MAC ethernet driver"
 	select PHYLIB
-	depends on HAS_DESIGNWARE_ETH
 	help
 	  This option enables support for the Synopsys
 	  Designware Core Univesal MAC 10M/100M/1G ethernet IP.
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/6] net: designware: use dma_alloc for descriptors
  2013-09-09 14:53 [PATCH] net: designware patches Sascha Hauer
  2013-09-09 14:53 ` [PATCH 1/6] net: designware: Fix broken cache invalidate Sascha Hauer
  2013-09-09 14:53 ` [PATCH 2/6] net: designware: drop HAS_DESIGNWARE_ETH Sascha Hauer
@ 2013-09-09 14:53 ` Sascha Hauer
  2013-09-09 14:53 ` [PATCH 4/6] net: designware: make alt/enhanced descriptor runtime configurable Sascha Hauer
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2013-09-09 14:53 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/designware.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 45de31c..33d7345 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -418,8 +418,8 @@ static int dwc_ether_probe(struct device_d *dev)
 		CONFIG_TX_DESCR_NUM * sizeof(struct dmamacdescr));
 	priv->rx_mac_descrtable = dma_alloc_coherent(
 		CONFIG_RX_DESCR_NUM * sizeof(struct dmamacdescr));
-	priv->txbuffs = malloc(TX_TOTAL_BUFSIZE);
-	priv->rxbuffs = malloc(RX_TOTAL_BUFSIZE);
+	priv->txbuffs = dma_alloc(TX_TOTAL_BUFSIZE);
+	priv->rxbuffs = dma_alloc(RX_TOTAL_BUFSIZE);
 	priv->fix_mac_speed = pdata->fix_mac_speed;
 
 	edev = &priv->netdev;
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 4/6] net: designware: make alt/enhanced descriptor runtime configurable
  2013-09-09 14:53 [PATCH] net: designware patches Sascha Hauer
                   ` (2 preceding siblings ...)
  2013-09-09 14:53 ` [PATCH 3/6] net: designware: use dma_alloc for descriptors Sascha Hauer
@ 2013-09-09 14:53 ` Sascha Hauer
  2013-09-09 14:53 ` [PATCH 5/6] net: designware: Add decvicetree support Sascha Hauer
  2013-09-09 14:53 ` [PATCH 6/6] net: designware: remove backspaces from code Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2013-09-09 14:53 UTC (permalink / raw)
  To: barebox

Instead of hardcoding the alternate/enhanced descriptor layout make
it configurable during runtime. This is based on the value of the
enh_desc variable which is currently hardcoded to zero. This should
be configurable via device_id in the future. Since currently we have
no in tree user of this driver this currently doesn't hurt.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/Kconfig      |  5 ----
 drivers/net/designware.c | 64 +++++++++++++++++++++++++-----------------------
 drivers/net/designware.h | 62 +++++++++++++++++-----------------------------
 3 files changed, 56 insertions(+), 75 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index bd04531..5d7d20f 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -134,11 +134,6 @@ config DRIVER_NET_DESIGNWARE
 	  This option enables support for the Synopsys
 	  Designware Core Univesal MAC 10M/100M/1G ethernet IP.
 
-config DRIVER_NET_DESIGNWARE_ALTDESCRIPTOR
-	bool
-	depends on DRIVER_NET_DESIGNWARE
-	default n
-
 config DRIVER_NET_GIANFAR
 	bool "Gianfar Ethernet"
 	depends on ARCH_MPC85XX
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 33d7345..0b5390d 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -54,6 +54,7 @@ struct dw_eth_dev {
 	struct eth_dma_regs *dma_regs_p;
 	int phy_addr;
 	phy_interface_t interface;
+	int enh_desc;
 };
 
 /* Speed specific definitions */
@@ -149,19 +150,19 @@ static void tx_descs_init(struct eth_device *dev)
 		desc_p->dmamac_addr = &txbuffs[idx * CONFIG_ETH_BUFSIZE];
 		desc_p->dmamac_next = &desc_table_p[idx + 1];
 
-#if defined(CONFIG_DRIVER_NET_DESIGNWARE_ALTDESCRIPTOR)
-		desc_p->txrx_status &= ~(DESC_TXSTS_TXINT | DESC_TXSTS_TXLAST |
-				DESC_TXSTS_TXFIRST | DESC_TXSTS_TXCRCDIS | \
-				DESC_TXSTS_TXCHECKINSCTRL | \
-				DESC_TXSTS_TXRINGEND | DESC_TXSTS_TXPADDIS);
-
-		desc_p->txrx_status |= DESC_TXSTS_TXCHAIN;
-		desc_p->dmamac_cntl = 0;
-		desc_p->txrx_status &= ~(DESC_TXSTS_MSK | DESC_TXSTS_OWNBYDMA);
-#else
-		desc_p->dmamac_cntl = DESC_TXCTRL_TXCHAIN;
-		desc_p->txrx_status = 0;
-#endif
+		if (priv->enh_desc) {
+			desc_p->txrx_status &= ~(DESC_ENH_TXSTS_TXINT | DESC_ENH_TXSTS_TXLAST |
+					DESC_ENH_TXSTS_TXFIRST | DESC_ENH_TXSTS_TXCRCDIS |
+					DESC_ENH_TXSTS_TXCHECKINSCTRL |
+					DESC_ENH_TXSTS_TXRINGEND | DESC_ENH_TXSTS_TXPADDIS);
+
+			desc_p->txrx_status |= DESC_ENH_TXSTS_TXCHAIN;
+			desc_p->dmamac_cntl = 0;
+			desc_p->txrx_status &= ~(DESC_ENH_TXSTS_MSK | DESC_ENH_TXSTS_OWNBYDMA);
+		} else {
+			desc_p->dmamac_cntl = DESC_TXCTRL_TXCHAIN;
+			desc_p->txrx_status = 0;
+		}
 	}
 
 	/* Correcting the last pointer of the chain */
@@ -184,9 +185,11 @@ static void rx_descs_init(struct eth_device *dev)
 		desc_p->dmamac_addr = &rxbuffs[idx * CONFIG_ETH_BUFSIZE];
 		desc_p->dmamac_next = &desc_table_p[idx + 1];
 
-		desc_p->dmamac_cntl =
-			(MAC_MAX_FRAME_SZ & DESC_RXCTRL_SIZE1MASK) | \
-				      DESC_RXCTRL_RXCHAIN;
+		desc_p->dmamac_cntl = MAC_MAX_FRAME_SZ;
+		if (priv->enh_desc)
+			desc_p->dmamac_cntl |= DESC_ENH_RXCTRL_RXCHAIN;
+		else
+			desc_p->dmamac_cntl |= DESC_RXCTRL_RXCHAIN;
 
 		dma_inv_range((unsigned long)desc_p->dmamac_addr,
 			      (unsigned long)desc_p->dmamac_addr + CONFIG_ETH_BUFSIZE);
@@ -282,11 +285,12 @@ static int dwc_ether_send(struct eth_device *dev, void *packet, int length)
 {
 	struct dw_eth_dev *priv = dev->priv;
 	struct eth_dma_regs *dma_p = priv->dma_regs_p;
-	u32 desc_num = priv->tx_currdescnum;
+	u32 owndma, desc_num = priv->tx_currdescnum;
 	struct dmamacdescr *desc_p = &priv->tx_mac_descrtable[desc_num];
 
+	owndma = priv->enh_desc ? DESC_ENH_TXSTS_OWNBYDMA : DESC_TXSTS_OWNBYDMA;
 	/* Check if the descriptor is owned by CPU */
-	if (desc_p->txrx_status & DESC_TXSTS_OWNBYDMA) {
+	if (desc_p->txrx_status & owndma) {
 		dev_err(&dev->dev, "CPU not owner of tx frame\n");
 		return -1;
 	}
@@ -295,20 +299,20 @@ static int dwc_ether_send(struct eth_device *dev, void *packet, int length)
 	dma_flush_range((unsigned long)desc_p->dmamac_addr,
 			(unsigned long)desc_p->dmamac_addr + length);
 
-#if defined(CONFIG_DRIVER_NET_DESIGNWARE_ALTDESCRIPTOR)
-	desc_p->txrx_status |= DESC_TXSTS_TXFIRST | DESC_TXSTS_TXLAST;
-	desc_p->dmamac_cntl |= (length << DESC_TXCTRL_SIZE1SHFT) & \
-			       DESC_TXCTRL_SIZE1MASK;
+	if (priv->enh_desc) {
+		desc_p->txrx_status |= DESC_ENH_TXSTS_TXFIRST | DESC_ENH_TXSTS_TXLAST;
+		desc_p->dmamac_cntl |= (length << DESC_ENH_TXCTRL_SIZE1SHFT) &
+				       DESC_ENH_TXCTRL_SIZE1MASK;
 
-	desc_p->txrx_status &= ~(DESC_TXSTS_MSK);
-	desc_p->txrx_status |= DESC_TXSTS_OWNBYDMA;
-#else
-	desc_p->dmamac_cntl |= ((length << DESC_TXCTRL_SIZE1SHFT) & \
-			       DESC_TXCTRL_SIZE1MASK) | DESC_TXCTRL_TXLAST | \
-			       DESC_TXCTRL_TXFIRST;
+		desc_p->txrx_status &= ~(DESC_ENH_TXSTS_MSK);
+		desc_p->txrx_status |= DESC_ENH_TXSTS_OWNBYDMA;
+	} else {
+		desc_p->dmamac_cntl |= ((length << DESC_TXCTRL_SIZE1SHFT) &
+				       DESC_TXCTRL_SIZE1MASK) | DESC_TXCTRL_TXLAST |
+				       DESC_TXCTRL_TXFIRST;
 
-	desc_p->txrx_status = DESC_TXSTS_OWNBYDMA;
-#endif
+		desc_p->txrx_status = DESC_TXSTS_OWNBYDMA;
+	}
 
 	/* Test the wrap-around condition. */
 	if (++desc_num >= CONFIG_TX_DESCR_NUM)
diff --git a/drivers/net/designware.h b/drivers/net/designware.h
index db2ead4..f7b14be 100644
--- a/drivers/net/designware.h
+++ b/drivers/net/designware.h
@@ -130,27 +130,21 @@ struct dmamacdescr {
  */
 
 /* tx status bits definitions */
-#if defined(CONFIG_DRIVER_NET_DESIGNWARE_ALTDESCRIPTOR)
+#define DESC_ENH_TXSTS_OWNBYDMA		(1 << 31)
+#define DESC_ENH_TXSTS_TXINT		(1 << 30)
+#define DESC_ENH_TXSTS_TXLAST		(1 << 29)
+#define DESC_ENH_TXSTS_TXFIRST		(1 << 28)
+#define DESC_ENH_TXSTS_TXCRCDIS		(1 << 27)
+
+#define DESC_ENH_TXSTS_TXPADDIS		(1 << 26)
+#define DESC_ENH_TXSTS_TXCHECKINSCTRL	(3 << 22)
+#define DESC_ENH_TXSTS_TXRINGEND		(1 << 21)
+#define DESC_ENH_TXSTS_TXCHAIN		(1 << 20)
+#define DESC_ENH_TXSTS_MSK			(0x1FFFF << 0)
 
 #define DESC_TXSTS_OWNBYDMA		(1 << 31)
-#define DESC_TXSTS_TXINT		(1 << 30)
-#define DESC_TXSTS_TXLAST		(1 << 29)
-#define DESC_TXSTS_TXFIRST		(1 << 28)
-#define DESC_TXSTS_TXCRCDIS		(1 << 27)
-
-#define DESC_TXSTS_TXPADDIS		(1 << 26)
-#define DESC_TXSTS_TXCHECKINSCTRL	(3 << 22)
-#define DESC_TXSTS_TXRINGEND		(1 << 21)
-#define DESC_TXSTS_TXCHAIN		(1 << 20)
 #define DESC_TXSTS_MSK			(0x1FFFF << 0)
 
-#else
-
-#define DESC_TXSTS_OWNBYDMA		(1 << 31)
-#define DESC_TXSTS_MSK			(0x1FFFF << 0)
-
-#endif
-
 /* rx status bits definitions */
 #define DESC_RXSTS_OWNBYDMA		(1 << 31)
 #define DESC_RXSTS_DAFILTERFAIL		(1 << 30)
@@ -178,14 +172,10 @@ struct dmamacdescr {
  */
 
 /* tx control bits definitions */
-#if defined(CONFIG_DRIVER_NET_DESIGNWARE_ALTDESCRIPTOR)
-
-#define DESC_TXCTRL_SIZE1MASK		(0x1FFF << 0)
-#define DESC_TXCTRL_SIZE1SHFT		(0)
-#define DESC_TXCTRL_SIZE2MASK		(0x1FFF << 16)
-#define DESC_TXCTRL_SIZE2SHFT		(16)
-
-#else
+#define DESC_ENH_TXCTRL_SIZE1MASK		(0x1FFF << 0)
+#define DESC_ENH_TXCTRL_SIZE1SHFT		(0)
+#define DESC_ENH_TXCTRL_SIZE2MASK		(0x1FFF << 16)
+#define DESC_ENH_TXCTRL_SIZE2SHFT		(16)
 
 #define DESC_TXCTRL_TXINT		(1 << 31)
 #define DESC_TXCTRL_TXLAST		(1 << 30)
@@ -200,21 +190,15 @@ struct dmamacdescr {
 #define DESC_TXCTRL_SIZE2MASK		(0x7FF << 11)
 #define DESC_TXCTRL_SIZE2SHFT		(11)
 
-#endif
-
 /* rx control bits definitions */
-#if defined(CONFIG_DRIVER_NET_DESIGNWARE_ALTDESCRIPTOR)
-
-#define DESC_RXCTRL_RXINTDIS		(1 << 31)
-#define DESC_RXCTRL_RXRINGEND		(1 << 15)
-#define DESC_RXCTRL_RXCHAIN		(1 << 14)
+#define DESC_ENH_RXCTRL_RXINTDIS		(1 << 31)
+#define DESC_ENH_RXCTRL_RXRINGEND		(1 << 15)
+#define DESC_ENH_RXCTRL_RXCHAIN		(1 << 14)
 
-#define DESC_RXCTRL_SIZE1MASK		(0x1FFF << 0)
-#define DESC_RXCTRL_SIZE1SHFT		(0)
-#define DESC_RXCTRL_SIZE2MASK		(0x1FFF << 16)
-#define DESC_RXCTRL_SIZE2SHFT		(16)
-
-#else
+#define DESC_ENH_RXCTRL_SIZE1MASK		(0x1FFF << 0)
+#define DESC_ENH_RXCTRL_SIZE1SHFT		(0)
+#define DESC_ENH_RXCTRL_SIZE2MASK		(0x1FFF << 16)
+#define DESC_ENH_RXCTRL_SIZE2SHFT		(16)
 
 #define DESC_RXCTRL_RXINTDIS		(1 << 31)
 #define DESC_RXCTRL_RXRINGEND		(1 << 25)
@@ -226,5 +210,3 @@ struct dmamacdescr {
 #define DESC_RXCTRL_SIZE2SHFT		(11)
 
 #endif
-
-#endif
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 5/6] net: designware: Add decvicetree support
  2013-09-09 14:53 [PATCH] net: designware patches Sascha Hauer
                   ` (3 preceding siblings ...)
  2013-09-09 14:53 ` [PATCH 4/6] net: designware: make alt/enhanced descriptor runtime configurable Sascha Hauer
@ 2013-09-09 14:53 ` Sascha Hauer
  2013-09-09 14:53 ` [PATCH 6/6] net: designware: remove backspaces from code Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2013-09-09 14:53 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/designware.c | 54 ++++++++++++++++++++++++++++++++++++++++--------
 include/net/designware.h |  1 +
 2 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 0b5390d..a71e2e9 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -29,12 +29,12 @@
 #include <init.h>
 #include <io.h>
 #include <net.h>
+#include <of_net.h>
 #include <asm/mmu.h>
 #include <net/designware.h>
 #include <linux/phy.h>
 #include "designware.h"
 
-
 struct dw_eth_dev {
 	struct eth_device netdev;
 	struct mii_bus miibus;
@@ -57,6 +57,14 @@ struct dw_eth_dev {
 	int enh_desc;
 };
 
+struct dw_eth_drvdata {
+	bool enh_desc;
+};
+
+static struct dw_eth_drvdata dwmac_370a_drvdata = {
+	.enh_desc = 1,
+};
+
 /* Speed specific definitions */
 #define SPEED_10M		1
 #define SPEED_100M		2
@@ -399,6 +407,14 @@ static void dwc_version(struct device_d *dev, u32 hwid)
 		uid, synid);
 }
 
+static int dwc_probe_dt(struct device_d *dev, struct dw_eth_dev *priv)
+{
+	priv->phy_addr = -1;
+	priv->interface = of_get_phy_mode(dev->device_node);
+
+	return 0;
+}
+
 static int dwc_ether_probe(struct device_d *dev)
 {
 	struct dw_eth_dev *priv;
@@ -406,14 +422,27 @@ static int dwc_ether_probe(struct device_d *dev)
 	struct mii_bus *miibus;
 	void __iomem *base;
 	struct dwc_ether_platform_data *pdata = dev->platform_data;
-
-	if (!pdata) {
-		printf("dwc_ether: no platform_data\n");
-		return -ENODEV;
-	}
+	int ret;
+	struct dw_eth_drvdata *drvdata;
 
 	priv = xzalloc(sizeof(struct dw_eth_dev));
 
+	ret = dev_get_drvdata(dev, (unsigned long *)&drvdata);
+	if (ret)
+		return ret;
+
+	priv->enh_desc = drvdata->enh_desc;
+
+	if (pdata) {
+		priv->phy_addr = pdata->phy_addr;
+		priv->interface = pdata->interface;
+		priv->fix_mac_speed = pdata->fix_mac_speed;
+	} else {
+		ret = dwc_probe_dt(dev, priv);
+		if (ret)
+			return ret;
+	}
+
 	base = dev_request_mem_region(dev, 0);
 	priv->mac_regs_p = base;
 	dwc_version(dev, readl(&priv->mac_regs_p->version));
@@ -424,7 +453,6 @@ static int dwc_ether_probe(struct device_d *dev)
 		CONFIG_RX_DESCR_NUM * sizeof(struct dmamacdescr));
 	priv->txbuffs = dma_alloc(TX_TOTAL_BUFSIZE);
 	priv->rxbuffs = dma_alloc(RX_TOTAL_BUFSIZE);
-	priv->fix_mac_speed = pdata->fix_mac_speed;
 
 	edev = &priv->netdev;
 	miibus = &priv->miibus;
@@ -439,8 +467,6 @@ static int dwc_ether_probe(struct device_d *dev)
 	edev->get_ethaddr = dwc_ether_get_ethaddr;
 	edev->set_ethaddr = dwc_ether_set_ethaddr;
 
-	priv->phy_addr = pdata->phy_addr;
-	priv->interface = pdata->interface;
 	miibus->parent = dev;
 	miibus->read = dwc_ether_mii_read;
 	miibus->write = dwc_ether_mii_write;
@@ -455,9 +481,19 @@ static void dwc_ether_remove(struct device_d *dev)
 {
 }
 
+static __maybe_unused struct of_device_id dwc_ether_compatible[] = {
+	{
+		.compatible = "snps,dwmac-3.70a",
+		.data = (unsigned long)&dwmac_370a_drvdata,
+	}, {
+		/* sentinel */
+	}
+};
+
 static struct driver_d dwc_ether_driver = {
 	.name = "designware_eth",
 	.probe = dwc_ether_probe,
 	.remove = dwc_ether_remove,
+	.of_compatible = DRV_OF_COMPAT(dwc_ether_compatible),
 };
 device_platform_driver(dwc_ether_driver);
diff --git a/include/net/designware.h b/include/net/designware.h
index 3f31c97..7a7a26a 100644
--- a/include/net/designware.h
+++ b/include/net/designware.h
@@ -7,6 +7,7 @@ struct dwc_ether_platform_data {
 	int phy_addr;
 	phy_interface_t interface;
 	void (*fix_mac_speed)(int speed);
+	bool enh_desc;	/* use Alternate/Enhanced Descriptor configurations */
 };
 
 #endif
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 6/6] net: designware: remove backspaces from code
  2013-09-09 14:53 [PATCH] net: designware patches Sascha Hauer
                   ` (4 preceding siblings ...)
  2013-09-09 14:53 ` [PATCH 5/6] net: designware: Add decvicetree support Sascha Hauer
@ 2013-09-09 14:53 ` Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2013-09-09 14:53 UTC (permalink / raw)
  To: barebox

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

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index a71e2e9..ecb4656 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -82,7 +82,7 @@ static int dwc_ether_mii_read(struct mii_bus *dev, int addr, int reg)
 	u64 start;
 	u32 miiaddr;
 
-	miiaddr = ((addr << MIIADDRSHIFT) & MII_ADDRMSK) | \
+	miiaddr = ((addr << MIIADDRSHIFT) & MII_ADDRMSK) |
 		  ((reg << MIIREGSHIFT) & MII_REGMSK);
 
 	writel(miiaddr | MII_CLKRANGE_150_250M | MII_BUSY, &mac_p->miiaddr);
@@ -105,7 +105,7 @@ static int dwc_ether_mii_write(struct mii_bus *dev, int addr, int reg, u16 val)
 	u32 miiaddr;
 
 	writel(val, &mac_p->miidata);
-	miiaddr = ((addr << MIIADDRSHIFT) & MII_ADDRMSK) | \
+	miiaddr = ((addr << MIIADDRSHIFT) & MII_ADDRMSK) |
 		  ((reg << MIIREGSHIFT) & MII_REGMSK) | MII_WRITE;
 
 	writel(miiaddr | MII_CLKRANGE_150_250M | MII_BUSY, &mac_p->miiaddr);
@@ -346,7 +346,7 @@ static int dwc_ether_rx(struct eth_device *dev)
 	if (status & DESC_RXSTS_OWNBYDMA)
 		return 0;
 
-	length = (status & DESC_RXSTS_FRMLENMSK) >> \
+	length = (status & DESC_RXSTS_FRMLENMSK) >>
 		 DESC_RXSTS_FRMLENSHFT;
 
 	/*
@@ -389,7 +389,7 @@ static int dwc_ether_set_ethaddr(struct eth_device *dev, u8 adr[6])
 	struct eth_mac_regs *mac_p = priv->mac_regs_p;
 	u32 macid_lo, macid_hi;
 
-	macid_lo = adr[0] + (adr[1] << 8) + \
+	macid_lo = adr[0] + (adr[1] << 8) +
 		   (adr[2] << 16) + (adr[3] << 24);
 	macid_hi = adr[4] + (adr[5] << 8);
 	writel(macid_hi, &mac_p->macaddr0hi);
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2013-09-09 14:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-09 14:53 [PATCH] net: designware patches Sascha Hauer
2013-09-09 14:53 ` [PATCH 1/6] net: designware: Fix broken cache invalidate Sascha Hauer
2013-09-09 14:53 ` [PATCH 2/6] net: designware: drop HAS_DESIGNWARE_ETH Sascha Hauer
2013-09-09 14:53 ` [PATCH 3/6] net: designware: use dma_alloc for descriptors Sascha Hauer
2013-09-09 14:53 ` [PATCH 4/6] net: designware: make alt/enhanced descriptor runtime configurable Sascha Hauer
2013-09-09 14:53 ` [PATCH 5/6] net: designware: Add decvicetree support Sascha Hauer
2013-09-09 14:53 ` [PATCH 6/6] net: designware: remove backspaces from code Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox