* upgrade to 2.6.39.3 * make gpio buttons work (kmod-input-gpio-keys-polled) * reorganize madwifi to better support devices without eeprom * add gpio support for sx763 * add support to read mac from uboot env to sx763 * refresh patches
Signed-off-by: Luka Perkov < openwrt ->-to->- lukaperkov.net > --- Index: target/linux/lantiq/patches-2.6.39/420-spi3.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/420-spi3.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/420-spi3.patch (working copy) @@ -18,7 +18,7 @@ #include <asm/bootinfo.h> #include <asm/irq.h> -@@ -119,3 +120,41 @@ +@@ -119,3 +120,41 @@ ltq_register_etop(struct ltq_eth_data *e platform_device_register(<q_etop); } } Index: target/linux/lantiq/patches-2.6.39/200-mach-arv45xx.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/200-mach-arv45xx.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/200-mach-arv45xx.patch (working copy) @@ -20,7 +20,7 @@ +obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o --- /dev/null +++ b/arch/mips/lantiq/xway/mach-arv45xx.c -@@ -0,0 +1,504 @@ +@@ -0,0 +1,563 @@ +/* + * 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 @@ -33,7 +33,6 @@ +#include <linux/platform_device.h> +#include <linux/leds.h> +#include <linux/gpio.h> -+#include <linux/gpio_buttons.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> @@ -45,10 +44,11 @@ +#include <lantiq_soc.h> +#include <lantiq_platform.h> + -+#include "../machtypes.h" +#include "devices.h" -+#include "dev-leds-gpio.h" +#include "dev-dwc_otg.h" ++#include "../machtypes.h" ++#include "../dev-leds-gpio.h" ++#include "../dev-gpio-buttons.h" + +#ifdef CONFIG_MTD_PARTITIONS +static struct mtd_partition arv4510_partitions[] = @@ -178,11 +178,32 @@ + { .name = "soc:green:fxo", .gpio = 75, .active_low = 1, .default_trigger = "default-on" }, +}; + -+static struct gpio_button -+arv4518pw_gpio_buttons[] __initdata = { -+ { .desc = "wlan", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 28, .active_low = 1, }, -+ { .desc = "wps", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 29, .active_low = 1, }, -+ { .desc = "reset", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 30, .active_low = 1, }, ++static struct gpio_keys_button ++arv4518pw_gpio_keys[] __initdata = { ++ { ++ .desc = "wlan", ++ .type = EV_KEY, ++ .code = BTN_0, ++ .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = 28, ++ .active_low = 1, ++ }, ++ { ++ .desc = "wps", ++ .type = EV_KEY, ++ .code = BTN_1, ++ .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = 29, ++ .active_low = 1, ++ }, ++ { ++ .desc = "reset", ++ .type = EV_KEY, ++ .code = BTN_2, ++ .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = 30, ++ .active_low = 1, ++ }, +}; + +static struct gpio_led @@ -249,11 +270,32 @@ + { .name = "soc:green:eth4", .gpio = 86, .active_low = 1, .default_trigger = "default-on", }, +}; + -+static struct gpio_button -+arv752dpw22_gpio_buttons[] __initdata = { -+ { .desc = "btn0", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 12, .active_low = 1, }, -+ { .desc = "btn1", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 13, .active_low = 1, }, -+ { .desc = "btn2", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 28, .active_low = 1, }, ++static struct gpio_keys_button ++arv752dpw22_gpio_keys[] __initdata = { ++ { ++ .desc = "btn0", ++ .type = EV_KEY, ++ .code = BTN_0, ++ .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = 12, ++ .active_low = 1, ++ }, ++ { ++ .desc = "btn1", ++ .type = EV_KEY, ++ .code = BTN_1, ++ .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = 13, ++ .active_low = 1, ++ }, ++ { ++ .desc = "btn2", ++ .type = EV_KEY, ++ .code = BTN_2, ++ .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = 28, ++ .active_low = 1, ++ }, +}; + +static struct gpio_led @@ -266,10 +308,23 @@ + { .name = "soc:green:usb", .gpio = 19, .active_low = 1, }, +}; + -+static struct gpio_button -+arv7518pw_gpio_buttons[] __initdata = { -+ { .desc = "reset", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 23, .active_low = 1, }, -+ { .desc = "wlan", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 25, .active_low = 1, }, ++static struct gpio_keys_button ++arv7518pw_gpio_keys[] __initdata = { ++ { ++ .desc = "reset", ++ .type = EV_KEY, ++ .code = BTN_0, ++ .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = 23, ++ .active_low = 1, }, ++ { ++ .desc = "wlan", ++ .type = EV_KEY, ++ .code = BTN_1, ++ .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = 25, ++ .active_low = 1, ++ }, +}; + +static void @@ -328,7 +383,7 @@ + p[i] = ((eeprom_data[(i<<1)+1]&0xff)<<24)|((eeprom_data[(i<<1)+1]&0xff00)<<8)|((eeprom_data[i<<1]&0xff)<<8)|((eeprom_data[i<<1]&0xff00)>>8); + if (i == 0xbf>>1){ + // printk ("regdomain: 0x%x --> 0x%x\n", p[i], (p[i] & 0xffff0000)|0x67); -+ /* regdomain is invalid?? how did original fw convert ++ /* regdomain is invalid?? how did original fw convert + * value to 0x82d4 ?? + * for now, force to 0x67 */ + p[i] &= 0xffff0000; @@ -378,14 +433,15 @@ +#define ARV4518PW_EBU 0 +#define ARV4518PW_USB 14 +#define ARV4518PW_SWITCH_RESET 13 ++#define ARV4518PW_MADWIFI_ADDR 0xb07f0400 + + ltq_register_gpio_ebu(ARV4518PW_EBU); + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4518pw_leds_gpio), arv4518pw_leds_gpio); -+ ltq_register_gpio_buttons(arv4518pw_gpio_buttons, ARRAY_SIZE(arv4518pw_gpio_buttons)); ++ ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(arv4518pw_gpio_keys), arv4518pw_gpio_keys); + ltq_register_nor(&arv45xx_flash_data); + ltq_pci_data.gpio = PCI_GNT2 | PCI_REQ2; + ltq_register_pci(<q_pci_data); -+ ltq_register_madwifi_eep(); ++ ltq_register_madwifi_eep(ARV4518PW_MADWIFI_ADDR); + xway_register_dwc(ARV4518PW_USB); + arv45xx_register_ethernet(); + arv45xx_register_ath5k(); @@ -432,12 +488,13 @@ +#define ARV452CPW_RELAY1 31 +#define ARV452CPW_RELAY2 79 +#define ARV452CPW_SWITCH_RESET 82 ++#define ARV452CPW_MADWIFI_ADDR 0xb07f0400 + + ltq_register_gpio_ebu(ARV452CPW_EBU); + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv452cpw_leds_gpio), arv452cpw_leds_gpio); + ltq_register_nor(&arv45xx_flash_data); + ltq_register_pci(<q_pci_data); -+ ltq_register_madwifi_eep(); ++ ltq_register_madwifi_eep(ARV452CPW_MADWIFI_ADDR); + xway_register_dwc(ARV452CPW_USB); + arv45xx_register_ethernet(); + arv45xx_register_ath5k(); @@ -463,11 +520,13 @@ +static void __init +arv4525pw_init(void) +{ ++#define ARV4525PW_MADWIFI_ADDR 0xb07f0400 ++ + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4525pw_leds_gpio), arv4525pw_leds_gpio); + ltq_register_nor(&arv45xx_flash_data); + ltq_pci_data.clock = PCI_CLOCK_INT; + ltq_register_pci(<q_pci_data); -+ ltq_register_madwifi_eep(); ++ ltq_register_madwifi_eep(ARV4525PW_MADWIFI_ADDR); + ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII; + arv45xx_register_ethernet(); +} @@ -485,7 +544,7 @@ + + ltq_register_gpio_ebu(ARV7518PW_EBU); + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv7518pw_leds_gpio), arv7518pw_leds_gpio); -+ ltq_register_gpio_buttons(arv7518pw_gpio_buttons, ARRAY_SIZE(arv7518pw_gpio_buttons)); ++ ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(arv7518pw_gpio_keys), arv7518pw_gpio_keys); + ltq_register_nor(&arv75xx_flash_data); + ltq_register_pci(<q_pci_data); + ltq_register_tapi(); @@ -508,7 +567,7 @@ + + ltq_register_gpio_ebu(ARV752DPW22_EBU); + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv752dpw22_leds_gpio), arv752dpw22_leds_gpio); -+ ltq_register_gpio_buttons(arv752dpw22_gpio_buttons, ARRAY_SIZE(arv752dpw22_gpio_buttons)); ++ ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(arv752dpw22_gpio_keys), arv752dpw22_gpio_keys); + ltq_register_nor(&arv75xx_flash_data); + ltq_pci_data.irq[15] = (INT_NUM_IM2_IRL0 + 31); + ltq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2; @@ -527,8 +586,8 @@ + arv752dpw22_init); --- a/arch/mips/lantiq/machtypes.h +++ b/arch/mips/lantiq/machtypes.h -@@ -21,6 +21,17 @@ enum lantiq_mach_type { - LANTIQ_MACH_EASY98000SF, /* Falcon Eval Board, Serial Flash */ +@@ -22,6 +22,17 @@ enum lantiq_mach_type { + LANTIQ_MACH_EASY98000NAND, /* Falcon Eval Board, NAND Flash */ LANTIQ_MACH_EASY98020, /* Falcon Reference Board */ LANTIQ_MACH_95C3AM1, /* Board 95C3AM1 */ + Index: target/linux/lantiq/patches-2.6.39/160-falcon-95C3AM1.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/160-falcon-95C3AM1.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/160-falcon-95C3AM1.patch (working copy) @@ -119,16 +119,16 @@ endif --- a/arch/mips/lantiq/falcon/Makefile +++ b/arch/mips/lantiq/falcon/Makefile -@@ -3,3 +3,4 @@ obj-y += softdog_vpe.o +@@ -4,3 +4,4 @@ obj-$(CONFIG_LANTIQ_MACH_EASY98000) += a obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o +obj-$(CONFIG_LANTIQ_MACH_95C3AM1) += mach-95C3AM1.o --- a/arch/mips/lantiq/machtypes.h +++ b/arch/mips/lantiq/machtypes.h -@@ -20,6 +20,7 @@ enum lantiq_mach_type { - LANTIQ_MACH_EASY98000, /* Falcon Eval Board, NOR Flash */ +@@ -21,6 +21,7 @@ enum lantiq_mach_type { LANTIQ_MACH_EASY98000SF, /* Falcon Eval Board, Serial Flash */ + LANTIQ_MACH_EASY98000NAND, /* Falcon Eval Board, NAND Flash */ LANTIQ_MACH_EASY98020, /* Falcon Reference Board */ + LANTIQ_MACH_95C3AM1, /* Board 95C3AM1 */ }; Index: target/linux/lantiq/patches-2.6.39/510-register_madwifi.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/510-register_madwifi.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/510-register_madwifi.patch (working copy) @@ -1,17 +1,20 @@ --- a/arch/mips/lantiq/xway/devices.c +++ b/arch/mips/lantiq/xway/devices.c -@@ -144,6 +144,16 @@ ltq_register_gpio_ebu(unsigned int value +@@ -144,6 +144,19 @@ ltq_register_gpio_ebu(unsigned int value platform_device_register(<q_ebu); } +/* madwifi */ +int lantiq_emulate_madwifi_eep = 0; ++unsigned long long lantiq_madwifi_eep_addr = 0; +EXPORT_SYMBOL(lantiq_emulate_madwifi_eep); ++EXPORT_SYMBOL(lantiq_madwifi_eep_addr); + +void __init -+ltq_register_madwifi_eep(void) ++ltq_register_madwifi_eep(unsigned long long addr) +{ + lantiq_emulate_madwifi_eep = 1; ++ lantiq_madwifi_eep_addr = addr; +} + static struct resource ltq_spi_resources[] = { @@ -23,6 +26,6 @@ extern void ltq_register_ase_asc(void); extern void ltq_register_etop(struct ltq_eth_data *eth); extern void ltq_register_gpio_ebu(unsigned int value); -+extern void ltq_register_madwifi_eep(void); ++extern void ltq_register_madwifi_eep(unsigned long long addr); #endif Index: target/linux/lantiq/patches-2.6.39/520-register_buttons.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/520-register_buttons.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/520-register_buttons.patch (working copy) @@ -1,46 +1,101 @@ ---- a/arch/mips/lantiq/xway/devices.c -+++ b/arch/mips/lantiq/xway/devices.c -@@ -154,6 +154,26 @@ ltq_register_madwifi_eep(void) - lantiq_emulate_madwifi_eep = 1; - } +--- a/arch/mips/lantiq/Makefile ++++ b/arch/mips/lantiq/Makefile +@@ -4,7 +4,7 @@ + # under the terms of the GNU General Public License version 2 as published + # by the Free Software Foundation. -+/* gpio buttons */ -+static struct gpio_buttons_platform_data ltq_gpio_buttons_platform_data; +-obj-y := irq.o setup.o clk.o prom.o devices.o ++obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-buttons.o + + obj-$(CONFIG_EARLY_PRINTK) += early_printk.o + +--- /dev/null ++++ b/arch/mips/lantiq/dev-gpio-buttons.c +@@ -0,0 +1,58 @@ ++/* ++ * Lantiq GPIO button support ++ * ++ * Copyright (C) 2008-2009 Gabor Juhos <juh...@openwrt.org> ++ * Copyright (C) 2008 Imre Kaloz <ka...@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. ++ */ + -+static struct platform_device ltq_gpio_buttons_platform_device = ++#include "linux/init.h" ++#include "linux/slab.h" ++#include <linux/platform_device.h> ++ ++#include "dev-gpio-buttons.h" ++ ++void __init ltq_register_gpio_keys_polled(int id, ++ unsigned poll_interval, ++ unsigned nbuttons, ++ struct gpio_keys_button *buttons) +{ -+ .name = "gpio-buttons", -+ .id = 0, -+ .dev = { -+ .platform_data = (void *) <q_gpio_buttons_platform_data, -+ }, -+}; ++ struct platform_device *pdev; ++ struct gpio_keys_platform_data pdata; ++ struct gpio_keys_button *p; ++ int err; + -+void __init -+ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt) -+{ -+ ltq_gpio_buttons_platform_data.buttons = buttons; -+ ltq_gpio_buttons_platform_data.nbuttons = cnt; -+ platform_device_register(<q_gpio_buttons_platform_device); ++ p = kmalloc(nbuttons * sizeof(*p), GFP_KERNEL); ++ if (!p) ++ return; ++ ++ memcpy(p, buttons, nbuttons * sizeof(*p)); ++ ++ pdev = platform_device_alloc("gpio-keys-polled", id); ++ if (!pdev) ++ goto err_free_buttons; ++ ++ memset(&pdata, 0, sizeof(pdata)); ++ pdata.poll_interval = poll_interval; ++ pdata.nbuttons = nbuttons; ++ pdata.buttons = p; ++ ++ err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); ++ if (err) ++ goto err_put_pdev; ++ ++ err = platform_device_add(pdev); ++ if (err) ++ goto err_put_pdev; ++ ++ return; ++ ++err_put_pdev: ++ platform_device_put(pdev); ++ ++err_free_buttons: ++ kfree(p); +} +--- /dev/null ++++ b/arch/mips/lantiq/dev-gpio-buttons.h +@@ -0,0 +1,26 @@ ++/* ++ * Lantiq GPIO button support ++ * ++ * Copyright (C) 2008-2009 Gabor Juhos <juh...@openwrt.org> ++ * Copyright (C) 2008 Imre Kaloz <ka...@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. ++ */ + - static struct resource ltq_spi_resources[] = { - { - .start = LTQ_SSC_BASE_ADDR, ---- a/arch/mips/lantiq/xway/devices.h -+++ b/arch/mips/lantiq/xway/devices.h -@@ -11,6 +11,7 @@ - - #include "../devices.h" - #include <linux/phy.h> -+#include <linux/gpio_buttons.h> - - extern void ltq_register_gpio(void); - extern void ltq_register_gpio_stp(void); -@@ -18,5 +19,6 @@ extern void ltq_register_ase_asc(void); - extern void ltq_register_etop(struct ltq_eth_data *eth); - extern void ltq_register_gpio_ebu(unsigned int value); - extern void ltq_register_madwifi_eep(void); -+extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt); - - #endif ++#ifndef _LANTIQ_DEV_GPIO_BUTTONS_H ++#define _LANTIQ_DEV_GPIO_BUTTONS_H ++ ++#include <linux/input.h> ++#include <linux/gpio_keys.h> ++ ++#define LTQ_KEYS_POLL_INTERVAL 20 /* msecs */ ++#define LTQ_KEYS_DEBOUNCE_INTERVAL (3 * LTQ_KEYS_POLL_INTERVAL) ++ ++void ltq_register_gpio_keys_polled(int id, ++ unsigned poll_interval, ++ unsigned nbuttons, ++ struct gpio_keys_button *buttons); ++ ++#endif /* _LANTIQ_DEV_GPIO_BUTTONS_H */ Index: target/linux/lantiq/patches-2.6.39/560-dev-leds-gpio.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/560-dev-leds-gpio.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/560-dev-leds-gpio.patch (working copy) @@ -88,8 +88,8 @@ # under the terms of the GNU General Public License version 2 as published # by the Free Software Foundation. --obj-y := irq.o setup.o clk.o prom.o devices.o -+obj-y := irq.o setup.o clk.o prom.o devices.o dev-leds-gpio.o +-obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-buttons.o ++obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-buttons.o dev-leds-gpio.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o Index: target/linux/lantiq/patches-2.6.39/0014-fix_mtd.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/0014-fix_mtd.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/0014-fix_mtd.patch (working copy) @@ -1,6 +1,6 @@ --- a/arch/mips/lantiq/xway/mach-easy50601.c +++ b/arch/mips/lantiq/xway/mach-easy50601.c -@@ -32,12 +32,7 @@ +@@ -32,12 +32,7 @@ static struct mtd_partition easy50601_pa { .name = "linux", .offset = 0x20000, @@ -16,7 +16,7 @@ --- a/arch/mips/lantiq/xway/mach-easy50712.c +++ b/arch/mips/lantiq/xway/mach-easy50712.c -@@ -34,12 +34,7 @@ +@@ -34,12 +34,7 @@ static struct mtd_partition easy50712_pa { .name = "linux", .offset = 0x20000, Index: target/linux/lantiq/patches-2.6.39/600-mach-dgn3500.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/600-mach-dgn3500.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/600-mach-dgn3500.patch (working copy) @@ -1,6 +1,6 @@ --- a/arch/mips/lantiq/machtypes.h +++ b/arch/mips/lantiq/machtypes.h -@@ -32,6 +32,9 @@ +@@ -33,6 +33,9 @@ enum lantiq_mach_type { LANTIQ_MACH_ARV752DPW, /* Arcor easybox a802 */ LANTIQ_MACH_ARV752DPW22, /* Arcor easybox a803 */ LANTIQ_MACH_ARV7518PW, /* ASTORIA */ @@ -12,7 +12,7 @@ #endif --- a/arch/mips/lantiq/xway/Kconfig +++ b/arch/mips/lantiq/xway/Kconfig -@@ -10,6 +10,10 @@ +@@ -10,6 +10,10 @@ config LANTIQ_MACH_ARV45XX bool "ARV45XX" default y @@ -25,7 +25,7 @@ endif --- a/arch/mips/lantiq/xway/Makefile +++ b/arch/mips/lantiq/xway/Makefile -@@ -6,4 +6,5 @@ +@@ -6,4 +6,5 @@ obj-$(CONFIG_SOC_AMAZON_SE) += clk-ase.o obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o @@ -33,20 +33,20 @@ obj-y += dev-dwc_otg.o --- a/arch/mips/lantiq/xway/devices.h +++ b/arch/mips/lantiq/xway/devices.h -@@ -12,6 +12,7 @@ +@@ -11,6 +11,7 @@ + #include "../devices.h" #include <linux/phy.h> - #include <linux/gpio_buttons.h> +#include <linux/spi/spi.h> extern void ltq_register_gpio(void); extern void ltq_register_gpio_stp(void); -@@ -20,5 +21,7 @@ +@@ -18,5 +19,7 @@ extern void ltq_register_ase_asc(void); + extern void ltq_register_etop(struct ltq_eth_data *eth); extern void ltq_register_gpio_ebu(unsigned int value); - extern void ltq_register_madwifi_eep(void); - extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt); + extern void ltq_register_madwifi_eep(unsigned long long addr); +extern void ltq_register_spi(struct ltq_spi_platform_data *pdata, -+ struct spi_board_info const *info, unsigned n); ++ struct spi_board_info const *info, unsigned n); #endif --- /dev/null Index: target/linux/lantiq/patches-2.6.39/550-dwc_otg.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/550-dwc_otg.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/550-dwc_otg.patch (working copy) @@ -15613,7 +15613,7 @@ +#endif --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -2812,11 +2812,11 @@ hub_port_init (struct usb_hub *hub, stru +@@ -2820,11 +2820,11 @@ hub_port_init (struct usb_hub *hub, stru udev->ttport = hdev->ttport; } else if (udev->speed != USB_SPEED_HIGH && hdev->speed == USB_SPEED_HIGH) { Index: target/linux/lantiq/patches-2.6.39/601-mach-gigasx76x.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/601-mach-gigasx76x.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/601-mach-gigasx76x.patch (working copy) @@ -1,11 +1,12 @@ --- a/arch/mips/lantiq/xway/Kconfig +++ b/arch/mips/lantiq/xway/Kconfig -@@ -14,6 +14,10 @@ +@@ -14,6 +14,11 @@ config LANTIQ_MACH_NETGEAR bool "Netgear" default y +config LANTIQ_MACH_GIGASX76X + bool "GIGASX76X" ++ select LTQ_DEV_GPIO_BUTTONS + default y + endmenu @@ -13,7 +14,7 @@ endif --- a/arch/mips/lantiq/xway/Makefile +++ b/arch/mips/lantiq/xway/Makefile -@@ -7,4 +7,5 @@ +@@ -7,4 +7,5 @@ obj-$(CONFIG_LANTIQ_MACH_EASY50712) += m obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o obj-$(CONFIG_LANTIQ_MACH_NETGEAR) += mach-netgear.o @@ -21,7 +22,7 @@ obj-y += dev-dwc_otg.o --- /dev/null +++ b/arch/mips/lantiq/xway/mach-gigasx76x.c -@@ -0,0 +1,113 @@ +@@ -0,0 +1,209 @@ +/* + * 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 @@ -32,11 +33,11 @@ + * + */ + ++#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/leds.h> +#include <linux/gpio.h> -+#include <linux/gpio_buttons.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> @@ -44,58 +45,71 @@ +#include <linux/ath5k_platform.h> +#include <linux/pci.h> +#include <linux/phy.h> ++#include <linux/io.h> ++#include <linux/string.h> + +#include <irq.h> + +#include <lantiq_soc.h> +#include <lantiq_platform.h> + -+#include "../machtypes.h" +#include "devices.h" +#include "dev-dwc_otg.h" -+#include "dev-leds-gpio.h" ++#include "../machtypes.h" ++#include "../dev-leds-gpio.h" ++#include "../dev-gpio-buttons.h" + ++#define UBOOT_ENV_OFFSET 0x010000 ++#define UBOOT_ENV_SIZE 0x010000 ++ +#ifdef CONFIG_MTD_PARTITIONS +static struct mtd_partition gigasx76x_partitions[] = +{ + { -+ .name = "secondary_env", -+ .offset = 0xe000, -+ .size = 0x2000, ++ .name = "uboot", ++ .offset = 0x000000, ++ .size = 0x010000, + }, + { -+ .name = "secondary_boot", -+ .offset = 0x10000, -+ .size = 0x10000, ++ .name = "uboot_env", ++ .offset = UBOOT_ENV_OFFSET, ++ .size = UBOOT_ENV_SIZE, + }, + { -+ .name = "uboot", -+ .offset = 0x20000, -+ .size = 0x30000, -+ }, -+ { + .name = "linux", -+ .offset = 0x50000, -+ .size = 0x7a0000, ++ .offset = 0x020000, ++ .size = 0x7d0000, + }, + { + .name = "board_config", + .offset = 0x7f0000, -+ .size = 0x10000, ++ .size = 0x010000, + }, +}; +#endif + +static struct gpio_led -+gigasx76x_leds_gpio[] __initdata = { ++gigasx76x_gpio_leds[] __initdata = { + { .name = "soc:green:usb", .gpio = 50, }, + { .name = "soc:green:wlan", .gpio = 51, }, + { .name = "soc:green:phone2", .gpio = 52, }, + { .name = "soc:green:phone1", .gpio = 53, }, + { .name = "soc:green:line", .gpio = 54, }, + { .name = "soc:green:online", .gpio = 55, }, ++ { .name = "soc:green:voip", .gpio = 56, }, +}; + ++static struct gpio_keys_button ++gigasx76x_gpio_keys[] __initdata = { ++ { ++ .desc = "reset", ++ .type = EV_KEY, ++ .code = KEY_RESTART, ++ .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL, ++ .gpio = 14, ++ .active_low = 1, ++ }, ++}; + +static struct physmap_flash_data gigasx76x_flash_data = { +#ifdef CONFIG_MTD_PARTITIONS @@ -105,39 +119,122 @@ +}; + +static struct ltq_pci_data ltq_pci_data = { -+ .clock = PCI_CLOCK_INT, -+ .gpio = PCI_GNT1 | PCI_REQ1, -+ .irq = { -+ [14] = INT_NUM_IM0_IRL0 + 22, -+ }, ++ .clock = PCI_CLOCK_INT, ++ .gpio = PCI_GNT1 | PCI_REQ1, ++ .irq = { [14] = INT_NUM_IM0_IRL0 + 22, }, +}; + +static struct ltq_eth_data ltq_eth_data = { -+ .mii_mode = PHY_INTERFACE_MODE_MII, ++ .mii_mode = PHY_INTERFACE_MODE_MII, +}; + -+static void __init -+gigasx76x_init(void) -+{ -+#define GIGASX76X_USB 29 ++static char __init *get_uboot_env_var(char *haystack, int haystack_len, char *needle, int needle_len) { ++ int i; ++ for (i = 0; i <= haystack_len - needle_len; i++) { ++ if (memcmp(haystack + i, needle, needle_len) == 0) { ++ return haystack + i + needle_len; ++ } ++ } ++ return NULL; ++} + ++/* ++ * gigasx76x_parse_hex_* are not uniq. in arm/orion there are also duplicates: ++ * dns323_parse_hex_* ++ * TODO: one day write a patch for this :) ++ */ ++static int __init gigasx76x_parse_hex_nibble(char n) { ++ if (n >= '0' && n <= '9') ++ return n - '0'; ++ ++ if (n >= 'A' && n <= 'F') ++ return n - 'A' + 10; ++ ++ if (n >= 'a' && n <= 'f') ++ return n - 'a' + 10; ++ ++ return -1; ++} ++ ++static int __init gigasx76x_parse_hex_byte(const char *b) { ++ int hi; ++ int lo; ++ ++ hi = gigasx76x_parse_hex_nibble(b[0]); ++ lo = gigasx76x_parse_hex_nibble(b[1]); ++ ++ if (hi < 0 || lo < 0) ++ return -1; ++ ++ return (hi << 4) | lo; ++} ++ ++static int __init gigasx76x_register_ethernet(void) { ++ u_int8_t addr[6]; ++ int i; ++ char *uboot_env_page; ++ char *mac; ++ ++ uboot_env_page = ioremap(LTQ_FLASH_START + UBOOT_ENV_OFFSET, UBOOT_ENV_SIZE); ++ if (!uboot_env_page) ++ return -ENOMEM; ++ ++ mac = get_uboot_env_var(uboot_env_page, UBOOT_ENV_SIZE, "\0ethaddr=", 9); ++ ++ if (!mac) { ++ goto error_fail; ++ } ++ ++ /* Sanity check the string we're looking at */ ++ for (i = 0; i < 5; i++) { ++ if (*(mac + (i * 3) + 2) != ':') { ++ goto error_fail; ++ } ++ } ++ ++ for (i = 0; i < 6; i++) { ++ int byte; ++ byte = gigasx76x_parse_hex_byte(mac + (i * 3)); ++ if (byte < 0) { ++ goto error_fail; ++ } ++ addr[i] = byte; ++ } ++ ++ iounmap(uboot_env_page); ++ printk("GIGASX76X: Found ethernet MAC address: "); ++ for (i = 0; i < 6; i++) ++ printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n"); ++ ++ memcpy(<q_eth_data.mac.sa_data, addr, 6); ++ ltq_register_etop(<q_eth_data); ++ ++ return 0; ++ ++ error_fail: ++ iounmap(uboot_env_page); ++ return -EINVAL; ++} ++ ++static void __init gigasx76x_init(void) { ++#define GIGASX76X_USB 29 ++#define GIGASX76X_MADWIFI_ADDR 0xb07f0000 ++ + ltq_register_gpio_stp(); + ltq_register_nor(&gigasx76x_flash_data); + ltq_register_pci(<q_pci_data); -+ ltq_register_etop(<q_eth_data); ++ gigasx76x_register_ethernet(); + xway_register_dwc(GIGASX76X_USB); + ltq_register_tapi(); -+ ltq_register_madwifi_eep(); -+ ltq_add_device_leds_gpio(-1, ARRAY_SIZE(gigasx76x_leds_gpio), gigasx76x_leds_gpio); ++ ltq_register_madwifi_eep(GIGASX76X_MADWIFI_ADDR); ++ ltq_add_device_leds_gpio(-1, ARRAY_SIZE(gigasx76x_gpio_leds), gigasx76x_gpio_leds); ++ ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(gigasx76x_gpio_keys), gigasx76x_gpio_keys); +} + -+MIPS_MACHINE(LANTIQ_MACH_GIGASX76X, -+ "GIGASX76X", -+ "GIGASX76X - Gigaset SX761,SX762,SX763", -+ gigasx76x_init); ++MIPS_MACHINE(LANTIQ_MACH_GIGASX76X, "GIGASX76X", "GIGASX76X - Gigaset SX761,SX762,SX763", gigasx76x_init); --- a/arch/mips/lantiq/machtypes.h +++ b/arch/mips/lantiq/machtypes.h -@@ -35,6 +35,9 @@ +@@ -36,6 +36,9 @@ enum lantiq_mach_type { /* Netgear */ LANTIQ_MACH_DGN3500B, /* Netgear DGN3500 */ Index: target/linux/lantiq/patches-2.6.39/530-register_tapi.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/530-register_tapi.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/530-register_tapi.patch (working copy) @@ -32,7 +32,7 @@ #endif --- a/arch/mips/lantiq/xway/mach-easy50712.c +++ b/arch/mips/lantiq/xway/mach-easy50712.c -@@ -66,6 +66,7 @@ static void __init easy50712_init(void) +@@ -61,6 +61,7 @@ static void __init easy50712_init(void) ltq_register_nor(&easy50712_flash_data); ltq_register_pci(<q_pci_data); ltq_register_etop(<q_eth_data); Index: target/linux/lantiq/patches-2.6.39/150-falcon-easy98020.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/150-falcon-easy98020.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/150-falcon-easy98020.patch (working copy) @@ -133,8 +133,8 @@ endif --- a/arch/mips/lantiq/falcon/Makefile +++ b/arch/mips/lantiq/falcon/Makefile -@@ -2,3 +2,4 @@ obj-y := clk-falcon.o devices.o gpio.o p - obj-y += softdog_vpe.o +@@ -3,3 +3,4 @@ obj-y += softdog_vpe.o + obj-$(CONFIG_LANTIQ_MACH_EASY98000) += addon-easy98000.o obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o +obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o Index: target/linux/lantiq/patches-2.6.39/240-udp_redirect.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/240-udp_redirect.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/240-udp_redirect.patch (working copy) @@ -296,7 +296,7 @@ if (up->pending) { /* -@@ -1608,6 +1618,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, +@@ -1611,6 +1621,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct rtable *rt = skb_rtable(skb); __be32 saddr, daddr; struct net *net = dev_net(skb->dev); @@ -304,7 +304,7 @@ /* * Validate the packet. -@@ -1640,7 +1651,16 @@ int __udp4_lib_rcv(struct sk_buff *skb, +@@ -1643,7 +1654,16 @@ int __udp4_lib_rcv(struct sk_buff *skb, sk = __udp4_lib_lookup_skb(skb, uh->source, uh->dest, udptable); if (sk != NULL) { @@ -322,7 +322,7 @@ sock_put(sk); /* a return value > 0 means to resubmit the input, but -@@ -1937,7 +1957,7 @@ struct proto udp_prot = { +@@ -1940,7 +1960,7 @@ struct proto udp_prot = { .clear_sk = sk_prot_clear_portaddr_nulls, }; EXPORT_SYMBOL(udp_prot); Index: target/linux/lantiq/patches-2.6.39/280-netif_receive_skb.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/280-netif_receive_skb.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/280-netif_receive_skb.patch (working copy) @@ -1,6 +1,6 @@ --- a/drivers/net/lantiq_etop.c +++ b/drivers/net/lantiq_etop.c -@@ -155,8 +155,12 @@ +@@ -155,8 +155,12 @@ ltq_etop_hw_receive(struct ltq_etop_chan skb_put(skb, len); skb->dev = ch->netdev; Index: target/linux/lantiq/patches-2.6.39/410-spi2.patch =================================================================== --- target/linux/lantiq/patches-2.6.39/410-spi2.patch (revision 27619) +++ target/linux/lantiq/patches-2.6.39/410-spi2.patch (working copy) @@ -10,7 +10,7 @@ --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig -@@ -193,6 +193,14 @@ +@@ -193,6 +193,14 @@ config SPI_IMX This enables using the Freescale i.MX SPI controllers in master mode. @@ -27,7 +27,7 @@ depends on PARPORT && EXPERIMENTAL --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile -@@ -26,6 +26,7 @@ +@@ -26,6 +26,7 @@ obj-$(CONFIG_SPI_EP93XX) += ep93xx_spi. obj-$(CONFIG_SPI_GPIO) += spi_gpio.o obj-$(CONFIG_SPI_GPIO_OLD) += spi_gpio_old.o obj-$(CONFIG_SPI_IMX) += spi_imx.o Index: target/linux/lantiq/Makefile =================================================================== --- target/linux/lantiq/Makefile (revision 27619) +++ target/linux/lantiq/Makefile (working copy) @@ -12,7 +12,7 @@ FEATURES:=squashfs jffs2 DEFAULT_SUBTARGET:=danube -LINUX_VERSION:=2.6.39.2 +LINUX_VERSION:=2.6.39.3 CFLAGS=-Os -pipe -mips32r2 -mtune=mips32r2 -fno-caller-saves _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel