summaryrefslogtreecommitdiff
path: root/target/linux/adm5120/files-2.6.26
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-09-23 14:56:29 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-09-23 14:56:29 +0000
commitd5723b9bc31596d77ad082d16c14ac50ac3988f9 (patch)
tree0c7a44c83c9059418c27ef12db4fde06316f9346 /target/linux/adm5120/files-2.6.26
parenta66691d8cbcb4b0cf5ce42125c06395573e78127 (diff)
[adm5120] experimental support for the Motorola MU Gateway
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12662 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/adm5120/files-2.6.26')
-rw-r--r--target/linux/adm5120/files-2.6.26/arch/mips/adm5120/Kconfig10
-rw-r--r--target/linux/adm5120/files-2.6.26/arch/mips/adm5120/common/prom.c2
-rw-r--r--target/linux/adm5120/files-2.6.26/arch/mips/adm5120/motorola/Makefile1
-rw-r--r--target/linux/adm5120/files-2.6.26/arch/mips/adm5120/motorola/pmugw.c102
4 files changed, 115 insertions, 0 deletions
diff --git a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/Kconfig b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/Kconfig
index 1c4a91ad85..71868f9b5f 100644
--- a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/Kconfig
+++ b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/Kconfig
@@ -123,6 +123,13 @@ config ADM5120_MACH_RB_192
select ADM5120_OEM_MIKROTIK
default y
+config ADM5120_MACH_PMUGW
+ bool "Motorola Powerline MU Gateway"
+ depends on CPU_LITTLE_ENDIAN
+ select ADM5120_SOC_BGA
+ select ADM5120_OEM_MOTOROLA
+ default y
+
config ADM5120_MACH_P_334WT
bool "ZyXEL Prestige 334WT"
depends on CPU_BIG_ENDIAN
@@ -158,6 +165,9 @@ config ADM5120_OEM_INFINEON
config ADM5120_OEM_MIKROTIK
def_bool n
+config ADM5120_OEM_MOTOROLA
+ def_bool n
+
config ADM5120_OEM_ZYXEL
def_bool n
diff --git a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/common/prom.c b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/common/prom.c
index 260c4e5bbf..4c48dc0be2 100644
--- a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/common/prom.c
+++ b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/common/prom.c
@@ -67,6 +67,8 @@ static struct board_desc common_boards[] __initdata = {
DEFBOARD("153", MACH_ADM5120_RB_153),
DEFBOARD("192", MACH_ADM5120_RB_192),
DEFBOARD("miniROUTER", MACH_ADM5120_RB_150),
+ /* Motorola boards */
+ DEFBOARD("Powerline MU Gateway",MACH_ADM5120_PMUGW),
};
static unsigned long __init find_machtype_byname(char *name)
diff --git a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/motorola/Makefile b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/motorola/Makefile
new file mode 100644
index 0000000000..239d5a0880
--- /dev/null
+++ b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/motorola/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_ADM5120_MACH_PMUGW) += pmugw.o
diff --git a/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/motorola/pmugw.c b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/motorola/pmugw.c
new file mode 100644
index 0000000000..a74d37d4f3
--- /dev/null
+++ b/target/linux/adm5120/files-2.6.26/arch/mips/adm5120/motorola/pmugw.c
@@ -0,0 +1,102 @@
+/*
+ * Motorola Powerline MU Gateway board
+ *
+ * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * 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 <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/irq.h>
+#include <linux/etherdevice.h>
+
+#include <asm/bootinfo.h>
+
+#include <asm/mach-adm5120/adm5120_defs.h>
+#include <asm/mach-adm5120/adm5120_board.h>
+#include <asm/mach-adm5120/adm5120_platform.h>
+#include <asm/mach-adm5120/adm5120_info.h>
+
+#include <prom/admboot.h>
+
+#define PMUGW_CONFIG_OFFSET 0x10000
+#define PMUGW_CONFIG_SIZE 0x1000
+
+#ifdef CONFIG_MTD_PARTITIONS
+static struct mtd_partition pmugw_partitions[] = {
+ {
+ .name = "admboot",
+ .offset = 0,
+ .size = 64*1024,
+ .mask_flags = MTD_WRITEABLE,
+ } , {
+ .name = "boardcfg",
+ .offset = MTDPART_OFS_APPEND,
+ .size = 64*1024,
+ } , {
+ .name = "firmware",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL,
+ }
+};
+#endif /* CONFIG_MTD_PARTITIONS */
+
+static u8 pmugw_vlans[6] __initdata = {
+ 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
+};
+
+static __init void pmugw_setup_mac(void)
+{
+ u8 mac_base[6];
+ int err;
+
+ err = admboot_get_mac_base(PMUGW_CONFIG_OFFSET,
+ PMUGW_CONFIG_SIZE, mac_base);
+
+ if ((err) || !is_valid_ether_addr(mac_base))
+ random_ether_addr(mac_base);
+
+ adm5120_setup_eth_macs(mac_base);
+}
+
+static void switch_bank_gpio5(unsigned bank)
+{
+ switch (bank) {
+ case 0:
+ gpio_set_value(ADM5120_GPIO_PIN5, 0);
+ break;
+ case 1:
+ gpio_set_value(ADM5120_GPIO_PIN5, 1);
+ break;
+ }
+}
+
+void __init pmugw_setup(void)
+{
+ /* setup flash A20 line */
+ gpio_request(ADM5120_GPIO_PIN5, NULL);
+ gpio_direction_output(ADM5120_GPIO_PIN5, 0);
+ adm5120_flash0_data.switch_bank = switch_bank_gpio5;
+
+#ifdef CONFIG_MTD_PARTITIONS
+ adm5120_flash0_data.nr_parts = ARRAY_SIZE(pmugw_partitions);
+ adm5120_flash0_data.parts = pmugw_partitions;
+#endif /* CONFIG_MTD_PARTITIONS */
+
+ adm5120_add_device_uart(1); /* ttyS0 */
+ adm5120_add_device_uart(0); /* ttyS1 */
+
+ adm5120_add_device_flash(0);
+
+ pmugw_setup_mac();
+ adm5120_add_device_switch(5, pmugw_vlans);
+}
+
+ADM5120_BOARD(MACH_ADM5120_PMUGW,
+ "Motorola Powerline MU Gateway",
+ pmugw_setup);