From ee14f5106f759038d84e3674cec8cbbbb8a03a0a Mon Sep 17 00:00:00 2001 From: Travis Kemen Date: Sun, 14 Mar 2010 01:41:52 +0000 Subject: Switch Marvell Orion CPU to kernel 2.6.32 plus LED support for all LEDs on LinkSys WRT350Nv2. Signed-off by: Matthias Buecher and Dirk Teurlings SVN-Revision: 20185 --- target/linux/orion/Makefile | 4 +- .../orion/base-files/etc/hotplug.d/usb/10-usb | 54 +++++++++++ .../orion/base-files/etc/uci-defaults/hardware | 37 ++++++++ target/linux/orion/config-default | 8 ++ .../orion/patches/010-ignore_atag_cmdline.patch | 2 +- .../orion/patches/020-wnr854t_switch_support.patch | 39 -------- .../patches/050-wrt350nv2_cfi_workaround.patch | 2 +- .../patches/090-wrt350nv2_gpio_leds_buttons.patch | 102 +++++++++++++++++++++ .../orion/patches/100-openwrt_partition_map.patch | 4 +- .../orion/patches/200-dt2_board_support.patch | 2 +- target/linux/orion/patches/300-skb_cb_align.patch | 2 +- 11 files changed, 209 insertions(+), 47 deletions(-) create mode 100644 target/linux/orion/base-files/etc/hotplug.d/usb/10-usb create mode 100644 target/linux/orion/base-files/etc/uci-defaults/hardware create mode 100644 target/linux/orion/patches/090-wrt350nv2_gpio_leds_buttons.patch diff --git a/target/linux/orion/Makefile b/target/linux/orion/Makefile index ac75a477b4..196e93f844 100644 --- a/target/linux/orion/Makefile +++ b/target/linux/orion/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2008 OpenWrt.org +# Copyright (C) 2008-2010 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -13,7 +13,7 @@ FEATURES:=squashfs SUBTARGETS=generic harddisk CFLAGS=-Os -pipe -march=armv5t -mtune=xscale -funit-at-a-time -LINUX_VERSION:=2.6.30.10 +LINUX_VERSION:=2.6.32.9 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/orion/base-files/etc/hotplug.d/usb/10-usb b/target/linux/orion/base-files/etc/hotplug.d/usb/10-usb new file mode 100644 index 0000000000..5572daede1 --- /dev/null +++ b/target/linux/orion/base-files/etc/hotplug.d/usb/10-usb @@ -0,0 +1,54 @@ +#!/bin/sh +# +# Copyright (C) 2009-2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +usb_led='' +usb_device='' + +led_set_attr() { + [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2" +} + +usb_led_set_timer() { + led_set_attr "${usb_led}" 'trigger' 'timer' + led_set_attr "${usb_led}" 'delay_on' "$1" + led_set_attr "${usb_led}" 'delay_off' "$2" +} + +usb_led_on() { + led_set_attr "${usb_led}" 'trigger' 'none' + led_set_attr "${usb_led}" 'brightness' 255 +} + +usb_led_off() { + led_set_attr "${usb_led}" 'trigger' 'none' + led_set_attr "${usb_led}" 'brightness' 0 +} + +get_usb_led() { + local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo` + + case "${hardware}" in + 'Linksys WRT350N v2') + usb_led='wrt350nv2:green:usb' + usb_device='1-1:1.0' + ;; + esac; +} + +get_usb_led + +case "${ACTION}" in + add) + # update LEDs + [ "${usb_device}" = "${DEVICENAME}" ] && usb_led_on + ;; + remove) + # update LEDs + [ "${usb_device}" = "${DEVICENAME}" ] && usb_led_off + ;; +esac diff --git a/target/linux/orion/base-files/etc/uci-defaults/hardware b/target/linux/orion/base-files/etc/uci-defaults/hardware new file mode 100644 index 0000000000..9c974963ef --- /dev/null +++ b/target/linux/orion/base-files/etc/uci-defaults/hardware @@ -0,0 +1,37 @@ +#!/bin/sh +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +# +# This script sets system defaults for the hardware on firstboot +# + +local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo` + +wrt350nv2_default() { +# leds + uci batch <<__EOF +set system.power_led=led +set system.power_led.name='Power LED (green)' +set system.power_led.sysfs='wrt350nv2:green:power' +set system.power_led.default='1' +set system.wifi_led=led +set system.wifi_led.name='Wireless LED (green)' +set system.wifi_led.sysfs='wrt350nv2:green:wireless' +set system.wifi_led.trigger='netdev' +set system.wifi_led.dev='wlan0' +set system.wifi_led.mode='link tx rx' +set system.wifi_led.default='0' +commit system +__EOF +} + +case "${hardware}" in + 'Linksys WRT350N v2') + wrt350nv2_default + ;; +esac diff --git a/target/linux/orion/config-default b/target/linux/orion/config-default index ed16c7e211..d84cac1fc6 100644 --- a/target/linux/orion/config-default +++ b/target/linux/orion/config-default @@ -40,6 +40,8 @@ CONFIG_CPU_PABRT_NOIFAR=y CONFIG_CPU_TLB_V4WBI=y CONFIG_CRC16=y # CONFIG_CRC_CCITT is not set +CONFIG_CRYPTO_DEV_MV_CESA=y +CONFIG_CRYPTO_HW=y # CONFIG_DEBUG_USER is not set CONFIG_DEVPORT=y CONFIG_DLCI=m @@ -59,6 +61,8 @@ CONFIG_GENERIC_CLOCKEVENTS=y # CONFIG_GENERIC_FIND_FIRST_BIT is not set # CONFIG_GENERIC_FIND_NEXT_BIT is not set CONFIG_GENERIC_GPIO=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_SYSFS=y # CONFIG_HAMRADIO is not set CONFIG_HARDIRQS_SW_RESEND=y CONFIG_HAS_DMA=y @@ -115,11 +119,14 @@ CONFIG_IPV6_NDISC_NODETYPE=y # CONFIG_IWLWIFI_LEDS is not set # CONFIG_LANMEDIA is not set # CONFIG_LATENCYTOP is not set +CONFIG_LEDS_GPIO=y CONFIG_LEGACY_PTY_COUNT=256 CONFIG_LEGACY_PTYS=y # CONFIG_LLC2 is not set CONFIG_LZO_COMPRESS=m CONFIG_LZO_DECOMPRESS=m +# CONFIG_MACH_BIGDISK is not set +# CONFIG_MACH_D2NET is not set # CONFIG_MACH_DB88F5281 is not set # CONFIG_MACH_DNS323 is not set CONFIG_MACH_DT2=y @@ -129,6 +136,7 @@ CONFIG_MACH_DT2=y # CONFIG_MACH_LINKSTATION_PRO is not set # CONFIG_MACH_MSS2 is not set # CONFIG_MACH_MV2120 is not set +# CONFIG_MACH_NET2BIG is not set # CONFIG_MACH_RD88F5181L_FXO is not set # CONFIG_MACH_RD88F5181L_GE is not set # CONFIG_MACH_RD88F5182 is not set diff --git a/target/linux/orion/patches/010-ignore_atag_cmdline.patch b/target/linux/orion/patches/010-ignore_atag_cmdline.patch index 05e835bf9d..9df21f1eb5 100644 --- a/target/linux/orion/patches/010-ignore_atag_cmdline.patch +++ b/target/linux/orion/patches/010-ignore_atag_cmdline.patch @@ -1,6 +1,6 @@ --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c -@@ -614,7 +614,7 @@ __tagtable(ATAG_REVISION, parse_tag_revi +@@ -629,7 +629,7 @@ __tagtable(ATAG_REVISION, parse_tag_revi static int __init parse_tag_cmdline(const struct tag *tag) { diff --git a/target/linux/orion/patches/020-wnr854t_switch_support.patch b/target/linux/orion/patches/020-wnr854t_switch_support.patch index f62b56944e..e69de29bb2 100644 --- a/target/linux/orion/patches/020-wnr854t_switch_support.patch +++ b/target/linux/orion/patches/020-wnr854t_switch_support.patch @@ -1,39 +0,0 @@ ---- a/arch/arm/mach-orion5x/wnr854t-setup.c -+++ b/arch/arm/mach-orion5x/wnr854t-setup.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -97,6 +98,20 @@ static struct mv643xx_eth_platform_data - .duplex = DUPLEX_FULL, - }; - -+static struct dsa_chip_data wnr854t_switch_chip_data = { -+ .port_names[0] = "lan3", -+ .port_names[1] = "lan4", -+ .port_names[2] = "wan", -+ .port_names[3] = "cpu", -+ .port_names[5] = "lan1", -+ .port_names[7] = "lan2", -+}; -+ -+static struct dsa_platform_data wnr854t_switch_plat_data = { -+ .nr_chips = 1, -+ .chip = &wnr854t_switch_chip_data, -+}; -+ - static void __init wnr854t_init(void) - { - /* -@@ -110,6 +125,7 @@ static void __init wnr854t_init(void) - * Configure peripherals. - */ - orion5x_eth_init(&wnr854t_eth_data); -+ orion5x_eth_switch_init(&wnr854t_switch_plat_data, NO_IRQ); - orion5x_uart0_init(); - - orion5x_setup_dev_boot_win(WNR854T_NOR_BOOT_BASE, diff --git a/target/linux/orion/patches/050-wrt350nv2_cfi_workaround.patch b/target/linux/orion/patches/050-wrt350nv2_cfi_workaround.patch index b8ba0e2e28..246276d1f3 100644 --- a/target/linux/orion/patches/050-wrt350nv2_cfi_workaround.patch +++ b/target/linux/orion/patches/050-wrt350nv2_cfi_workaround.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c -@@ -385,8 +385,9 @@ struct mtd_info *cfi_cmdset_0002(struct +@@ -374,8 +374,9 @@ struct mtd_info *cfi_cmdset_0002(struct cfi_fixup_major_minor(cfi, extp); diff --git a/target/linux/orion/patches/090-wrt350nv2_gpio_leds_buttons.patch b/target/linux/orion/patches/090-wrt350nv2_gpio_leds_buttons.patch new file mode 100644 index 0000000000..e185693284 --- /dev/null +++ b/target/linux/orion/patches/090-wrt350nv2_gpio_leds_buttons.patch @@ -0,0 +1,102 @@ +--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c 2009-12-08 02:39:46.000000000 +0100 ++++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c 2010-01-13 15:25:17.000000000 +0100 +@@ -15,6 +15,9 @@ + #include + #include + #include ++#include ++#include ++#include + #include + #include + #include +@@ -24,6 +27,80 @@ + #include "common.h" + #include "mpp.h" + ++/* ++ * LEDs attached to GPIO ++ */ ++static struct gpio_led wrt350n_v2_led_pins[] = { ++ { ++ .name = "wrt350nv2:green:power", ++ .gpio = 0, ++ .active_low = 1, ++ }, { ++ .name = "wrt350nv2:green:security", ++ .gpio = 1, ++ .active_low = 1, ++ }, { ++ .name = "wrt350nv2:orange:power", ++ .gpio = 5, ++ .active_low = 1, ++ }, { ++ .name = "wrt350nv2:green:usb", ++ .gpio = 6, ++ .active_low = 1, ++ }, { ++ .name = "wrt350nv2:green:wireless", ++ .gpio = 7, ++ .active_low = 1, ++ }, ++}; ++ ++static struct gpio_led_platform_data wrt350n_v2_led_data = { ++ .leds = wrt350n_v2_led_pins, ++ .num_leds = ARRAY_SIZE(wrt350n_v2_led_pins), ++}; ++ ++static struct platform_device wrt350n_v2_leds = { ++ .name = "leds-gpio", ++ .id = -1, ++ .dev = { ++ .platform_data = &wrt350n_v2_led_data, ++ }, ++}; ++ ++/* ++ * Buttons attached to GPIO ++ */ ++static struct gpio_keys_button wrt350n_v2_buttons[] = { ++ { ++ .code = KEY_RESTART, ++ .gpio = 3, ++ .desc = "Reset Button", ++ .active_low = 1, ++ }, { ++ .code = KEY_WLAN, ++ .gpio = 2, ++ .desc = "WPS Button", ++ .active_low = 1, ++ }, ++}; ++ ++static struct gpio_keys_platform_data wrt350n_v2_button_data = { ++ .buttons = wrt350n_v2_buttons, ++ .nbuttons = ARRAY_SIZE(wrt350n_v2_buttons), ++}; ++ ++static struct platform_device wrt350n_v2_button_device = { ++ .name = "gpio-keys", ++ .id = -1, ++ .num_resources = 0, ++ .dev = { ++ .platform_data = &wrt350n_v2_button_data, ++ }, ++}; ++ ++/* ++ * General setup ++ */ + static struct orion5x_mpp_mode wrt350n_v2_mpp_modes[] __initdata = { + { 0, MPP_GPIO }, /* Power LED green (0=on) */ + { 1, MPP_GPIO }, /* Security LED (0=on) */ +@@ -140,6 +217,8 @@ + orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE, + WRT350N_V2_NOR_BOOT_SIZE); + platform_device_register(&wrt350n_v2_nor_flash); ++ platform_device_register(&wrt350n_v2_button_device); ++ platform_device_register(&wrt350n_v2_leds); + } + + static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) diff --git a/target/linux/orion/patches/100-openwrt_partition_map.patch b/target/linux/orion/patches/100-openwrt_partition_map.patch index bef4a54e84..79e1be7ee0 100644 --- a/target/linux/orion/patches/100-openwrt_partition_map.patch +++ b/target/linux/orion/patches/100-openwrt_partition_map.patch @@ -1,6 +1,6 @@ --- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c +++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c -@@ -58,11 +58,11 @@ static struct mtd_partition wrt350n_v2_nor_flash_partitions +@@ -135,11 +135,11 @@ static struct mtd_partition wrt350n_v2_nor_flash_partitions { .name = "kernel", .offset = 0x00000000, @@ -15,7 +15,7 @@ }, { .name = "lang", .offset = 0x00760000, -@@ -75,6 +79,14 @@ static struct mtd_partition wrt350n_v2_nor_flash_partitions +@@ -152,6 +152,14 @@ static struct mtd_partition wrt350n_v2_nor_flash_partitions .name = "u-boot", .offset = 0x007c0000, .size = 0x00040000, diff --git a/target/linux/orion/patches/200-dt2_board_support.patch b/target/linux/orion/patches/200-dt2_board_support.patch index 4735a221e4..27154723e1 100644 --- a/target/linux/orion/patches/200-dt2_board_support.patch +++ b/target/linux/orion/patches/200-dt2_board_support.patch @@ -16,7 +16,7 @@ select I2C_BOARDINFO --- a/arch/arm/mach-orion5x/Makefile +++ b/arch/arm/mach-orion5x/Makefile -@@ -17,3 +17,4 @@ obj-$(CONFIG_MACH_WNR854T) += wnr854t-se +@@ -20,3 +20,4 @@ obj-$(CONFIG_MACH_WNR854T) += wnr854t-se obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o obj-$(CONFIG_MACH_RD88F6183AP_GE) += rd88f6183ap-ge-setup.o diff --git a/target/linux/orion/patches/300-skb_cb_align.patch b/target/linux/orion/patches/300-skb_cb_align.patch index 89563c244f..3fefa4de39 100644 --- a/target/linux/orion/patches/300-skb_cb_align.patch +++ b/target/linux/orion/patches/300-skb_cb_align.patch @@ -1,6 +1,6 @@ --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -335,7 +335,7 @@ struct sk_buff { +@@ -332,7 +332,7 @@ struct sk_buff { * want to keep them across layers you have to do a skb_clone() * first. This is owned by whoever has the skb queued ATM. */ -- cgit v1.2.3