Skip to contentSkip to conversation

MIPS: lantiq: add ethernet driver

PATCH In review John Crispin 2 participants 7 messages May 9, 2011 1 message not in the archive

Subsystems (4)

v3 of 6 In review Latest is v6 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v3 1/3 MIPS: lantiq: add DMA support

This patch adds support for the DMA engine found inside the XWAY family of SoCs. The engine has 5 ports and 20 channels.

---

Changes in V2
* use spinlocks

Changes in V3
* dma is not a platform device

 .../mips/include/asm/mach-lantiq/xway/lantiq_soc.h |    3 +-
 arch/mips/include/asm/mach-lantiq/xway/xway_dma.h  |   60 +++++
 arch/mips/lantiq/xway/Makefile                     |    2 +-
 arch/mips/lantiq/xway/dma.c                        |  253 ++++++++++++++++++++
 4 files changed, 316 insertions(+), 2 deletions(-)
 create mode 100644 arch/mips/include/asm/mach-lantiq/xway/xway_dma.h
 create mode 100644 arch/mips/lantiq/xway/dma.c
arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h +2 -1
index 343e82c..4827afb 100644
@@ -86,7 +86,8 @@
 #define LTQ_PPE32_SIZE		0x40000
 
 /* DMA */
-#define LTQ_DMA_BASE_ADDR	0xBE104100
+#define LTQ_DMA_BASE_ADDR	0x1E104100
+#define LTQ_DMA_SIZE		0x800
 
 /* PCI */
 #define PCI_CR_BASE_ADDR	0x1E105400
arch/mips/include/asm/mach-lantiq/xway/xway_dma.h new file +60 -0

60 lines not on this page · raw message

arch/mips/lantiq/xway/Makefile +1 -1
index a021def..d88a3e8 100644
@@ -1,4 +1,4 @@
-obj-y := pmu.o ebu.o reset.o gpio.o gpio_stp.o gpio_ebu.o devices.o
+obj-y := pmu.o ebu.o reset.o gpio.o gpio_stp.o gpio_ebu.o devices.o dma.o
 
 obj-$(CONFIG_SOC_XWAY) += clk-xway.o prom-xway.o
 obj-$(CONFIG_SOC_AMAZON_SE) += clk-ase.o prom-ase.o
arch/mips/lantiq/xway/dma.c new file +253 -0

253 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#2 lore raw

Re: [PATCH V3 1/3] MIPS: lantiq: add DMA support

Queued for 2.6.40.

Thanks,

Ralf

#3 lore raw

Re: [PATCH V3 1/3] MIPS: lantiq: add DMA support

Quoted 8 lines · Ralf Baechle

Queued for 2.6.40.

Thanks,

Ralf

thank you !

#4 lore raw

PATCH v3 2/3 MIPS: lantiq: add ethernet driver

In reply to a message not in the archive

This patch adds the driver for the ETOP Packet Processing Engine (PPE32) found inside the XWAY family of Lantiq MIPS SoCs. This driver makes 100MBit ethernet work. Support for all 8 dma channels, gbit and the embedded switch found on the ar9/vr9 still needs to be implemented.

---

Changes in V2:
* use spinlocks
* use NAPI
* remove duplicate stats counter

Changes in V3:
* validate the MAC passed inside the platform data
* make checkpatch happy

 .../mips/include/asm/mach-lantiq/lantiq_platform.h |    7 +
 .../mips/include/asm/mach-lantiq/xway/lantiq_soc.h |    4 +-
 arch/mips/lantiq/xway/devices.c                    |   23 +
 arch/mips/lantiq/xway/devices.h                    |    2 +
 drivers/net/Kconfig                                |    7 +
 drivers/net/Makefile                               |    1 +
 drivers/net/lantiq_etop.c                          |  805 ++++++++++++++++++++
 7 files changed, 847 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/lantiq_etop.c
arch/mips/include/asm/mach-lantiq/lantiq_platform.h +7 -0
index 1f1dba6..a305f1d 100644
@@ -10,6 +10,7 @@
 #define _LANTIQ_PLATFORM_H__
 
 #include <linux/mtd/partitions.h>
+#include <linux/socket.h>
 
 /* struct used to pass info to the pci core */
 enum {
@@ -43,4 +44,10 @@ struct ltq_pci_data {
 	int irq[16];
 };
 
+/* struct used to pass info to network drivers */
+struct ltq_eth_data {
+	struct sockaddr mac;
+	int mii_mode;
+};
+
 #endif
arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h +2 -2
index 4827afb..8a3c6be 100644
@@ -82,8 +82,8 @@
 #define PMU_SWITCH		0x10000000
 
 /* ETOP - ethernet */
-#define LTQ_PPE32_BASE_ADDR	0xBE180000
-#define LTQ_PPE32_SIZE		0x40000
+#define LTQ_ETOP_BASE_ADDR	0x1E180000
+#define LTQ_ETOP_SIZE		0x40000
 
 /* DMA */
 #define LTQ_DMA_BASE_ADDR	0x1E104100
arch/mips/lantiq/xway/devices.c +23 -0
index 7d58ae5..c257026 100644
@@ -75,3 +75,26 @@ void __init ltq_register_gpio_stp(void)
 {
 	platform_device_register_simple("ltq_stp", 0, &ltq_stp_resource, 1);
 }
+
+/* ethernet */
+static struct resource ltq_etop_resources = {
+	.name	= "etop",
+	.start	= LTQ_ETOP_BASE_ADDR,
+	.end	= LTQ_ETOP_BASE_ADDR + LTQ_ETOP_SIZE - 1,
+	.flags	= IORESOURCE_MEM,
+};
+
+static struct platform_device ltq_etop = {
+	.name		= "ltq_etop",
+	.resource	= &ltq_etop_resources,
+	.num_resources	= 1,
+};
+
+void __init
+ltq_register_etop(struct ltq_eth_data *eth)
+{
+	if (eth) {
+		ltq_etop.dev.platform_data = eth;
+		platform_device_register(&ltq_etop);
+	}
+}
arch/mips/lantiq/xway/devices.h +2 -0
index 87ba61e..2deb68e 100644
@@ -10,8 +10,10 @@
 #define _LTQ_DEVICES_XWAY_H__
 
 #include "../devices.h"
+#include <linux/phy.h>
 
 extern void ltq_register_gpio(void);
 extern void ltq_register_gpio_stp(void);
+extern void ltq_register_etop(struct ltq_eth_data *eth);
 
 #endif
drivers/net/Kconfig +7 -0
index b30c688..4878587 100644
@@ -2017,6 +2017,13 @@ config FTMAC100
 	  from Faraday. It is used on Faraday A320, Andes AG101 and some
 	  other ARM/NDS32 SoC's.
 
+config LANTIQ_ETOP
+	tristate "Lantiq SoC ETOP driver"
+	depends on SOC_TYPE_XWAY
+	help
+	  Support for the MII0 inside the Lantiq SoC
+
+
 source "drivers/net/fs_enet/Kconfig"
 
 source "drivers/net/octeon/Kconfig"
drivers/net/Makefile +1 -0
index fbfca11..df71da7 100644
@@ -261,6 +261,7 @@ obj-$(CONFIG_MLX4_CORE) += mlx4/
 obj-$(CONFIG_ENC28J60) += enc28j60.o
 obj-$(CONFIG_ETHOC) += ethoc.o
 obj-$(CONFIG_GRETH) += greth.o
+obj-$(CONFIG_LANTIQ_ETOP) += lantiq_etop.o
 
 obj-$(CONFIG_XTENSA_XT2000_SONIC) += xtsonic.o
 
drivers/net/lantiq_etop.c new file +805 -0

805 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#6 lore raw

PATCH v3 3/3 MIPS: lantiq: etop board support

In reply to a message not in the archive

Register the etop platform device inside the machtype specific init code.

--

 arch/mips/lantiq/xway/mach-easy50712.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/mips/lantiq/xway/mach-easy50712.c +5 -0
index 5242a27..0cbb30b 100644
@@ -59,6 +59,10 @@ static struct ltq_pci_data ltq_pci_data = {
 	},
 };
 
+static struct ltq_eth_data ltq_eth_data = {
+	.mii_mode = PHY_INTERFACE_MODE_MII,
+};
+
 static void __init easy50712_init(void)
 {
 	ltq_register_gpio();
@@ -66,6 +70,7 @@ static void __init easy50712_init(void)
 	ltq_register_nor(&easy50712_flash_data);
 	ltq_register_wdt();
 	ltq_register_pci(&ltq_pci_data);
+	ltq_register_etop(&ltq_eth_data);
 }
 
 MIPS_MACHINE(LTQ_MACH_EASY50712,
Signature · 1 line
1.7.2.3
#7 lore raw

Re: [PATCH V3 3/3] MIPS: lantiq: etop board support

Queued for 2.6.40.

Thanks,

Ralf