ARM: LPC32xx: Ethernet support
authorRoland Stigge <stigge@antcom.de>
Mon, 12 Mar 2012 21:27:28 +0000 (22:27 +0100)
committerRoland Stigge <stigge@antcom.de>
Tue, 13 Mar 2012 20:23:07 +0000 (21:23 +0100)
This patch adds ethernet support to the LPC32xx ARM architecture. The actual
driver in drivers/net is contained in a separate patch.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
arch/arm/mach-lpc32xx/Kconfig
arch/arm/mach-lpc32xx/clock.c
arch/arm/mach-lpc32xx/common.c
arch/arm/mach-lpc32xx/common.h
arch/arm/mach-lpc32xx/include/mach/board.h [new file with mode: 0644]
arch/arm/mach-lpc32xx/irq.c
arch/arm/mach-lpc32xx/phy3250.c

index fde6635..75946ac 100644 (file)
@@ -29,5 +29,30 @@ config ARCH_LPC32XX_UART6_SELECT
 
 endmenu
 
+menu "LPC32XX chip components"
+
+config ARCH_LPC32XX_IRAM_FOR_NET
+       bool "Use IRAM for network buffers"
+       default y
+       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"
+       help
+         Say Y here to enable MII support, or N for 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
 
index 370a547..47639f3 100644 (file)
@@ -1134,7 +1134,7 @@ static struct clk_lookup lookups[] = {
        _REGISTER_CLOCK("lpc32xx-adc", NULL, clk_adc)
        _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc)
        _REGISTER_CLOCK("dev:mmc0", NULL, clk_mmc)
-       _REGISTER_CLOCK("lpc-net.0", NULL, clk_net)
+       _REGISTER_CLOCK("lpc-eth.0", NULL, clk_net)
        _REGISTER_CLOCK("dev:clcd", NULL, clk_lcd)
        _REGISTER_CLOCK("lpc32xx_udc", "ck_usbd", clk_usbd)
        _REGISTER_CLOCK("lpc32xx_rtc", NULL, clk_rtc)
index 11c9008..bbbf063 100644 (file)
@@ -186,6 +186,27 @@ struct platform_device lpc32xx_ohci_device = {
 };
 
 /*
+ * Network Support
+ */
+static struct resource net_resources[] = {
+       [0] = DEFINE_RES_MEM(LPC32XX_ETHERNET_BASE, SZ_4K),
+       [1] = DEFINE_RES_MEM(LPC32XX_IRAM_BASE, SZ_128K),
+       [2] = DEFINE_RES_IRQ(IRQ_LPC32XX_ETHERNET),
+};
+
+static u64 lpc32xx_mac_dma_mask = 0xffffffffUL;
+struct platform_device lpc32xx_net_device = {
+       .name = "lpc-eth",
+       .id = 0,
+       .dev = {
+               .dma_mask = &lpc32xx_mac_dma_mask,
+               .coherent_dma_mask = 0xffffffffUL,
+       },
+       .num_resources = ARRAY_SIZE(net_resources),
+       .resource = net_resources,
+};
+
+/*
  * Returns the unique ID for the device
  */
 void lpc32xx_get_uid(u32 devid[4])
index e1880b0..23c2190 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef __LPC32XX_COMMON_H
 #define __LPC32XX_COMMON_H
 
+#include <mach/board.h>
 #include <linux/platform_device.h>
 
 /*
@@ -32,6 +33,7 @@ extern struct platform_device lpc32xx_tsc_device;
 extern struct platform_device lpc32xx_adc_device;
 extern struct platform_device lpc32xx_rtc_device;
 extern struct platform_device lpc32xx_ohci_device;
+extern struct platform_device lpc32xx_net_device;
 
 /*
  * Other arch specific structures and functions
@@ -67,8 +69,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
  */
diff --git a/arch/arm/mach-lpc32xx/include/mach/board.h b/arch/arm/mach-lpc32xx/include/mach/board.h
new file mode 100644 (file)
index 0000000..52531ca
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * arm/arch/mach-lpc32xx/include/mach/board.h
+ *
+ * Author: Kevin Wells <kevin.wells@nxp.com>
+ *
+ * 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
+
+extern u32 lpc32xx_return_iram_size(void);
+
+#endif  /* __ASM_ARCH_BOARD_H */
index 4eae566..f4564cb 100644 (file)
@@ -146,6 +146,10 @@ static const struct lpc32xx_event_info lpc32xx_events[NR_IRQS] = {
                .event_group = &lpc32xx_event_int_regs,
                .mask = LPC32XX_CLKPWR_INTSRC_KEY_BIT,
        },
+       [IRQ_LPC32XX_ETHERNET] = {
+               .event_group = &lpc32xx_event_int_regs,
+               .mask = LPC32XX_CLKPWR_INTSRC_MAC_BIT,
+       },
        [IRQ_LPC32XX_USB_OTG_ATX] = {
                .event_group = &lpc32xx_event_int_regs,
                .mask = LPC32XX_CLKPWR_INTSRC_USBATXINT_BIT,
index 53f1230..562ec96 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
+#include <mach/board.h>
 #include <mach/gpio-lpc32xx.h>
 #include "common.h"
 
@@ -280,6 +281,7 @@ static struct platform_device *phy3250_devs[] __initdata = {
        &lpc32xx_gpio_led_device,
        &lpc32xx_adc_device,
        &lpc32xx_ohci_device,
+       &lpc32xx_net_device,
 };
 
 static struct amba_device *amba_devs[] __initdata = {