Switch Marvell Orion CPU to kernel 2.6.32 plus LED support for all LEDs
authorTravis Kemen <thepeople@openwrt.org>
Sun, 14 Mar 2010 01:41:52 +0000 (01:41 +0000)
committerTravis Kemen <thepeople@openwrt.org>
Sun, 14 Mar 2010 01:41:52 +0000 (01:41 +0000)
on LinkSys WRT350Nv2.

Signed-off by: Matthias Buecher <mail@maddes.net> and Dirk Teurlings
<info@upexia.nl>

SVN-Revision: 20185

target/linux/orion/Makefile
target/linux/orion/base-files/etc/hotplug.d/usb/10-usb [new file with mode: 0644]
target/linux/orion/base-files/etc/uci-defaults/hardware [new file with mode: 0644]
target/linux/orion/config-default
target/linux/orion/patches/010-ignore_atag_cmdline.patch
target/linux/orion/patches/020-wnr854t_switch_support.patch
target/linux/orion/patches/050-wrt350nv2_cfi_workaround.patch
target/linux/orion/patches/090-wrt350nv2_gpio_leds_buttons.patch [new file with mode: 0644]
target/linux/orion/patches/100-openwrt_partition_map.patch
target/linux/orion/patches/200-dt2_board_support.patch
target/linux/orion/patches/300-skb_cb_align.patch

index ac75a477b48805d8829f1f7e8e3cf28b161d866d..196e93f844cf94f77d396ae7571373e70cbf1db5 100644 (file)
@@ -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 (file)
index 0000000..5572dae
--- /dev/null
@@ -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 (file)
index 0000000..9c97496
--- /dev/null
@@ -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
index ed16c7e211702e0796aa2b1dd2e42328d398fd7d..d84cac1fc6f2273023474a8cf69fd1fe17cd183e 100644 (file)
@@ -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
index 05e835bf9d6de4c04bee5e0f0af573a50c1b5c6f..9df21f1eb56e53de8afaa58676d634f1a4459f9f 100644 (file)
@@ -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)
  {
index f62b56944e5a6dcd4b752662ae7bf67e67e7ebfb..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -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 <linux/mtd/physmap.h>
- #include <linux/mv643xx_eth.h>
- #include <linux/ethtool.h>
-+#include <net/dsa.h>
- #include <asm/mach-types.h>
- #include <asm/gpio.h>
- #include <asm/mach/arch.h>
-@@ -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,
index b8ba0e2e28026604eb741f12598c31be9fb08a50..246276d1f3c41f94b98f6f24a386e08fd80be599 100644 (file)
@@ -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 (file)
index 0000000..e185693
--- /dev/null
@@ -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 <linux/mtd/physmap.h>
+ #include <linux/mv643xx_eth.h>
+ #include <linux/ethtool.h>
++#include <linux/leds.h>
++#include <linux/gpio_keys.h>
++#include <linux/input.h>
+ #include <net/dsa.h>
+ #include <asm/mach-types.h>
+ #include <asm/gpio.h>
+@@ -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)
index bef4a54e849d763ce3a9fd7a7eee72fdb1e66342..79e1be7ee0b7f3f9ef463f0fc15a68518a12a718 100644 (file)
@@ -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,
index 4735a221e4ba2f0bca2972cbb98663223176534a..27154723e1b1055ff1cbe2a64df65ee6684845a7 100644 (file)
@@ -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
index 89563c244fc374f5101ee706ea19fc2da85ea11e..3fefa4de397f41d98656cdc90ab41d8cbcedf7b8 100644 (file)
@@ -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.
         */