netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 0/9] macb: add support for Cadence GEM
@ 2011-03-15 10:14 Jamie Iles
  2011-03-15 10:14 ` [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name Jamie Iles
                   ` (9 more replies)
  0 siblings, 10 replies; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 10:14 UTC (permalink / raw)
  To: netdev, linux-arm-kernel; +Cc: nicolas.ferre, plagnioj, Jamie Iles

This patch series extends the Atmel MACB driver to support the Cadence
GEM (Gigabit Ethernet MAC) to support 10/100 operation.  The GEM is
based on the MACB block but has a few moved registers and bitfields.
This patch series attempts to use the MACB accessors where block
functionallity is identical and only overrides to GEM specific
acccessors when needed.

This has been runtested on a board with a Cadence GEM and compile tested
for all at91 configurations and a number of avr32 configurations.

Changes since v1:
	- AT91 now provides a fake "hclk" and "macb_clk" has been
	renamed to "pclk" to be consistent with AVR32.
	- Configurable GEM receive buffer size support has been added.
	- pr_foo() and dev_foo() have been converted to netdev_foo()
	where appropriate.
	- New conditional accessors (macb_or_gem_{read,write}l) have
	been introduced that do the conditional accesses dependent on
	macb/gem type.
	- GEM is now dynamically detected from the module ID rather than
	platform device name.

Jean-Christophe, I haven't based this on your conditional clock patch as
I wasn't sure what decision had been made on that and whether the
at91/avr32 detection is reliable.

Jamie Iles (9):
  at91: provide macb clks with "pclk" and "hclk" name
  macb: remove conditional clk handling
  macb: unify at91 and avr32 platform data
  macb: convert printk to netdev_ and friends
  macb: initial support for Cadence GEM
  macb: support higher rate GEM MDIO clock divisors
  macb: support statistics for GEM devices
  macb: support DMA bus widths > 32 bits
  macb: allow GEM to have configurable receive buffer size

 arch/arm/mach-at91/at572d940hf.c            |    8 +-
 arch/arm/mach-at91/at572d940hf_devices.c    |    6 +-
 arch/arm/mach-at91/at91cap9.c               |    8 +-
 arch/arm/mach-at91/at91cap9_devices.c       |    6 +-
 arch/arm/mach-at91/at91rm9200_devices.c     |    6 +-
 arch/arm/mach-at91/at91sam9260.c            |    8 +-
 arch/arm/mach-at91/at91sam9260_devices.c    |    6 +-
 arch/arm/mach-at91/at91sam9263.c            |    8 +-
 arch/arm/mach-at91/at91sam9263_devices.c    |    6 +-
 arch/arm/mach-at91/at91sam9g45.c            |    8 +-
 arch/arm/mach-at91/at91sam9g45_devices.c    |    6 +-
 arch/arm/mach-at91/board-1arm.c             |    2 +-
 arch/arm/mach-at91/board-afeb-9260v1.c      |    2 +-
 arch/arm/mach-at91/board-at572d940hf_ek.c   |    2 +-
 arch/arm/mach-at91/board-cam60.c            |    2 +-
 arch/arm/mach-at91/board-cap9adk.c          |    2 +-
 arch/arm/mach-at91/board-carmeva.c          |    2 +-
 arch/arm/mach-at91/board-cpu9krea.c         |    2 +-
 arch/arm/mach-at91/board-cpuat91.c          |    2 +-
 arch/arm/mach-at91/board-csb337.c           |    2 +-
 arch/arm/mach-at91/board-csb637.c           |    2 +-
 arch/arm/mach-at91/board-eb9200.c           |    2 +-
 arch/arm/mach-at91/board-ecbat91.c          |    2 +-
 arch/arm/mach-at91/board-eco920.c           |    2 +-
 arch/arm/mach-at91/board-foxg20.c           |    2 +-
 arch/arm/mach-at91/board-gsia18s.c          |    2 +-
 arch/arm/mach-at91/board-kafa.c             |    2 +-
 arch/arm/mach-at91/board-kb9202.c           |    2 +-
 arch/arm/mach-at91/board-neocore926.c       |    2 +-
 arch/arm/mach-at91/board-pcontrol-g20.c     |    2 +-
 arch/arm/mach-at91/board-picotux200.c       |    2 +-
 arch/arm/mach-at91/board-qil-a9260.c        |    2 +-
 arch/arm/mach-at91/board-rm9200dk.c         |    2 +-
 arch/arm/mach-at91/board-rm9200ek.c         |    2 +-
 arch/arm/mach-at91/board-sam9-l9260.c       |    2 +-
 arch/arm/mach-at91/board-sam9260ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9263ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9g20ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9m10g45ek.c     |    2 +-
 arch/arm/mach-at91/board-snapper9260.c      |    2 +-
 arch/arm/mach-at91/board-stamp9g20.c        |    2 +-
 arch/arm/mach-at91/board-usb-a9260.c        |    2 +-
 arch/arm/mach-at91/board-usb-a9263.c        |    2 +-
 arch/arm/mach-at91/board-yl-9200.c          |    2 +-
 arch/arm/mach-at91/include/mach/board.h     |   14 +-
 arch/avr32/mach-at32ap/include/mach/board.h |    5 +-
 drivers/net/Kconfig                         |    8 +-
 drivers/net/macb.c                          |  331 ++++++++++++++++++---------
 drivers/net/macb.h                          |  146 ++++++++++++-
 include/linux/platform_data/macb.h          |   10 +
 50 files changed, 466 insertions(+), 190 deletions(-)
 create mode 100644 include/linux/platform_data/macb.h

-- 
1.7.4


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

* [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name
  2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
@ 2011-03-15 10:14 ` Jamie Iles
  2011-03-15 12:35   ` Jean-Christophe PLAGNIOL-VILLARD
  2011-03-16  6:53   ` avictor.za
  2011-03-15 10:14 ` [PATCHv2 2/9] macb: remove conditional clk handling Jamie Iles
                   ` (8 subsequent siblings)
  9 siblings, 2 replies; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 10:14 UTC (permalink / raw)
  To: netdev, linux-arm-kernel; +Cc: nicolas.ferre, plagnioj, Jamie Iles

The macb driver expects clocks with the names "pclk" and "hclk".  We
currently provide "macb_clk" but to fit in line with other
architectures (namely AVR32), provide "pclk" and a fake "hclk".

Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 arch/arm/mach-at91/at572d940hf.c |    8 +++++++-
 arch/arm/mach-at91/at91cap9.c    |    8 +++++++-
 arch/arm/mach-at91/at91sam9260.c |    8 +++++++-
 arch/arm/mach-at91/at91sam9263.c |    8 +++++++-
 arch/arm/mach-at91/at91sam9g45.c |    8 +++++++-
 5 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-at91/at572d940hf.c b/arch/arm/mach-at91/at572d940hf.c
index a6b9c68..9b3a37e 100644
--- a/arch/arm/mach-at91/at572d940hf.c
+++ b/arch/arm/mach-at91/at572d940hf.c
@@ -71,10 +71,15 @@ static struct clk pioC_clk = {
 	.type		= CLK_TYPE_PERIPHERAL,
 };
 static struct clk macb_clk = {
-	.name		= "macb_clk",
+	.name		= "pclk",
 	.pmc_mask	= 1 << AT572D940HF_ID_EMAC,
 	.type		= CLK_TYPE_PERIPHERAL,
 };
+static struct clk macb_hclk = {
+	.name		= "hclk",
+	.pmc_mask	= 0,
+	.type		= CLK_TYPE_PERIPHERAL,
+};
 static struct clk usart0_clk = {
 	.name		= "usart0_clk",
 	.pmc_mask	= 1 << AT572D940HF_ID_US0,
@@ -182,6 +187,7 @@ static struct clk *periph_clocks[] __initdata = {
 	&pioB_clk,
 	&pioC_clk,
 	&macb_clk,
+	&macb_hclk,
 	&usart0_clk,
 	&usart1_clk,
 	&usart2_clk,
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index 7337617..0d38ce7 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -150,10 +150,15 @@ static struct clk pwm_clk = {
 	.type		= CLK_TYPE_PERIPHERAL,
 };
 static struct clk macb_clk = {
-	.name		= "macb_clk",
+	.name		= "pclk",
 	.pmc_mask	= 1 << AT91CAP9_ID_EMAC,
 	.type		= CLK_TYPE_PERIPHERAL,
 };
+static struct clk macb_hclk = {
+	.name		= "hclk",
+	.pmc_mask	= 0,
+	.type		= CLK_TYPE_PERIPHERAL,
+};
 static struct clk aestdes_clk = {
 	.name		= "aestdes_clk",
 	.pmc_mask	= 1 << AT91CAP9_ID_AESTDES,
@@ -212,6 +217,7 @@ static struct clk *periph_clocks[] __initdata = {
 	&tcb_clk,
 	&pwm_clk,
 	&macb_clk,
+	&macb_hclk,
 	&aestdes_clk,
 	&adc_clk,
 	&isi_clk,
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 195208b..f00774c 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -162,10 +162,15 @@ static struct clk ohci_clk = {
 	.type		= CLK_TYPE_PERIPHERAL,
 };
 static struct clk macb_clk = {
-	.name		= "macb_clk",
+	.name		= "pclk",
 	.pmc_mask	= 1 << AT91SAM9260_ID_EMAC,
 	.type		= CLK_TYPE_PERIPHERAL,
 };
+static struct clk macb_hclk = {
+	.name		= "hclk",
+	.pmc_mask	= 0,
+	.type		= CLK_TYPE_PERIPHERAL,
+};
 static struct clk isi_clk = {
 	.name		= "isi_clk",
 	.pmc_mask	= 1 << AT91SAM9260_ID_ISI,
@@ -221,6 +226,7 @@ static struct clk *periph_clocks[] __initdata = {
 	&tc2_clk,
 	&ohci_clk,
 	&macb_clk,
+	&macb_hclk,
 	&isi_clk,
 	&usart3_clk,
 	&usart4_clk,
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 249f900..25cbae1 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -136,10 +136,15 @@ static struct clk pwm_clk = {
 	.type		= CLK_TYPE_PERIPHERAL,
 };
 static struct clk macb_clk = {
-	.name		= "macb_clk",
+	.name		= "pclk",
 	.pmc_mask	= 1 << AT91SAM9263_ID_EMAC,
 	.type		= CLK_TYPE_PERIPHERAL,
 };
+static struct clk macb_hclk = {
+	.name		= "hclk",
+	.pmc_mask	= 0,
+	.type		= CLK_TYPE_PERIPHERAL,
+};
 static struct clk dma_clk = {
 	.name		= "dma_clk",
 	.pmc_mask	= 1 << AT91SAM9263_ID_DMA,
@@ -190,6 +195,7 @@ static struct clk *periph_clocks[] __initdata = {
 	&tcb_clk,
 	&pwm_clk,
 	&macb_clk,
+	&macb_hclk,
 	&twodge_clk,
 	&udc_clk,
 	&isi_clk,
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index c67b47f..a4d4a2d 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -157,10 +157,15 @@ static struct clk ac97_clk = {
 	.type		= CLK_TYPE_PERIPHERAL,
 };
 static struct clk macb_clk = {
-	.name		= "macb_clk",
+	.name		= "pclk",
 	.pmc_mask	= 1 << AT91SAM9G45_ID_EMAC,
 	.type		= CLK_TYPE_PERIPHERAL,
 };
+static struct clk macb_hclk = {
+	.name		= "hclk",
+	.pmc_mask	= 0,
+	.type		= CLK_TYPE_PERIPHERAL,
+};
 static struct clk isi_clk = {
 	.name		= "isi_clk",
 	.pmc_mask	= 1 << AT91SAM9G45_ID_ISI,
@@ -224,6 +229,7 @@ static struct clk *periph_clocks[] __initdata = {
 	&lcdc_clk,
 	&ac97_clk,
 	&macb_clk,
+	&macb_hclk,
 	&isi_clk,
 	&udphs_clk,
 	&mmc1_clk,
-- 
1.7.4


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

* [PATCHv2 2/9] macb: remove conditional clk handling
  2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
  2011-03-15 10:14 ` [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name Jamie Iles
@ 2011-03-15 10:14 ` Jamie Iles
  2011-03-15 10:14 ` [PATCHv2 3/9] macb: unify at91 and avr32 platform data Jamie Iles
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 10:14 UTC (permalink / raw)
  To: netdev, linux-arm-kernel; +Cc: nicolas.ferre, plagnioj, Jamie Iles

AT91 now provides both "pclk" and "hclk" aliases for the the macb
device so we can use the same clk handling paths for both AT91 and
AVR32.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/net/macb.c |   23 ++---------------------
 1 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 79ccb54..e3860d6 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -1140,28 +1140,19 @@ static int __init macb_probe(struct platform_device *pdev)
 
 	spin_lock_init(&bp->lock);
 
-#if defined(CONFIG_ARCH_AT91)
-	bp->pclk = clk_get(&pdev->dev, "macb_clk");
+	bp->pclk = clk_get(&pdev->dev, "pclk");
 	if (IS_ERR(bp->pclk)) {
 		dev_err(&pdev->dev, "failed to get macb_clk\n");
 		goto err_out_free_dev;
 	}
 	clk_enable(bp->pclk);
-#else
-	bp->pclk = clk_get(&pdev->dev, "pclk");
-	if (IS_ERR(bp->pclk)) {
-		dev_err(&pdev->dev, "failed to get pclk\n");
-		goto err_out_free_dev;
-	}
+
 	bp->hclk = clk_get(&pdev->dev, "hclk");
 	if (IS_ERR(bp->hclk)) {
 		dev_err(&pdev->dev, "failed to get hclk\n");
 		goto err_out_put_pclk;
 	}
-
-	clk_enable(bp->pclk);
 	clk_enable(bp->hclk);
-#endif
 
 	bp->regs = ioremap(regs->start, regs->end - regs->start + 1);
 	if (!bp->regs) {
@@ -1245,14 +1236,10 @@ err_out_free_irq:
 err_out_iounmap:
 	iounmap(bp->regs);
 err_out_disable_clocks:
-#ifndef CONFIG_ARCH_AT91
 	clk_disable(bp->hclk);
 	clk_put(bp->hclk);
-#endif
 	clk_disable(bp->pclk);
-#ifndef CONFIG_ARCH_AT91
 err_out_put_pclk:
-#endif
 	clk_put(bp->pclk);
 err_out_free_dev:
 	free_netdev(dev);
@@ -1278,10 +1265,8 @@ static int __exit macb_remove(struct platform_device *pdev)
 		unregister_netdev(dev);
 		free_irq(dev->irq, dev);
 		iounmap(bp->regs);
-#ifndef CONFIG_ARCH_AT91
 		clk_disable(bp->hclk);
 		clk_put(bp->hclk);
-#endif
 		clk_disable(bp->pclk);
 		clk_put(bp->pclk);
 		free_netdev(dev);
@@ -1299,9 +1284,7 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state)
 
 	netif_device_detach(netdev);
 
-#ifndef CONFIG_ARCH_AT91
 	clk_disable(bp->hclk);
-#endif
 	clk_disable(bp->pclk);
 
 	return 0;
@@ -1313,9 +1296,7 @@ static int macb_resume(struct platform_device *pdev)
 	struct macb *bp = netdev_priv(netdev);
 
 	clk_enable(bp->pclk);
-#ifndef CONFIG_ARCH_AT91
 	clk_enable(bp->hclk);
-#endif
 
 	netif_device_attach(netdev);
 
-- 
1.7.4


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

* [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
  2011-03-15 10:14 ` [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name Jamie Iles
  2011-03-15 10:14 ` [PATCHv2 2/9] macb: remove conditional clk handling Jamie Iles
@ 2011-03-15 10:14 ` Jamie Iles
  2011-03-15 11:14   ` Peter Korsgaard
  2011-03-15 10:14 ` [PATCHv2 4/9] macb: convert printk to netdev_ and friends Jamie Iles
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 10:14 UTC (permalink / raw)
  To: netdev, linux-arm-kernel; +Cc: nicolas.ferre, plagnioj, Jamie Iles

Both at91 and avr32 defines its own platform data structure for
the macb driver and both share common structures though at91
includes a currently unused phy_irq_pin.  Create a common
eth_platform_data for macb that both at91 and avr32 can use.  In
future we can use this to support other architectures that use the
same IP block with the macb driver.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 arch/arm/mach-at91/at572d940hf_devices.c    |    6 +++---
 arch/arm/mach-at91/at91cap9_devices.c       |    6 +++---
 arch/arm/mach-at91/at91rm9200_devices.c     |    6 +++---
 arch/arm/mach-at91/at91sam9260_devices.c    |    6 +++---
 arch/arm/mach-at91/at91sam9263_devices.c    |    6 +++---
 arch/arm/mach-at91/at91sam9g45_devices.c    |    6 +++---
 arch/arm/mach-at91/board-1arm.c             |    2 +-
 arch/arm/mach-at91/board-afeb-9260v1.c      |    2 +-
 arch/arm/mach-at91/board-at572d940hf_ek.c   |    2 +-
 arch/arm/mach-at91/board-cam60.c            |    2 +-
 arch/arm/mach-at91/board-cap9adk.c          |    2 +-
 arch/arm/mach-at91/board-carmeva.c          |    2 +-
 arch/arm/mach-at91/board-cpu9krea.c         |    2 +-
 arch/arm/mach-at91/board-cpuat91.c          |    2 +-
 arch/arm/mach-at91/board-csb337.c           |    2 +-
 arch/arm/mach-at91/board-csb637.c           |    2 +-
 arch/arm/mach-at91/board-eb9200.c           |    2 +-
 arch/arm/mach-at91/board-ecbat91.c          |    2 +-
 arch/arm/mach-at91/board-eco920.c           |    2 +-
 arch/arm/mach-at91/board-foxg20.c           |    2 +-
 arch/arm/mach-at91/board-gsia18s.c          |    2 +-
 arch/arm/mach-at91/board-kafa.c             |    2 +-
 arch/arm/mach-at91/board-kb9202.c           |    2 +-
 arch/arm/mach-at91/board-neocore926.c       |    2 +-
 arch/arm/mach-at91/board-pcontrol-g20.c     |    2 +-
 arch/arm/mach-at91/board-picotux200.c       |    2 +-
 arch/arm/mach-at91/board-qil-a9260.c        |    2 +-
 arch/arm/mach-at91/board-rm9200dk.c         |    2 +-
 arch/arm/mach-at91/board-rm9200ek.c         |    2 +-
 arch/arm/mach-at91/board-sam9-l9260.c       |    2 +-
 arch/arm/mach-at91/board-sam9260ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9263ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9g20ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9m10g45ek.c     |    2 +-
 arch/arm/mach-at91/board-snapper9260.c      |    2 +-
 arch/arm/mach-at91/board-stamp9g20.c        |    2 +-
 arch/arm/mach-at91/board-usb-a9260.c        |    2 +-
 arch/arm/mach-at91/board-usb-a9263.c        |    2 +-
 arch/arm/mach-at91/board-yl-9200.c          |    2 +-
 arch/arm/mach-at91/include/mach/board.h     |   14 ++------------
 arch/avr32/mach-at32ap/include/mach/board.h |    5 +----
 drivers/net/macb.c                          |    4 +---
 include/linux/platform_data/macb.h          |   17 +++++++++++++++++
 43 files changed, 72 insertions(+), 70 deletions(-)
 create mode 100644 include/linux/platform_data/macb.h

diff --git a/arch/arm/mach-at91/at572d940hf_devices.c b/arch/arm/mach-at91/at572d940hf_devices.c
index 0fc20a2..6e1b9a3 100644
--- a/arch/arm/mach-at91/at572d940hf_devices.c
+++ b/arch/arm/mach-at91/at572d940hf_devices.c
@@ -140,7 +140,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct eth_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -167,7 +167,7 @@ static struct platform_device at572d940hf_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct eth_platform_data *data)
 {
 	if (!data)
 		return;
@@ -196,7 +196,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at572d940hf_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct eth_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index d1f775e..e041743 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -198,7 +198,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct eth_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -225,7 +225,7 @@ static struct platform_device at91cap9_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct eth_platform_data *data)
 {
 	if (!data)
 		return;
@@ -262,7 +262,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91cap9_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct eth_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 7b53922..5f873d5 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -127,7 +127,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct eth_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -154,7 +154,7 @@ static struct platform_device at91rm9200_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct eth_platform_data *data)
 {
 	if (!data)
 		return;
@@ -191,7 +191,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91rm9200_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct eth_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 07eb7b0..e172b46 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -128,7 +128,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct eth_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -155,7 +155,7 @@ static struct platform_device at91sam9260_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct eth_platform_data *data)
 {
 	if (!data)
 		return;
@@ -192,7 +192,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91sam9260_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct eth_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index fb5c23a..416613c 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -138,7 +138,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct eth_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -165,7 +165,7 @@ static struct platform_device at91sam9263_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct eth_platform_data *data)
 {
 	if (!data)
 		return;
@@ -202,7 +202,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91sam9263_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct eth_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 1e8f275..0867343 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -283,7 +283,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct eth_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -310,7 +310,7 @@ static struct platform_device at91sam9g45_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct eth_platform_data *data)
 {
 	if (!data)
 		return;
@@ -347,7 +347,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91sam9g45_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct eth_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index 8a3fc84..1961d1e 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -64,7 +64,7 @@ static void __init onearm_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata onearm_eth_data = {
+static struct eth_platform_data __initdata onearm_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index cba7f77..8943ff3 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -109,7 +109,7 @@ static struct spi_board_info afeb9260_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata afeb9260_macb_data = {
+static struct eth_platform_data __initdata afeb9260_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA9,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-at572d940hf_ek.c b/arch/arm/mach-at91/board-at572d940hf_ek.c
index 3929f1c..a17d8e7 100644
--- a/arch/arm/mach-at91/board-at572d940hf_ek.c
+++ b/arch/arm/mach-at91/board-at572d940hf_ek.c
@@ -104,7 +104,7 @@ static struct at91_mmc_data __initdata eb_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata eb_eth_data = {
+static struct eth_platform_data __initdata eb_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PB25,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index b54e3e6..8cc6bfc 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -121,7 +121,7 @@ static struct spi_board_info cam60_spi_devices[] __initdata = {
 /*
  * MACB Ethernet device
  */
-static struct __initdata at91_eth_data cam60_macb_data = {
+static struct __initdata eth_platform_data cam60_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PB5,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index e727444..8f9bc88 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -158,7 +158,7 @@ static struct at91_mmc_data __initdata cap9adk_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata cap9adk_macb_data = {
+static struct eth_platform_data __initdata cap9adk_macb_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 2e74a19..dbc9061 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -62,7 +62,7 @@ static void __init carmeva_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata carmeva_eth_data = {
+static struct eth_platform_data __initdata carmeva_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index 3838594..a7d0843 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -104,7 +104,7 @@ static struct at91_udc_data __initdata cpu9krea_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata cpu9krea_macb_data = {
+static struct eth_platform_data __initdata cpu9krea_macb_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index 2f4dd8c..52909f0 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -83,7 +83,7 @@ static void __init cpuat91_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata cpuat91_eth_data = {
+static struct eth_platform_data __initdata cpuat91_eth_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 464839d..7e062fa 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -63,7 +63,7 @@ static void __init csb337_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata csb337_eth_data = {
+static struct eth_platform_data __initdata csb337_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC2,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 431688c..fb8456e 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -57,7 +57,7 @@ static void __init csb637_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata csb637_eth_data = {
+static struct eth_platform_data __initdata csb637_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC0,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 6cf6566..ac71845 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -65,7 +65,7 @@ static void __init eb9200_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata eb9200_eth_data = {
+static struct eth_platform_data __initdata eb9200_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index de2fd04..aa8fb2a 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -65,7 +65,7 @@ static void __init ecb_at91init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata ecb_at91eth_data = {
+static struct eth_platform_data __initdata ecb_at91eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
index a158a0c..a1e9173 100644
--- a/arch/arm/mach-at91/board-eco920.c
+++ b/arch/arm/mach-at91/board-eco920.c
@@ -47,7 +47,7 @@ static void __init eco920_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata eco920_eth_data = {
+static struct eth_platform_data __initdata eco920_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC2,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
index dfc7dfe..b7630b9 100644
--- a/arch/arm/mach-at91/board-foxg20.c
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -141,7 +141,7 @@ static struct spi_board_info foxg20_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata foxg20_macb_data = {
+static struct eth_platform_data __initdata foxg20_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
index bc28136..0405b17 100644
--- a/arch/arm/mach-at91/board-gsia18s.c
+++ b/arch/arm/mach-at91/board-gsia18s.c
@@ -98,7 +98,7 @@ static struct at91_udc_data __initdata udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct eth_platform_data __initdata macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA28,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index d2e1f4e..f45fc82 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -62,7 +62,7 @@ static void __init kafa_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata kafa_eth_data = {
+static struct eth_platform_data __initdata kafa_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index a13d206..88a40c2 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -71,7 +71,7 @@ static void __init kb9202_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata kb9202_eth_data = {
+static struct eth_platform_data __initdata kb9202_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PB29,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index fe5f1d4..97890d8 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -161,7 +161,7 @@ static struct at91_mmc_data __initdata neocore926_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata neocore926_macb_data = {
+static struct eth_platform_data __initdata neocore926_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PE31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
index feb6578..03e8286 100644
--- a/arch/arm/mach-at91/board-pcontrol-g20.c
+++ b/arch/arm/mach-at91/board-pcontrol-g20.c
@@ -129,7 +129,7 @@ static struct at91_udc_data __initdata pcontrol_g20_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct eth_platform_data __initdata macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA28,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 55dad3a..3f3cd9c 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -65,7 +65,7 @@ static void __init picotux200_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata picotux200_eth_data = {
+static struct eth_platform_data __initdata picotux200_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 69d15a8..165e43e 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -110,7 +110,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct eth_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index 4c1047c..c31cdda 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -70,7 +70,7 @@ static void __init dk_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata dk_eth_data = {
+static struct eth_platform_data __initdata dk_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 9df1be8..0fe93aa 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -70,7 +70,7 @@ static void __init ek_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata ek_eth_data = {
+static struct eth_platform_data __initdata ek_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 25a26be..145884d 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -115,7 +115,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct eth_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index de1816e..fcaedf5 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -156,7 +156,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct eth_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index bfe490d..4f799a4 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -163,7 +163,7 @@ static struct at91_mmc_data __initdata ek_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct eth_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PE31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index ca8198b..d54b3e6 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -128,7 +128,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct eth_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 6c999db..7df85eb 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -120,7 +120,7 @@ static struct mci_platform_data __initdata mci1_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct eth_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PD5,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index 17f7d9b..6902e7d 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -70,7 +70,7 @@ static struct at91_udc_data __initdata snapper9260_udc_data = {
 	.vbus_polled		= 1,
 };
 
-static struct at91_eth_data snapper9260_macb_data = {
+static struct eth_platform_data snapper9260_macb_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index f8902b1..9a7c586 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -163,7 +163,7 @@ static struct at91_udc_data __initdata stamp9g20evb_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct eth_platform_data __initdata macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA28,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
index 07784ba..c756389 100644
--- a/arch/arm/mach-at91/board-usb-a9260.c
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -84,7 +84,7 @@ static struct at91_udc_data __initdata ek_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct eth_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
index b614508..e6c260d 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -97,7 +97,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct eth_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PE31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index e0f0080..102dfc1 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -112,7 +112,7 @@ static struct gpio_led yl9200_leds[] = {
 /*
  * Ethernet
  */
-static struct at91_eth_data __initdata yl9200_eth_data = {
+static struct eth_platform_data __initdata yl9200_eth_data = {
 	.phy_irq_pin		= AT91_PIN_PB28,
 	.is_rmii		= 1,
 };
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index 2b499eb..d970420 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -40,6 +40,7 @@
 #include <linux/atmel-mci.h>
 #include <sound/atmel-ac97c.h>
 #include <linux/serial.h>
+#include <linux/platform_data/macb.h>
 
  /* USB Device */
 struct at91_udc_data {
@@ -81,18 +82,7 @@ extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
   /* atmel-mci platform config */
 extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data);
 
- /* Ethernet (EMAC & MACB) */
-struct at91_eth_data {
-	u32		phy_mask;
-	u8		phy_irq_pin;	/* PHY IRQ */
-	u8		is_rmii;	/* using RMII interface? */
-};
-extern void __init at91_add_device_eth(struct at91_eth_data *data);
-
-#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9G20) || defined(CONFIG_ARCH_AT91CAP9) \
-	|| defined(CONFIG_ARCH_AT91SAM9G45) || defined(CONFIG_ARCH_AT572D940HF)
-#define eth_platform_data	at91_eth_data
-#endif
+extern void __init at91_add_device_eth(struct eth_platform_data *data);
 
  /* USB Host */
 struct at91_usbh_data {
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index 6174020..3d79356 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -6,6 +6,7 @@
 
 #include <linux/types.h>
 #include <linux/serial.h>
+#include <linux/platform_data/macb.h>
 
 #define GPIO_PIN_NONE	(-1)
 
@@ -41,10 +42,6 @@ struct atmel_uart_data {
 void at32_map_usart(unsigned int hw_id, unsigned int line, int flags);
 struct platform_device *at32_add_device_usart(unsigned int id);
 
-struct eth_platform_data {
-	u32	phy_mask;
-	u8	is_rmii;
-};
 struct platform_device *
 at32_add_device_eth(unsigned int id, struct eth_platform_data *data);
 
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index e3860d6..8403eee 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -18,12 +18,10 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/dma-mapping.h>
+#include <linux/platform_data/macb.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
 
-#include <mach/board.h>
-#include <mach/cpu.h>
-
 #include "macb.h"
 
 #define RX_BUFFER_SIZE		128
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
new file mode 100644
index 0000000..ed93b38
--- /dev/null
+++ b/include/linux/platform_data/macb.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __MACB_PDATA_H__
+#define __MACB_PDATA_H__
+
+struct eth_platform_data {
+	u32		phy_mask;
+	u8		phy_irq_pin;	/* PHY IRQ */
+	u8		is_rmii;	/* using RMII interface? */
+};
+
+#endif /* __MACB_PDATA_H__ */
-- 
1.7.4


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

* [PATCHv2 4/9] macb: convert printk to netdev_ and friends
  2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
                   ` (2 preceding siblings ...)
  2011-03-15 10:14 ` [PATCHv2 3/9] macb: unify at91 and avr32 platform data Jamie Iles
@ 2011-03-15 10:14 ` Jamie Iles
  2011-03-15 12:36   ` Jean-Christophe PLAGNIOL-VILLARD
  2011-03-15 10:14 ` [PATCHv2 5/9] macb: initial support for Cadence GEM Jamie Iles
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 10:14 UTC (permalink / raw)
  To: netdev, linux-arm-kernel; +Cc: nicolas.ferre, plagnioj, Jamie Iles

macb is already using the dev_dbg() and friends helpers so use netdev_()
along with a pr_fmt() definition to make the printing a little cleaner.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/net/macb.c |  113 +++++++++++++++++++++++++---------------------------
 1 files changed, 54 insertions(+), 59 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 8403eee..41cecfb 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) "macb: " fmt
 #include <linux/clk.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
@@ -81,7 +82,7 @@ static void __init macb_get_hwaddr(struct macb *bp)
 	if (is_valid_ether_addr(addr)) {
 		memcpy(bp->dev->dev_addr, addr, sizeof(addr));
 	} else {
-		dev_info(&bp->pdev->dev, "invalid hw address, using random\n");
+		netdev_info(bp->dev, "invalid hw address, using random\n");
 		random_ether_addr(bp->dev->dev_addr);
 	}
 }
@@ -175,11 +176,11 @@ static void macb_handle_link_change(struct net_device *dev)
 
 	if (status_change) {
 		if (phydev->link)
-			printk(KERN_INFO "%s: link up (%d/%s)\n",
-			       dev->name, phydev->speed,
-			       DUPLEX_FULL == phydev->duplex ? "Full":"Half");
+			netdev_info(dev, "link up (%d/%s)\n", phydev->speed,
+				    DUPLEX_FULL == phydev->duplex ?
+				    "Full" : "Half");
 		else
-			printk(KERN_INFO "%s: link down\n", dev->name);
+			netdev_info(dev, "link down\n");
 	}
 }
 
@@ -193,7 +194,7 @@ static int macb_mii_probe(struct net_device *dev)
 
 	phydev = phy_find_first(bp->mii_bus);
 	if (!phydev) {
-		printk (KERN_ERR "%s: no PHY found\n", dev->name);
+		netdev_err(dev, "no PHY found\n");
 		return -1;
 	}
 
@@ -206,7 +207,7 @@ static int macb_mii_probe(struct net_device *dev)
 				 PHY_INTERFACE_MODE_RMII :
 				 PHY_INTERFACE_MODE_MII);
 	if (ret) {
-		printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
+		netdev_err(dev, "Could not attach to PHY\n");
 		return ret;
 	}
 
@@ -300,14 +301,13 @@ static void macb_tx(struct macb *bp)
 	status = macb_readl(bp, TSR);
 	macb_writel(bp, TSR, status);
 
-	dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n",
-		(unsigned long)status);
+	netdev_dbg(bp->dev, "macb_tx status = %02lx\n", (unsigned long)status);
 
 	if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) {
 		int i;
-		printk(KERN_ERR "%s: TX %s, resetting buffers\n",
-			bp->dev->name, status & MACB_BIT(UND) ?
-			"underrun" : "retry limit exceeded");
+		netdev_err(bp->dev, "TX %s, resetting buffers\n",
+			   status & MACB_BIT(UND) ?
+			   "underrun" : "retry limit exceeded");
 
 		/* Transfer ongoing, disable transmitter, to avoid confusion */
 		if (status & MACB_BIT(TGO))
@@ -363,8 +363,8 @@ static void macb_tx(struct macb *bp)
 		if (!(bufstat & MACB_BIT(TX_USED)))
 			break;
 
-		dev_dbg(&bp->pdev->dev, "skb %u (data %p) TX complete\n",
-			tail, skb->data);
+		netdev_dbg(bp->dev, "skb %u (data %p) TX complete\n", tail,
+			   skb->data);
 		dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
 				 DMA_TO_DEVICE);
 		bp->stats.tx_packets++;
@@ -389,8 +389,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
 
 	len = MACB_BFEXT(RX_FRMLEN, bp->rx_ring[last_frag].ctrl);
 
-	dev_dbg(&bp->pdev->dev, "macb_rx_frame frags %u - %u (len %u)\n",
-		first_frag, last_frag, len);
+	netdev_dbg(bp->dev, "macb_rx_frame frags %u - %u (len %u)\n",
+		   first_frag, last_frag, len);
 
 	skb = dev_alloc_skb(len + RX_OFFSET);
 	if (!skb) {
@@ -431,8 +431,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
 
 	bp->stats.rx_packets++;
 	bp->stats.rx_bytes += len;
-	dev_dbg(&bp->pdev->dev, "received skb of length %u, csum: %08x\n",
-		skb->len, skb->csum);
+	netdev_dbg(bp->dev, "received skb of length %u, csum: %08x\n",
+		   skb->len, skb->csum);
 	netif_receive_skb(skb);
 
 	return 0;
@@ -509,8 +509,8 @@ static int macb_poll(struct napi_struct *napi, int budget)
 
 	work_done = 0;
 
-	dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n",
-		(unsigned long)status, budget);
+	netdev_dbg(bp->dev, "poll: status = %08lx, budget = %d\n",
+		   (unsigned long)status, budget);
 
 	work_done = macb_rx(bp, budget);
 	if (work_done < budget) {
@@ -559,8 +559,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
 			macb_writel(bp, IDR, MACB_RX_INT_FLAGS);
 
 			if (napi_schedule_prep(&bp->napi)) {
-				dev_dbg(&bp->pdev->dev,
-					"scheduling RX softirq\n");
+				netdev_dbg(bp->dev, "scheduling RX softirq\n");
 				__napi_schedule(&bp->napi);
 			}
 		}
@@ -576,11 +575,11 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
 
 		if (status & MACB_BIT(HRESP)) {
 			/*
-			 * TODO: Reset the hardware, and maybe move the printk
-			 * to a lower-priority context as well (work queue?)
+			 * TODO: Reset the hardware, and maybe move the
+			 * netdev_err to a lower-priority context as well
+			 * (work queue?)
 			 */
-			printk(KERN_ERR "%s: DMA bus error: HRESP not OK\n",
-			       dev->name);
+			netdev_err(dev, "DMA bus error: HRESP not OK\n");
 		}
 
 		status = macb_readl(bp, ISR);
@@ -616,12 +615,11 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 #ifdef DEBUG
 	int i;
-	dev_dbg(&bp->pdev->dev,
-		"start_xmit: len %u head %p data %p tail %p end %p\n",
-		skb->len, skb->head, skb->data,
-		skb_tail_pointer(skb), skb_end_pointer(skb));
-	dev_dbg(&bp->pdev->dev,
-		"data:");
+	netdev_dbg(bp->dev,
+		   "start_xmit: len %u head %p data %p tail %p end %p\n",
+		   skb->len, skb->head, skb->data,
+		   skb_tail_pointer(skb), skb_end_pointer(skb));
+	netdev_dbg(bp->dev, "data:");
 	for (i = 0; i < 16; i++)
 		printk(" %02x", (unsigned int)skb->data[i]);
 	printk("\n");
@@ -634,20 +632,19 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (TX_BUFFS_AVAIL(bp) < 1) {
 		netif_stop_queue(dev);
 		spin_unlock_irqrestore(&bp->lock, flags);
-		dev_err(&bp->pdev->dev,
-			"BUG! Tx Ring full when queue awake!\n");
-		dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n",
-			bp->tx_head, bp->tx_tail);
+		netdev_err(bp->dev, "BUG! Tx Ring full when queue awake!\n");
+		netdev_dbg(bp->dev, "tx_head = %u, tx_tail = %u\n",
+			   bp->tx_head, bp->tx_tail);
 		return NETDEV_TX_BUSY;
 	}
 
 	entry = bp->tx_head;
-	dev_dbg(&bp->pdev->dev, "Allocated ring entry %u\n", entry);
+	netdev_dbg(bp->dev, "Allocated ring entry %u\n", entry);
 	mapping = dma_map_single(&bp->pdev->dev, skb->data,
 				 len, DMA_TO_DEVICE);
 	bp->tx_skb[entry].skb = skb;
 	bp->tx_skb[entry].mapping = mapping;
-	dev_dbg(&bp->pdev->dev, "Mapped skb data %p to DMA addr %08lx\n",
+	netdev_dbg(bp->dev, "Mapped skb data %p to DMA addr %08lx\n",
 		skb->data, (unsigned long)mapping);
 
 	ctrl = MACB_BF(TX_FRMLEN, len);
@@ -710,27 +707,27 @@ static int macb_alloc_consistent(struct macb *bp)
 					 &bp->rx_ring_dma, GFP_KERNEL);
 	if (!bp->rx_ring)
 		goto out_err;
-	dev_dbg(&bp->pdev->dev,
-		"Allocated RX ring of %d bytes at %08lx (mapped %p)\n",
-		size, (unsigned long)bp->rx_ring_dma, bp->rx_ring);
+	netdev_dbg(bp->dev,
+		   "Allocated RX ring of %d bytes at %08lx (mapped %p)\n",
+		   size, (unsigned long)bp->rx_ring_dma, bp->rx_ring);
 
 	size = TX_RING_BYTES;
 	bp->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
 					 &bp->tx_ring_dma, GFP_KERNEL);
 	if (!bp->tx_ring)
 		goto out_err;
-	dev_dbg(&bp->pdev->dev,
-		"Allocated TX ring of %d bytes at %08lx (mapped %p)\n",
-		size, (unsigned long)bp->tx_ring_dma, bp->tx_ring);
+	netdev_dbg(bp->dev,
+		   "Allocated TX ring of %d bytes at %08lx (mapped %p)\n",
+		   size, (unsigned long)bp->tx_ring_dma, bp->tx_ring);
 
 	size = RX_RING_SIZE * RX_BUFFER_SIZE;
 	bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size,
 					    &bp->rx_buffers_dma, GFP_KERNEL);
 	if (!bp->rx_buffers)
 		goto out_err;
-	dev_dbg(&bp->pdev->dev,
-		"Allocated RX buffers of %d bytes at %08lx (mapped %p)\n",
-		size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers);
+	netdev_dbg(bp->dev,
+		   "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n",
+		   size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers);
 
 	return 0;
 
@@ -941,7 +938,7 @@ static int macb_open(struct net_device *dev)
 	struct macb *bp = netdev_priv(dev);
 	int err;
 
-	dev_dbg(&bp->pdev->dev, "open\n");
+	netdev_dbg(bp->dev, "open\n");
 
 	/* if the phy is not yet register, retry later*/
 	if (!bp->phy_dev)
@@ -952,9 +949,8 @@ static int macb_open(struct net_device *dev)
 
 	err = macb_alloc_consistent(bp);
 	if (err) {
-		printk(KERN_ERR
-		       "%s: Unable to allocate DMA memory (error %d)\n",
-		       dev->name, err);
+		netdev_err(dev, "Unable to allocate DMA memory (error %d)\n",
+			   err);
 		return err;
 	}
 
@@ -1163,9 +1159,8 @@ static int __init macb_probe(struct platform_device *pdev)
 	err = request_irq(dev->irq, macb_interrupt, IRQF_SAMPLE_RANDOM,
 			  dev->name, dev);
 	if (err) {
-		printk(KERN_ERR
-		       "%s: Unable to request IRQ %d (error %d)\n",
-		       dev->name, dev->irq, err);
+		dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n",
+			dev->irq, err);
 		goto err_out_iounmap;
 	}
 
@@ -1217,13 +1212,13 @@ static int __init macb_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, dev);
 
-	printk(KERN_INFO "%s: Atmel MACB at 0x%08lx irq %d (%pM)\n",
-	       dev->name, dev->base_addr, dev->irq, dev->dev_addr);
+	netdev_info(dev, "Atmel MACB at 0x%08lx irq %d (%pM)\n",
+		dev->base_addr, dev->irq, dev->dev_addr);
 
 	phydev = bp->phy_dev;
-	printk(KERN_INFO "%s: attached PHY driver [%s] "
-		"(mii_bus:phy_addr=%s, irq=%d)\n", dev->name,
-		phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
+	netdev_info(dev, "attached PHY driver [%s] "
+		    "(mii_bus:phy_addr=%s, irq=%d)\n", phydev->drv->name,
+		    dev_name(&phydev->dev), phydev->irq);
 
 	return 0;
 
-- 
1.7.4


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

* [PATCHv2 5/9] macb: initial support for Cadence GEM
  2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
                   ` (3 preceding siblings ...)
  2011-03-15 10:14 ` [PATCHv2 4/9] macb: convert printk to netdev_ and friends Jamie Iles
@ 2011-03-15 10:14 ` Jamie Iles
  2011-03-15 10:14 ` [PATCHv2 6/9] macb: support higher rate GEM MDIO clock divisors Jamie Iles
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 10:14 UTC (permalink / raw)
  To: netdev, linux-arm-kernel; +Cc: nicolas.ferre, plagnioj, Jamie Iles

The Cadence GEM is based on the MACB Ethernet controller but has a few
small changes with regards to register and bitfield placement.  This
patch detects the presence of a GEM by reading the module ID register
and setting a flag appropriately.

This handles the new HW address, USRIO and hash register base register
locations in GEM.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/net/Kconfig |    8 ++++--
 drivers/net/macb.c  |   43 +++++++++++++++++++++-----------------
 drivers/net/macb.h  |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 86 insertions(+), 22 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 3cdf485..30d43c2 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -223,12 +223,14 @@ menuconfig NET_ETHERNET
 if NET_ETHERNET
 
 config MACB
-	tristate "Atmel MACB support"
+	tristate "Cadence MACB/GEM support"
 	depends on HAVE_NET_MACB
 	select PHYLIB
 	help
-	  The Atmel MACB ethernet interface is found on many AT32 and AT91
-	  parts. Say Y to include support for the MACB chip.
+	  The Cadence MACB ethernet interface is found on many Atmel AT32 and
+	  AT91 parts.  This driver also supports the Cadence GEM (Gigabit
+	  Ethernet MAC found in some ARM SoC devices).  Note: the Gigabit mode
+	  is not yet supported.  Say Y to include support for the MACB/GEM chip.
 
 	  To compile this driver as a module, choose M here: the module
 	  will be called macb.
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 41cecfb..9cd1d7e 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -1,5 +1,5 @@
 /*
- * Atmel MACB Ethernet Controller driver
+ * Cadence MACB/GEM Ethernet Controller driver
  *
  * Copyright (C) 2004-2006 Atmel Corporation
  *
@@ -7,7 +7,6 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
 #define pr_fmt(fmt) "macb: " fmt
 #include <linux/clk.h>
 #include <linux/module.h>
@@ -58,9 +57,9 @@ static void __macb_set_hwaddr(struct macb *bp)
 	u16 top;
 
 	bottom = cpu_to_le32(*((u32 *)bp->dev->dev_addr));
-	macb_writel(bp, SA1B, bottom);
+	macb_or_gem_writel(bp, SA1B, bottom);
 	top = cpu_to_le16(*((u16 *)(bp->dev->dev_addr + 4)));
-	macb_writel(bp, SA1T, top);
+	macb_or_gem_writel(bp, SA1T, top);
 }
 
 static void __init macb_get_hwaddr(struct macb *bp)
@@ -69,8 +68,8 @@ static void __init macb_get_hwaddr(struct macb *bp)
 	u16 top;
 	u8 addr[6];
 
-	bottom = macb_readl(bp, SA1B);
-	top = macb_readl(bp, SA1T);
+	bottom = macb_or_gem_readl(bp, SA1B);
+	top = macb_or_gem_readl(bp, SA1T);
 
 	addr[0] = bottom & 0xff;
 	addr[1] = (bottom >> 8) & 0xff;
@@ -893,8 +892,8 @@ static void macb_sethashtable(struct net_device *dev)
 		mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
 	}
 
-	macb_writel(bp, HRB, mc_filter[0]);
-	macb_writel(bp, HRT, mc_filter[1]);
+	macb_or_gem_writel(bp, HRB, mc_filter[0]);
+	macb_or_gem_writel(bp, HRT, mc_filter[1]);
 }
 
 /*
@@ -916,8 +915,8 @@ static void macb_set_rx_mode(struct net_device *dev)
 
 	if (dev->flags & IFF_ALLMULTI) {
 		/* Enable all multicast mode */
-		macb_writel(bp, HRB, -1);
-		macb_writel(bp, HRT, -1);
+		macb_or_gem_writel(bp, HRB, -1);
+		macb_or_gem_writel(bp, HRT, -1);
 		cfg |= MACB_BIT(NCFGR_MTI);
 	} else if (!netdev_mc_empty(dev)) {
 		/* Enable specific multicasts */
@@ -925,8 +924,8 @@ static void macb_set_rx_mode(struct net_device *dev)
 		cfg |= MACB_BIT(NCFGR_MTI);
 	} else if (dev->flags & (~IFF_ALLMULTI)) {
 		/* Disable all multicast mode */
-		macb_writel(bp, HRB, 0);
-		macb_writel(bp, HRT, 0);
+		macb_or_gem_writel(bp, HRB, 0);
+		macb_or_gem_writel(bp, HRT, 0);
 		cfg &= ~MACB_BIT(NCFGR_MTI);
 	}
 
@@ -1164,6 +1163,10 @@ static int __init macb_probe(struct platform_device *pdev)
 		goto err_out_iounmap;
 	}
 
+	/* Cadence GEM has a module ID of 2. */
+	if (MACB_BFEXT(IDNUM, macb_readl(bp, MID)) == 0x2)
+		bp->is_gem = 1;
+
 	dev->netdev_ops = &macb_netdev_ops;
 	netif_napi_add(dev, &bp->napi, macb_poll, 64);
 	dev->ethtool_ops = &macb_ethtool_ops;
@@ -1187,15 +1190,16 @@ static int __init macb_probe(struct platform_device *pdev)
 
 	if (pdata && pdata->is_rmii)
 #if defined(CONFIG_ARCH_AT91)
-		macb_writel(bp, USRIO, (MACB_BIT(RMII) | MACB_BIT(CLKEN)) );
+		macb_or_gem_writel(bp, USRIO, (MACB_BIT(RMII) |
+					       MACB_BIT(CLKEN)));
 #else
-		macb_writel(bp, USRIO, 0);
+		macb_or_gem_writel(bp, USRIO, 0);
 #endif
 	else
 #if defined(CONFIG_ARCH_AT91)
-		macb_writel(bp, USRIO, MACB_BIT(CLKEN));
+		macb_or_gem_writel(bp, USRIO, MACB_BIT(CLKEN));
 #else
-		macb_writel(bp, USRIO, MACB_BIT(MII));
+		macb_or_gem_writel(bp, USRIO, MACB_BIT(MII));
 #endif
 
 	bp->tx_pending = DEF_TX_RING_PENDING;
@@ -1212,8 +1216,9 @@ static int __init macb_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, dev);
 
-	netdev_info(dev, "Atmel MACB at 0x%08lx irq %d (%pM)\n",
-		dev->base_addr, dev->irq, dev->dev_addr);
+	netdev_info(dev, "Cadence %s at 0x%08lx irq %d (%pM)\n",
+		    bp->is_gem ? "GEM" : "MACB", dev->base_addr,
+		    dev->irq, dev->dev_addr);
 
 	phydev = bp->phy_dev;
 	netdev_info(dev, "attached PHY driver [%s] "
@@ -1324,6 +1329,6 @@ module_init(macb_init);
 module_exit(macb_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Atmel MACB Ethernet driver");
+MODULE_DESCRIPTION("Cadence MACB/GEM Ethernet driver");
 MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
 MODULE_ALIAS("platform:macb");
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index d3212f6..3a07352 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -59,6 +59,15 @@
 #define MACB_TPQ				0x00bc
 #define MACB_USRIO				0x00c0
 #define MACB_WOL				0x00c4
+#define MACB_MID				0x00fc
+
+/* GEM register offsets. */
+#define GEM_NCFGR				0x0004
+#define GEM_USRIO				0x000c
+#define GEM_HRB					0x0080
+#define GEM_HRT					0x0084
+#define GEM_SA1B				0x0088
+#define GEM_SA1T				0x008C
 
 /* Bitfields in NCR */
 #define MACB_LB_OFFSET				0
@@ -228,6 +237,12 @@
 #define MACB_WOL_MTI_OFFSET			19
 #define MACB_WOL_MTI_SIZE			1
 
+/* Bitfields in MID */
+#define MACB_IDNUM_OFFSET			16
+#define MACB_IDNUM_SIZE				16
+#define MACB_REV_OFFSET				0
+#define MACB_REV_SIZE				16
+
 /* Constants for CLK */
 #define MACB_CLK_DIV8				0
 #define MACB_CLK_DIV16				1
@@ -254,11 +269,52 @@
 		    << MACB_##name##_OFFSET))		\
 	 | MACB_BF(name,value))
 
+#define GEM_BIT(name)					\
+	(1 << GEM_##name##_OFFSET)
+#define GEM_BF(name, value)				\
+	(((value) & ((1 << GEM_##name##_SIZE) - 1))	\
+	 << GEM_##name##_OFFSET)
+#define GEM_BFEXT(name, value)\
+	(((value) >> GEM_##name##_OFFSET)		\
+	 & ((1 << GEM_##name##_SIZE) - 1))
+#define GEM_BFINS(name, value, old)			\
+	(((old) & ~(((1 << GEM_##name##_SIZE) - 1)	\
+		    << GEM_##name##_OFFSET))		\
+	 | GEM_BF(name, value))
+
 /* Register access macros */
 #define macb_readl(port,reg)				\
 	__raw_readl((port)->regs + MACB_##reg)
 #define macb_writel(port,reg,value)			\
 	__raw_writel((value), (port)->regs + MACB_##reg)
+#define gem_readl(port, reg)				\
+	__raw_readl((port)->regs + GEM_##reg)
+#define gem_writel(port, reg, value)			\
+	__raw_writel((value), (port)->regs + GEM_##reg)
+
+/*
+ * Conditional GEM/MACB macros.  These perform the operation to the correct
+ * register dependent on whether the device is a GEM or a MACB.  For registers
+ * and bitfields that are common across both devices, use macb_{read,write}l
+ * to avoid the cost of the conditional.
+ */
+#define macb_or_gem_writel(__bp, __reg, __value) \
+	({ \
+		if ((__bp)->is_gem) \
+			gem_writel((__bp), __reg, __value); \
+		else \
+			macb_writel((__bp), __reg, __value); \
+	})
+
+#define macb_or_gem_readl(__bp, __reg) \
+	({ \
+		u32 __v; \
+		if ((__bp)->is_gem) \
+			__v = gem_readl((__bp), __reg); \
+		else \
+			__v = macb_readl((__bp), __reg); \
+		__v; \
+	})
 
 struct dma_desc {
 	u32	addr;
@@ -360,6 +416,7 @@ struct macb_stats {
 
 struct macb {
 	void __iomem		*regs;
+	int			is_gem;
 
 	unsigned int		rx_tail;
 	struct dma_desc		*rx_ring;
-- 
1.7.4


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

* [PATCHv2 6/9] macb: support higher rate GEM MDIO clock divisors
  2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
                   ` (4 preceding siblings ...)
  2011-03-15 10:14 ` [PATCHv2 5/9] macb: initial support for Cadence GEM Jamie Iles
@ 2011-03-15 10:14 ` Jamie Iles
  2011-03-15 10:14 ` [PATCHv2 7/9] macb: support statistics for GEM devices Jamie Iles
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 10:14 UTC (permalink / raw)
  To: netdev, linux-arm-kernel; +Cc: nicolas.ferre, plagnioj, Jamie Iles

GEM devices support larger clock divisors and have a different
range of divisors.  Program the MDIO clock divisors based on the
device type.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/net/macb.c |   55 +++++++++++++++++++++++++++++++++++++++++----------
 drivers/net/macb.h |   11 ++++++++++
 2 files changed, 55 insertions(+), 11 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 9cd1d7e..f3da878 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -780,6 +780,48 @@ static void macb_reset_hw(struct macb *bp)
 	macb_readl(bp, ISR);
 }
 
+static u32 gem_mdc_clk_div(struct macb *bp)
+{
+	u32 config;
+	unsigned long pclk_hz = clk_get_rate(bp->pclk);
+
+	if (pclk_hz <= 20000000)
+		config = GEM_BF(CLK, GEM_CLK_DIV8);
+	else if (pclk_hz <= 40000000)
+		config = GEM_BF(CLK, GEM_CLK_DIV16);
+	else if (pclk_hz <= 80000000)
+		config = GEM_BF(CLK, GEM_CLK_DIV32);
+	else if (pclk_hz <= 120000000)
+		config = GEM_BF(CLK, GEM_CLK_DIV48);
+	else if (pclk_hz <= 160000000)
+		config = GEM_BF(CLK, GEM_CLK_DIV64);
+	else
+		config = GEM_BF(CLK, GEM_CLK_DIV96);
+
+	return config;
+}
+
+static u32 macb_mdc_clk_div(struct macb *bp)
+{
+	u32 config;
+	unsigned long pclk_hz;
+
+	if (bp->is_gem)
+		return gem_mdc_clk_div(bp);
+
+	pclk_hz = clk_get_rate(bp->pclk);
+	if (pclk_hz <= 20000000)
+		config = MACB_BF(CLK, MACB_CLK_DIV8);
+	else if (pclk_hz <= 40000000)
+		config = MACB_BF(CLK, MACB_CLK_DIV16);
+	else if (pclk_hz <= 80000000)
+		config = MACB_BF(CLK, MACB_CLK_DIV32);
+	else
+		config = MACB_BF(CLK, MACB_CLK_DIV64);
+
+	return config;
+}
+
 static void macb_init_hw(struct macb *bp)
 {
 	u32 config;
@@ -787,7 +829,7 @@ static void macb_init_hw(struct macb *bp)
 	macb_reset_hw(bp);
 	__macb_set_hwaddr(bp);
 
-	config = macb_readl(bp, NCFGR) & MACB_BF(CLK, -1L);
+	config = macb_mdc_clk_div(bp);
 	config |= MACB_BIT(PAE);		/* PAuse Enable */
 	config |= MACB_BIT(DRFCS);		/* Discard Rx FCS */
 	config |= MACB_BIT(BIG);		/* Receive oversized frames */
@@ -1105,7 +1147,6 @@ static int __init macb_probe(struct platform_device *pdev)
 	struct net_device *dev;
 	struct macb *bp;
 	struct phy_device *phydev;
-	unsigned long pclk_hz;
 	u32 config;
 	int err = -ENXIO;
 
@@ -1174,15 +1215,7 @@ static int __init macb_probe(struct platform_device *pdev)
 	dev->base_addr = regs->start;
 
 	/* Set MII management clock divider */
-	pclk_hz = clk_get_rate(bp->pclk);
-	if (pclk_hz <= 20000000)
-		config = MACB_BF(CLK, MACB_CLK_DIV8);
-	else if (pclk_hz <= 40000000)
-		config = MACB_BF(CLK, MACB_CLK_DIV16);
-	else if (pclk_hz <= 80000000)
-		config = MACB_BF(CLK, MACB_CLK_DIV32);
-	else
-		config = MACB_BF(CLK, MACB_CLK_DIV64);
+	config = macb_mdc_clk_div(bp);
 	macb_writel(bp, NCFGR, config);
 
 	macb_get_hwaddr(bp);
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index 3a07352..65abd8a 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -135,6 +135,9 @@
 #define MACB_IRXFCS_OFFSET			19
 #define MACB_IRXFCS_SIZE			1
 
+/* GEM specific NCFGR bitfields. */
+#define GEM_CLK_OFFSET				18
+#define GEM_CLK_SIZE				3
 /* Bitfields in NSR */
 #define MACB_NSR_LINK_OFFSET			0
 #define MACB_NSR_LINK_SIZE			1
@@ -249,6 +252,14 @@
 #define MACB_CLK_DIV32				2
 #define MACB_CLK_DIV64				3
 
+/* GEM specific constants for CLK. */
+#define GEM_CLK_DIV8				0
+#define GEM_CLK_DIV16				1
+#define GEM_CLK_DIV32				2
+#define GEM_CLK_DIV48				3
+#define GEM_CLK_DIV64				4
+#define GEM_CLK_DIV96				5
+
 /* Constants for MAN register */
 #define MACB_MAN_SOF				1
 #define MACB_MAN_WRITE				1
-- 
1.7.4


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

* [PATCHv2 7/9] macb: support statistics for GEM devices
  2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
                   ` (5 preceding siblings ...)
  2011-03-15 10:14 ` [PATCHv2 6/9] macb: support higher rate GEM MDIO clock divisors Jamie Iles
@ 2011-03-15 10:14 ` Jamie Iles
  2011-03-15 10:14 ` [PATCHv2 8/9] macb: support DMA bus widths > 32 bits Jamie Iles
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 10:14 UTC (permalink / raw)
  To: netdev, linux-arm-kernel; +Cc: nicolas.ferre, plagnioj, Jamie Iles

GEM devices have a different number of statistics registers and they
are at a different offset to MACB devices.  Make the statistics
collection method dependent on device type.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/net/macb.c |   57 +++++++++++++++++++++++++++++++++++++++++++++++++--
 drivers/net/macb.h |   54 ++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 107 insertions(+), 4 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index f3da878..0598373 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -282,8 +282,8 @@ err_out:
 static void macb_update_stats(struct macb *bp)
 {
 	u32 __iomem *reg = bp->regs + MACB_PFR;
-	u32 *p = &bp->hw_stats.rx_pause_frames;
-	u32 *end = &bp->hw_stats.tx_pause_frames + 1;
+	u32 *p = &bp->hw_stats.macb.rx_pause_frames;
+	u32 *end = &bp->hw_stats.macb.tx_pause_frames + 1;
 
 	WARN_ON((unsigned long)(end - p - 1) != (MACB_TPF - MACB_PFR) / 4);
 
@@ -1029,11 +1029,62 @@ static int macb_close(struct net_device *dev)
 	return 0;
 }
 
+static void gem_update_stats(struct macb *bp)
+{
+	u32 __iomem *reg = bp->regs + GEM_OTX;
+	u32 *p = &bp->hw_stats.gem.tx_octets_31_0;
+	u32 *end = &bp->hw_stats.gem.rx_udp_checksum_errors + 1;
+
+	for (; p < end; p++, reg++)
+		*p += __raw_readl(reg);
+}
+
+static struct net_device_stats *gem_get_stats(struct macb *bp)
+{
+	struct gem_stats *hwstat = &bp->hw_stats.gem;
+	struct net_device_stats *nstat = &bp->stats;
+
+	gem_update_stats(bp);
+
+	nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors +
+			    hwstat->rx_alignment_errors +
+			    hwstat->rx_resource_errors +
+			    hwstat->rx_overruns +
+			    hwstat->rx_oversize_frames +
+			    hwstat->rx_jabbers +
+			    hwstat->rx_undersized_frames +
+			    hwstat->rx_length_field_frame_errors);
+	nstat->tx_errors = (hwstat->tx_late_collisions +
+			    hwstat->tx_excessive_collisions +
+			    hwstat->tx_underrun +
+			    hwstat->tx_carrier_sense_errors);
+	nstat->multicast = hwstat->rx_multicast_frames;
+	nstat->collisions = (hwstat->tx_single_collision_frames +
+			     hwstat->tx_multiple_collision_frames +
+			     hwstat->tx_excessive_collisions);
+	nstat->rx_length_errors = (hwstat->rx_oversize_frames +
+				   hwstat->rx_jabbers +
+				   hwstat->rx_undersized_frames +
+				   hwstat->rx_length_field_frame_errors);
+	nstat->rx_over_errors = hwstat->rx_resource_errors;
+	nstat->rx_crc_errors = hwstat->rx_frame_check_sequence_errors;
+	nstat->rx_frame_errors = hwstat->rx_alignment_errors;
+	nstat->rx_fifo_errors = hwstat->rx_overruns;
+	nstat->tx_aborted_errors = hwstat->tx_excessive_collisions;
+	nstat->tx_carrier_errors = hwstat->tx_carrier_sense_errors;
+	nstat->tx_fifo_errors = hwstat->tx_underrun;
+
+	return nstat;
+}
+
 static struct net_device_stats *macb_get_stats(struct net_device *dev)
 {
 	struct macb *bp = netdev_priv(dev);
 	struct net_device_stats *nstat = &bp->stats;
-	struct macb_stats *hwstat = &bp->hw_stats;
+	struct macb_stats *hwstat = &bp->hw_stats.macb;
+
+	if (bp->is_gem)
+		return gem_get_stats(bp);
 
 	/* read stats from hardware */
 	macb_update_stats(bp);
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index 65abd8a..a2074f5 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -68,6 +68,7 @@
 #define GEM_HRT					0x0084
 #define GEM_SA1B				0x0088
 #define GEM_SA1T				0x008C
+#define GEM_OTX					0x0100
 
 /* Bitfields in NCR */
 #define MACB_LB_OFFSET				0
@@ -425,6 +426,54 @@ struct macb_stats {
 	u32	tx_pause_frames;
 };
 
+struct gem_stats {
+	u32	tx_octets_31_0;
+	u32	tx_octets_47_32;
+	u32	tx_frames;
+	u32	tx_broadcast_frames;
+	u32	tx_multicast_frames;
+	u32	tx_pause_frames;
+	u32	tx_64_byte_frames;
+	u32	tx_65_127_byte_frames;
+	u32	tx_128_255_byte_frames;
+	u32	tx_256_511_byte_frames;
+	u32	tx_512_1023_byte_frames;
+	u32	tx_1024_1518_byte_frames;
+	u32	tx_greater_than_1518_byte_frames;
+	u32	tx_underrun;
+	u32	tx_single_collision_frames;
+	u32	tx_multiple_collision_frames;
+	u32	tx_excessive_collisions;
+	u32	tx_late_collisions;
+	u32	tx_deferred_frames;
+	u32	tx_carrier_sense_errors;
+	u32	rx_octets_31_0;
+	u32	rx_octets_47_32;
+	u32	rx_frames;
+	u32	rx_broadcast_frames;
+	u32	rx_multicast_frames;
+	u32	rx_pause_frames;
+	u32	rx_64_byte_frames;
+	u32	rx_65_127_byte_frames;
+	u32	rx_128_255_byte_frames;
+	u32	rx_256_511_byte_frames;
+	u32	rx_512_1023_byte_frames;
+	u32	rx_1024_1518_byte_frames;
+	u32	rx_greater_than_1518_byte_frames;
+	u32	rx_undersized_frames;
+	u32	rx_oversize_frames;
+	u32	rx_jabbers;
+	u32	rx_frame_check_sequence_errors;
+	u32	rx_length_field_frame_errors;
+	u32	rx_symbol_errors;
+	u32	rx_alignment_errors;
+	u32	rx_resource_errors;
+	u32	rx_overruns;
+	u32	rx_ip_header_checksum_errors;
+	u32	rx_tcp_checksum_errors;
+	u32	rx_udp_checksum_errors;
+};
+
 struct macb {
 	void __iomem		*regs;
 	int			is_gem;
@@ -444,7 +493,10 @@ struct macb {
 	struct net_device	*dev;
 	struct napi_struct	napi;
 	struct net_device_stats	stats;
-	struct macb_stats	hw_stats;
+	union {
+		struct macb_stats	macb;
+		struct gem_stats	gem;
+	}			hw_stats;
 
 	dma_addr_t		rx_ring_dma;
 	dma_addr_t		tx_ring_dma;
-- 
1.7.4


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

* [PATCHv2 8/9] macb: support DMA bus widths > 32 bits
  2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
                   ` (6 preceding siblings ...)
  2011-03-15 10:14 ` [PATCHv2 7/9] macb: support statistics for GEM devices Jamie Iles
@ 2011-03-15 10:14 ` Jamie Iles
  2011-03-15 10:14 ` [PATCHv2 9/9] macb: allow GEM to have configurable receive buffer size Jamie Iles
  2011-03-16 20:17 ` [PATCHv2 0/9] macb: add support for Cadence GEM David Miller
  9 siblings, 0 replies; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 10:14 UTC (permalink / raw)
  To: netdev, linux-arm-kernel; +Cc: nicolas.ferre, plagnioj, Jamie Iles

Some GEM implementations may support DMA bus widths up to 128 bits.  We
can get the maximum supported DMA bus width from the design
configuration register so use that to program the device up.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/net/macb.c |   23 +++++++++++++++++++++++
 drivers/net/macb.h |   19 +++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 0598373..db9f403 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -822,6 +822,27 @@ static u32 macb_mdc_clk_div(struct macb *bp)
 	return config;
 }
 
+/*
+ * Get the DMA bus width field of the network configuration register that we
+ * should program.  We find the width from decoding the design configuration
+ * register to find the maximum supported data bus width.
+ */
+static u32 macb_dbw(struct macb *bp)
+{
+	if (!bp->is_gem)
+		return 0;
+
+	switch (GEM_BFEXT(DBWDEF, gem_readl(bp, DCFG1))) {
+	case 4:
+		return GEM_BF(DBW, GEM_DBW128);
+	case 2:
+		return GEM_BF(DBW, GEM_DBW64);
+	case 1:
+	default:
+		return GEM_BF(DBW, GEM_DBW32);
+	}
+}
+
 static void macb_init_hw(struct macb *bp)
 {
 	u32 config;
@@ -837,6 +858,7 @@ static void macb_init_hw(struct macb *bp)
 		config |= MACB_BIT(CAF);	/* Copy All Frames */
 	if (!(bp->dev->flags & IFF_BROADCAST))
 		config |= MACB_BIT(NBC);	/* No BroadCast */
+	config |= macb_dbw(bp);
 	macb_writel(bp, NCFGR, config);
 
 	/* Initialize TX and RX buffers */
@@ -1267,6 +1289,7 @@ static int __init macb_probe(struct platform_device *pdev)
 
 	/* Set MII management clock divider */
 	config = macb_mdc_clk_div(bp);
+	config |= macb_dbw(bp);
 	macb_writel(bp, NCFGR, config);
 
 	macb_get_hwaddr(bp);
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index a2074f5..5f93bab 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -69,6 +69,13 @@
 #define GEM_SA1B				0x0088
 #define GEM_SA1T				0x008C
 #define GEM_OTX					0x0100
+#define GEM_DCFG1				0x0280
+#define GEM_DCFG2				0x0284
+#define GEM_DCFG3				0x0288
+#define GEM_DCFG4				0x028c
+#define GEM_DCFG5				0x0290
+#define GEM_DCFG6				0x0294
+#define GEM_DCFG7				0x0298
 
 /* Bitfields in NCR */
 #define MACB_LB_OFFSET				0
@@ -139,6 +146,14 @@
 /* GEM specific NCFGR bitfields. */
 #define GEM_CLK_OFFSET				18
 #define GEM_CLK_SIZE				3
+#define GEM_DBW_OFFSET				21
+#define GEM_DBW_SIZE				2
+
+/* Constants for data bus width. */
+#define GEM_DBW32				0
+#define GEM_DBW64				1
+#define GEM_DBW128				2
+
 /* Bitfields in NSR */
 #define MACB_NSR_LINK_OFFSET			0
 #define MACB_NSR_LINK_SIZE			1
@@ -247,6 +262,10 @@
 #define MACB_REV_OFFSET				0
 #define MACB_REV_SIZE				16
 
+/* Bitfields in DCFG1. */
+#define GEM_DBWDEF_OFFSET			25
+#define GEM_DBWDEF_SIZE				3
+
 /* Constants for CLK */
 #define MACB_CLK_DIV8				0
 #define MACB_CLK_DIV16				1
-- 
1.7.4


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

* [PATCHv2 9/9] macb: allow GEM to have configurable receive buffer size
  2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
                   ` (7 preceding siblings ...)
  2011-03-15 10:14 ` [PATCHv2 8/9] macb: support DMA bus widths > 32 bits Jamie Iles
@ 2011-03-15 10:14 ` Jamie Iles
  2011-03-16 20:17 ` [PATCHv2 0/9] macb: add support for Cadence GEM David Miller
  9 siblings, 0 replies; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 10:14 UTC (permalink / raw)
  To: netdev, linux-arm-kernel; +Cc: nicolas.ferre, plagnioj, Jamie Iles

GEM has configurable receive buffer sizes so requires this to be
programmed up.  Any size < 2048 and a multiple of 64 bytes is permitted.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 drivers/net/macb.c |   17 +++++++++++++++++
 drivers/net/macb.h |    5 +++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index db9f403..52ad367 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -843,6 +843,21 @@ static u32 macb_dbw(struct macb *bp)
 	}
 }
 
+/*
+ * Configure the receive DMA engine to use the correct receive buffer size.
+ * This is a configurable parameter for GEM.
+ */
+static void macb_configure_dma(struct macb *bp)
+{
+	u32 dmacfg;
+
+	if (bp->is_gem) {
+		dmacfg = gem_readl(bp, DMACFG) & ~GEM_BF(RXBS, -1L);
+		dmacfg |= GEM_BF(RXBS, RX_BUFFER_SIZE / 64);
+		gem_writel(bp, DMACFG, dmacfg);
+	}
+}
+
 static void macb_init_hw(struct macb *bp)
 {
 	u32 config;
@@ -861,6 +876,8 @@ static void macb_init_hw(struct macb *bp)
 	config |= macb_dbw(bp);
 	macb_writel(bp, NCFGR, config);
 
+	macb_configure_dma(bp);
+
 	/* Initialize TX and RX buffers */
 	macb_writel(bp, RBQP, bp->rx_ring_dma);
 	macb_writel(bp, TBQP, bp->tx_ring_dma);
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index 5f93bab..d743d3e 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -64,6 +64,7 @@
 /* GEM register offsets. */
 #define GEM_NCFGR				0x0004
 #define GEM_USRIO				0x000c
+#define GEM_DMACFG				0x0010
 #define GEM_HRB					0x0080
 #define GEM_HRT					0x0084
 #define GEM_SA1B				0x0088
@@ -154,6 +155,10 @@
 #define GEM_DBW64				1
 #define GEM_DBW128				2
 
+/* Bitfields in DMACFG. */
+#define GEM_RXBS_OFFSET				16
+#define GEM_RXBS_SIZE				8
+
 /* Bitfields in NSR */
 #define MACB_NSR_LINK_OFFSET			0
 #define MACB_NSR_LINK_SIZE			1
-- 
1.7.4


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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-15 10:14 ` [PATCHv2 3/9] macb: unify at91 and avr32 platform data Jamie Iles
@ 2011-03-15 11:14   ` Peter Korsgaard
  2011-03-15 11:34     ` Jamie Iles
                       ` (2 more replies)
  0 siblings, 3 replies; 46+ messages in thread
From: Peter Korsgaard @ 2011-03-15 11:14 UTC (permalink / raw)
  To: Jamie Iles; +Cc: netdev, plagnioj, nicolas.ferre, linux-arm-kernel

>>>>> "Jamie" == Jamie Iles <jamie@jamieiles.com> writes:

Hi,

 Jamie> Both at91 and avr32 defines its own platform data structure for
 Jamie> the macb driver and both share common structures though at91
 Jamie> includes a currently unused phy_irq_pin.  Create a common
 Jamie> eth_platform_data for macb that both at91 and avr32 can use.  In
 Jamie> future we can use this to support other architectures that use the
 Jamie> same IP block with the macb driver.

Nice!

 Jamie> Signed-off-by: Jamie Iles <jamie@jamieiles.com>

 Jamie> +++ b/include/linux/platform_data/macb.h
 Jamie> @@ -0,0 +1,17 @@
 Jamie> +/*
 Jamie> + * Copyright (C) 2004-2006 Atmel Corporation
 Jamie> + *
 Jamie> + * This program is free software; you can redistribute it and/or modify
 Jamie> + * it under the terms of the GNU General Public License version 2 as
 Jamie> + * published by the Free Software Foundation.
 Jamie> + */
 Jamie> +#ifndef __MACB_PDATA_H__
 Jamie> +#define __MACB_PDATA_H__
 Jamie> +
 Jamie> +struct eth_platform_data {

How about at the same time renaming it to something a bit less generic
like macb_platform_data?

-- 
Bye, Peter Korsgaard

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-15 11:14   ` Peter Korsgaard
@ 2011-03-15 11:34     ` Jamie Iles
  2011-03-15 12:36     ` Jean-Christophe PLAGNIOL-VILLARD
  2011-03-17  8:43     ` avictor.za
  2 siblings, 0 replies; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 11:34 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Jamie Iles, netdev, linux-arm-kernel, nicolas.ferre, plagnioj

Hi Peter,

On Tue, Mar 15, 2011 at 12:14:31PM +0100, Peter Korsgaard wrote:
> >>>>> "Jamie" == Jamie Iles <jamie@jamieiles.com> writes:
>  Jamie> +++ b/include/linux/platform_data/macb.h
>  Jamie> @@ -0,0 +1,17 @@
>  Jamie> +/*
>  Jamie> + * Copyright (C) 2004-2006 Atmel Corporation
>  Jamie> + *
>  Jamie> + * This program is free software; you can redistribute it and/or modify
>  Jamie> + * it under the terms of the GNU General Public License version 2 as
>  Jamie> + * published by the Free Software Foundation.
>  Jamie> + */
>  Jamie> +#ifndef __MACB_PDATA_H__
>  Jamie> +#define __MACB_PDATA_H__
>  Jamie> +
>  Jamie> +struct eth_platform_data {
> 
> How about at the same time renaming it to something a bit less generic
> like macb_platform_data?

Yes, that's a fair point.

Jamie

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

* Re: [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name
  2011-03-15 10:14 ` [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name Jamie Iles
@ 2011-03-15 12:35   ` Jean-Christophe PLAGNIOL-VILLARD
  2011-03-15 12:44     ` Jamie Iles
  2011-03-16  6:53   ` avictor.za
  1 sibling, 1 reply; 46+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-03-15 12:35 UTC (permalink / raw)
  To: Jamie Iles; +Cc: netdev, nicolas.ferre, linux-arm-kernel

On 10:14 Tue 15 Mar     , Jamie Iles wrote:
> The macb driver expects clocks with the names "pclk" and "hclk".  We
> currently provide "macb_clk" but to fit in line with other
> architectures (namely AVR32), provide "pclk" and a fake "hclk".
> 
> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Signed-off-by: Jamie Iles <jamie@jamieiles.com>
> ---
>  arch/arm/mach-at91/at572d940hf.c |    8 +++++++-
>  arch/arm/mach-at91/at91cap9.c    |    8 +++++++-
>  arch/arm/mach-at91/at91sam9260.c |    8 +++++++-
>  arch/arm/mach-at91/at91sam9263.c |    8 +++++++-
>  arch/arm/mach-at91/at91sam9g45.c |    8 +++++++-
>  5 files changed, 35 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at572d940hf.c b/arch/arm/mach-at91/at572d940hf.c
> index a6b9c68..9b3a37e 100644
> --- a/arch/arm/mach-at91/at572d940hf.c
> +++ b/arch/arm/mach-at91/at572d940hf.c
> @@ -71,10 +71,15 @@ static struct clk pioC_clk = {
>  	.type		= CLK_TYPE_PERIPHERAL,
>  };
>  static struct clk macb_clk = {
> -	.name		= "macb_clk",
> +	.name		= "pclk",
>  	.pmc_mask	= 1 << AT572D940HF_ID_EMAC,
>  	.type		= CLK_TYPE_PERIPHERAL,
>  };
> +static struct clk macb_hclk = {
> +	.name		= "hclk",
> +	.pmc_mask	= 0,
> +	.type		= CLK_TYPE_PERIPHERAL,
> +};
for the fake clock you must specify the parent as macb_clk

take a look on the tcb1_clk for the 9g45

Best Regards,
J.

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-15 11:14   ` Peter Korsgaard
  2011-03-15 11:34     ` Jamie Iles
@ 2011-03-15 12:36     ` Jean-Christophe PLAGNIOL-VILLARD
  2011-03-17  8:43     ` avictor.za
  2 siblings, 0 replies; 46+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-03-15 12:36 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Jamie Iles, netdev, linux-arm-kernel, nicolas.ferre

On 12:14 Tue 15 Mar     , Peter Korsgaard wrote:
> >>>>> "Jamie" == Jamie Iles <jamie@jamieiles.com> writes:
> 
> Hi,
> 
>  Jamie> Both at91 and avr32 defines its own platform data structure for
>  Jamie> the macb driver and both share common structures though at91
>  Jamie> includes a currently unused phy_irq_pin.  Create a common
>  Jamie> eth_platform_data for macb that both at91 and avr32 can use.  In
>  Jamie> future we can use this to support other architectures that use the
>  Jamie> same IP block with the macb driver.
> 
> Nice!
> 
>  Jamie> Signed-off-by: Jamie Iles <jamie@jamieiles.com>
> 
>  Jamie> +++ b/include/linux/platform_data/macb.h
>  Jamie> @@ -0,0 +1,17 @@
>  Jamie> +/*
>  Jamie> + * Copyright (C) 2004-2006 Atmel Corporation
>  Jamie> + *
>  Jamie> + * This program is free software; you can redistribute it and/or modify
>  Jamie> + * it under the terms of the GNU General Public License version 2 as
>  Jamie> + * published by the Free Software Foundation.
>  Jamie> + */
>  Jamie> +#ifndef __MACB_PDATA_H__
>  Jamie> +#define __MACB_PDATA_H__
>  Jamie> +
>  Jamie> +struct eth_platform_data {
> 
> How about at the same time renaming it to something a bit less generic
> like macb_platform_data?
agreed

Best Regards,
J.
> 
> -- 
> Bye, Peter Korsgaard

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

* Re: [PATCHv2 4/9] macb: convert printk to netdev_ and friends
  2011-03-15 10:14 ` [PATCHv2 4/9] macb: convert printk to netdev_ and friends Jamie Iles
@ 2011-03-15 12:36   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 46+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-03-15 12:36 UTC (permalink / raw)
  To: Jamie Iles; +Cc: netdev, nicolas.ferre, linux-arm-kernel

On 10:14 Tue 15 Mar     , Jamie Iles wrote:
> macb is already using the dev_dbg() and friends helpers so use netdev_()
> along with a pr_fmt() definition to make the printing a little cleaner.
> 
> Signed-off-by: Jamie Iles <jamie@jamieiles.com>
looks fine

Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Best Regards,
J.

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

* Re: [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name
  2011-03-15 12:35   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-03-15 12:44     ` Jamie Iles
  0 siblings, 0 replies; 46+ messages in thread
From: Jamie Iles @ 2011-03-15 12:44 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Jamie Iles, netdev, linux-arm-kernel, nicolas.ferre

On Tue, Mar 15, 2011 at 01:35:39PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 10:14 Tue 15 Mar     , Jamie Iles wrote:
> > The macb driver expects clocks with the names "pclk" and "hclk".  We
> > currently provide "macb_clk" but to fit in line with other
> > architectures (namely AVR32), provide "pclk" and a fake "hclk".
> > 
> > Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > Signed-off-by: Jamie Iles <jamie@jamieiles.com>
> > ---
> >  arch/arm/mach-at91/at572d940hf.c |    8 +++++++-
> >  arch/arm/mach-at91/at91cap9.c    |    8 +++++++-
> >  arch/arm/mach-at91/at91sam9260.c |    8 +++++++-
> >  arch/arm/mach-at91/at91sam9263.c |    8 +++++++-
> >  arch/arm/mach-at91/at91sam9g45.c |    8 +++++++-
> >  5 files changed, 35 insertions(+), 5 deletions(-)
> > 
> > diff --git a/arch/arm/mach-at91/at572d940hf.c b/arch/arm/mach-at91/at572d940hf.c
> > index a6b9c68..9b3a37e 100644
> > --- a/arch/arm/mach-at91/at572d940hf.c
> > +++ b/arch/arm/mach-at91/at572d940hf.c
> > @@ -71,10 +71,15 @@ static struct clk pioC_clk = {
> >  	.type		= CLK_TYPE_PERIPHERAL,
> >  };
> >  static struct clk macb_clk = {
> > -	.name		= "macb_clk",
> > +	.name		= "pclk",
> >  	.pmc_mask	= 1 << AT572D940HF_ID_EMAC,
> >  	.type		= CLK_TYPE_PERIPHERAL,
> >  };
> > +static struct clk macb_hclk = {
> > +	.name		= "hclk",
> > +	.pmc_mask	= 0,
> > +	.type		= CLK_TYPE_PERIPHERAL,
> > +};
> for the fake clock you must specify the parent as macb_clk
> 
> take a look on the tcb1_clk for the 9g45

Ok, will do.  Thanks for the pointer!

Jamie

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

* Re: [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name
  2011-03-15 10:14 ` [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name Jamie Iles
  2011-03-15 12:35   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-03-16  6:53   ` avictor.za
  2011-03-16  8:38     ` Russell King - ARM Linux
  1 sibling, 1 reply; 46+ messages in thread
From: avictor.za @ 2011-03-16  6:53 UTC (permalink / raw)
  To: Jamie Iles; +Cc: netdev, linux-arm-kernel, plagnioj, nicolas.ferre

hi,

On Tue, Mar 15, 2011 at 12:14 PM, Jamie Iles <jamie@jamieiles.com> wrote:
> The macb driver expects clocks with the names "pclk" and "hclk".  We
> currently provide "macb_clk" but to fit in line with other
> architectures (namely AVR32), provide "pclk" and a fake "hclk".

There is no reference to a "pclk" or "hclk" in the AT91 architecture.
So to avoid possible confusion, maybe create two "fake" clocks both
parented to "macb_clk", and add a comment they're only for
compatibility with the AVR32.


Regards,
  Andrew Victor

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

* Re: [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name
  2011-03-16  6:53   ` avictor.za
@ 2011-03-16  8:38     ` Russell King - ARM Linux
  2011-03-17  9:22       ` Andrew Victor
  0 siblings, 1 reply; 46+ messages in thread
From: Russell King - ARM Linux @ 2011-03-16  8:38 UTC (permalink / raw)
  To: avictor.za; +Cc: Jamie Iles, netdev, plagnioj, linux-arm-kernel, nicolas.ferre

On Wed, Mar 16, 2011 at 08:53:47AM +0200, avictor.za@gmail.com wrote:
> hi,
> 
> On Tue, Mar 15, 2011 at 12:14 PM, Jamie Iles <jamie@jamieiles.com> wrote:
> > The macb driver expects clocks with the names "pclk" and "hclk".  We
> > currently provide "macb_clk" but to fit in line with other
> > architectures (namely AVR32), provide "pclk" and a fake "hclk".
> 
> There is no reference to a "pclk" or "hclk" in the AT91 architecture.
> So to avoid possible confusion, maybe create two "fake" clocks both
> parented to "macb_clk", and add a comment they're only for
> compatibility with the AVR32.

It doesn't matter what's in the documentation.

There's no apb_pclk mentioned in the ARM platform documentation yet we
have such a clock in the bus-level code for primecell support.  I'm sure
many of the other early primecell using platforms are also the same.

On OMAP1 there's no iclk yet OMAP drivers have had iclk and iclk is a
dummy no-op clock for OMAP1 for compatibility with OMAP2.

What matters more than conforming to documentation is keeping the drivers
in a clean and maintainable state without throwing lots of ifdefs into
them.

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
                   ` (8 preceding siblings ...)
  2011-03-15 10:14 ` [PATCHv2 9/9] macb: allow GEM to have configurable receive buffer size Jamie Iles
@ 2011-03-16 20:17 ` David Miller
  2011-03-21  6:38   ` Nicolas Ferre
  9 siblings, 1 reply; 46+ messages in thread
From: David Miller @ 2011-03-16 20:17 UTC (permalink / raw)
  To: jamie; +Cc: netdev, linux-arm-kernel, nicolas.ferre, plagnioj

From: Jamie Iles <jamie@jamieiles.com>
Date: Tue, 15 Mar 2011 10:14:47 +0000

> This patch series extends the Atmel MACB driver to support the Cadence
> GEM (Gigabit Ethernet MAC) to support 10/100 operation.  The GEM is
> based on the MACB block but has a few moved registers and bitfields.
> This patch series attempts to use the MACB accessors where block
> functionallity is identical and only overrides to GEM specific
> acccessors when needed.
> 
> This has been runtested on a board with a Cadence GEM and compile tested
> for all at91 configurations and a number of avr32 configurations.
> 
> Changes since v1:
> 	- AT91 now provides a fake "hclk" and "macb_clk" has been
> 	renamed to "pclk" to be consistent with AVR32.
> 	- Configurable GEM receive buffer size support has been added.
> 	- pr_foo() and dev_foo() have been converted to netdev_foo()
> 	where appropriate.
> 	- New conditional accessors (macb_or_gem_{read,write}l) have
> 	been introduced that do the conditional accesses dependent on
> 	macb/gem type.
> 	- GEM is now dynamically detected from the module ID rather than
> 	platform device name.
> 
> Jean-Christophe, I haven't based this on your conditional clock patch as
> I wasn't sure what decision had been made on that and whether the
> at91/avr32 detection is reliable.

I'm happy to ACK this so you guys can merge this via one of the
ARM trees:

Acked-by: David S. Miller <davem@davemloft.net>

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-15 11:14   ` Peter Korsgaard
  2011-03-15 11:34     ` Jamie Iles
  2011-03-15 12:36     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-03-17  8:43     ` avictor.za
  2011-03-17  8:48       ` Peter Korsgaard
  2 siblings, 1 reply; 46+ messages in thread
From: avictor.za @ 2011-03-17  8:43 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Jamie Iles, netdev, plagnioj, nicolas.ferre, linux-arm-kernel

hi,

>  Jamie> Both at91 and avr32 defines its own platform data structure for
>  Jamie> the macb driver and both share common structures though at91
>  Jamie> includes a currently unused phy_irq_pin.  Create a common
>  Jamie> eth_platform_data for macb that both at91 and avr32 can use.  In
>  Jamie> future we can use this to support other architectures that use the
>  Jamie> same IP block with the macb driver.
>
> How about at the same time renaming it to something a bit less generic
> like macb_platform_data?

The AT91RM9200 uses the same platform_data structure, but has a
different Ethernet peripheral (ie, not the MACB)

The phy_irq_pin is used in the AT91RM9200 ethernet driver.
(drivers/net/arm/at91_ether.c)


Regards,
  Andrew Victor

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-17  8:43     ` avictor.za
@ 2011-03-17  8:48       ` Peter Korsgaard
  2011-03-17  8:58         ` Russell King - ARM Linux
  0 siblings, 1 reply; 46+ messages in thread
From: Peter Korsgaard @ 2011-03-17  8:48 UTC (permalink / raw)
  To: avictor.za; +Cc: Jamie Iles, netdev, plagnioj, nicolas.ferre, linux-arm-kernel

>>>>> "avictor" == avictor za@gmail com <avictor.za@gmail.com> writes:

Hi,

 >> How about at the same time renaming it to something a bit less
 >> generic like macb_platform_data?

 avictor> The AT91RM9200 uses the same platform_data structure, but has a
 avictor> different Ethernet peripheral (ie, not the MACB)

 avictor> The phy_irq_pin is used in the AT91RM9200 ethernet driver.
 avictor> (drivers/net/arm/at91_ether.c)

That should probably be cleaned up as well then. Sharing platform_data
structures between unrelated drivers seems like quite a mess to me.

-- 
Bye, Peter Korsgaard

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-17  8:48       ` Peter Korsgaard
@ 2011-03-17  8:58         ` Russell King - ARM Linux
  2011-03-17  9:22           ` Peter Korsgaard
  0 siblings, 1 reply; 46+ messages in thread
From: Russell King - ARM Linux @ 2011-03-17  8:58 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: avictor.za, Jamie Iles, plagnioj, linux-arm-kernel,
	nicolas.ferre, netdev

On Thu, Mar 17, 2011 at 09:48:28AM +0100, Peter Korsgaard wrote:
> >>>>> "avictor" == avictor za@gmail com <avictor.za@gmail.com> writes:
> 
> Hi,
> 
>  >> How about at the same time renaming it to something a bit less
>  >> generic like macb_platform_data?
> 
>  avictor> The AT91RM9200 uses the same platform_data structure, but has a
>  avictor> different Ethernet peripheral (ie, not the MACB)
> 
>  avictor> The phy_irq_pin is used in the AT91RM9200 ethernet driver.
>  avictor> (drivers/net/arm/at91_ether.c)
> 
> That should probably be cleaned up as well then. Sharing platform_data
> structures between unrelated drivers seems like quite a mess to me.

Why should every driver have a separate platform data structure?
Is it right to end up with thousands of unique data structures each
specific to a particular driver?  To me, that sounds like a headache
waiting to happen.

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

* Re: [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name
  2011-03-16  8:38     ` Russell King - ARM Linux
@ 2011-03-17  9:22       ` Andrew Victor
  2011-03-17 10:00         ` Russell King - ARM Linux
  0 siblings, 1 reply; 46+ messages in thread
From: Andrew Victor @ 2011-03-17  9:22 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: nicolas.ferre, Jamie Iles, plagnioj, linux-arm-kernel, netdev

hi Russell,

>> There is no reference to a "pclk" or "hclk" in the AT91 architecture.
>> So to avoid possible confusion, maybe create two "fake" clocks both
>> parented to "macb_clk", and add a comment they're only for
>> compatibility with the AVR32.
>
> It doesn't matter what's in the documentation.
>
> What matters more than conforming to documentation is keeping the drivers
> in a clean and maintainable state without throwing lots of ifdefs into
> them.

I'm not saying the drivers need ifdefs, they should request both
"pclk" and "hclk" as suggested.

What I was suggesting is the platform clock setup on AT91 as:
    macb_clk
        |
        +-- hclk
        +-- pclk

rather than:
    pclk
        |
        +-- hclk

Regards,
  Andrew Victor

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-17  8:58         ` Russell King - ARM Linux
@ 2011-03-17  9:22           ` Peter Korsgaard
  2011-03-17  9:34             ` Jamie Iles
  0 siblings, 1 reply; 46+ messages in thread
From: Peter Korsgaard @ 2011-03-17  9:22 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: avictor.za, Jamie Iles, plagnioj, linux-arm-kernel,
	nicolas.ferre, netdev

>>>>> "Russell" == Russell King <- ARM Linux <linux@arm.linux.org.uk>> writes:

Hi,

 >> That should probably be cleaned up as well then. Sharing platform_data
 >> structures between unrelated drivers seems like quite a mess to me.

 Russell> Why should every driver have a separate platform data structure?
 Russell> Is it right to end up with thousands of unique data structures each
 Russell> specific to a particular driver?  To me, that sounds like a headache
 Russell> waiting to happen.

Well, the point of the platform data is to provide driver specific
(E.G. not generic) data to the driver, so in general it will be
different for different hardware.

The current situation with 2 different structure defination depending on
arch, macro magic and 1 of these structures also used for a 2nd driver
isn't optimal.

But ok, I don't feel strongly about struct macb_platform_data also being
used for the old at91_ether driver, but it shouldn't be called
eth_platform_data as it isn't really a generic structure.

-- 
Bye, Peter Korsgaard

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-17  9:22           ` Peter Korsgaard
@ 2011-03-17  9:34             ` Jamie Iles
  2011-03-17 21:51               ` Jamie Iles
  0 siblings, 1 reply; 46+ messages in thread
From: Jamie Iles @ 2011-03-17  9:34 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Russell King - ARM Linux, avictor.za, Jamie Iles, plagnioj,
	linux-arm-kernel, nicolas.ferre, netdev

On Thu, Mar 17, 2011 at 10:22:53AM +0100, Peter Korsgaard wrote:
> >>>>> "Russell" == Russell King <- ARM Linux <linux@arm.linux.org.uk>> writes:
> 
> Hi,
> 
>  >> That should probably be cleaned up as well then. Sharing platform_data
>  >> structures between unrelated drivers seems like quite a mess to me.
> 
>  Russell> Why should every driver have a separate platform data structure?
>  Russell> Is it right to end up with thousands of unique data structures each
>  Russell> specific to a particular driver?  To me, that sounds like a headache
>  Russell> waiting to happen.
> 
> Well, the point of the platform data is to provide driver specific
> (E.G. not generic) data to the driver, so in general it will be
> different for different hardware.
> 
> The current situation with 2 different structure defination depending on
> arch, macro magic and 1 of these structures also used for a 2nd driver
> isn't optimal.
> 
> But ok, I don't feel strongly about struct macb_platform_data also being
> used for the old at91_ether driver, but it shouldn't be called
> eth_platform_data as it isn't really a generic structure.

Ok, I'll rename to macb_platform_data and update at91_ether to use that 
with a comment describing that we're sharing the platform data with 
macb.  At least that gets rid of the preprocessor stuff in board.h for 
at91 too.

Jamie

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

* Re: [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name
  2011-03-17  9:22       ` Andrew Victor
@ 2011-03-17 10:00         ` Russell King - ARM Linux
  2011-03-17 10:09           ` Jamie Iles
  0 siblings, 1 reply; 46+ messages in thread
From: Russell King - ARM Linux @ 2011-03-17 10:00 UTC (permalink / raw)
  To: Andrew Victor
  Cc: nicolas.ferre, Jamie Iles, plagnioj, linux-arm-kernel, netdev

On Thu, Mar 17, 2011 at 11:22:37AM +0200, Andrew Victor wrote:
> hi Russell,
> 
> >> There is no reference to a "pclk" or "hclk" in the AT91 architecture.
> >> So to avoid possible confusion, maybe create two "fake" clocks both
> >> parented to "macb_clk", and add a comment they're only for
> >> compatibility with the AVR32.
> >
> > It doesn't matter what's in the documentation.
> >
> > What matters more than conforming to documentation is keeping the drivers
> > in a clean and maintainable state without throwing lots of ifdefs into
> > them.
> 
> I'm not saying the drivers need ifdefs, they should request both
> "pclk" and "hclk" as suggested.
> 
> What I was suggesting is the platform clock setup on AT91 as:
>     macb_clk
>         |
>         +-- hclk
>         +-- pclk
> 
> rather than:
>     pclk
>         |
>         +-- hclk

And what I've been saying all along is to make pclk a _dummy_ clock on
the platform it doesn't exist for, rather than making it related in some
way to another clock given to the peripheral.

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

* Re: [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name
  2011-03-17 10:00         ` Russell King - ARM Linux
@ 2011-03-17 10:09           ` Jamie Iles
  0 siblings, 0 replies; 46+ messages in thread
From: Jamie Iles @ 2011-03-17 10:09 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Andrew Victor, nicolas.ferre, Jamie Iles, plagnioj,
	linux-arm-kernel, netdev

On Thu, Mar 17, 2011 at 10:00:10AM +0000, Russell King - ARM Linux wrote:
> On Thu, Mar 17, 2011 at 11:22:37AM +0200, Andrew Victor wrote:
> > hi Russell,
> > 
> > >> There is no reference to a "pclk" or "hclk" in the AT91 architecture.
> > >> So to avoid possible confusion, maybe create two "fake" clocks both
> > >> parented to "macb_clk", and add a comment they're only for
> > >> compatibility with the AVR32.
> > >
> > > It doesn't matter what's in the documentation.
> > >
> > > What matters more than conforming to documentation is keeping the drivers
> > > in a clean and maintainable state without throwing lots of ifdefs into
> > > them.
> > 
> > I'm not saying the drivers need ifdefs, they should request both
> > "pclk" and "hclk" as suggested.
> > 
> > What I was suggesting is the platform clock setup on AT91 as:
> >     macb_clk
> >         |
> >         +-- hclk
> >         +-- pclk
> > 
> > rather than:
> >     pclk
> >         |
> >         +-- hclk
> 
> And what I've been saying all along is to make pclk a _dummy_ clock on
> the platform it doesn't exist for, rather than making it related in some
> way to another clock given to the peripheral.

Ok, so just to summarize, before my patches, at91 provides "macb_clk", 
whereas avr32 provides "pclk" and "hclk".

I've renamed at91's "macb_clk" to "pclk" and added a fake, unrelated 
"hclk".  It was suggested that the fake "hclk" should be a child of 
"pclk" but you're saying to leave it as I have it right?

Jamie

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-17  9:34             ` Jamie Iles
@ 2011-03-17 21:51               ` Jamie Iles
  2011-03-18 15:41                 ` Russell King - ARM Linux
  0 siblings, 1 reply; 46+ messages in thread
From: Jamie Iles @ 2011-03-17 21:51 UTC (permalink / raw)
  To: Jamie Iles
  Cc: Peter Korsgaard, Russell King - ARM Linux, avictor.za, plagnioj,
	linux-arm-kernel, nicolas.ferre, netdev

On Thu, Mar 17, 2011 at 09:34:03AM +0000, Jamie Iles wrote:
> Ok, I'll rename to macb_platform_data and update at91_ether to use 
> that with a comment describing that we're sharing the platform data 
> with macb.  At least that gets rid of the preprocessor stuff in 
> board.h for at91 too.

So here's the updated patch with changes to the at91_ether driver to 
share the data with macb.

Russell, are you happy to take this series?  If so, how would you prefer 
it, in the patch system or as a git pull?

Jamie

----

>From 7e719117365953dbabe292c1fbc5bd0c1590698c Mon Sep 17 00:00:00 2001
From: Jamie Iles <jamie@jamieiles.com>
Date: Tue, 8 Mar 2011 20:17:06 +0000
Subject: [PATCHv3 3/9] macb: unify at91 and avr32 platform data

Both at91 and avr32 defines its own platform data structure for
the macb driver and both share common structures though at91
includes a currently unused phy_irq_pin.  Create a common
macb_platform_data for macb that both at91 and avr32 can use.  In
future we can use this to support other architectures that use the
same IP block with the macb driver.

v2: rename eth_platform_data to macb_platform_data and allow at91_ether
to share the platform data with macb.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 arch/arm/mach-at91/at572d940hf_devices.c    |    6 +++---
 arch/arm/mach-at91/at91cap9_devices.c       |    6 +++---
 arch/arm/mach-at91/at91rm9200_devices.c     |    6 +++---
 arch/arm/mach-at91/at91sam9260_devices.c    |    6 +++---
 arch/arm/mach-at91/at91sam9263_devices.c    |    6 +++---
 arch/arm/mach-at91/at91sam9g45_devices.c    |    6 +++---
 arch/arm/mach-at91/board-1arm.c             |    2 +-
 arch/arm/mach-at91/board-afeb-9260v1.c      |    2 +-
 arch/arm/mach-at91/board-at572d940hf_ek.c   |    2 +-
 arch/arm/mach-at91/board-cam60.c            |    2 +-
 arch/arm/mach-at91/board-cap9adk.c          |    2 +-
 arch/arm/mach-at91/board-carmeva.c          |    2 +-
 arch/arm/mach-at91/board-cpu9krea.c         |    2 +-
 arch/arm/mach-at91/board-cpuat91.c          |    2 +-
 arch/arm/mach-at91/board-csb337.c           |    2 +-
 arch/arm/mach-at91/board-csb637.c           |    2 +-
 arch/arm/mach-at91/board-eb9200.c           |    2 +-
 arch/arm/mach-at91/board-ecbat91.c          |    2 +-
 arch/arm/mach-at91/board-eco920.c           |    2 +-
 arch/arm/mach-at91/board-foxg20.c           |    2 +-
 arch/arm/mach-at91/board-gsia18s.c          |    2 +-
 arch/arm/mach-at91/board-kafa.c             |    2 +-
 arch/arm/mach-at91/board-kb9202.c           |    2 +-
 arch/arm/mach-at91/board-neocore926.c       |    2 +-
 arch/arm/mach-at91/board-pcontrol-g20.c     |    2 +-
 arch/arm/mach-at91/board-picotux200.c       |    2 +-
 arch/arm/mach-at91/board-qil-a9260.c        |    2 +-
 arch/arm/mach-at91/board-rm9200dk.c         |    2 +-
 arch/arm/mach-at91/board-rm9200ek.c         |    2 +-
 arch/arm/mach-at91/board-sam9-l9260.c       |    2 +-
 arch/arm/mach-at91/board-sam9260ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9263ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9g20ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9m10g45ek.c     |    2 +-
 arch/arm/mach-at91/board-snapper9260.c      |    2 +-
 arch/arm/mach-at91/board-stamp9g20.c        |    2 +-
 arch/arm/mach-at91/board-usb-a9260.c        |    2 +-
 arch/arm/mach-at91/board-usb-a9263.c        |    2 +-
 arch/arm/mach-at91/board-yl-9200.c          |    2 +-
 arch/arm/mach-at91/include/mach/board.h     |   14 ++------------
 arch/avr32/boards/atngw100/setup.c          |    2 +-
 arch/avr32/boards/atstk1000/atstk1002.c     |    2 +-
 arch/avr32/boards/favr-32/setup.c           |    2 +-
 arch/avr32/boards/hammerhead/setup.c        |    2 +-
 arch/avr32/boards/merisc/setup.c            |    2 +-
 arch/avr32/boards/mimc200/setup.c           |    2 +-
 arch/avr32/mach-at32ap/at32ap700x.c         |    8 ++++----
 arch/avr32/mach-at32ap/include/mach/board.h |    7 ++-----
 drivers/net/arm/at91_ether.c                |    3 ++-
 drivers/net/arm/at91_ether.h                |    4 +++-
 drivers/net/macb.c                          |   10 ++++------
 include/linux/platform_data/macb.h          |   17 +++++++++++++++++
 52 files changed, 91 insertions(+), 86 deletions(-)
 create mode 100644 include/linux/platform_data/macb.h

diff --git a/arch/arm/mach-at91/at572d940hf_devices.c b/arch/arm/mach-at91/at572d940hf_devices.c
index 0fc20a2..503b080 100644
--- a/arch/arm/mach-at91/at572d940hf_devices.c
+++ b/arch/arm/mach-at91/at572d940hf_devices.c
@@ -140,7 +140,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -167,7 +167,7 @@ static struct platform_device at572d940hf_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -196,7 +196,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at572d940hf_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index d1f775e..70d39fec 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -198,7 +198,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -225,7 +225,7 @@ static struct platform_device at91cap9_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -262,7 +262,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91cap9_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 7b53922..ca504a0 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -127,7 +127,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -154,7 +154,7 @@ static struct platform_device at91rm9200_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -191,7 +191,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91rm9200_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 07eb7b0..f6d4c57 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -128,7 +128,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -155,7 +155,7 @@ static struct platform_device at91sam9260_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -192,7 +192,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91sam9260_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index fb5c23a..d4a310c 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -138,7 +138,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -165,7 +165,7 @@ static struct platform_device at91sam9263_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -202,7 +202,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91sam9263_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 1e8f275..679247f 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -283,7 +283,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -310,7 +310,7 @@ static struct platform_device at91sam9g45_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -347,7 +347,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91sam9g45_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index 8a3fc84..ab4fefc 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -64,7 +64,7 @@ static void __init onearm_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata onearm_eth_data = {
+static struct macb_platform_data __initdata onearm_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index cba7f77..6d8bfa1 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -109,7 +109,7 @@ static struct spi_board_info afeb9260_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata afeb9260_macb_data = {
+static struct macb_platform_data __initdata afeb9260_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA9,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-at572d940hf_ek.c b/arch/arm/mach-at91/board-at572d940hf_ek.c
index 3929f1c..c57cf34 100644
--- a/arch/arm/mach-at91/board-at572d940hf_ek.c
+++ b/arch/arm/mach-at91/board-at572d940hf_ek.c
@@ -104,7 +104,7 @@ static struct at91_mmc_data __initdata eb_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata eb_eth_data = {
+static struct macb_platform_data __initdata eb_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PB25,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index b54e3e6..fcab5ba 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -121,7 +121,7 @@ static struct spi_board_info cam60_spi_devices[] __initdata = {
 /*
  * MACB Ethernet device
  */
-static struct __initdata at91_eth_data cam60_macb_data = {
+static struct __initdata macb_platform_data cam60_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PB5,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index e727444..6196438 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -158,7 +158,7 @@ static struct at91_mmc_data __initdata cap9adk_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata cap9adk_macb_data = {
+static struct macb_platform_data __initdata cap9adk_macb_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 2e74a19..a5db698 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -62,7 +62,7 @@ static void __init carmeva_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata carmeva_eth_data = {
+static struct macb_platform_data __initdata carmeva_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index 3838594..0cd73fc 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -104,7 +104,7 @@ static struct at91_udc_data __initdata cpu9krea_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata cpu9krea_macb_data = {
+static struct macb_platform_data __initdata cpu9krea_macb_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index 2f4dd8c..1faf4ff 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -83,7 +83,7 @@ static void __init cpuat91_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata cpuat91_eth_data = {
+static struct macb_platform_data __initdata cpuat91_eth_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 464839d..e090e3b 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -63,7 +63,7 @@ static void __init csb337_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata csb337_eth_data = {
+static struct macb_platform_data __initdata csb337_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC2,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 431688c..01d5e01 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -57,7 +57,7 @@ static void __init csb637_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata csb637_eth_data = {
+static struct macb_platform_data __initdata csb637_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC0,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 6cf6566..5a439ec 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -65,7 +65,7 @@ static void __init eb9200_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata eb9200_eth_data = {
+static struct macb_platform_data __initdata eb9200_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index de2fd04..029832d 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -65,7 +65,7 @@ static void __init ecb_at91init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata ecb_at91eth_data = {
+static struct macb_platform_data __initdata ecb_at91eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
index a158a0c..7475432 100644
--- a/arch/arm/mach-at91/board-eco920.c
+++ b/arch/arm/mach-at91/board-eco920.c
@@ -47,7 +47,7 @@ static void __init eco920_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata eco920_eth_data = {
+static struct macb_platform_data __initdata eco920_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC2,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
index dfc7dfe..a405841 100644
--- a/arch/arm/mach-at91/board-foxg20.c
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -141,7 +141,7 @@ static struct spi_board_info foxg20_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata foxg20_macb_data = {
+static struct macb_platform_data __initdata foxg20_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
index bc28136..5de9a6b 100644
--- a/arch/arm/mach-at91/board-gsia18s.c
+++ b/arch/arm/mach-at91/board-gsia18s.c
@@ -98,7 +98,7 @@ static struct at91_udc_data __initdata udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct macb_platform_data __initdata macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA28,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index d2e1f4e..0e1096c 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -62,7 +62,7 @@ static void __init kafa_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata kafa_eth_data = {
+static struct macb_platform_data __initdata kafa_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index a13d206..9fe14a2 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -71,7 +71,7 @@ static void __init kb9202_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata kb9202_eth_data = {
+static struct macb_platform_data __initdata kb9202_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PB29,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index fe5f1d4..02f2e4d 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -161,7 +161,7 @@ static struct at91_mmc_data __initdata neocore926_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata neocore926_macb_data = {
+static struct macb_platform_data __initdata neocore926_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PE31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
index feb6578..a719aef 100644
--- a/arch/arm/mach-at91/board-pcontrol-g20.c
+++ b/arch/arm/mach-at91/board-pcontrol-g20.c
@@ -129,7 +129,7 @@ static struct at91_udc_data __initdata pcontrol_g20_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct macb_platform_data __initdata macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA28,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 55dad3a..f7c5ae0 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -65,7 +65,7 @@ static void __init picotux200_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata picotux200_eth_data = {
+static struct macb_platform_data __initdata picotux200_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 69d15a8..1173fd9 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -110,7 +110,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index 4c1047c..6dcb06a 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -70,7 +70,7 @@ static void __init dk_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata dk_eth_data = {
+static struct macb_platform_data __initdata dk_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 9df1be8..e325eb8 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -70,7 +70,7 @@ static void __init ek_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata ek_eth_data = {
+static struct macb_platform_data __initdata ek_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 25a26be..1e29e79 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -115,7 +115,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index de1816e..8c84331 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -156,7 +156,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index bfe490d..a88d8c5 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -163,7 +163,7 @@ static struct at91_mmc_data __initdata ek_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PE31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index ca8198b..48a5f4c 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -128,7 +128,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 6c999db..933a21d 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -120,7 +120,7 @@ static struct mci_platform_data __initdata mci1_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PD5,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index 0a99b3c..8c9eb1b 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -70,7 +70,7 @@ static struct at91_udc_data __initdata snapper9260_udc_data = {
 	.vbus_polled		= 1,
 };
 
-static struct at91_eth_data snapper9260_macb_data = {
+static struct macb_platform_data snapper9260_macb_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index f8902b1..821afb0 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -163,7 +163,7 @@ static struct at91_udc_data __initdata stamp9g20evb_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct macb_platform_data __initdata macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA28,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
index 07784ba..8cc7868 100644
--- a/arch/arm/mach-at91/board-usb-a9260.c
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -84,7 +84,7 @@ static struct at91_udc_data __initdata ek_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
index b614508..242da50 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -97,7 +97,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PE31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index e0f0080..2aa861c 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -112,7 +112,7 @@ static struct gpio_led yl9200_leds[] = {
 /*
  * Ethernet
  */
-static struct at91_eth_data __initdata yl9200_eth_data = {
+static struct macb_platform_data __initdata yl9200_eth_data = {
 	.phy_irq_pin		= AT91_PIN_PB28,
 	.is_rmii		= 1,
 };
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index 2b499eb..5e5acc4 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -40,6 +40,7 @@
 #include <linux/atmel-mci.h>
 #include <sound/atmel-ac97c.h>
 #include <linux/serial.h>
+#include <linux/platform_data/macb.h>
 
  /* USB Device */
 struct at91_udc_data {
@@ -81,18 +82,7 @@ extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
   /* atmel-mci platform config */
 extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data);
 
- /* Ethernet (EMAC & MACB) */
-struct at91_eth_data {
-	u32		phy_mask;
-	u8		phy_irq_pin;	/* PHY IRQ */
-	u8		is_rmii;	/* using RMII interface? */
-};
-extern void __init at91_add_device_eth(struct at91_eth_data *data);
-
-#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9G20) || defined(CONFIG_ARCH_AT91CAP9) \
-	|| defined(CONFIG_ARCH_AT91SAM9G45) || defined(CONFIG_ARCH_AT572D940HF)
-#define eth_platform_data	at91_eth_data
-#endif
+extern void __init at91_add_device_eth(struct macb_platform_data *data);
 
  /* USB Host */
 struct at91_usbh_data {
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index 659d119..1e14083 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -113,7 +113,7 @@ struct eth_addr {
 	u8 addr[6];
 };
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2];
+static struct macb_platform_data __initdata eth_data[2];
 
 static struct spi_board_info spi0_board_info[] __initdata = {
 	{
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 6ce30fb..47906ba 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -110,7 +110,7 @@ struct eth_addr {
 };
 
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2] = {
+static struct macb_platform_data __initdata eth_data[2] = {
 	{
 		/*
 		 * The MDIO pullups on STK1000 are a bit too weak for
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index 86fab77..27bd6fb 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -50,7 +50,7 @@ struct eth_addr {
 	u8 addr[6];
 };
 static struct eth_addr __initdata hw_addr[1];
-static struct eth_platform_data __initdata eth_data[1] = {
+static struct macb_platform_data __initdata eth_data[1] = {
 	{
 		.phy_mask	= ~(1U << 1),
 	},
diff --git a/arch/avr32/boards/hammerhead/setup.c b/arch/avr32/boards/hammerhead/setup.c
index da14fbd..9d1efd1 100644
--- a/arch/avr32/boards/hammerhead/setup.c
+++ b/arch/avr32/boards/hammerhead/setup.c
@@ -102,7 +102,7 @@ struct eth_addr {
 };
 
 static struct eth_addr __initdata hw_addr[1];
-static struct eth_platform_data __initdata eth_data[1];
+static struct macb_platform_data __initdata eth_data[1];
 
 /*
  * The next two functions should go away as the boot loader is
diff --git a/arch/avr32/boards/merisc/setup.c b/arch/avr32/boards/merisc/setup.c
index e61bc94..ed137e3 100644
--- a/arch/avr32/boards/merisc/setup.c
+++ b/arch/avr32/boards/merisc/setup.c
@@ -52,7 +52,7 @@ struct eth_addr {
 };
 
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2];
+static struct macb_platform_data __initdata eth_data[2];
 
 static int ads7846_get_pendown_state_PB26(void)
 {
diff --git a/arch/avr32/boards/mimc200/setup.c b/arch/avr32/boards/mimc200/setup.c
index c4da5cb..05358aa 100644
--- a/arch/avr32/boards/mimc200/setup.c
+++ b/arch/avr32/boards/mimc200/setup.c
@@ -86,7 +86,7 @@ struct eth_addr {
 	u8 addr[6];
 };
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2];
+static struct macb_platform_data __initdata eth_data[2];
 
 static struct spi_eeprom eeprom_25lc010 = {
 		.name = "25lc010",
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index e67c999..a8d2e6c 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1064,7 +1064,7 @@ void __init at32_setup_serial_console(unsigned int usart_id)
  * -------------------------------------------------------------------- */
 
 #ifdef CONFIG_CPU_AT32AP7000
-static struct eth_platform_data macb0_data;
+static struct macb_platform_data macb0_data;
 static struct resource macb0_resource[] = {
 	PBMEM(0xfff01800),
 	IRQ(25),
@@ -1073,7 +1073,7 @@ DEFINE_DEV_DATA(macb, 0);
 DEV_CLK(hclk, macb0, hsb, 8);
 DEV_CLK(pclk, macb0, pbb, 6);
 
-static struct eth_platform_data macb1_data;
+static struct macb_platform_data macb1_data;
 static struct resource macb1_resource[] = {
 	PBMEM(0xfff01c00),
 	IRQ(26),
@@ -1083,7 +1083,7 @@ DEV_CLK(hclk, macb1, hsb, 9);
 DEV_CLK(pclk, macb1, pbb, 7);
 
 struct platform_device *__init
-at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
+at32_add_device_eth(unsigned int id, struct macb_platform_data *data)
 {
 	struct platform_device *pdev;
 	u32 pin_mask;
@@ -1160,7 +1160,7 @@ at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
 		return NULL;
 	}
 
-	memcpy(pdev->dev.platform_data, data, sizeof(struct eth_platform_data));
+	memcpy(pdev->dev.platform_data, data, sizeof(struct macb_platform_data));
 	platform_device_register(pdev);
 
 	return pdev;
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index 6174020..cb340ae 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -6,6 +6,7 @@
 
 #include <linux/types.h>
 #include <linux/serial.h>
+#include <linux/platform_data/macb.h>
 
 #define GPIO_PIN_NONE	(-1)
 
@@ -41,12 +42,8 @@ struct atmel_uart_data {
 void at32_map_usart(unsigned int hw_id, unsigned int line, int flags);
 struct platform_device *at32_add_device_usart(unsigned int id);
 
-struct eth_platform_data {
-	u32	phy_mask;
-	u8	is_rmii;
-};
 struct platform_device *
-at32_add_device_eth(unsigned int id, struct eth_platform_data *data);
+at32_add_device_eth(unsigned int id, struct macb_platform_data *data);
 
 struct spi_board_info;
 struct platform_device *
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
index e07b314..cb85318 100644
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -25,6 +25,7 @@
 #include <linux/skbuff.h>
 #include <linux/dma-mapping.h>
 #include <linux/ethtool.h>
+#include <linux/platform_data/macb.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/gfp.h>
@@ -983,7 +984,7 @@ static const struct net_device_ops at91ether_netdev_ops = {
 static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address,
 			struct platform_device *pdev, struct clk *ether_clk)
 {
-	struct at91_eth_data *board_data = pdev->dev.platform_data;
+	struct macb_platform_data *board_data = pdev->dev.platform_data;
 	struct net_device *dev;
 	struct at91_private *lp;
 	unsigned int val;
diff --git a/drivers/net/arm/at91_ether.h b/drivers/net/arm/at91_ether.h
index 353f4da..3725fbb0 100644
--- a/drivers/net/arm/at91_ether.h
+++ b/drivers/net/arm/at91_ether.h
@@ -85,7 +85,9 @@ struct recv_desc_bufs
 struct at91_private
 {
 	struct mii_if_info mii;			/* ethtool support */
-	struct at91_eth_data board_data;	/* board-specific configuration */
+	struct macb_platform_data board_data;	/* board-specific
+						 * configuration (shared with
+						 * macb for common data */
 	struct clk *ether_clk;			/* clock */
 
 	/* PHY */
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index e3860d6..aee1e51 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -18,12 +18,10 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/dma-mapping.h>
+#include <linux/platform_data/macb.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
 
-#include <mach/board.h>
-#include <mach/cpu.h>
-
 #include "macb.h"
 
 #define RX_BUFFER_SIZE		128
@@ -190,7 +188,7 @@ static int macb_mii_probe(struct net_device *dev)
 {
 	struct macb *bp = netdev_priv(dev);
 	struct phy_device *phydev;
-	struct eth_platform_data *pdata;
+	struct macb_platform_data *pdata;
 	int ret;
 
 	phydev = phy_find_first(bp->mii_bus);
@@ -227,7 +225,7 @@ static int macb_mii_probe(struct net_device *dev)
 
 static int macb_mii_init(struct macb *bp)
 {
-	struct eth_platform_data *pdata;
+	struct macb_platform_data *pdata;
 	int err = -ENXIO, i;
 
 	/* Enable management port */
@@ -1107,7 +1105,7 @@ static const struct net_device_ops macb_netdev_ops = {
 
 static int __init macb_probe(struct platform_device *pdev)
 {
-	struct eth_platform_data *pdata;
+	struct macb_platform_data *pdata;
 	struct resource *regs;
 	struct net_device *dev;
 	struct macb *bp;
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
new file mode 100644
index 0000000..e7c748f
--- /dev/null
+++ b/include/linux/platform_data/macb.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __MACB_PDATA_H__
+#define __MACB_PDATA_H__
+
+struct macb_platform_data {
+	u32		phy_mask;
+	u8		phy_irq_pin;	/* PHY IRQ */
+	u8		is_rmii;	/* using RMII interface? */
+};
+
+#endif /* __MACB_PDATA_H__ */
-- 
1.7.4


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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-17 21:51               ` Jamie Iles
@ 2011-03-18 15:41                 ` Russell King - ARM Linux
  2011-03-18 15:48                   ` Jamie Iles
  0 siblings, 1 reply; 46+ messages in thread
From: Russell King - ARM Linux @ 2011-03-18 15:41 UTC (permalink / raw)
  To: Jamie Iles
  Cc: Peter Korsgaard, avictor.za, plagnioj, linux-arm-kernel,
	nicolas.ferre, netdev

On Thu, Mar 17, 2011 at 09:51:01PM +0000, Jamie Iles wrote:
> On Thu, Mar 17, 2011 at 09:34:03AM +0000, Jamie Iles wrote:
> > Ok, I'll rename to macb_platform_data and update at91_ether to use 
> > that with a comment describing that we're sharing the platform data 
> > with macb.  At least that gets rid of the preprocessor stuff in 
> > board.h for at91 too.
> 
> So here's the updated patch with changes to the at91_ether driver to 
> share the data with macb.
> 
> Russell, are you happy to take this series?  If so, how would you prefer 
> it, in the patch system or as a git pull?

As Nicolas Ferre is listed in MAINTAINERS as being responsible for the
MACB driver, I think he should at last Ack these patches first.

I'm also concious of the fact that Linus complains if my tree contains
changes for drivers/ stuff as well as ARM stuff, so I'm nervous about
taking it as-is.  So, I'd rather see drivers stuff separated as much
as possible from the arch updates.

I'm also concious that this has become ready for potentially merging
during the merge window, and therefore hasn't had previous exposure
in linux-next, and so should wait until the next merge window.  I do
feel that I'm going to be yelled at for saying that... but I'm sure
I'll also be yelled at if I did take it.

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-18 15:41                 ` Russell King - ARM Linux
@ 2011-03-18 15:48                   ` Jamie Iles
  2011-03-18 15:54                     ` Russell King - ARM Linux
  0 siblings, 1 reply; 46+ messages in thread
From: Jamie Iles @ 2011-03-18 15:48 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Jamie Iles, Peter Korsgaard, avictor.za, plagnioj,
	linux-arm-kernel, nicolas.ferre, netdev

On Fri, Mar 18, 2011 at 03:41:18PM +0000, Russell King - ARM Linux wrote:
> On Thu, Mar 17, 2011 at 09:51:01PM +0000, Jamie Iles wrote:
> > On Thu, Mar 17, 2011 at 09:34:03AM +0000, Jamie Iles wrote:
> > > Ok, I'll rename to macb_platform_data and update at91_ether to use 
> > > that with a comment describing that we're sharing the platform data 
> > > with macb.  At least that gets rid of the preprocessor stuff in 
> > > board.h for at91 too.
> > 
> > So here's the updated patch with changes to the at91_ether driver to 
> > share the data with macb.
> > 
> > Russell, are you happy to take this series?  If so, how would you prefer 
> > it, in the patch system or as a git pull?
> 
> As Nicolas Ferre is listed in MAINTAINERS as being responsible for the
> MACB driver, I think he should at last Ack these patches first.

OK, that's absolutely fine with me.

> I'm also concious of the fact that Linus complains if my tree contains
> changes for drivers/ stuff as well as ARM stuff, so I'm nervous about
> taking it as-is.  So, I'd rather see drivers stuff separated as much
> as possible from the arch updates.

I happy to split the driver and arch updates, but I'm not sure that it 
can be done in such a way that platforms would build between the arch 
and driver merges.

> I'm also concious that this has become ready for potentially merging
> during the merge window, and therefore hasn't had previous exposure
> in linux-next, and so should wait until the next merge window.  I do
> feel that I'm going to be yelled at for saying that... but I'm sure
> I'll also be yelled at if I did take it.

I don't have any problem with waiting until the next merge window, and 
to be honest I'd like see these patches have some time in next as I 
can't test them on devices with a MACB.

Jamie

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-18 15:48                   ` Jamie Iles
@ 2011-03-18 15:54                     ` Russell King - ARM Linux
  2011-03-19 15:49                       ` Nicolas Ferre
  2011-04-23  5:48                       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 46+ messages in thread
From: Russell King - ARM Linux @ 2011-03-18 15:54 UTC (permalink / raw)
  To: Jamie Iles
  Cc: Peter Korsgaard, avictor.za, plagnioj, linux-arm-kernel,
	nicolas.ferre, netdev

On Fri, Mar 18, 2011 at 03:48:39PM +0000, Jamie Iles wrote:
> On Fri, Mar 18, 2011 at 03:41:18PM +0000, Russell King - ARM Linux wrote:
> > On Thu, Mar 17, 2011 at 09:51:01PM +0000, Jamie Iles wrote:
> > > On Thu, Mar 17, 2011 at 09:34:03AM +0000, Jamie Iles wrote:
> > > > Ok, I'll rename to macb_platform_data and update at91_ether to use 
> > > > that with a comment describing that we're sharing the platform data 
> > > > with macb.  At least that gets rid of the preprocessor stuff in 
> > > > board.h for at91 too.
> > > 
> > > So here's the updated patch with changes to the at91_ether driver to 
> > > share the data with macb.
> > > 
> > > Russell, are you happy to take this series?  If so, how would you prefer 
> > > it, in the patch system or as a git pull?
> > 
> > As Nicolas Ferre is listed in MAINTAINERS as being responsible for the
> > MACB driver, I think he should at last Ack these patches first.
> 
> OK, that's absolutely fine with me.
> 
> > I'm also concious of the fact that Linus complains if my tree contains
> > changes for drivers/ stuff as well as ARM stuff, so I'm nervous about
> > taking it as-is.  So, I'd rather see drivers stuff separated as much
> > as possible from the arch updates.
> 
> I happy to split the driver and arch updates, but I'm not sure that it 
> can be done in such a way that platforms would build between the arch 
> and driver merges.
> 
> > I'm also concious that this has become ready for potentially merging
> > during the merge window, and therefore hasn't had previous exposure
> > in linux-next, and so should wait until the next merge window.  I do
> > feel that I'm going to be yelled at for saying that... but I'm sure
> > I'll also be yelled at if I did take it.
> 
> I don't have any problem with waiting until the next merge window, and 
> to be honest I'd like see these patches have some time in next as I 
> can't test them on devices with a MACB.

Okay, that sounds like a very good reason to wait until Nicolas can
review them and provide an ack.

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-18 15:54                     ` Russell King - ARM Linux
@ 2011-03-19 15:49                       ` Nicolas Ferre
  2011-04-23  5:48                       ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 46+ messages in thread
From: Nicolas Ferre @ 2011-03-19 15:49 UTC (permalink / raw)
  To: Russell King - ARM Linux, Jamie Iles, Peter Korsgaard,
	avictor.za, plagnioj
  Cc: linux-arm-kernel, netdev

On 3/18/2011 11:54 PM, Russell King - ARM Linux :
> On Fri, Mar 18, 2011 at 03:48:39PM +0000, Jamie Iles wrote:
>> On Fri, Mar 18, 2011 at 03:41:18PM +0000, Russell King - ARM Linux wrote:
>>> On Thu, Mar 17, 2011 at 09:51:01PM +0000, Jamie Iles wrote:
>>>> On Thu, Mar 17, 2011 at 09:34:03AM +0000, Jamie Iles wrote:
>>>>> Ok, I'll rename to macb_platform_data and update at91_ether to use 
>>>>> that with a comment describing that we're sharing the platform data 
>>>>> with macb.  At least that gets rid of the preprocessor stuff in 
>>>>> board.h for at91 too.
>>>>
>>>> So here's the updated patch with changes to the at91_ether driver to 
>>>> share the data with macb.
>>>>
>>>> Russell, are you happy to take this series?  If so, how would you prefer 
>>>> it, in the patch system or as a git pull?
>>>
>>> As Nicolas Ferre is listed in MAINTAINERS as being responsible for the
>>> MACB driver, I think he should at last Ack these patches first.
>>
>> OK, that's absolutely fine with me.
>>
>>> I'm also concious of the fact that Linus complains if my tree contains
>>> changes for drivers/ stuff as well as ARM stuff, so I'm nervous about
>>> taking it as-is.  So, I'd rather see drivers stuff separated as much
>>> as possible from the arch updates.
>>
>> I happy to split the driver and arch updates, but I'm not sure that it 
>> can be done in such a way that platforms would build between the arch 
>> and driver merges.
>>
>>> I'm also concious that this has become ready for potentially merging
>>> during the merge window, and therefore hasn't had previous exposure
>>> in linux-next, and so should wait until the next merge window.  I do
>>> feel that I'm going to be yelled at for saying that... but I'm sure
>>> I'll also be yelled at if I did take it.
>>
>> I don't have any problem with waiting until the next merge window, and 
>> to be honest I'd like see these patches have some time in next as I 
>> can't test them on devices with a MACB.
> 
> Okay, that sounds like a very good reason to wait until Nicolas can
> review them and provide an ack.

Be sure that I am silently following this series in the background (too
silently ? ;-) ). I will provide an ack after a last review and testing
but as you have all fruitfully discussed main aspects I am very happy
with the way it is going.

Thanks to all of you, best regards,
-- 
Nicolas Ferre


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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-03-16 20:17 ` [PATCHv2 0/9] macb: add support for Cadence GEM David Miller
@ 2011-03-21  6:38   ` Nicolas Ferre
  2011-03-21 11:18     ` Jamie Iles
  0 siblings, 1 reply; 46+ messages in thread
From: Nicolas Ferre @ 2011-03-21  6:38 UTC (permalink / raw)
  To: David Miller, jamie, Russell King - ARM Linux
  Cc: netdev, linux-arm-kernel, plagnioj, Andrew Victor, Peter Korsgaard

On 3/17/2011 4:17 AM, David Miller :
> From: Jamie Iles <jamie@jamieiles.com>
> Date: Tue, 15 Mar 2011 10:14:47 +0000
> 
>> This patch series extends the Atmel MACB driver to support the Cadence
>> GEM (Gigabit Ethernet MAC) to support 10/100 operation.  The GEM is
>> based on the MACB block but has a few moved registers and bitfields.
>> This patch series attempts to use the MACB accessors where block
>> functionallity is identical and only overrides to GEM specific
>> acccessors when needed.
>>
>> This has been runtested on a board with a Cadence GEM and compile tested
>> for all at91 configurations and a number of avr32 configurations.
>>
>> Changes since v1:
>> 	- AT91 now provides a fake "hclk" and "macb_clk" has been
>> 	renamed to "pclk" to be consistent with AVR32.
>> 	- Configurable GEM receive buffer size support has been added.
>> 	- pr_foo() and dev_foo() have been converted to netdev_foo()
>> 	where appropriate.
>> 	- New conditional accessors (macb_or_gem_{read,write}l) have
>> 	been introduced that do the conditional accesses dependent on
>> 	macb/gem type.
>> 	- GEM is now dynamically detected from the module ID rather than
>> 	platform device name.
>>
>> Jean-Christophe, I haven't based this on your conditional clock patch as
>> I wasn't sure what decision had been made on that and whether the
>> at91/avr32 detection is reliable.
> 
> I'm happy to ACK this so you guys can merge this via one of the
> ARM trees:
> 
> Acked-by: David S. Miller <davem@davemloft.net>

I add my:

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Now, tell me if we need to setup a git tree with this and make it handled by linux-next (we do not have for at91 yet)?
or Russell can take the series in a "devel" branch?

I have tested the series with the v2 patches. It is working good with some modification that were discussed (hclk, pclk clocks). I attach modifications I have made to make it work so that you have an idea of my testbed (not a patch as you should already have this and it is on a development platform):

+/* One additional fake clock for macb interfaces */
+static struct clk hclk = {
+       .name           = "hclk",
+       .pmc_mask       = 0,
+       .type           = CLK_TYPE_PERIPHERAL,
+};

@@ -247,6 +254,7 @@ static struct clk *periph_clocks[] __initdata = {
        // irq0
        &ohci_clk,
        &tcb1_clk,
+       &hclk,
 };

[..]

                /* Clock */
-               at91_clock_associate("macb0_clk", &at91sam9x5_eth0_device.dev, "macb_clk");
+               at91_clock_associate("macb0_clk", &at91sam9x5_eth0_device.dev, "pclk");

                eth0_data = *data;
                platform_device_register(&at91sam9x5_eth0_device);

Thanks, best regards,
-- 
Nicolas Ferre


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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-03-21  6:38   ` Nicolas Ferre
@ 2011-03-21 11:18     ` Jamie Iles
  2011-03-22 16:18       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 46+ messages in thread
From: Jamie Iles @ 2011-03-21 11:18 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: David Miller, jamie, Russell King - ARM Linux, netdev,
	linux-arm-kernel, plagnioj, Andrew Victor, Peter Korsgaard

On Mon, Mar 21, 2011 at 02:38:18PM +0800, Nicolas Ferre wrote:
> On 3/17/2011 4:17 AM, David Miller :
> > From: Jamie Iles <jamie@jamieiles.com>
> > Date: Tue, 15 Mar 2011 10:14:47 +0000
> > 
> >> This patch series extends the Atmel MACB driver to support the Cadence
> >> GEM (Gigabit Ethernet MAC) to support 10/100 operation.  The GEM is
> >> based on the MACB block but has a few moved registers and bitfields.
> >> This patch series attempts to use the MACB accessors where block
> >> functionallity is identical and only overrides to GEM specific
> >> acccessors when needed.
> >>
> >> This has been runtested on a board with a Cadence GEM and compile tested
> >> for all at91 configurations and a number of avr32 configurations.
> >>
> >> Changes since v1:
> >> 	- AT91 now provides a fake "hclk" and "macb_clk" has been
> >> 	renamed to "pclk" to be consistent with AVR32.
> >> 	- Configurable GEM receive buffer size support has been added.
> >> 	- pr_foo() and dev_foo() have been converted to netdev_foo()
> >> 	where appropriate.
> >> 	- New conditional accessors (macb_or_gem_{read,write}l) have
> >> 	been introduced that do the conditional accesses dependent on
> >> 	macb/gem type.
> >> 	- GEM is now dynamically detected from the module ID rather than
> >> 	platform device name.
> >>
> >> Jean-Christophe, I haven't based this on your conditional clock patch as
> >> I wasn't sure what decision had been made on that and whether the
> >> at91/avr32 detection is reliable.
> > 
> > I'm happy to ACK this so you guys can merge this via one of the
> > ARM trees:
> > 
> > Acked-by: David S. Miller <davem@davemloft.net>
> 
> I add my:
> 
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> Now, tell me if we need to setup a git tree with this and make it 
> handled by linux-next (we do not have for at91 yet)?
> or Russell can take the series in a "devel" branch?

Thanks for testing Nicolas!

I have an existing tree for this at

	git://github.com/jamieiles/linux-2.6-ji.git macb-gem

based off of 2.6.38 (with your ACK's now added) and I'd be happy with 
either route.

Jamie

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-03-21 11:18     ` Jamie Iles
@ 2011-03-22 16:18       ` Jean-Christophe PLAGNIOL-VILLARD
  2011-03-22 16:39         ` Jamie Iles
  0 siblings, 1 reply; 46+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-03-22 16:18 UTC (permalink / raw)
  To: Jamie Iles
  Cc: Nicolas Ferre, David Miller, Russell King - ARM Linux, netdev,
	linux-arm-kernel, Andrew Victor, Peter Korsgaard

On 11:18 Mon 21 Mar     , Jamie Iles wrote:
> On Mon, Mar 21, 2011 at 02:38:18PM +0800, Nicolas Ferre wrote:
> > On 3/17/2011 4:17 AM, David Miller :
> > > From: Jamie Iles <jamie@jamieiles.com>
> > > Date: Tue, 15 Mar 2011 10:14:47 +0000
> > > 
> > >> This patch series extends the Atmel MACB driver to support the Cadence
> > >> GEM (Gigabit Ethernet MAC) to support 10/100 operation.  The GEM is
> > >> based on the MACB block but has a few moved registers and bitfields.
> > >> This patch series attempts to use the MACB accessors where block
> > >> functionallity is identical and only overrides to GEM specific
> > >> acccessors when needed.
> > >>
> > >> This has been runtested on a board with a Cadence GEM and compile tested
> > >> for all at91 configurations and a number of avr32 configurations.
> > >>
> > >> Changes since v1:
> > >> 	- AT91 now provides a fake "hclk" and "macb_clk" has been
> > >> 	renamed to "pclk" to be consistent with AVR32.
> > >> 	- Configurable GEM receive buffer size support has been added.
> > >> 	- pr_foo() and dev_foo() have been converted to netdev_foo()
> > >> 	where appropriate.
> > >> 	- New conditional accessors (macb_or_gem_{read,write}l) have
> > >> 	been introduced that do the conditional accesses dependent on
> > >> 	macb/gem type.
> > >> 	- GEM is now dynamically detected from the module ID rather than
> > >> 	platform device name.
> > >>
> > >> Jean-Christophe, I haven't based this on your conditional clock patch as
> > >> I wasn't sure what decision had been made on that and whether the
> > >> at91/avr32 detection is reliable.
> > > 
> > > I'm happy to ACK this so you guys can merge this via one of the
> > > ARM trees:
> > > 
> > > Acked-by: David S. Miller <davem@davemloft.net>
> > 
> > I add my:
> > 
> > Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> > 
> > Now, tell me if we need to setup a git tree with this and make it 
> > handled by linux-next (we do not have for at91 yet)?
> > or Russell can take the series in a "devel" branch?
> 
> Thanks for testing Nicolas!
> 
> I have an existing tree for this at
> 
> 	git://github.com/jamieiles/linux-2.6-ji.git macb-gem
> 
> based off of 2.6.38 (with your ACK's now added) and I'd be happy with 
> either route.
but we must detect the gem via the version register and ditto for macb for
avr32 and at91

so please rebase it over my patch

and you get my sob too

Best Regards,
J.

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-03-22 16:18       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-03-22 16:39         ` Jamie Iles
  2011-03-22 17:55           ` Jamie Iles
  0 siblings, 1 reply; 46+ messages in thread
From: Jamie Iles @ 2011-03-22 16:39 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Jamie Iles, Nicolas Ferre, David Miller,
	Russell King - ARM Linux, netdev, linux-arm-kernel,
	Andrew Victor, Peter Korsgaard

Hi Jean-Christophe,

On Tue, Mar 22, 2011 at 05:18:11PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 11:18 Mon 21 Mar     , Jamie Iles wrote:
> > I have an existing tree for this at
> > 
> > 	git://github.com/jamieiles/linux-2.6-ji.git macb-gem
> > 
> > based off of 2.6.38 (with your ACK's now added) and I'd be happy with 
> > either route.
> but we must detect the gem via the version register and ditto for macb for
> avr32 and at91
> 
> so please rebase it over my patch
> 
> and you get my sob too

Would you mind respinning your patch without the changes to the clk 
stuff?  Otherwise we're changing it from compile time to version based, 
only to completely remove it in subsequent patches.

Also, can you confirm that the module ID's that you are using to 
differentiate between AT91 and AVR32 won't clash with MACB uses in 
other, non-at91/avr32 chips, or that it doesn't matter?

Jamie

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-03-22 16:39         ` Jamie Iles
@ 2011-03-22 17:55           ` Jamie Iles
  2011-03-24 16:25             ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 46+ messages in thread
From: Jamie Iles @ 2011-03-22 17:55 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Nicolas Ferre, David Miller, Russell King - ARM Linux, netdev,
	linux-arm-kernel, Andrew Victor, Peter Korsgaard

Hi Jean-Christophe,

On Tue, Mar 22, 2011 at 04:39:17PM +0000, Jamie Iles wrote:
> Hi Jean-Christophe,
> 
> On Tue, Mar 22, 2011 at 05:18:11PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 11:18 Mon 21 Mar     , Jamie Iles wrote:
> > > I have an existing tree for this at
> > > 
> > > 	git://github.com/jamieiles/linux-2.6-ji.git macb-gem
> > > 
> > > based off of 2.6.38 (with your ACK's now added) and I'd be happy with 
> > > either route.
> > but we must detect the gem via the version register and ditto for macb for
> > avr32 and at91
> > 
> > so please rebase it over my patch
> > 
> > and you get my sob too
> 
> Would you mind respinning your patch without the changes to the clk 
> stuff?  Otherwise we're changing it from compile time to version based, 
> only to completely remove it in subsequent patches.

Actually, this patch doesn't work anyway as the version register is 
being read before the clks are enabled so the device isn't accessible 
(and the registers haven't yet been ioremap()'d).

> Also, can you confirm that the module ID's that you are using to 
> differentiate between AT91 and AVR32 won't clash with MACB uses in 
> other, non-at91/avr32 chips, or that it doesn't matter?

If this does work, then it would be nice if we made the else path of the 
RMII AT91 tests also test for avr32 too so we aren't driving the USRIO 
pins on platforms that aren't at91 but also aren't avr32.  So something 
the patch below instead.

Jamie

8<---

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 79ccb54..55b81f5 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -22,7 +22,6 @@
 #include <linux/phy.h>
 
 #include <mach/board.h>
-#include <mach/cpu.h>
 
 #include "macb.h"
 
@@ -1169,6 +1168,7 @@ static int __init macb_probe(struct platform_device *pdev)
 		err = -ENOMEM;
 		goto err_out_disable_clocks;
 	}
+	bp->version = macb_readl(bp, VERSION);
 
 	dev->irq = platform_get_irq(pdev, 0);
 	err = request_irq(dev->irq, macb_interrupt, IRQF_SAMPLE_RANDOM,
@@ -1201,18 +1201,18 @@ static int __init macb_probe(struct platform_device *pdev)
 	macb_get_hwaddr(bp);
 	pdata = pdev->dev.platform_data;
 
-	if (pdata && pdata->is_rmii)
-#if defined(CONFIG_ARCH_AT91)
-		macb_writel(bp, USRIO, (MACB_BIT(RMII) | MACB_BIT(CLKEN)) );
-#else
-		macb_writel(bp, USRIO, 0);
-#endif
-	else
-#if defined(CONFIG_ARCH_AT91)
-		macb_writel(bp, USRIO, MACB_BIT(CLKEN));
-#else
-		macb_writel(bp, USRIO, MACB_BIT(MII));
-#endif
+	if (pdata && pdata->is_rmii) {
+		if (macb_is_at91(bp))
+			macb_writel(bp, USRIO,
+				    (MACB_BIT(RMII) | MACB_BIT(CLKEN)));
+		else if (macb_is_avr32(bp))
+			macb_writel(bp, USRIO, 0);
+	} else {
+		if (macb_is_at91(bp))
+			macb_writel(bp, USRIO, MACB_BIT(CLKEN));
+		else if (macb_is_avr32(bp))
+			macb_writel(bp, USRIO, MACB_BIT(MII));
+	}
 
 	bp->tx_pending = DEF_TX_RING_PENDING;
 
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index d3212f6..56a4fcb 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -59,6 +59,7 @@
 #define MACB_TPQ				0x00bc
 #define MACB_USRIO				0x00c0
 #define MACB_WOL				0x00c4
+#define MACB_VERSION				0x00fc
 
 /* Bitfields in NCR */
 #define MACB_LB_OFFSET				0
@@ -389,6 +390,14 @@ struct macb {
 	unsigned int 		link;
 	unsigned int 		speed;
 	unsigned int 		duplex;
+
+	uint32_t		version;
 };
 
+#define MACB_VERSION_MASK	0xffff0000
+#define macb_is_at91(bp)	\
+	(((bp)->version & MACB_VERSION_MASK) == 0x06010000)
+#define macb_is_avr32(bp)	\
+	(((bp)->version & MACB_VERSION_MASK) == 0x00010000)
+
 #endif /* _MACB_H */

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-03-22 17:55           ` Jamie Iles
@ 2011-03-24 16:25             ` Jean-Christophe PLAGNIOL-VILLARD
  2011-03-31  9:40               ` Jamie Iles
  0 siblings, 1 reply; 46+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-03-24 16:25 UTC (permalink / raw)
  To: Jamie Iles
  Cc: Nicolas Ferre, David Miller, Russell King - ARM Linux, netdev,
	linux-arm-kernel, Andrew Victor, Peter Korsgaard

On 17:55 Tue 22 Mar     , Jamie Iles wrote:
> Hi Jean-Christophe,
> 
> On Tue, Mar 22, 2011 at 04:39:17PM +0000, Jamie Iles wrote:
> > Hi Jean-Christophe,
> > 
> > On Tue, Mar 22, 2011 at 05:18:11PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 11:18 Mon 21 Mar     , Jamie Iles wrote:
> > > > I have an existing tree for this at
> > > > 
> > > > 	git://github.com/jamieiles/linux-2.6-ji.git macb-gem
> > > > 
> > > > based off of 2.6.38 (with your ACK's now added) and I'd be happy with 
> > > > either route.
> > > but we must detect the gem via the version register and ditto for macb for
> > > avr32 and at91
> > > 
> > > so please rebase it over my patch
> > > 
> > > and you get my sob too
> > 
> > Would you mind respinning your patch without the changes to the clk 
> > stuff?  Otherwise we're changing it from compile time to version based, 
> > only to completely remove it in subsequent patches.
> 
> Actually, this patch doesn't work anyway as the version register is 
> being read before the clks are enabled so the device isn't accessible 
> (and the registers haven't yet been ioremap()'d).
yeah I found it also I forget to put he RFC in the patch title as I want just to
give the way to detect it the way to detect it for avr32 and at91
so we can remove the ifdef fully
> 
> > Also, can you confirm that the module ID's that you are using to 
> > differentiate between AT91 and AVR32 won't clash with MACB uses in 
> > other, non-at91/avr32 chips, or that it doesn't matter?
> 
> If this does work, then it would be nice if we made the else path of the 
> RMII AT91 tests also test for avr32 too so we aren't driving the USRIO 
> pins on platforms that aren't at91 but also aren't avr32.  So something 
> the patch below instead.
I'm currently traveling so I can not test it yet will test it next week
but looks good

Best Regards,
J.

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-03-24 16:25             ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-03-31  9:40               ` Jamie Iles
  2011-04-05 10:28                 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 46+ messages in thread
From: Jamie Iles @ 2011-03-31  9:40 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Jamie Iles, Nicolas Ferre, David Miller,
	Russell King - ARM Linux, netdev, linux-arm-kernel,
	Andrew Victor, Peter Korsgaard

Hi Jean-Christophe,

On Thu, Mar 24, 2011 at 05:25:17PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 17:55 Tue 22 Mar     , Jamie Iles wrote:
> > Hi Jean-Christophe,
> > > Also, can you confirm that the module ID's that you are using to 
> > > differentiate between AT91 and AVR32 won't clash with MACB uses in 
> > > other, non-at91/avr32 chips, or that it doesn't matter?
> > 
> > If this does work, then it would be nice if we made the else path of the 
> > RMII AT91 tests also test for avr32 too so we aren't driving the USRIO 
> > pins on platforms that aren't at91 but also aren't avr32.  So something 
> > the patch below instead.
> I'm currently traveling so I can not test it yet will test it next week
> but looks good

Just wondering if you'd had chance to test.  If so, would you mind 
reposting and I'll rebase my patches on top of it.

I also have patches for checksum offloading, receive packet timestamping 
and wake-on-lan support but I'd like to get the basic GEM ones into next 
first.

Jamie

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-03-31  9:40               ` Jamie Iles
@ 2011-04-05 10:28                 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-04-05 10:49                   ` Jamie Iles
  2011-04-05 11:12                   ` Peter Korsgaard
  0 siblings, 2 replies; 46+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-04-05 10:28 UTC (permalink / raw)
  To: Jamie Iles
  Cc: Nicolas Ferre, David Miller, Russell King - ARM Linux, netdev,
	linux-arm-kernel, Andrew Victor, Peter Korsgaard

On 10:40 Thu 31 Mar     , Jamie Iles wrote:
> Hi Jean-Christophe,
> 
> On Thu, Mar 24, 2011 at 05:25:17PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 17:55 Tue 22 Mar     , Jamie Iles wrote:
> > > Hi Jean-Christophe,
> > > > Also, can you confirm that the module ID's that you are using to 
> > > > differentiate between AT91 and AVR32 won't clash with MACB uses in 
> > > > other, non-at91/avr32 chips, or that it doesn't matter?
> > > 
> > > If this does work, then it would be nice if we made the else path of the 
> > > RMII AT91 tests also test for avr32 too so we aren't driving the USRIO 
> > > pins on platforms that aren't at91 but also aren't avr32.  So something 
> > > the patch below instead.
> > I'm currently traveling so I can not test it yet will test it next week
> > but looks good
> 
> Just wondering if you'd had chance to test.  If so, would you mind 
> reposting and I'll rebase my patches on top of it.
> 
> I also have patches for checksum offloading, receive packet timestamping 
> and wake-on-lan support but I'd like to get the basic GEM ones into next 
> first.
work fine on 9263ek except the IP version detection.

the at91 macb ip version is supposed to be at 0x0601010C but it's not.
At least on 9263 it's 0x0001010C. So we can not detect the arch at runtime
but we can detect that it's a macb.

So could keep the ifdef for 2 archs but use the ip version on arm

Best Regards,
J.

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-04-05 10:28                 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-04-05 10:49                   ` Jamie Iles
  2011-04-05 11:21                     ` Jean-Christophe PLAGNIOL-VILLARD
  2011-04-05 11:12                   ` Peter Korsgaard
  1 sibling, 1 reply; 46+ messages in thread
From: Jamie Iles @ 2011-04-05 10:49 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD, Russell King - ARM Linux
  Cc: Jamie Iles, netdev, Nicolas Ferre, David Miller, Peter Korsgaard,
	Andrew Victor, linux-arm-kernel

On Tue, Apr 05, 2011 at 12:28:42PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> work fine on 9263ek except the IP version detection.
> 
> the at91 macb ip version is supposed to be at 0x0601010C but it's not.
> At least on 9263 it's 0x0001010C. So we can not detect the arch at runtime
> but we can detect that it's a macb.
> 
> So could keep the ifdef for 2 archs but use the ip version on arm

OK, well I think my patches are already doing that so should be OK as 
they are.

Russell, are you able to take these through your tree (I think they 
count as consolidation work) or should I ask Stephen for a tree in 
linux-next for a while first?

Jamie

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-04-05 10:28                 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-04-05 10:49                   ` Jamie Iles
@ 2011-04-05 11:12                   ` Peter Korsgaard
  1 sibling, 0 replies; 46+ messages in thread
From: Peter Korsgaard @ 2011-04-05 11:12 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Jamie Iles, Nicolas Ferre, David Miller,
	Russell King - ARM Linux, netdev, linux-arm-kernel,
	Andrew Victor

>>>>> "Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> writes:

Hi,

 JC> work fine on 9263ek except the IP version detection.

 JC> the at91 macb ip version is supposed to be at 0x0601010C but it's not.
 JC> At least on 9263 it's 0x0001010C. So we can not detect the arch at runtime
 JC> but we can detect that it's a macb.

Same here on a 9g45.

-- 
Bye, Peter Korsgaard

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-04-05 10:49                   ` Jamie Iles
@ 2011-04-05 11:21                     ` Jean-Christophe PLAGNIOL-VILLARD
  2011-04-05 11:47                       ` Jamie Iles
  0 siblings, 1 reply; 46+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-04-05 11:21 UTC (permalink / raw)
  To: Jamie Iles
  Cc: Russell King - ARM Linux, netdev, Nicolas Ferre, David Miller,
	Peter Korsgaard, Andrew Victor, linux-arm-kernel

On 11:49 Tue 05 Apr     , Jamie Iles wrote:
> On Tue, Apr 05, 2011 at 12:28:42PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > work fine on 9263ek except the IP version detection.
> > 
> > the at91 macb ip version is supposed to be at 0x0601010C but it's not.
> > At least on 9263 it's 0x0001010C. So we can not detect the arch at runtime
> > but we can detect that it's a macb.
> > 
> > So could keep the ifdef for 2 archs but use the ip version on arm
> 
> OK, well I think my patches are already doing that so should be OK as 
> they are.
> 
> Russell, are you able to take these through your tree (I think they 
> count as consolidation work) or should I ask Stephen for a tree in 
> linux-next for a while first?
no please do not us the is_gem but the same way as I did in the ip detection
keep the version register and then check it.

as this ip can be used on other arch we do not want to see thousands of is_xxx

Best Regards,
J.

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-04-05 11:21                     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-04-05 11:47                       ` Jamie Iles
  2011-04-05 11:57                         ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 46+ messages in thread
From: Jamie Iles @ 2011-04-05 11:47 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Jamie Iles, Russell King - ARM Linux, netdev, Nicolas Ferre,
	David Miller, Peter Korsgaard, Andrew Victor, linux-arm-kernel

On Tue, Apr 05, 2011 at 01:21:02PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 11:49 Tue 05 Apr     , Jamie Iles wrote:
> > On Tue, Apr 05, 2011 at 12:28:42PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > work fine on 9263ek except the IP version detection.
> > > 
> > > the at91 macb ip version is supposed to be at 0x0601010C but it's not.
> > > At least on 9263 it's 0x0001010C. So we can not detect the arch at runtime
> > > but we can detect that it's a macb.
> > > 
> > > So could keep the ifdef for 2 archs but use the ip version on arm
> > 
> > OK, well I think my patches are already doing that so should be OK as 
> > they are.
> > 
> > Russell, are you able to take these through your tree (I think they 
> > count as consolidation work) or should I ask Stephen for a tree in 
> > linux-next for a while first?
> no please do not us the is_gem but the same way as I did in the ip detection
> keep the version register and then check it.
> 
> as this ip can be used on other arch we do not want to see thousands 
> of is_xxx

But GEM isn't an architecture/machine type, it's a new Cadence Ethernet 
controller that follows on from MACB, not some arch specific tweaks so 
we really only have two options - MACB or GEM.

Still, if it's important to you then I'll make the change.

Jamie

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

* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
  2011-04-05 11:47                       ` Jamie Iles
@ 2011-04-05 11:57                         ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 46+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-04-05 11:57 UTC (permalink / raw)
  To: Jamie Iles
  Cc: Russell King - ARM Linux, netdev, Nicolas Ferre, David Miller,
	Peter Korsgaard, Andrew Victor, linux-arm-kernel

On 12:47 Tue 05 Apr     , Jamie Iles wrote:
> On Tue, Apr 05, 2011 at 01:21:02PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 11:49 Tue 05 Apr     , Jamie Iles wrote:
> > > On Tue, Apr 05, 2011 at 12:28:42PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > work fine on 9263ek except the IP version detection.
> > > > 
> > > > the at91 macb ip version is supposed to be at 0x0601010C but it's not.
> > > > At least on 9263 it's 0x0001010C. So we can not detect the arch at runtime
> > > > but we can detect that it's a macb.
> > > > 
> > > > So could keep the ifdef for 2 archs but use the ip version on arm
> > > 
> > > OK, well I think my patches are already doing that so should be OK as 
> > > they are.
> > > 
> > > Russell, are you able to take these through your tree (I think they 
> > > count as consolidation work) or should I ask Stephen for a tree in 
> > > linux-next for a while first?
> > no please do not us the is_gem but the same way as I did in the ip detection
> > keep the version register and then check it.
> > 
> > as this ip can be used on other arch we do not want to see thousands 
> > of is_xxx
> 
> But GEM isn't an architecture/machine type, it's a new Cadence Ethernet 
> controller that follows on from MACB, not some arch specific tweaks so 
> we really only have two options - MACB or GEM.
I agree but you can have this ip in other soc so we need to try to make it
as generic as possible
and socs can have specific tweaks
So use the version register and mask it is better in my mind and more flexible
It's a shame that we can not detect the diff between avr32 and at91 via ip
version.

I hope that ip variation could be detected via version register.
Next time.
> 
> Still, if it's important to you then I'll make the change.
If you don't ming please

Best Regards,
J.

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

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
  2011-03-18 15:54                     ` Russell King - ARM Linux
  2011-03-19 15:49                       ` Nicolas Ferre
@ 2011-04-23  5:48                       ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 46+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-04-23  5:48 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Jamie Iles, Peter Korsgaard, avictor.za, linux-arm-kernel,
	nicolas.ferre, netdev

> > I happy to split the driver and arch updates, but I'm not sure that it 
> > can be done in such a way that platforms would build between the arch 
> > and driver merges.
> > 
> > > I'm also concious that this has become ready for potentially merging
> > > during the merge window, and therefore hasn't had previous exposure
> > > in linux-next, and so should wait until the next merge window.  I do
> > > feel that I'm going to be yelled at for saying that... but I'm sure
> > > I'll also be yelled at if I did take it.
> > 
> > I don't have any problem with waiting until the next merge window, and 
> > to be honest I'd like see these patches have some time in next as I 
> > can't test them on devices with a MACB.
> 
> Okay, that sounds like a very good reason to wait until Nicolas can
> review them and provide an ack.
David Russell If you don't mind I'll apply it on at91 tree as we prepare other
huge update on mach-at91

Best Regards,
J.

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

end of thread, other threads:[~2011-04-23  5:57 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
2011-03-15 10:14 ` [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name Jamie Iles
2011-03-15 12:35   ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-15 12:44     ` Jamie Iles
2011-03-16  6:53   ` avictor.za
2011-03-16  8:38     ` Russell King - ARM Linux
2011-03-17  9:22       ` Andrew Victor
2011-03-17 10:00         ` Russell King - ARM Linux
2011-03-17 10:09           ` Jamie Iles
2011-03-15 10:14 ` [PATCHv2 2/9] macb: remove conditional clk handling Jamie Iles
2011-03-15 10:14 ` [PATCHv2 3/9] macb: unify at91 and avr32 platform data Jamie Iles
2011-03-15 11:14   ` Peter Korsgaard
2011-03-15 11:34     ` Jamie Iles
2011-03-15 12:36     ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-17  8:43     ` avictor.za
2011-03-17  8:48       ` Peter Korsgaard
2011-03-17  8:58         ` Russell King - ARM Linux
2011-03-17  9:22           ` Peter Korsgaard
2011-03-17  9:34             ` Jamie Iles
2011-03-17 21:51               ` Jamie Iles
2011-03-18 15:41                 ` Russell King - ARM Linux
2011-03-18 15:48                   ` Jamie Iles
2011-03-18 15:54                     ` Russell King - ARM Linux
2011-03-19 15:49                       ` Nicolas Ferre
2011-04-23  5:48                       ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-15 10:14 ` [PATCHv2 4/9] macb: convert printk to netdev_ and friends Jamie Iles
2011-03-15 12:36   ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-15 10:14 ` [PATCHv2 5/9] macb: initial support for Cadence GEM Jamie Iles
2011-03-15 10:14 ` [PATCHv2 6/9] macb: support higher rate GEM MDIO clock divisors Jamie Iles
2011-03-15 10:14 ` [PATCHv2 7/9] macb: support statistics for GEM devices Jamie Iles
2011-03-15 10:14 ` [PATCHv2 8/9] macb: support DMA bus widths > 32 bits Jamie Iles
2011-03-15 10:14 ` [PATCHv2 9/9] macb: allow GEM to have configurable receive buffer size Jamie Iles
2011-03-16 20:17 ` [PATCHv2 0/9] macb: add support for Cadence GEM David Miller
2011-03-21  6:38   ` Nicolas Ferre
2011-03-21 11:18     ` Jamie Iles
2011-03-22 16:18       ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-22 16:39         ` Jamie Iles
2011-03-22 17:55           ` Jamie Iles
2011-03-24 16:25             ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-31  9:40               ` Jamie Iles
2011-04-05 10:28                 ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-05 10:49                   ` Jamie Iles
2011-04-05 11:21                     ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-05 11:47                       ` Jamie Iles
2011-04-05 11:57                         ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-05 11:12                   ` Peter Korsgaard

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