From: Gabor Juhos Date: Tue, 23 Sep 2008 14:56:29 +0000 (+0000) Subject: experimental support for the Motorola MU Gateway X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=cd9ca196b67a5bc984e824a1ad295d255e80cf5f;p=openwrt%2Fstaging%2Frobimarko.git experimental support for the Motorola MU Gateway SVN-Revision: 12662 --- 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 + * + * 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 +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include + +#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); diff --git a/target/linux/adm5120/image/lzma-loader/src/board.c b/target/linux/adm5120/image/lzma-loader/src/board.c index 22317f9683..5ebdbc3b12 100644 --- a/target/linux/adm5120/image/lzma-loader/src/board.c +++ b/target/linux/adm5120/image/lzma-loader/src/board.c @@ -1,8 +1,8 @@ /* * ADM5120 specific board support for LZMA decompressor * - * Copyright (C) 2007 OpenWrt.org - * Copyright (C) 2007 Gabor Juhos + * Copyright (C) 2007-2008 OpenWrt.org + * Copyright (C) 2007-2008 Gabor Juhos * * 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 #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 */ @@ -91,8 +93,13 @@ * 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) { diff --git a/target/linux/adm5120/image/lzma-loader/src/config.h b/target/linux/adm5120/image/lzma-loader/src/config.h index 74ae9afa20..4e8b5f647c 100644 --- a/target/linux/adm5120/image/lzma-loader/src/config.h +++ b/target/linux/adm5120/image/lzma-loader/src/config.h @@ -97,6 +97,14 @@ # 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 */ @@ -121,4 +129,8 @@ # define CONFIG_FLASH_SIZE FLASH_2M #endif +#if !defined(CONFIG_USE_UART0) && !defined(CONFIG_USE_UART1) +# define CONFIG_USE_UART0 +#endif + #endif /* _CONFIG_H_ */ diff --git a/target/linux/adm5120/image/lzma-loader/src/decompress.c b/target/linux/adm5120/image/lzma-loader/src/decompress.c index 4a20a6b425..de6c937d37 100644 --- a/target/linux/adm5120/image/lzma-loader/src/decompress.c +++ b/target/linux/adm5120/image/lzma-loader/src/decompress.c @@ -4,7 +4,8 @@ * LZMA compressed kernel decompressor for ADM5120 boards * * Copyright (C) 2005 by Oleg I. Vdovikin - * Copyright (C) 2007 OpenWrt.org + * Copyright (C) 2007-2008 OpenWrt.org + * Copyright (C) 2007-2008 Gabor Juhos * * 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(); diff --git a/target/linux/adm5120/image/router_le.mk b/target/linux/adm5120/image/router_le.mk index db2dc50381..ddfb7e2707 100644 --- a/target/linux/adm5120/image/router_le.mk +++ b/target/linux/adm5120/image/router_le.mk @@ -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 diff --git a/target/linux/adm5120/patches-2.6.26/001-adm5120.patch b/target/linux/adm5120/patches-2.6.26/001-adm5120.patch index 52c8c812fe..160c9adc74 100644 --- a/target/linux/adm5120/patches-2.6.26/001-adm5120.patch +++ b/target/linux/adm5120/patches-2.6.26/001-adm5120.patch @@ -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 */ @@ -106,6 +107,7 @@ +#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 diff --git a/target/linux/adm5120/router_le/config-2.6.26 b/target/linux/adm5120/router_le/config-2.6.26 index c340a678ad..81d3c39509 100644 --- a/target/linux/adm5120/router_le/config-2.6.26 +++ b/target/linux/adm5120/router_le/config-2.6.26 @@ -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 index 0000000000..e640b81a1f --- /dev/null +++ b/target/linux/adm5120/router_le/profiles/Motorola.mk @@ -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))