experimental support for the Motorola MU Gateway
authorGabor Juhos <juhosg@openwrt.org>
Tue, 23 Sep 2008 14:56:29 +0000 (14:56 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Tue, 23 Sep 2008 14:56:29 +0000 (14:56 +0000)
SVN-Revision: 12662

target/linux/adm5120/files-2.6.26/arch/mips/adm5120/Kconfig
target/linux/adm5120/files-2.6.26/arch/mips/adm5120/common/prom.c
target/linux/adm5120/files-2.6.26/arch/mips/adm5120/motorola/Makefile [new file with mode: 0644]
target/linux/adm5120/files-2.6.26/arch/mips/adm5120/motorola/pmugw.c [new file with mode: 0644]
target/linux/adm5120/image/lzma-loader/src/board.c
target/linux/adm5120/image/lzma-loader/src/config.h
target/linux/adm5120/image/lzma-loader/src/decompress.c
target/linux/adm5120/image/router_le.mk
target/linux/adm5120/patches-2.6.26/001-adm5120.patch
target/linux/adm5120/router_le/config-2.6.26
target/linux/adm5120/router_le/profiles/Motorola.mk [new file with mode: 0644]

index 1c4a91ad85eb864d2eea7717ffa617911784c883..71868f9b5fd7727e980f1a0d570e74c985753d95 100644 (file)
@@ -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
 
index 260c4e5bbf9d078cf313da732a82809582d13fc2..4c48dc0be2f2e59c054dc7abe1717b41eab31118 100644 (file)
@@ -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 (file)
index 0000000..239d5a0
--- /dev/null
@@ -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 (file)
index 0000000..a74d37d
--- /dev/null
@@ -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);
index 22317f968381b86ec2d9d84eb245d19816d72c25..5ebdbc3b1206d7859c641c93caf59841e225a382 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * ADM5120 specific board support for LZMA decompressor
  *
- * Copyright (C) 2007 OpenWrt.org
- * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
+ * Copyright (C) 2007-2008 OpenWrt.org
+ * Copyright (C) 2007-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 as published by
@@ -19,6 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
+#include "config.h"
 #include <stddef.h>
 
 #define READREG(r)     *(volatile unsigned int *)(r)
@@ -35,7 +36,8 @@
 /*
  * UART definitions
  */
-#define UART_BASE      0xB2600000
+#define UART0_BASE     0xB2600000
+#define UART1_BASE     0xB2800000
 /* UART registers */
 #define UART_REG_DATA  0x00    /* Data register */
 #define UART_REG_ECR   0x04    /* Error Clear register */
  * UART routines
  */
 
-#define UART_READ(r)   READREG(UART_BASE+(r))
-#define UART_WRITE(r,v)        WRITEREG(UART_BASE+(r),(v))
+#if defined(CONFIG_USE_UART0)
+#  define UART_READ(r)         READREG(UART0_BASE+(r))
+#  define UART_WRITE(r,v)      WRITEREG(UART0_BASE+(r),(v))
+#else
+#  define UART_READ(r)         READREG(UART1_BASE+(r))
+#  define UART_WRITE(r,v)      WRITEREG(UART1_BASE+(r),(v))
+#endif
 
 static void uart_init(void)
 {
index 74ae9afa204d6851e14beb6df4f37d8943ab3900..4e8b5f647c1cc340d3b921a7d1d2e79c3cbde09b 100644 (file)
 #  define CONFIG_FLASH_SIZE    FLASH_4M
 #endif
 
+/*
+ * Motorola boards
+ */
+#if defined(CONFIG_BOARD_POWERLINEMUGW)
+#  define CONFIG_BOARD_NAME    "Powerline MU Gateway"
+#  define CONFIG_USE_UART1     1
+#endif
+
 /*
  * ZyXEL boards
  */
 #  define CONFIG_FLASH_SIZE    FLASH_2M
 #endif
 
+#if !defined(CONFIG_USE_UART0) && !defined(CONFIG_USE_UART1)
+#  define CONFIG_USE_UART0
+#endif
+
 #endif /* _CONFIG_H_ */
index 4a20a6b4252d373dc0819c4d8ef2ab0e7fe8092f..de6c937d376e2ea0ec6b53bb3961f11b0ad46a0b 100644 (file)
@@ -4,7 +4,8 @@
  * LZMA compressed kernel decompressor for ADM5120 boards
  *
  * Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
- * Copyright (C) 2007 OpenWrt.org
+ * Copyright (C) 2007-2008 OpenWrt.org
+ * Copyright (C) 2007-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 as published by
@@ -293,7 +294,7 @@ void decompress_entry(unsigned long reg_a0, unsigned long reg_a1,
        board_init();
 
        printf("\n\nLZMA loader for " CONFIG_BOARD_NAME
-                       ", Copyright (C) 2007 OpenWrt.org\n\n");
+                       ", Copyright (C) 2007-2008 OpenWrt.org\n\n");
 
        decompress_init();
 
index db2dc5038143d394495beb48a44c66757cd03d16..ddfb7e27070543a34f5f20ef8af7bac6cb303844 100644 (file)
@@ -302,6 +302,10 @@ define Image/Build/Profile/EASY5120PATA
        $(call Image/Build/Template/Infineon/$(1),easy-5120p-ata)
 endef
 
+define Image/Build/Profile/PMUGW
+       $(call Image/Build/Template/Infineon/$(1),powerline-mugw)
+endef
+
 define Image/Build/Profile/RouterBoard
        $(call Image/Build/Template/Mikrotik/$(1))
 endef
@@ -321,6 +325,8 @@ ifeq ($(CONFIG_BROKEN),y)
        $(call Image/Build/Profile/CAS861W,$(1))
        $(call Image/Build/Profile/NFS101U,$(1))
        $(call Image/Build/Profile/NFS101WU,$(1))
+       # Motorola
+       $(call Image/Build/Profile/PMUGW,$(1))
   endef
 endif
 
@@ -340,6 +346,7 @@ define Image/Build/Profile/Generic
        $(call Image/Build/Profile/EASY5120PATA,$(1))
        # Mikrotik
        $(call Image/Build/Profile/RB1xx/$(1))
+
        $(call Image/Build/Experimental,$(1))
 endef
 
index 52c8c812feeaecd89e0feee00c29881afcb2d056..160c9adc746202876c26421a0b1cacddbf2d07d3 100644 (file)
@@ -32,7 +32,7 @@
  source "arch/mips/jazz/Kconfig"
 --- a/arch/mips/Makefile
 +++ b/arch/mips/Makefile
-@@ -174,6 +174,20 @@
+@@ -174,6 +174,21 @@
  load-$(CONFIG_MACH_JAZZ)      += 0xffffffff80080000
  
  #
@@ -45,6 +45,7 @@
 +core-$(CONFIG_ADM5120_OEM_EDIMAX)     += arch/mips/adm5120/edimax/
 +core-$(CONFIG_ADM5120_OEM_INFINEON)   += arch/mips/adm5120/infineon/
 +core-$(CONFIG_ADM5120_OEM_MIKROTIK)   += arch/mips/adm5120/mikrotik/
++core-$(CONFIG_ADM5120_OEM_MOTOROLA)   += arch/mips/adm5120/motorola/
 +core-$(CONFIG_ADM5120_OEM_ZYXEL)      += arch/mips/adm5120/zyxel/
 +cflags-$(CONFIG_ADM5120)              += -Iinclude/asm-mips/mach-adm5120
 +load-$(CONFIG_ADM5120)                        += 0xffffffff80001000
@@ -55,7 +56,7 @@
  core-$(CONFIG_SOC_AU1X00)     += arch/mips/au1000/common/
 --- a/include/asm-mips/bootinfo.h
 +++ b/include/asm-mips/bootinfo.h
-@@ -94,6 +94,54 @@
+@@ -94,6 +94,55 @@
  #define MACH_MSP7120_FPGA       5     /* PMC-Sierra MSP7120 Emulation */
  #define MACH_MSP_OTHER        255     /* PMC-Sierra unknown board type */
  
 +#define MACH_ADM5120_BR6104K  41      /* Edimax BR-6104K */
 +#define MACH_ADM5120_BR6104KP 42      /* Edimax BR-6104KP */
 +#define MACH_ADM5120_BR61X4WG 43      /* Edimax BR-6104Wg/BR-6114WG */
++#define MACH_ADM5120_PMUGW    44      /* Motorola Powerline MU Gateway */
 +
  #define CL_SIZE                       COMMAND_LINE_SIZE
  
index c340a678ad1309e80d50b32f40da448c97c62a0a..81d3c39509bfc1d741568efd409d9fcfd2239403 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_ADM5120_MACH_EASY83000=y
 CONFIG_ADM5120_MACH_NFS_101=y
 CONFIG_ADM5120_MACH_NP27G=y
 CONFIG_ADM5120_MACH_NP28G=y
+CONFIG_ADM5120_MACH_PMUGW=y
 CONFIG_ADM5120_MACH_RB_11X=y
 CONFIG_ADM5120_MACH_RB_133=y
 CONFIG_ADM5120_MACH_RB_133C=y
@@ -26,6 +27,7 @@ CONFIG_ADM5120_OEM_COMPEX=y
 CONFIG_ADM5120_OEM_EDIMAX=y
 CONFIG_ADM5120_OEM_INFINEON=y
 CONFIG_ADM5120_OEM_MIKROTIK=y
+CONFIG_ADM5120_OEM_MOTOROLA=y
 # CONFIG_ADM5120_OEM_ZYXEL is not set
 CONFIG_ADM5120_SOC_BGA=y
 CONFIG_ADM5120_WDT=y
@@ -304,7 +306,6 @@ CONFIG_TRAD_SIGNALS=y
 CONFIG_USB=m
 CONFIG_USB_ADM5120_HCD=m
 CONFIG_USB_EHCI_HCD=m
-# CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
 # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
 CONFIG_USB_OHCI_HCD=m
diff --git a/target/linux/adm5120/router_le/profiles/Motorola.mk b/target/linux/adm5120/router_le/profiles/Motorola.mk
new file mode 100644 (file)
index 0000000..e640b81
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/PMUGW
+       NAME:=Motorola Powerline MU Gateway (EXPERIMENTAL)
+endef
+
+define Profile/PMUGW/Description
+       Package set optimized for the Motorola Powerline MU Gateway board
+endef
+
+$(eval $(call Profile,PMUGW))