From c8f606c7601dd8a00120ebf8e3b06ec3bfe59efd Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 17 May 2010 10:06:46 +0000 Subject: [PATCH] * adds support for speedport w502V * bump kernel to 2.6.33.4 * make ethernet be configurable as MII/RMII * on xway we now assign a static amount of cp1 ram (still need to find a sane value) * remove bogus board.c * jiffies were running with a (1 << 2) multiplier SVN-Revision: 21485 --- target/linux/ifxmips/Makefile | 7 +- target/linux/ifxmips/danube/config-2.6.33 | 6 +- .../files-2.6.33/arch/mips/ifxmips/Makefile | 1 - .../arch/mips/ifxmips/common/devices.h | 2 + .../arch/mips/ifxmips/common/prom.c | 11 +- .../arch/mips/ifxmips/common/setup.c | 5 +- .../arch/mips/ifxmips/danube/arcaydian.c | 27 +- .../arch/mips/ifxmips/danube/arcaydian.h | 1 + .../arch/mips/ifxmips/danube/board.c | 457 ------------------ .../arch/mips/ifxmips/danube/devices.c | 12 +- .../arch/mips/ifxmips/danube/devices.h | 2 +- .../danube/{mach-arv452.c => mach-arv4520.c} | 73 +-- .../arch/mips/ifxmips/danube/mach-arv4525.c | 135 ++++++ .../arch/mips/ifxmips/danube/mach-easy4010.c | 3 +- .../arch/mips/ifxmips/danube/mach-easy50712.c | 6 +- .../asm/mach-ifxmips/ifxmips_platform.h | 9 + .../mips/include/asm/mach-ifxmips/machine.h | 3 +- .../files-2.6.33/drivers/net/ifxmips.c | 12 +- 18 files changed, 215 insertions(+), 557 deletions(-) delete mode 100644 target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/Makefile delete mode 100644 target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/board.c rename target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/{mach-arv452.c => mach-arv4520.c} (50%) create mode 100644 target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-arv4525.c create mode 100644 target/linux/ifxmips/files-2.6.33/arch/mips/include/asm/mach-ifxmips/ifxmips_platform.h diff --git a/target/linux/ifxmips/Makefile b/target/linux/ifxmips/Makefile index 425a0096a8..4809e33100 100644 --- a/target/linux/ifxmips/Makefile +++ b/target/linux/ifxmips/Makefile @@ -10,15 +10,14 @@ ARCH:=mips BOARD:=ifxmips BOARDNAME:=Infineon Mips FEATURES:=squashfs jffs2 atm -SUBTARGETS:=ar9 danube +SUBTARGETS:=danube ar9 -LINUX_VERSION:=2.6.33.2 +LINUX_VERSION:=2.6.33.4 CFLAGS=-Os -pipe -mips32r2 -mtune=mips32r2 -funit-at-a-time include $(INCLUDE_DIR)/target.mk -DEFAULT_PACKAGES+=uboot-lantiq -#kmod-pppoa ppp-mod-pppoa linux-atm atm-tools br2684ctl ifxmips-dsl-api ifxmips-dsl-control ifx-tapidemo +DEFAULT_PACKAGES+=uboot-lantiq kmod-pppoa ppp-mod-pppoa linux-atm atm-tools br2684ctl ifxmips-dsl-api ifxmips-dsl-control ifx-tapidemo #define Target/Description # Build firmware images for Infineon Mips Controllers diff --git a/target/linux/ifxmips/danube/config-2.6.33 b/target/linux/ifxmips/danube/config-2.6.33 index 7aeb8f8697..bf8ce79537 100644 --- a/target/linux/ifxmips/danube/config-2.6.33 +++ b/target/linux/ifxmips/danube/config-2.6.33 @@ -11,7 +11,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y # CONFIG_ARCH_SUPPORTS_MSI is not set CONFIG_ARCH_SUPPORTS_OPROFILE=y CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ATM=y # CONFIG_BCM47XX is not set # CONFIG_BCM63XX is not set CONFIG_BITREVERSE=y @@ -56,7 +55,8 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K_LIB=y CONFIG_DANUBE_MACH_ARV4519=y -CONFIG_DANUBE_MACH_ARV452=y +CONFIG_DANUBE_MACH_ARV4520=y +CONFIG_DANUBE_MACH_ARV4525=y CONFIG_DANUBE_MACH_EASY4010=y CONFIG_DANUBE_MACH_EASY50712=y CONFIG_DECOMPRESS_LZMA=y @@ -143,8 +143,6 @@ CONFIG_KALLSYMS=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_IFXMIPS=y CONFIG_LOONGSON_UART_BASE=y -CONFIG_LZMA_COMPRESS=y -CONFIG_LZMA_DECOMPRESS=y # CONFIG_MACH_ALCHEMY is not set # CONFIG_MACH_DECSTATION is not set # CONFIG_MACH_JAZZ is not set diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/Makefile b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/Makefile deleted file mode 100644 index 372030cf9c..0000000000 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-y := reset.o prom.o setup.o irq.o dma-core.o pmu.o board.o clock.o gpio.o timer.o dev-gpio-buttons.o diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/devices.h b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/devices.h index 2f8b45ea4b..31fac266c0 100644 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/devices.h +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/devices.h @@ -1,6 +1,8 @@ #ifndef _IFXMIPS_DEVICES_H__ #define _IFXMIPS_DEVICES_H__ +#include + void __init ifxmips_register_gpio_dev(void); void __init ifxmips_register_gpio_leds(struct gpio_led *leds, int cnt); void __init ifxmips_register_leds(struct gpio_led *leds, int cnt); diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/prom.c b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/prom.c index 8eb12c78bf..e6a4a09d77 100644 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/prom.c +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/prom.c @@ -11,7 +11,7 @@ /* for voice cpu (MIPS24K) */ unsigned int *prom_cp1_base; -unsigned int prom_cp1_size; +unsigned int prom_cp1_size = 0; /* for Multithreading (APRP) on MIPS34K */ unsigned long physical_memsize; @@ -89,13 +89,6 @@ static void __init prom_init_cmdline(void) char *a = (char *)KSEG1ADDR(argv[i]); if (!argv[i]) continue; - /* for voice cpu on Twinpass/Danube */ - if (cpu_data[0].cputype == CPU_24K) - if (!strncmp(a, "cp1_size=", 9)) - { - prom_cp1_size = memparse(a + 9, &a); - continue; - } if (strlen(arcs_cmdline) + strlen(a + 1) >= sizeof(arcs_cmdline)) { early_printf("cmdline overflow, skipping: %s\n", a); @@ -125,6 +118,8 @@ static void __init prom_init_cmdline(void) /* only on Twinpass/Danube a second CPU is used for Voice */ if ((cpu_data[0].cputype == CPU_24K) && (prom_cp1_size)) { +#define CP1_SIZE 2 << 20 + prom_cp1_size = CP1_SIZE; memsize -= prom_cp1_size; prom_cp1_base = (unsigned int *)KSEG1ADDR(memsize); diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/setup.c b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/setup.c index 41e6415e8e..01d3249772 100644 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/setup.c +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/common/setup.c @@ -78,8 +78,11 @@ ifxmips_get_cpu_hz(void) return CLOCK_333M; case 4: return DDR_HZ; + case 8: + return DDR_HZ << 1; + default: + return DDR_HZ >> 1; } - return DDR_HZ >> 1; } EXPORT_SYMBOL(ifxmips_get_cpu_hz); diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/arcaydian.c b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/arcaydian.c index aba5438e1b..9979341c44 100644 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/arcaydian.c +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/arcaydian.c @@ -18,25 +18,28 @@ #include "arcaydian.h" -static int ifxmips_brn = 1; +static int ifxmips_brn = 0; int __init -ifxmips_find_brn_mac(unsigned char *ifxmips_ethaddr) +ifxmix_detect_brn_block(void) { unsigned char temp[8]; memcpy_fromio(temp, (void *)KSEG1ADDR(IFXMIPS_FLASH_START + 0x800000 - 0x10000), 8); if (!memcmp(temp, "BRN-BOOT", 8)) - { - memcpy_fromio(ifxmips_ethaddr, - (void *)KSEG1ADDR(IFXMIPS_FLASH_START + - 0x800000 - 0x10000 + 0x16), 6); - if (is_valid_ether_addr(ifxmips_ethaddr)) - return 1; - } else { - ifxmips_brn = 0; - } - return 0; + ifxmips_brn = 1; + return !ifxmips_brn; +} + +int __init +ifxmips_find_brn_mac(unsigned char *ifxmips_ethaddr) +{ + if(!ifxmips_brn) + return 1; + memcpy_fromio(ifxmips_ethaddr, + (void *)KSEG1ADDR(IFXMIPS_FLASH_START + + 0x800000 - 0x10000 + 0x16), 6); + return is_valid_ether_addr(ifxmips_ethaddr); } int diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/arcaydian.h b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/arcaydian.h index a867cd0c4e..c20acf662f 100644 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/arcaydian.h +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/arcaydian.h @@ -1,6 +1,7 @@ #ifndef _ARCAYDIAN_H__ #define _ARCAYDIAN_H__ +int __init ifxmix_detect_brn_block(void); int __init ifxmips_find_brn_mac(unsigned char *ifxmips_ethaddr); #endif diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/board.c b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/board.c deleted file mode 100644 index e4a418b728..0000000000 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/board.c +++ /dev/null @@ -1,457 +0,0 @@ -/* - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright (C) 2007 John Crispin - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#define MAX_BOARD_NAME_LEN 32 -#define MAX_IFXMIPS_DEVS 9 - -#define SYSTEM_DANUBE "Danube" -#define SYSTEM_DANUBE_CHIPID1 0x00129083 -#define SYSTEM_DANUBE_CHIPID2 0x0012B083 - -#define SYSTEM_TWINPASS "Twinpass" -#define SYSTEM_TWINPASS_CHIPID 0x0012D083 - -enum { - EASY50712, - EASY4010, - ARV4519, - ARV452, -}; - -extern int ifxmips_pci_external_clock; -extern int ifxmips_pci_req_mask; - -static unsigned int chiprev; -static int cmdline_mac; -char board_name[MAX_BOARD_NAME_LEN + 1] = { 0 }; - -struct ifxmips_board { - int type; - char name[32]; - unsigned int system_type; - struct platform_device **devs; - struct resource reset_resource; - struct resource gpiodev_resource; - struct gpio_led *ifxmips_leds; - struct gpio_led *gpio_leds; - int pci_external_clock; - int pci_req_mask; - int num_devs; -}; - -DEFINE_SPINLOCK(ebu_lock); -EXPORT_SYMBOL_GPL(ebu_lock); - -extern unsigned char ifxmips_ethaddr[6]; -static int ifxmips_brn; - -static struct gpio_led_platform_data ifxmips_led_data; - -static struct platform_device ifxmips_led = { - .id = 0, - .name = "ifxmips_led", - .dev = { - .platform_data = (void *) &ifxmips_led_data, - } -}; - -static struct platform_device ifxmips_gpio = { - .id = 0, - .name = "ifxmips_gpio", - .num_resources = 1, -}; - -static struct platform_device ifxmips_mii = { - .id = 0, - .name = "ifxmips_mii0", - .dev = { - .platform_data = ifxmips_ethaddr, - } -}; - -static struct platform_device ifxmips_wdt = { - .id = 0, - .name = "ifxmips_wdt", -}; - -static struct platform_device ifxmips_ebu = { - .id = 0, - .name = "ifxmips_ebu", -}; - -static struct resource ifxmips_mtd_resource = { - .start = IFXMIPS_FLASH_START, - .end = IFXMIPS_FLASH_START + IFXMIPS_FLASH_MAX - 1, - .flags = IORESOURCE_MEM, -}; - -static struct platform_device ifxmips_mtd = { - .id = 0, - .name = "ifxmips_mtd", - .num_resources = 1, - .resource = &ifxmips_mtd_resource, -}; - -static struct platform_device ifxmips_gpio_dev = { - .name = "GPIODEV", - .id = -1, - .num_resources = 1, -}; - -#ifdef CONFIG_LEDS_GPIO -static struct gpio_led arv4519_gpio_leds[] = { - { .name = "ifx:green:power", .gpio = 3, .active_low = 1, }, - { .name = "ifx:red:power", .gpio = 7, .active_low = 1, }, - { .name = "ifx:green:adsl", .gpio = 4, .active_low = 1, }, - { .name = "ifx:green:internet", .gpio = 5, .active_low = 1, }, - { .name = "ifx:red:internet", .gpio = 8, .active_low = 1, }, - { .name = "ifx:green:wlan", .gpio = 6, .active_low = 1, }, - { .name = "ifx:green:usbpwr", .gpio = 14, .active_low = 1, }, - { .name = "ifx:green:usb", .gpio = 19, .active_low = 1, }, -}; - -static struct gpio_led arv452_gpio_leds[] = { - { .name = "ifx:blue:power", .gpio = 3, .active_low = 1, }, - { .name = "ifx:blue:adsl", .gpio = 4, .active_low = 1, }, - { .name = "ifx:blue:internet", .gpio = 5, .active_low = 1, }, - { .name = "ifx:red:power", .gpio = 6, .active_low = 1, }, - { .name = "ifx:yello:wps", .gpio = 7, .active_low = 1, }, - { .name = "ifx:red:wps", .gpio = 9, .active_low = 1, }, - { .name = "ifx:blue:voip", .gpio = 32, .active_low = 1, }, - { .name = "ifx:blue:fxs1", .gpio = 33, .active_low = 1, }, - { .name = "ifx:blue:fxs2", .gpio = 34, .active_low = 1, }, - { .name = "ifx:blue:fxo", .gpio = 35, .active_low = 1, }, - { .name = "ifx:blue:voice", .gpio = 36, .active_low = 1, }, - { .name = "ifx:blue:usb", .gpio = 37, .active_low = 1, }, - { .name = "ifx:blue:wlan", .gpio = 38, .active_low = 1, }, - { .name = "ifx:red:internet", .gpio = 41, .active_low = 1, }, -}; - -static struct gpio_led_platform_data ifxmips_gpio_led_data; - -static struct platform_device ifxmips_gpio_leds = { - .name = "leds-gpio", - .id = -1, - .dev = { - .platform_data = (void *) &ifxmips_gpio_led_data, - } -}; -#endif - -static struct resource dwc_usb_res[] = { - { - .name = "dwc3884_membase", - .flags = IORESOURCE_MEM, - .start = 0x1E101000, - .end = 0x1E101FFF - }, - { - .name = "dwc3884_irq", - .flags = IORESOURCE_IRQ, - .start = IFXMIPS_USB_INT, - } -}; - -static struct platform_device dwc_usb = -{ - .id = 0, - .name = "dwc3884-hcd", - .resource = dwc_usb_res, - .num_resources = ARRAY_SIZE(dwc_usb_res), -}; - -struct platform_device *easy50712_devs[] = { - &ifxmips_led, &ifxmips_gpio, &ifxmips_mii, - &ifxmips_mtd, &ifxmips_wdt, &ifxmips_gpio_dev, &dwc_usb -}; - -struct platform_device *easy4010_devs[] = { - &ifxmips_led, &ifxmips_gpio, &ifxmips_mii, - &ifxmips_mtd, &ifxmips_wdt, &ifxmips_gpio_dev, &dwc_usb -}; - -struct platform_device *arv5419_devs[] = { - &ifxmips_gpio, &ifxmips_mii, &ifxmips_mtd, - &ifxmips_gpio_dev, &ifxmips_wdt, &dwc_usb, -#ifdef CONFIG_LEDS_GPIO - &ifxmips_gpio_leds, -#endif -}; - -struct platform_device *arv452_devs[] = { - &ifxmips_gpio, &ifxmips_mii, &ifxmips_mtd, - &ifxmips_gpio_dev, &ifxmips_wdt, &dwc_usb, - &ifxmips_ebu, -#ifdef CONFIG_LEDS_GPIO - &ifxmips_gpio_leds, -#endif -}; - -static struct gpio_led easy50712_leds[] = { - { .name = "ifx:green:test0", .gpio = 0,}, - { .name = "ifx:green:test1", .gpio = 1,}, - { .name = "ifx:green:test2", .gpio = 2,}, - { .name = "ifx:green:test3", .gpio = 3,}, -}; - -static struct gpio_led easy4010_leds[] = { - { .name = "ifx:green:test0", .gpio = 0,}, - { .name = "ifx:green:test1", .gpio = 1,}, - { .name = "ifx:green:test2", .gpio = 2,}, - { .name = "ifx:green:test3", .gpio = 3,}, -}; - -static struct ifxmips_board boards[] = { - { - /* infineon eval kit */ - .type = EASY50712, - .name = "EASY50712", - .system_type = SYSTEM_DANUBE_CHIPID1, - .devs = easy50712_devs, - .reset_resource = {.name = "reset", .start = 1, .end = 15,}, - .gpiodev_resource = { .name = "gpio", - .start = (1 << 0) | (1 << 1), - .end = (1 << 0) | (1 << 1)}, - .ifxmips_leds = easy50712_leds, - }, { - /* infineon eval kit */ - .type = EASY4010, - .name = "EASY4010", - .system_type = SYSTEM_TWINPASS_CHIPID, - .devs = easy4010_devs, - .reset_resource = {.name = "reset", .start = 1, .end = 15}, - .gpiodev_resource = { .name = "gpio", - .start = (1 << 0) | (1 << 1), - .end = (1 << 0) | (1 << 1)}, - .ifxmips_leds = easy4010_leds, - }, { - /* arcaydian annex-a board used by thompson, airties, ... */ - .type = ARV4519, - .name = "ARV4519", - .system_type = SYSTEM_DANUBE_CHIPID2, - .devs = arv5419_devs, - .reset_resource = {.name = "reset", .start = 1, .end = 14}, - .pci_external_clock = 1, -#ifdef CONFIG_LEDS_GPIO - .gpio_leds = arv4519_gpio_leds, -#endif - }, { - /* arcaydian annex-b board used by airties, arcor */ - .type = ARV452, - .name = "ARV452", - .system_type = SYSTEM_DANUBE_CHIPID2, - .devs = arv452_devs, - .reset_resource = {.name = "reset", .start = 1, .end = 14}, - .pci_external_clock = 1, -#ifdef CONFIG_LEDS_GPIO - .gpio_leds = arv452_gpio_leds, -#endif - }, -}; - -const char *get_system_type(void) -{ - chiprev = (ifxmips_r32(IFXMIPS_MPS_CHIPID) & 0x0FFFFFFF); - - switch (chiprev) { - case SYSTEM_DANUBE_CHIPID1: - case SYSTEM_DANUBE_CHIPID2: - return SYSTEM_DANUBE; - - case SYSTEM_TWINPASS_CHIPID: - return SYSTEM_TWINPASS; - } - - return BOARD_SYSTEM_TYPE; -} - -static int __init ifxmips_set_board_type(char *str) -{ - str = strchr(str, '='); - if (!str) - goto out; - str++; - if (strlen(str) > MAX_BOARD_NAME_LEN) - goto out; - strncpy(board_name, str, MAX_BOARD_NAME_LEN); - printk(KERN_INFO "bootloader told us, that this is a %s board\n", - board_name); -out: - return 1; -} -__setup("ifxmips_board", ifxmips_set_board_type); - -static int __init ifxmips_set_ethaddr(char *str) -{ -#define IS_HEX(x) \ - (((x >= '0' && x <= '9') || (x >= 'a' && x <= 'f') \ - || (x >= 'A' && x <= 'F')) ? (1) : (0)) - int i; - str = strchr(str, '='); - if (!str) - goto out; - str++; - if (strlen(str) != 17) - goto out; - for (i = 0; i < 6; i++) { - if (!IS_HEX(str[3 * i]) || !IS_HEX(str[(3 * i) + 1])) - goto out; - if ((i != 5) && (str[(3 * i) + 2] != ':')) - goto out; - ifxmips_ethaddr[i] = simple_strtoul(&str[3 * i], NULL, 16); - } - if (is_valid_ether_addr(ifxmips_ethaddr)) - cmdline_mac = 1; -out: - return 1; -} -__setup("ethaddr", ifxmips_set_ethaddr); - -int ifxmips_find_brn_block(void) -{ - unsigned char temp[8]; - memcpy_fromio(temp, - (void *)KSEG1ADDR(IFXMIPS_FLASH_START + 0x800000 - 0x10000), 8); - if (memcmp(temp, "BRN-BOOT", 8) == 0) { - if (!cmdline_mac) - memcpy_fromio(ifxmips_ethaddr, - (void *)KSEG1ADDR(IFXMIPS_FLASH_START + - 0x800000 - 0x10000 + 0x16), 6); - if (is_valid_ether_addr(ifxmips_ethaddr)) - cmdline_mac = 1; - return 1; - } else { - return 0; - } -} - -int ifxmips_has_brn_block(void) -{ - return ifxmips_brn; -} -EXPORT_SYMBOL(ifxmips_has_brn_block); - -struct ifxmips_board *ifxmips_find_board(void) -{ - int i; - if (!*board_name) - return 0; - for (i = 0; i < ARRAY_SIZE(boards); i++) - if ((boards[i].system_type == chiprev) && - (!strcmp(boards[i].name, board_name))) - return &boards[i]; - return 0; -} - -int __init ifxmips_init_devices(void) -{ - struct ifxmips_board *board; - - chiprev = (ifxmips_r32(IFXMIPS_MPS_CHIPID) & 0x0FFFFFFF); - board = ifxmips_find_board(); - ifxmips_brn = ifxmips_find_brn_block(); - - if (!cmdline_mac) - random_ether_addr(ifxmips_ethaddr); - - if (!board) { - switch (chiprev) { - case SYSTEM_DANUBE_CHIPID1: - case SYSTEM_DANUBE_CHIPID2: - default: - board = &boards[0]; - break; - case SYSTEM_TWINPASS_CHIPID: - board = &boards[1]; - break; - } - } - - switch (board->type) { - case EASY50712: - board->num_devs = ARRAY_SIZE(easy50712_devs); - ifxmips_led_data.num_leds = ARRAY_SIZE(easy50712_leds); - break; - case EASY4010: - board->num_devs = ARRAY_SIZE(easy4010_devs); - ifxmips_led_data.num_leds = ARRAY_SIZE(easy4010_leds); - break; - case ARV4519: - /* set some sane defaults for the gpios */ - gpio_set_value(3, 0); - gpio_set_value(4, 0); - gpio_set_value(5, 0); - gpio_set_value(6, 0); - gpio_set_value(7, 1); - gpio_set_value(8, 1); - gpio_set_value(19, 0); - board->num_devs = ARRAY_SIZE(arv5419_devs); -#ifdef CONFIG_LEDS_GPIO - ifxmips_gpio_led_data.num_leds = ARRAY_SIZE(arv4519_gpio_leds); -#endif - break; - case ARV452: - /* set some sane defaults for the gpios */ - board->num_devs = ARRAY_SIZE(arv452_devs); - ifxmips_w32(0x8001e7ff, IFXMIPS_EBU_BUSCON1); -#ifdef CONFIG_LEDS_GPIO - ifxmips_gpio_led_data.num_leds = ARRAY_SIZE(arv452_gpio_leds); -#endif - break; - } -#ifdef CONFIG_LEDS_GPIO - ifxmips_gpio_led_data.leds = board->gpio_leds; -#endif - ifxmips_led_data.leds = board->ifxmips_leds; - - printk(KERN_INFO "%s: adding %d devs\n", - __func__, board->num_devs); - - ifxmips_gpio.resource = &board->reset_resource; - ifxmips_gpio_dev.resource = &board->gpiodev_resource; - if (board->pci_external_clock) - ifxmips_pci_external_clock = 1; - if (board->pci_req_mask) - ifxmips_pci_req_mask = board->pci_req_mask; - printk(KERN_INFO "using board definition %s\n", board->name); - return platform_add_devices(board->devs, board->num_devs); -} - -arch_initcall(ifxmips_init_devices); diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/devices.c b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/devices.c index dbcac556df..caefc82340 100644 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/devices.c +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/devices.c @@ -20,6 +20,8 @@ #include #include +#include "devices.h" + /* usb */ static struct resource dwc_usb_res[] = { @@ -84,10 +86,16 @@ static struct platform_device danube_ethernet = }; void __init -danube_register_ethernet(unsigned char *mac) +danube_register_ethernet(unsigned char *mac, int mii_mode) { + struct ifxmips_eth_data *eth = kmalloc(sizeof(struct ifxmips_eth_data), GFP_KERNEL); + memset(eth, 0, sizeof(struct ifxmips_eth_data)); if(mac) - danube_ethernet.dev.platform_data = mac; + eth->mac = mac; + else + eth->mac = ifxmips_ethaddr; + eth->mii_mode = mii_mode; + danube_ethernet.dev.platform_data = eth; platform_device_register(&danube_ethernet); } diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/devices.h b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/devices.h index 75201a2ece..2ac79273e9 100644 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/devices.h +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/devices.h @@ -10,7 +10,7 @@ enum { void __init danube_register_usb(void); void __init danube_register_ebu_gpio(struct resource *resource, u32 value); -void __init danube_register_ethernet(unsigned char *mac); +void __init danube_register_ethernet(unsigned char *mac, int mii_mode); void __init danube_register_pci(int clock, int irq_mask); #endif diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-arv452.c b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-arv4520.c similarity index 50% rename from target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-arv452.c rename to target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-arv4520.c index 2e406c90ae..65ba39b9eb 100644 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-arv452.c +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-arv4520.c @@ -9,6 +9,7 @@ #include #include +#include #include #include "arcaydian.h" @@ -23,7 +24,7 @@ #define ARV452_LATCH_SWITCH (1 << 10) #ifdef CONFIG_MTD_PARTITIONS -static struct mtd_partition arv452_partitions[] = +static struct mtd_partition arv4520_partitions[] = { { .name = "uboot", @@ -58,50 +59,21 @@ static struct mtd_partition arv452_partitions[] = }; #endif -static struct physmap_flash_data arv452_flash_data = { +static struct physmap_flash_data arv4520_flash_data = { #ifdef CONFIG_MTD_PARTITIONS - .nr_parts = ARRAY_SIZE(arv452_partitions), - .parts = arv452_partitions, + .nr_parts = ARRAY_SIZE(arv4520_partitions), + .parts = arv4520_partitions, #endif }; static struct gpio_led -arv452_leds_gpio[] __initdata = { -/* - { .name = "ifx0", .gpio = 0, .active_low = 1, }, - { .name = "ifx1", .gpio = 1, .active_low = 1, }, - { .name = "ifx2", .gpio = 2, .active_low = 1, }, -*/ +arv4520_leds_gpio[] __initdata = { { .name = "ifx:blue:power", .gpio = 3, .active_low = 1, }, { .name = "ifx:blue:adsl", .gpio = 4, .active_low = 1, }, { .name = "ifx:blue:internet", .gpio = 5, .active_low = 1, }, { .name = "ifx:red:power", .gpio = 6, .active_low = 1, }, { .name = "ifx:yello:wps", .gpio = 7, .active_low = 1, }, { .name = "ifx:red:wps", .gpio = 9, .active_low = 1, }, -/* - { .name = "ifx10", .gpio = 10, .active_low = 1, }, - { .name = "ifx11", .gpio = 11, .active_low = 1, }, - { .name = "ifx12", .gpio = 12, .active_low = 1, }, - { .name = "ifx13", .gpio = 13, .active_low = 1, }, - { .name = "ifx14", .gpio = 14, .active_low = 1, }, - { .name = "ifx15", .gpio = 15, .active_low = 1, }, - { .name = "ifx16", .gpio = 16, .active_low = 1, }, - { .name = "ifx17", .gpio = 17, .active_low = 1, }, - { .name = "ifx18", .gpio = 18, .active_low = 1, }, - { .name = "ifx19", .gpio = 19, .active_low = 1, }, - { .name = "ifx20", .gpio = 20, .active_low = 1, }, - { .name = "ifx21", .gpio = 21, .active_low = 1, }, - { .name = "ifx22", .gpio = 22, .active_low = 1, }, - { .name = "ifx23", .gpio = 23, .active_low = 1, }, - { .name = "ifx24", .gpio = 24, .active_low = 1, }, - { .name = "ifx25", .gpio = 25, .active_low = 1, }, - { .name = "ifx26", .gpio = 26, .active_low = 1, }, - { .name = "ifx27", .gpio = 27, .active_low = 1, }, - { .name = "ifx28", .gpio = 28, .active_low = 1, }, - { .name = "ifx29", .gpio = 29, .active_low = 1, }, - { .name = "ifx30", .gpio = 30, .active_low = 1, }, - { .name = "ifx31", .gpio = 31, .active_low = 1, }, -*/ { .name = "ifx:blue:voip", .gpio = 32, .active_low = 1, }, { .name = "ifx:blue:fxs1", .gpio = 33, .active_low = 1, }, { .name = "ifx:blue:fxs2", .gpio = 34, .active_low = 1, }, @@ -109,20 +81,10 @@ arv452_leds_gpio[] __initdata = { { .name = "ifx:blue:voice", .gpio = 36, .active_low = 1, }, { .name = "ifx:blue:usb", .gpio = 37, .active_low = 1, }, { .name = "ifx:blue:wlan", .gpio = 38, .active_low = 1, }, -/* { .name = "ifx39", .gpio = 39, .active_low = 1, }, - { .name = "ifx40", .gpio = 40, .active_low = 1, }, - { .name = "ifx41", .gpio = 41, .active_low = 1, }, - { .name = "ifx42", .gpio = 42, .active_low = 1, }, - { .name = "ifx43", .gpio = 43, .active_low = 1, }, - { .name = "ifx44", .gpio = 44, .active_low = 1, }, - { .name = "ifx45", .gpio = 45, .active_low = 1, }, - { .name = "ifx46", .gpio = 46, .active_low = 1, }, - { .name = "ifx47", .gpio = 47, .active_low = 1, }, -*/ }; static struct gpio_button -arv452_gpio_buttons[] __initdata = { +arv4520_gpio_buttons[] __initdata = { { .desc = "reset", .type = EV_KEY, @@ -133,7 +95,7 @@ arv452_gpio_buttons[] __initdata = { } }; -static struct resource arv452_ebu_resource = +static struct resource arv4520_ebu_resource = { .name = "ebu-gpio", .start = ARV452_EBU_GPIO_START, @@ -142,29 +104,32 @@ static struct resource arv452_ebu_resource = }; static void __init -arv452_init(void) +arv4520_init(void) { unsigned char mac[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + ifxmix_detect_brn_block(); + ifxmips_find_brn_mac(mac); ifxmips_register_gpio(); - danube_register_ebu_gpio(&arv452_ebu_resource, ARV452_LATCH_SWITCH); + danube_register_ebu_gpio(&arv4520_ebu_resource, ARV452_LATCH_SWITCH); - ifxmips_register_mtd(&arv452_flash_data); + ifxmips_register_mtd(&arv4520_flash_data); danube_register_pci(PCI_CLOCK_EXT, 0); ifxmips_register_wdt(); - ifxmips_register_gpio_leds(arv452_leds_gpio, ARRAY_SIZE(arv452_leds_gpio)); + ifxmips_register_gpio_leds(arv4520_leds_gpio, ARRAY_SIZE(arv4520_leds_gpio)); - danube_register_ethernet(mac); + danube_register_ethernet(mac, REV_MII_MODE); danube_register_usb(); } -MIPS_MACHINE(IFXMIPS_MACH_ARV452, - "ARV452", +MIPS_MACHINE(IFXMIPS_MACH_ARV4520, + "ARV4520", "Airties WAV-281, Arcor A800", - arv452_init); + arv4520_init); diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-arv4525.c b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-arv4525.c new file mode 100644 index 0000000000..69c92e641e --- /dev/null +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-arv4525.c @@ -0,0 +1,135 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "arcaydian.h" +#include "devices.h" + +#define ARV452_EBU_GPIO_START 0x14000000 +#define ARV452_EBU_GPIO_SIZE 0x00001000 + +#define ARV452_GPIO_BUTTON_RESET 14 +#define ARV452_BUTTONS_POLL_INTERVAL 20 + +#define ARV452_LATCH_SWITCH (1 << 10) + +#ifdef CONFIG_MTD_PARTITIONS +static struct mtd_partition arv4525_partitions[] = +{ + { + .name = "uboot", + .offset = 0x0, + .size = 0x20000, + }, + { + .name = "uboot_env", + .offset = 0x20000, + .size = 0x0, + }, + { + .name = "kernel", + .offset = 0x0, + .size = 0x0, + }, + { + .name = "rootfs", + .offset = 0x0, + .size = 0x0, + }, + { + .name = "board_config", + .offset = 0x3f0000, + .size = 0x10000, + }, + { + .name = "openwrt", + .offset = 0x0, + .size = 0x0, + }, +}; +#endif + +static struct physmap_flash_data arv4525_flash_data = { +#ifdef CONFIG_MTD_PARTITIONS + .nr_parts = ARRAY_SIZE(arv4525_partitions), + .parts = arv4525_partitions, +#endif +}; + +static struct gpio_led +arv4525_leds_gpio[] __initdata = { + { .name = "ifx:blue:power", .gpio = 3, .active_low = 1, }, + { .name = "ifx:blue:adsl", .gpio = 4, .active_low = 1, }, + { .name = "ifx:blue:internet", .gpio = 5, .active_low = 1, }, + { .name = "ifx:red:power", .gpio = 6, .active_low = 1, }, + { .name = "ifx:yello:wps", .gpio = 7, .active_low = 1, }, + { .name = "ifx:red:wps", .gpio = 9, .active_low = 1, }, + { .name = "ifx:blue:voip", .gpio = 32, .active_low = 1, }, + { .name = "ifx:blue:fxs1", .gpio = 33, .active_low = 1, }, + { .name = "ifx:blue:fxs2", .gpio = 34, .active_low = 1, }, + { .name = "ifx:blue:fxo", .gpio = 35, .active_low = 1, }, + { .name = "ifx:blue:voice", .gpio = 36, .active_low = 1, }, + { .name = "ifx:blue:usb", .gpio = 37, .active_low = 1, }, + { .name = "ifx:blue:wlan", .gpio = 38, .active_low = 1, }, +}; + +static struct gpio_button +arv4525_gpio_buttons[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = BTN_0, + .threshold = 3, + .gpio = ARV452_GPIO_BUTTON_RESET, + .active_low = 1, + } +}; + +static struct resource arv4525_ebu_resource = +{ + .name = "ebu-gpio", + .start = ARV452_EBU_GPIO_START, + .end = ARV452_EBU_GPIO_START + ARV452_EBU_GPIO_SIZE - 1, + .flags = IORESOURCE_MEM, +}; + +static void __init +arv4525_init(void) +{ + unsigned char mac[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + ifxmix_detect_brn_block(); + + ifxmips_find_brn_mac(mac); + + ifxmips_register_gpio(); + + danube_register_ebu_gpio(&arv4525_ebu_resource, ARV452_LATCH_SWITCH); + + ifxmips_register_mtd(&arv4525_flash_data); + + danube_register_pci(PCI_CLOCK_INT, 0); + + ifxmips_register_wdt(); + + ifxmips_register_gpio_leds(arv4525_leds_gpio, ARRAY_SIZE(arv4525_leds_gpio)); + + danube_register_ethernet(mac, MII_MODE); + + danube_register_usb(); +} + +MIPS_MACHINE(IFXMIPS_MACH_ARV4525, + "ARV4525", + "Speedport W502V", + arv4525_init); diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-easy4010.c b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-easy4010.c index 3fe8f1fade..afb0b89a83 100644 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-easy4010.c +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-easy4010.c @@ -9,6 +9,7 @@ #include #include +#include #include #include "devices.h" @@ -68,7 +69,7 @@ easy4010_init(void) ifxmips_register_wdt(); - danube_register_ethernet(ifxmips_ethaddr); + danube_register_ethernet(ifxmips_ethaddr, REV_MII_MODE); danube_register_usb(); } diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-easy50712.c b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-easy50712.c index 9a38377a92..c7ee7db777 100644 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-easy50712.c +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-easy50712.c @@ -9,6 +9,7 @@ #include #include +#include #include #include "devices.h" @@ -60,8 +61,7 @@ easy50712_init(void) { ifxmips_register_gpio(); - //printk("ifxmips_register_gpio_dev\n"); - //ifxmips_register_gpio_dev(); + ifxmips_register_gpio_dev(); ifxmips_register_mtd(&easy50712_flash_data); @@ -69,7 +69,7 @@ easy50712_init(void) ifxmips_register_wdt(); - danube_register_ethernet(ifxmips_ethaddr); + danube_register_ethernet(ifxmips_ethaddr, REV_MII_MODE); danube_register_usb(); } diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/include/asm/mach-ifxmips/ifxmips_platform.h b/target/linux/ifxmips/files-2.6.33/arch/mips/include/asm/mach-ifxmips/ifxmips_platform.h new file mode 100644 index 0000000000..aef95437b4 --- /dev/null +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/include/asm/mach-ifxmips/ifxmips_platform.h @@ -0,0 +1,9 @@ +#ifndef _IFXMIPS_PLATFORM_H__ +#define _IFXMIPS_PLATFORM_H__ + +struct ifxmips_eth_data { + const char *mac; + int mii_mode; +}; + +#endif diff --git a/target/linux/ifxmips/files-2.6.33/arch/mips/include/asm/mach-ifxmips/machine.h b/target/linux/ifxmips/files-2.6.33/arch/mips/include/asm/mach-ifxmips/machine.h index f014de0181..574eadcf73 100644 --- a/target/linux/ifxmips/files-2.6.33/arch/mips/include/asm/mach-ifxmips/machine.h +++ b/target/linux/ifxmips/files-2.6.33/arch/mips/include/asm/mach-ifxmips/machine.h @@ -7,7 +7,8 @@ enum ifxmips_mach_type { IFXMIPS_MACH_EASY50712, /* Danube evalkit */ IFXMIPS_MACH_EASY4010, /* Twinpass evalkit */ IFXMIPS_MACH_ARV4519, /* Airties WAV-221 */ - IFXMIPS_MACH_ARV452, /* Airties WAV-281, Arcor EasyboxA800 */ + IFXMIPS_MACH_ARV4520, /* Airties WAV-281, Arcor EasyboxA800 */ + IFXMIPS_MACH_ARV4525, /* Speedport W502V */ /* ASE based machines */ IFXMIPS_MACH_EASY50601, /* ASE wave board */ diff --git a/target/linux/ifxmips/files-2.6.33/drivers/net/ifxmips.c b/target/linux/ifxmips/files-2.6.33/drivers/net/ifxmips.c index e6d0d9615f..4c618352dd 100644 --- a/target/linux/ifxmips/files-2.6.33/drivers/net/ifxmips.c +++ b/target/linux/ifxmips/files-2.6.33/drivers/net/ifxmips.c @@ -41,6 +41,7 @@ #include #include #include +#include struct ifxmips_mii_priv { struct net_device_stats stats; @@ -267,11 +268,6 @@ void ifxmips_etop_dma_buffer_free(unsigned char *dataptr, void *opt) } } -static struct net_device_stats *ifxmips_get_stats(struct net_device *dev) -{ - return &((struct ifxmips_mii_priv *)netdev_priv(dev))->stats; -} - static void ifxmips_adjust_link(struct net_device *dev) { @@ -436,12 +432,12 @@ static int ifxmips_mii_probe(struct platform_device *dev) { int result = 0; - unsigned char *mac = (unsigned char *)dev->dev.platform_data; + struct ifxmips_eth_data *eth = (struct ifxmips_eth_data*)dev->dev.platform_data; ifxmips_mii0_dev = alloc_etherdev(sizeof(struct ifxmips_mii_priv)); ifxmips_mii0_dev->netdev_ops = &ifxmips_eth_netdev_ops; - memcpy(mac_addr, mac, 6); + memcpy(mac_addr, eth->mac, 6); strcpy(ifxmips_mii0_dev->name, "eth%d"); - ifxmips_mii_chip_init(REV_MII_MODE); + ifxmips_mii_chip_init(eth->mii_mode); result = register_netdev(ifxmips_mii0_dev); if (result) { printk(KERN_INFO "ifxmips_mii0: error %i registering device \"%s\"\n", result, ifxmips_mii0_dev->name);