Signed-off by: Matthias Buecher <mail@maddes.net> and Dirk Teurlings <info@upexia.nl> SVN-Revision: 20185master
parent
308c0afbc1
commit
ee14f5106f
@ -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 |
@ -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 |
@ -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,
|
@ -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)
|
Loading…
Reference in new issue