Skip to contentSkip to conversation

ARM: LPC32xx: Ethernet support

PATCH Superseded [email protected] 1 participant 2 messages Feb 2, 2012

Subsystems (5)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: LPC32xx: Ethernet support

This patch adds ethernet support to the LPC32xx ARM architecture.

arch/arm/mach-lpc32xx/Kconfig +26 -0
index fde6635..a6ee27a 100644
@@ -29,5 +29,31 @@ config ARCH_LPC32XX_UART6_SELECT
 
 endmenu
 
+menu "LPC32XX chip components"
+
+config ARCH_LPC32XX_IRAM_FOR_NET
+	bool "Use IRAM for network buffers"
+	default n
+	help
+	  Say Y here to use the LPC internal fast IRAM (i.e. 256KB SRAM) as
+	  network buffer.  If the total combined required buffer sizes is
+	  larger than the size of IRAM, then SDRAM will be used instead.
+
+	  This can be enabled safely if the IRAM is not intended for other
+	  uses.
+
+config ARCH_LPC32XX_MII_SUPPORT
+	bool "Check to enable MII support or leave disabled for RMII support"
+	default n
+	help
+	  Say Y here to enable MII support, or N to RMII support. Regardless of
+	  which support is selected, the ethernet interface driver needs to be
+	  selected in the device driver networking section.
+
+	  The PHY3250 reference board uses RMII, so users of this board should
+	  say N.
+
+endmenu
+
 endif
 
arch/arm/mach-lpc32xx/common.h +1 -2
index 050fd2f..e42d702 100644
@@ -19,6 +19,7 @@
 #ifndef __LPC32XX_COMMON_H
 #define __LPC32XX_COMMON_H
 
+#include <mach/board.h>
 #include <linux/platform_device.h>
 
 /*
@@ -66,8 +67,6 @@ extern u32 clk_get_pclk_div(void);
  */
 extern void lpc32xx_get_uid(u32 devid[4]);
 
-extern u32 lpc32xx_return_iram_size(void);
-
 /*
  * Pointers used for sizing and copying suspend function data
  */
arch/arm/mach-lpc32xx/include/mach/board.h new file +32 -0
new file mode 100644
index 0000000..bcdac8e
@@ -0,0 +1,32 @@
+/*
+ * arm/arch/mach-lpc32xx/include/mach/board.h
+ *
+ * Author: Kevin Wells <[email protected]>
+ *
+ * Copyright (C) 2010 NXP Semiconductors
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ASM_ARCH_BOARD_H
+#define __ASM_ARCH_BOARD_H
+
+/*
+ * Network configuration structure
+ */
+struct lpc_net_cfg {
+	int	phy_irq;        /* PHY IRQ number, or -1 for polling */
+	u32	phy_mask;       /* PHY mask value */
+};
+
+extern u32 lpc32xx_return_iram_size(void);
+
+#endif  /* __ASM_ARCH_BOARD_H */
arch/arm/mach-lpc32xx/phy3250.c +38 -0
index 4e81e99..12a3d03 100644
@@ -37,6 +37,7 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
+#include <mach/board.h>
 #include <mach/gpio-lpc32xx.h>
 #include "common.h"
 
@@ -270,6 +271,40 @@ static struct platform_device lpc32xx_gpio_led_device = {
 	.dev.platform_data	= &led_data,
 };
 
+/*
+ * Network Support
+ */
+static struct lpc_net_cfg lpc32xx_netdata = {
+	.phy_irq = -1,
+	.phy_mask = 0xFFFFFFF0,
+};
+
+static struct resource net_resources[] = {
+	[0] = {
+		.start = LPC32XX_ETHERNET_BASE,
+		.end = LPC32XX_ETHERNET_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start = IRQ_LPC32XX_ETHERNET,
+		.end = IRQ_LPC32XX_ETHERNET,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+static u64 lpc32xx_mac_dma_mask = 0xffffffffUL;
+static struct platform_device lpc32xx_net_device = {
+	.name = "lpc-net",
+	.id = 0,
+	.dev = {
+		.dma_mask = &lpc32xx_mac_dma_mask,
+		.coherent_dma_mask = 0xffffffffUL,
+		.platform_data = &lpc32xx_netdata,
+	},
+	.num_resources = ARRAY_SIZE(net_resources),
+	.resource = net_resources,
+};
+
 static struct platform_device *phy3250_devs[] __initdata = {
 	&lpc32xx_i2c0_device,
 	&lpc32xx_i2c1_device,
@@ -279,6 +314,9 @@ static struct platform_device *phy3250_devs[] __initdata = {
 #if defined(CONFIG_USB_OHCI_HCD)
 	&lpc32xx_ohci_device,
 #endif
+#if defined(CONFIG_LPC_ENET)
+	&lpc32xx_net_device,
+#endif
 };
 
 static struct amba_device *amba_devs[] __initdata = {
drivers/net/ethernet/Kconfig +1 -0
index 3474a61..c63a64c 100644
@@ -126,6 +126,7 @@ config NET_NETX
 
 source "drivers/net/ethernet/nuvoton/Kconfig"
 source "drivers/net/ethernet/nvidia/Kconfig"
+source "drivers/net/ethernet/nxp/Kconfig"
 source "drivers/net/ethernet/octeon/Kconfig"
 source "drivers/net/ethernet/oki-semi/Kconfig"
 
drivers/net/ethernet/Makefile +1 -0
index 08d5f03..9676a51 100644
@@ -47,6 +47,7 @@ obj-$(CONFIG_NET_VENDOR_NATSEMI) += natsemi/
 obj-$(CONFIG_NET_NETX) += netx-eth.o
 obj-$(CONFIG_NET_VENDOR_NUVOTON) += nuvoton/
 obj-$(CONFIG_NET_VENDOR_NVIDIA) += nvidia/
+obj-$(CONFIG_LPC_ENET) += nxp/
 obj-$(CONFIG_OCTEON_MGMT_ETHERNET) += octeon/
 obj-$(CONFIG_NET_VENDOR_OKI) += oki-semi/
 obj-$(CONFIG_ETHOC) += ethoc.o
drivers/net/ethernet/nxp/Kconfig new file +7 -0
new file mode 100644
index 0000000..90cce04
@@ -0,0 +1,7 @@
+config LPC_ENET
+        tristate "NXP ethernet MAC on LPC devices"
+        depends on ARCH_LPC32XX
+        select PHYLIB
+        help
+          Say Y here if you want to use the NXP ethernet MAC included
+          on some NXP LPC devices, e.g. LPC32xx.
drivers/net/ethernet/nxp/Makefile new file +1 -0
new file mode 100644
index 0000000..a128114
@@ -0,0 +1 @@
+obj-$(CONFIG_LPC_ENET) += lpc_eth.o
drivers/net/ethernet/nxp/lpc_eth.c new file +1337 -0

1,337 lines not on this page · raw message

drivers/net/ethernet/nxp/lpc_eth.h new file +317 -0

317 lines not on this page · raw message

#1 lore raw

Hi,

Quoted 3 lines · On 02/02/2012 04:04 PM, [email protected] wrote:

This patch adds ethernet support to the LPC32xx ARM architecture.

This is part of a series of patches to make the lpc32xx architecture more usable. Without some of the other fixes in the patches, the ethernet driver alone isn't very useful.

For compiling and testing, please also consider the other patches at

http://antcom.de/lpc32xx/

You can also compare my lpc32xx based branch "work92105" at
http://git.antcom.de/, repo linux-2.6.

I can also forward the other (non-network related) LPC32xx-patches to you if you like.

Thanks in advance!

Roland