diff options
author | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-07-18 10:29:58 +0000 |
---|---|---|
committer | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-07-18 10:29:58 +0000 |
commit | af139e0177a37caa0cd6f28741ee48a985622a1b (patch) | |
tree | 3e7c4142764fe488d0d1d6a2d895a76781b584b2 /target/linux/adm5120/files | |
parent | 349bd35d6d71af2b45be93ab278381376763e503 (diff) |
[adm5120] add support for generic eb214a, thanks cezary (#7027)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22275 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/adm5120/files')
6 files changed, 138 insertions, 1 deletions
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/Kconfig b/target/linux/adm5120/files/arch/mips/adm5120/Kconfig index 7f8378db50..2be9f901af 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/Kconfig +++ b/target/linux/adm5120/files/arch/mips/adm5120/Kconfig @@ -37,6 +37,13 @@ config ADM5120_MACH_WP54 select ADM5120_OEM_COMPEX default y +config ADM5120_MACH_EB_214A + bool "EB-214A support" + depends on CPU_LITTLE_ENDIAN + select ADM5120_SOC_BGA + select ADM5120_OEM_GENERIC + default y + config ADM5120_MACH_BR_6104K bool "Edimax BR-6104K support" depends on CPU_LITTLE_ENDIAN @@ -165,6 +172,9 @@ config ADM5120_OEM_COMPEX config ADM5120_OEM_EDIMAX def_bool n +config ADM5120_OEM_GENERIC + def_bool n + config ADM5120_OEM_INFINEON def_bool n diff --git a/target/linux/adm5120/files/arch/mips/adm5120/common/prom.c b/target/linux/adm5120/files/arch/mips/adm5120/common/prom.c index 81ba365a0e..8506366ab1 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/common/prom.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/common/prom.c @@ -68,6 +68,8 @@ static struct board_desc common_boards[] __initdata = { DEFBOARD("OSBRiDGE 5GXi", MACH_ADM5120_5GXI), /* Motorola boards */ DEFBOARD("Powerline MU Gateway",MACH_ADM5120_PMUGW), + /* Generic EB-214A */ + DEFBOARD("ADM5120", MACH_ADM5120_EB_214A), }; static unsigned long __init find_machtype_byname(char *name) diff --git a/target/linux/adm5120/files/arch/mips/adm5120/generic/Makefile b/target/linux/adm5120/files/arch/mips/adm5120/generic/Makefile new file mode 100644 index 0000000000..0c032e3a52 --- /dev/null +++ b/target/linux/adm5120/files/arch/mips/adm5120/generic/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_ADM5120_MACH_EB_214A) += eb-214a.o diff --git a/target/linux/adm5120/files/arch/mips/adm5120/generic/eb-214a.c b/target/linux/adm5120/files/arch/mips/adm5120/generic/eb-214a.c new file mode 100644 index 0000000000..4ebe413a3c --- /dev/null +++ b/target/linux/adm5120/files/arch/mips/adm5120/generic/eb-214a.c @@ -0,0 +1,123 @@ +/* + * EB-214A board support + * + * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org> + * Copyright (C) 2010 Cezary Jackiewicz <cezary@eko.one.pl> + * + * 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. + * + */ + +#include <asm/addrspace.h> +#include <asm/byteorder.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/gpio.h> +#include <linux/irq.h> +#include <linux/etherdevice.h> + +#include <asm/mips_machine.h> + +#include <asm/mach-adm5120/adm5120_info.h> +#include <asm/mach-adm5120/adm5120_platform.h> +#include <asm/mach-adm5120/adm5120_defs.h> + + +#define EB214A_GPIO_DEV_MASK 0 +#define EB214A_CONFIG_OFFSET 0x4000 + +#ifdef CONFIG_MTD_PARTITIONS +static struct mtd_partition eb214a_partitions[] = { + { + .name = "bootloader", + .offset = 0, + .size = 32*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "config", + .offset = MTDPART_OFS_APPEND, + .size = 32*1024, + } , { + .name = "firmware", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + } +}; +#endif /* CONFIG_MTD_PARTITIONS */ + +static struct adm5120_pci_irq eb214a_pci_irqs[] __initdata = { + PCIIRQ(4, 0, 1, ADM5120_IRQ_PCI0), + PCIIRQ(4, 1, 2, ADM5120_IRQ_PCI0), + PCIIRQ(4, 2, 3, ADM5120_IRQ_PCI0), +}; + +static struct gpio_led eb214a_gpio_leds[] __initdata = { + GPIO_LED_INV(ADM5120_GPIO_PIN7, "power", NULL), + GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L0, "usb1", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L1, "usb2", NULL), + GPIO_LED_INV(ADM5120_GPIO_P4L2, "usb3", NULL), + GPIO_LED_INV(ADM5120_GPIO_P3L0, "usb4", NULL), +}; + +static struct gpio_button eb214a_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = BTN_0, + .threshold = 5, + .gpio = ADM5120_GPIO_PIN1, + } +}; + +static u8 eb214a_vlans[6] __initdata = { + 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 +}; + +static void __init eb214a_mac_setup(void) +{ + u8 mac_base[6]; + u8 *cfg; + int i; + + cfg = (u8 *) KSEG1ADDR(ADM5120_SRAM0_BASE + EB214A_CONFIG_OFFSET); + for (i = 0; i < 6; i++) + mac_base[i] = cfg[i]; + + if (!is_valid_ether_addr(mac_base)) + random_ether_addr(mac_base); + + adm5120_setup_eth_macs(mac_base); +} + +static void __init eb214a_setup(void) +{ +#ifdef CONFIG_MTD_PARTITIONS + adm5120_flash0_data.nr_parts = ARRAY_SIZE(eb214a_partitions); + adm5120_flash0_data.parts = eb214a_partitions; +#endif /* CONFIG_MTD_PARTITIONS */ + adm5120_add_device_flash(0); + + adm5120_add_device_gpio(EB214A_GPIO_DEV_MASK); + + adm5120_add_device_uart(0); + //adm5120_add_device_uart(1); + + adm5120_add_device_switch(5, eb214a_vlans); + + eb214a_mac_setup(); + + adm5120_add_device_gpio_buttons(ARRAY_SIZE(eb214a_gpio_buttons), + eb214a_gpio_buttons); + + adm5120_add_device_gpio_leds(ARRAY_SIZE(eb214a_gpio_leds), + eb214a_gpio_leds); + + adm5120_pci_set_irq_map(ARRAY_SIZE(eb214a_pci_irqs), + eb214a_pci_irqs); +// adm5120_add_device_usb(); +} + +MIPS_MACHINE(MACH_ADM5120_EB_214A, "EB-214A", "Generic EB-214A", eb214a_setup); diff --git a/target/linux/adm5120/files/arch/mips/include/asm/mach-adm5120/adm5120_info.h b/target/linux/adm5120/files/arch/mips/include/asm/mach-adm5120/adm5120_info.h index a72a9927fb..9e72c1b1a1 100644 --- a/target/linux/adm5120/files/arch/mips/include/asm/mach-adm5120/adm5120_info.h +++ b/target/linux/adm5120/files/arch/mips/include/asm/mach-adm5120/adm5120_info.h @@ -84,6 +84,7 @@ enum { MACH_ADM5120_WP54, /* Compex WP54G/WP54AG/WPP54G/WPP54AG */ MACH_ADM5120_WP54G_WRT, /* Compex WP54G-WRT */ MACH_ADM5120_WP54Gv1C, /* Compex WP54G version 1C */ + MACH_ADM5120_EB_214A, /* Generic EB-214A */ }; /* diff --git a/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c b/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c index bde3e32082..0bef8048ff 100644 --- a/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c +++ b/target/linux/adm5120/files/arch/mips/pci/pci-adm5120.c @@ -201,7 +201,7 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) goto out; } - if (slot < 1 || slot > 3) { + if (slot < 1 || slot > 4) { printk(KERN_ALERT "PCI: slot number %u is not supported\n", slot); goto out; |