1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 00:30:16 +02:00

Switch Marvell Orion CPU to kernel 2.6.32 plus LED support for all LEDs

on LinkSys WRT350Nv2.

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

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20185 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
thepeople 2010-03-14 01:41:52 +00:00
parent 4b16a9a832
commit f286b80a74
11 changed files with 209 additions and 47 deletions

View 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

View File

@ -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

View File

@ -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

View 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

View 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)
{

View 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,

View 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);

View File

@ -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)

View 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,

View 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

View 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.
*/