[OpenWrt-Devel] How to trigger the failsafe mode by reset button

2012-07-23 Thread ming wu
Hi all:

Now i want to check how to trigger the failsafe mode by the reset button,so
i check the script:
https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait

I found the these piece code read from console:



42https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L42
  echo Press the [$1] key and hit [enter]
$243https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L43
  # if we're on the console we wait for
input44https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L44
  { 
45https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L45
  while [ -r $keypress_wait ];
do46https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L46
  timer=$(cat
$keypress_sec)47https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L47
48https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L48
  [ -n $timer ] ||
timer=149https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L49
  timer=${timer%%\
*}50https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L50
  [ $timer -ge 1 ] ||
timer=151https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L51
  
do_failsafe=52https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L52
  
{53https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L53
  read -t $timer
do_failsafe54https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L54
  if [ $do_failsafe = $1 ];
then55https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L55
  echo true
$keypress_true56https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L56
  lock -u
$keypress_wait57https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L57
  rm -f
$keypress_wait58https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L58
  
fi59https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L59
  
}60https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/preinit/30_failsafe_wait#L60
  done
But which code is for the button?I know in this stage we have insmod the
gpio-button-hotplug module and run the hotplug2,but i can't see how it
trigger from kernel space to user space and enter the failsafe mode.

Any help are appreciated!


mips
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/8] mktplinkfw: add an option to generate 16MiB images

2012-07-23 Thread Andrew 'Necromant' Andrianov
Signed-off-by: Andrew 'Necromant' Andrianov and...@ncrmnt.org
---
 tools/firmware-utils/src/mktplinkfw.c |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/tools/firmware-utils/src/mktplinkfw.c 
b/tools/firmware-utils/src/mktplinkfw.c
index fab2081..75ce1d7 100644
--- a/tools/firmware-utils/src/mktplinkfw.c
+++ b/tools/firmware-utils/src/mktplinkfw.c
@@ -171,6 +171,19 @@ static struct flash_layout layouts[] = {
.kernel_la  = 0x8006,
.kernel_ep  = 0x8006,
.rootfs_ofs = 0x10,
+   },
+{
+   .id = 16M,
+   .fw_max_len = 0xf8,
+   .kernel_la  = 0x8006,
+   .kernel_ep  = 0x8006,
+   .rootfs_ofs = 0x14,
+   }, {
+   .id = 16Mlzma,
+   .fw_max_len = 0xf8,
+   .kernel_la  = 0x8006,
+   .kernel_ep  = 0x8006,
+   .rootfs_ofs = 0x10,
}, {
/* terminating entry */
}
-- 
1.7.6

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/8] ar71xx: add Mercury MW150R machtype and platform stuff

2012-07-23 Thread Andrew 'Necromant' Andrianov
Signed-off-by: Andrew 'Necromant' Andrianov and...@ncrmnt.org
---
 .../files/arch/mips/ath79/mach-mercury-mw150r.c|  119 
 .../610-MIPS-ath79-openwrt-machines.patch  |   49 ++---
 2 files changed, 154 insertions(+), 14 deletions(-)
 create mode 100644 
target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c
new file mode 100644
index 000..7ed2602
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c
@@ -0,0 +1,119 @@
+/*
+ *  Mercury MW150R board support
+ *
+ *  Copyright (C) 2012 Andrew 'Necromant' Andrianov and...@ncrmnt.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.
+ */
+
+#include asm/mach-ath79/ath79.h
+#include asm/mach-ath79/ar71xx_regs.h
+
+#include common.h
+#include dev-ap9x-pci.h
+#include dev-eth.h
+#include dev-gpio-buttons.h
+#include dev-leds-gpio.h
+#include dev-m25p80.h
+#include machtypes.h
+
+#define MW150R_GPIO_LED_GEAR   27
+#define MW150R_GPIO_LED_WLAN   0
+#define MW150R_GPIO_LED_LOCK   26
+#define MW150R_GPIO_LED_LAN1   13
+#define MW150R_GPIO_LED_LAN2   14
+#define MW150R_GPIO_LED_LAN3   15
+#define MW150R_GPIO_LED_LAN4   16
+#define MW150R_GPIO_LED_WAN17
+
+#define MW150R_GPIO_BTN_RESET  11
+
+#define MW150R_KEYS_POLL_INTERVAL  20  /* msecs */
+#define MW150R_KEYS_DEBOUNCE_INTERVAL (3 * MW150R_KEYS_POLL_INTERVAL)
+
+static const char *mw150r_part_probes[] = {
+   tp-link,
+   NULL,
+};
+
+static struct flash_platform_data mw150r_flash_data = {
+   .part_probes= mw150r_part_probes,
+};
+
+static struct gpio_led mw150r_leds_gpio[] __initdata = {
+   {
+   .name   = mercury:green:lan1,
+   .gpio   = MW150R_GPIO_LED_LAN1,
+   }, {
+   .name   = mercury:green:lan2,
+   .gpio   = MW150R_GPIO_LED_LAN2,
+   }, {
+   .name   = mercury:green:lan3,
+   .gpio   = MW150R_GPIO_LED_LAN3,
+   }, {
+   .name   = mercury:green:lan4,
+   .gpio   = MW150R_GPIO_LED_LAN4,
+   }, {
+   .name   = mercury:green:gear,
+   .gpio   = MW150R_GPIO_LED_GEAR,
+   .active_low = 1,
+   }, {
+   .name   = mercury:green:lock,
+   .gpio   = MW150R_GPIO_LED_LOCK,
+   }, {
+   .name   = mercury:green:wan,
+   .gpio   = MW150R_GPIO_LED_WAN,
+   }, {
+   .name   = mercury:green:wlan,
+   .gpio   = MW150R_GPIO_LED_WLAN,
+   },
+};
+
+static struct gpio_keys_button mw150r_gpio_keys[] __initdata = {
+   {
+   .desc   = reset,
+   .type   = EV_KEY,
+   .code   = KEY_RESTART,
+   .debounce_interval = MW150R_KEYS_DEBOUNCE_INTERVAL,
+   .gpio   = MW150R_GPIO_BTN_RESET,
+   }
+};
+
+static void __init mw150r_setup(void)
+{
+   u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+   u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+   ath79_register_m25p80(mw150r_flash_data);
+
+   ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+   AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+   AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+   AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+   AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+   ath79_register_leds_gpio(-1, ARRAY_SIZE(mw150r_leds_gpio),
+mw150r_leds_gpio);
+
+   ath79_register_gpio_keys_polled(-1, MW150R_KEYS_POLL_INTERVAL,
+   ARRAY_SIZE(mw150r_gpio_keys),
+   mw150r_gpio_keys);
+
+   ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
+   ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
+
+   ath79_register_mdio(0, 0x0);
+
+   /* LAN ports */
+   ath79_register_eth(1);
+
+   /* WAN port */
+   ath79_register_eth(0);
+
+   ap9x_pci_setup_wmac_led_pin(0, 1);
+   ap91_pci_init(ee, mac);
+}
+MIPS_MACHINE(ATH79_MACH_MERCURY_MW150R, MERCURY-MW150R, Mercury MW150R,
+mw150r_setup);
diff --git 
a/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch 
b/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch
index f0727ad..e8f8196 100644
--- a/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch
@@ -1,6 +1,8 @@
 

[OpenWrt-Devel] [PATCH 3/8] ar71xx: properly add Mercury MW150R to platform and sysupgrade scripts

2012-07-23 Thread Andrew 'Necromant' Andrianov
Signed-off-by: Andrew 'Necromant' Andrianov and...@ncrmnt.org
---
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |3 +++
 .../ar71xx/base-files/lib/upgrade/platform.sh  |3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 4d21caf..95a5085 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -396,6 +396,9 @@ ar71xx_board_detect() {
*EmbWir-Dorin)
name=ew-dorin
;;
+   *Mercury MW150R)
+name=mercury-mw150r
+   ;;
esac
 
case $machine in
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 5e5a54f..db6ff92 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -146,7 +146,8 @@ platform_check_image() {
tl-wr941nd | \
tl-wr1041n-v2 | \
tl-wr1043nd | \
-   tl-wr2543n)
+   tl-wr2543n | \
+   mercury-mw150r)
[ $magic != 0100 ]  {
echo Invalid image type.
return 1
-- 
1.7.6

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 4/8] ar71xx: Add Mercury MW150R stuff to image Makefile

2012-07-23 Thread Andrew 'Necromant' Andrianov
This adds options for 4 8 and 16Mib (hacked) versions of
the firmware. 16MiB version relies on the previous patch
to mktplinkfw.

Signed-off-by: Andrew 'Necromant' Andrianov and...@ncrmnt.org
---
 target/linux/ar71xx/image/Makefile |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/target/linux/ar71xx/image/Makefile 
b/target/linux/ar71xx/image/Makefile
index 6c2581d..6039f2b 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -948,6 +948,14 @@ define Image/Build/Profile/TLWR743
$(call 
Image/Build/Template/$(fs_64kraw)/$(1),TPLINK,tl-wr743nd-v1,$(tlwr741_cmdline),0x07430001,1,4M)
 endef
 
+mw150r_cmdline=board=MERCURY-MW150R console=ttyATH0,115200
+# Hacked Mercury MW150R with u-boot from WR703N, flash sizes: 16 8 and 4 Mibs
+define Image/Build/Profile/MW150R
+   $(call 
Image/Build/Template/$(fs_64kraw)/$(1),TPLINK-LZMA,mecury-mw150r-16m,$(mw150r_cmdline),0x07030101,1,16Mlzma)
+   $(call 
Image/Build/Template/$(fs_64kraw)/$(1),TPLINK-LZMA,mecury-mw150r-8m,$(mw150r_cmdline),0x07030101,1,8Mlzma)
   
+   $(call 
Image/Build/Template/$(fs_64kraw)/$(1),TPLINK-LZMA,mecury-mw150r-4m,$(mw150r_cmdline),0x07030101,1,4Mlzma)
   
+endef
+
 tlwr841v15_cmdline=board=TL-WR841N-v1.5 console=ttyS0,115200
 tlwr841v3_cmdline=board=TL-WR941ND console=ttyS0,115200
 tlwr841v5_cmdline=board=TL-WR741ND console=ttyS0,115200
@@ -1140,6 +1148,7 @@ define Image/Build/Profile/Default
$(call Image/Build/Profile/WZRHPG450H,$(1))
$(call Image/Build/Profile/ZCN1523H28,$(1))
$(call Image/Build/Profile/ZCN1523H516,$(1))
+   $(call Image/Build/Profile/MW150R,$(1))
 endef
 
 define Image/Build/Profile/Minimal
-- 
1.7.6

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 5/8] ar71xx: Add default led definitions for Mercury MW150R

2012-07-23 Thread Andrew 'Necromant' Andrianov
Signed-off-by: Andrew 'Necromant' Andrianov and...@ncrmnt.org
---
 .../linux/ar71xx/base-files/etc/uci-defaults/leds  |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/leds 
b/target/linux/ar71xx/base-files/etc/uci-defaults/leds
index e32d33d..69201ae 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/leds
@@ -40,6 +40,15 @@ dir-615-e4)
ucidef_set_led_switch lan4 LAN4 d-link:green:lan4 switch0 0x10
;;
 
+mercury-mw150r)
+   ucidef_set_led_netdev wan WAN mercury:green:wan eth1
+   ucidef_set_led_switch lan1 LAN1 mercury:green:lan1 switch0 
0x02
+   ucidef_set_led_switch lan2 LAN2 mercury:green:lan2 switch0 
0x04
+   ucidef_set_led_switch lan3 LAN3 mercury:green:lan3 switch0 
0x08
+   ucidef_set_led_switch lan4 LAN4 mercury:green:lan4 switch0 
0x10
+   ucidef_set_led_wlan wlan WLAN mercury:green:wlan phy0tpt
+   ;;
+
 dir-825-b1)
ucidef_set_led_usbdev usb USB d-link:blue:usb 1-1
;;
-- 
1.7.6

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 6/8] ar71xx: Add Mercury MW150R board Profile

2012-07-23 Thread Andrew 'Necromant' Andrianov
Signed-off-by: Andrew 'Necromant' Andrianov and...@ncrmnt.org
---
 target/linux/ar71xx/generic/profiles/mercury.mk |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)
 create mode 100644 target/linux/ar71xx/generic/profiles/mercury.mk

diff --git a/target/linux/ar71xx/generic/profiles/mercury.mk 
b/target/linux/ar71xx/generic/profiles/mercury.mk
new file mode 100644
index 000..9474d36
--- /dev/null
+++ b/target/linux/ar71xx/generic/profiles/mercury.mk
@@ -0,0 +1,15 @@
+#
+# Copyright (C) 2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/MW150R
+NAME:=Mercury MW150R
+PACKAGES:=kmod-usb-core kmod-usb2
+endef
+define Profile/MW150R/Description
+Package set optimized for the Mercury MW150R.
+endef
+$(eval $(call Profile,MW150R))
-- 
1.7.6

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 7/8] ar71xx: Enable Mercury MW150R machine in kernel config

2012-07-23 Thread Andrew 'Necromant' Andrianov
Signed-off-by: Andrew 'Necromant' Andrianov and...@ncrmnt.org
---
 target/linux/ar71xx/config-3.3 |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/target/linux/ar71xx/config-3.3 b/target/linux/ar71xx/config-3.3
index ebb0553..c17bc3d 100644
--- a/target/linux/ar71xx/config-3.3
+++ b/target/linux/ar71xx/config-3.3
@@ -37,6 +37,7 @@ CONFIG_ATH79_MACH_EW_DORIN=y
 CONFIG_ATH79_MACH_HORNET_UB=y
 CONFIG_ATH79_MACH_JA76PF=y
 CONFIG_ATH79_MACH_JWAP003=y
+CONFIG_ATH79_MACH_MERCURY_MW150R=y
 CONFIG_ATH79_MACH_MZK_W04NU=y
 CONFIG_ATH79_MACH_MZK_W300NH=y
 CONFIG_ATH79_MACH_NBG460N=y
-- 
1.7.6

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 8/8] ar71xx: Set WAN led to be active_low as it is on Mercury MW150R

2012-07-23 Thread Andrew 'Necromant' Andrianov
Signed-off-by: Andrew 'Necromant' Andrianov and...@ncrmnt.org
---
 .../files/arch/mips/ath79/mach-mercury-mw150r.c|1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c
index 7ed2602..73a5473 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mercury-mw150r.c
@@ -65,6 +65,7 @@ static struct gpio_led mw150r_leds_gpio[] __initdata = {
}, {
.name   = mercury:green:wan,
.gpio   = MW150R_GPIO_LED_WAN,
+   .active_low = 1,
}, {
.name   = mercury:green:wlan,
.gpio   = MW150R_GPIO_LED_WLAN,
-- 
1.7.6

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [ar71xx] Mercury MW150R board support

2012-07-23 Thread Andrew 'Necromant' Andrianov
Mercury MW150R is sold for ~20$ in several flavors, sometimes locally-rebranded.
Some of the flavors can run OpenWRT. Some (from taobao) even have OpenWRT
preinstalled. They come with flash ranging from 2MiB to 8MiB. The worst case
are the routers that have only 2MiB flash and 8MiB DDR RAM shipped with VxWorks
preinstalled.
These worst-case boards can only run OpenWRT after a DDR and flash upgrade.
This patchset was tested against one of those (worst-case boards) I got.
All the proper leds, buttons and sysupgrade tweaks inside.
My resulting hardware upgrade was:
8MiB DDR RAM - 64 MiB DDR RAM
2MiB SPI Flash - 16MiB SPI Flash
I used uboot dumped from WR703N, which is a dirty hack at the moment.
I will be adding detailed hardware upgrade instructions to the OpenWRT wiki
shortly.

 .../linux/ar71xx/base-files/etc/uci-defaults/leds  |9 ++
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |3 +-
 target/linux/ar71xx/config-3.3 |1 +
 .../files/arch/mips/ath79/mach-mercury-mw150r.c|  119 
 target/linux/ar71xx/generic/profiles/mercury.mk|   15 +++
 target/linux/ar71xx/image/Makefile |9 ++
 .../610-MIPS-ath79-openwrt-machines.patch  |   49 ++---
 tools/firmware-utils/src/mktplinkfw.c  |   13 ++
 9 files changed, 206 insertions(+), 15 deletions(-)

Regards,
Andrew


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v3] make vtun more configurable

2012-07-23 Thread Andreas Bräu
added possibility to disable lzo compression and encryption to save ram.Signed-off-by: Andreas Braeu ab atandi95.de---

vtun.patch
Description: Binary data
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH][BCM63XX] Add 96328A-1441N1 board support.

2012-07-23 Thread Álvaro Fernández Rojas
Add 96328A-1441N1 board support (wlan BCM43225).
Flash size is 16M.

Signed-off-by: Álvaro Fernández Rojas nolt...@gmail.com

Index: target/linux/brcm63xx/image/Makefile
===
--- target/linux/brcm63xx/image/Makefile(revisión: 32704)
+++ target/linux/brcm63xx/image/Makefile(copia de trabajo)
@@ -152,6 +152,7 @@ 
$(call 
Image/Build/CFE,$(1),963281TAN,6328,963481TAN-8M-flash-generic,,--pad 4)
$(call 
Image/Build/CFE,$(1),963281TAN,6328,963481TAN-16M-flash-generic,,--pad 8)
$(call Image/Build/CFE,$(1),963281T_TEF,6328,963281T_TEF-generic,,--pad 
8)
+   $(call 
Image/Build/CFE,$(1),96328A-1441N1,6328,96328A-1441N1-generic,,--pad 8)
$(call Image/Build/CFE,$(1),96345GW2,6345,96345GW2-generic)
$(call Image/Build/CFE,$(1),96345GW2,6345,96348GW2-bc221,,--layoutver 5)
$(call 
Image/Build/CFE,$(1),96345GW2,6345,92345GW2-rev,OpenWRT-$(REVISION))
Index: target/linux/brcm63xx/patches-3.3/903-board_96328A-1441N1.patch
===
--- target/linux/brcm63xx/patches-3.3/903-board_96328A-1441N1.patch 
(revisión: 0)
+++ target/linux/brcm63xx/patches-3.3/903-board_96328A-1441N1.patch 
(revisión: 0)
@@ -0,0 +1,89 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -419,6 +419,78 @@ static struct board_info __initdata boar
+   },
+   },
+ };
++
++static struct board_info __initdata board_96328A_1441N1 = {
++  .name   = 96328A-1441N1,
++  .expected_cpu_id= 0x6328,
++
++  .has_uart0  = 1,
++  .has_pci= 1,
++  .has_ohci0  = 1,
++  .has_ehci0  = 1,
++  .has_enetsw = 1,
++
++  .enetsw = {
++  .used_ports = {
++  [0] = {
++  .used   = 1,
++  .phy_id = 1,
++  .name   = Port 1,
++  },
++  [1] = {
++  .used   = 1,
++  .phy_id = 2,
++  .name   = Port 2,
++  },
++  [2] = {
++  .used   = 1,
++  .phy_id = 3,
++  .name   = Port 3,
++  },
++  [3] = {
++  .used   = 1,
++  .phy_id = 4,
++  .name   = Port 4,
++  },
++  },
++  },
++
++  .leds = {
++  {
++  .name   = 96328A-1441N1:green:power,
++  .gpio   = 8,
++  .default_trigger = default-on,
++  },
++  {
++  .name   = 96328A-1441N1:red:power,
++  .gpio   = 4,
++  },
++  {
++  .name   = 96328A-1441N1:green:inet,
++  .gpio   = 7,
++  },
++  {
++  .name   = 96328A-1441N1:red:inet,
++  .gpio   = 1,
++  },
++  {
++  .name   = 96328A-1441N1:green:dsl,
++  .gpio   = 11,
++  .active_low = 1,
++  },
++  },
++
++  .buttons = {
++  {
++  .desc   = reset,
++  .gpio   = 23,
++  .active_low = 1,
++  .type   = EV_KEY,
++  .code   = KEY_RESTART,
++  .debounce_interval = BCM963XX_KEYS_DEBOUNCE_INTERVAL,
++  },
++  },
++};
+ #endif
+ 
+ /*
+@@ -2698,6 +2770,7 @@ static const struct board_info __initdat
+   board_963281TAN,
+   board_dsl_274xb_f1,
+   board_963281T_TEF,
++  board_96328A_1441N1,
+ #endif
+ #ifdef CONFIG_BCM63XX_CPU_6338
+   board_96338gw,
Index: target/linux/brcm63xx/base-files/etc/uci-defaults/brcm63xx_fixcrc.sh
===
--- target/linux/brcm63xx/base-files/etc/uci-defaults/brcm63xx_fixcrc.sh
(revisión: 32704)
+++ target/linux/brcm63xx/base-files/etc/uci-defaults/brcm63xx_fixcrc.sh
(copia de trabajo)
@@ -16,6 +16,7 @@ 
 case $board_name in
963281TAN |\
963281T_TEF |\
+   96328A-1441N1 |\
CPVA502+ |\
AW4339U |\
CPVA642 |\
Index: target/linux/brcm63xx/base-files/etc/uci-defaults/network
===
--- 

[OpenWrt-Devel] [PATCH v3][BCM63XX] Add BCMA SPROM support.

2012-07-23 Thread Álvaro Fernández Rojas
Enable BCMA on BCM63XX.
Switch BCMA fallback SPROM depending on bus chip id.
Fallback SPROMs supported: 4313, 4331, 6362, 43224, 43225, 43227, 43228 and 
43428.

Signed-off-by: Álvaro Fernández Rojas nolt...@gmail.com

Index: target/linux/brcm63xx/config-3.3
===
--- target/linux/brcm63xx/config-3.3(revisión: 32793)
+++ target/linux/brcm63xx/config-3.3(copia de trabajo)
@@ -15,6 +15,12 @@
 CONFIG_BCM63XX_ENET=y
 CONFIG_BCM63XX_PHY=y
 CONFIG_BCM63XX_WDT=y
+CONFIG_BCMA=y
+CONFIG_BCMA_DEBUG=y
+CONFIG_BCMA_DRIVER_MIPS=y
+CONFIG_BCMA_DRIVER_PCI_HOSTMODE=y
+CONFIG_BCMA_HOST_PCI=y
+CONFIG_BCMA_HOST_PCI_POSSIBLE=y
 CONFIG_BCMA_POSSIBLE=y
 CONFIG_BOARD_BCM963XX=y
 # CONFIG_BOARD_LIVEBOX is not set
Index: target/linux/brcm63xx/patches-3.3/901-bcm63xx_bcma_sprom.patch
===
--- target/linux/brcm63xx/patches-3.3/901-bcm63xx_bcma_sprom.patch  
(revisión: 0)
+++ target/linux/brcm63xx/patches-3.3/901-bcm63xx_bcma_sprom.patch  
(revisión: 0)
@@ -0,0 +1,758 @@
+--- /dev/null
 b/arch/mips/bcm63xx/bcma.c
+@@ -0,0 +1,65 @@
++/*
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License.  See the file COPYING in the main directory of this archive
++ * for more details.
++ *
++ * Copyright (C) 2012 Álvaro Fernández Rojas nolt...@gmail.com
++ */
++
++#include linux/if_ether.h
++
++#include bcm63xx_bcma.h
++#include bcm63xx_bcma_sproms.h
++#include bcm63xx_nvram.h
++
++int bcm63xx_get_bcma_fallback_sprom(struct bcma_bus *bus, struct ssb_sprom 
*out)
++{
++  if (bus-hosttype == BCMA_HOSTTYPE_PCI) {
++  //Copy SPROM params.
++  switch(bus-chipinfo.id) {
++  case BCMA_CHIP_ID_BCM4313:
++  memcpy(out, bcm4313_sprom, sizeof(struct 
ssb_sprom));
++  break;
++  case BCMA_CHIP_ID_BCM4331:
++  memcpy(out, bcm4331_sprom, sizeof(struct 
ssb_sprom));
++  break;
++  case BCMA_CHIP_ID_BCM6362:
++  memcpy(out, bcm6362_sprom, sizeof(struct 
ssb_sprom));
++  break;
++  case BCMA_CHIP_ID_BCM43224:
++  memcpy(out, bcm43224_sprom, sizeof(struct 
ssb_sprom));
++  break;
++  case BCMA_CHIP_ID_BCM43225:
++  memcpy(out, bcm43225_sprom, sizeof(struct 
ssb_sprom));
++  break;
++  case BCMA_CHIP_ID_BCM43227:
++  memcpy(out, bcm43227_sprom, sizeof(struct 
ssb_sprom));
++  break;
++  case BCMA_CHIP_ID_BCM43228:
++  memcpy(out, bcm43228_sprom, sizeof(struct 
ssb_sprom));
++  break;
++  case BCMA_CHIP_ID_BCM43428:
++  memcpy(out, bcm43428_sprom, sizeof(struct 
ssb_sprom));
++  break;
++  default:
++  printk(bcm63xx_bcma: unable to fill BCMA 
fallback SPROM for chip id 0x%x\n, bus-chipinfo.id);
++  return -EINVAL;
++  }
++
++  printk(bcm63xx_bcma: filled BCMA SPROM for chip id 0x%x\n, 
bus-chipinfo.id);
++
++  //Get MAC address.
++  if(bcm63xx_nvram_get_mac_address(out-il0mac)) {
++  printk(bcm63xx_bcma: failed to get bcm63xx_nvram mac 
address\n);
++  return -EINVAL;
++  }
++  memcpy(out-et0mac, out-il0mac, ETH_ALEN);
++  memcpy(out-et1mac, out-il0mac, ETH_ALEN);
++
++  return 0;
++  }
++  else {
++  printk(bcm63xx_bcma: unable to fill BCMA fallback SPROM for 
given hosttype\n);
++  return -EINVAL;
++  }
++}
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -19,6 +19,7 @@
+ #include linux/spi/spi_gpio.h
+ #include linux/spi/74x164.h
+ #include asm/addrspace.h
++#include bcm63xx_bcma.h
+ #include bcm63xx_board.h
+ #include bcm63xx_cpu.h
+ #include bcm63xx_dev_uart.h
+@@ -2934,6 +2935,14 @@ int __init board_register_devices(void)
+   pr_err(PFX failed to register fallback SPROM\n);
+   }
+ #endif
++
++#ifdef CONFIG_BCMA_HOST_PCI
++  if (!board.has_caldata) {
++  if 
(bcma_arch_register_fallback_sprom(bcm63xx_get_bcma_fallback_sprom)  0)
++  pr_err(PFX failed to register BCMA fallback SPROM\n);
++  }
++#endif
++
+   bcm63xx_hsspi_register();
+ 
+   bcm63xx_spi_register();
+--- a/arch/mips/bcm63xx/Makefile
 b/arch/mips/bcm63xx/Makefile
+@@ -1,7 +1,7 @@
+ obj-y += clk.o cpu.o cs.o gpio.o 

[OpenWrt-Devel] [PATCH v3][BCM63XX] Add 963281T_TEF board support.

2012-07-23 Thread Álvaro Fernández Rojas
Add 963281T_TEF board support (wlan BCM43225).
Flash size is 16M.

Signed-off-by: Álvaro Fernández Rojas nolt...@gmail.com

Index: target/linux/brcm63xx/image/Makefile
===
--- target/linux/brcm63xx/image/Makefile(revisión: 32704)
+++ target/linux/brcm63xx/image/Makefile(copia de trabajo)
@@ -151,6 +151,7 @@ 
$(call 
Image/Build/CFE,$(1),963281TAN,6328,963481TAN-4M-flash-generic,,--pad 2)
$(call 
Image/Build/CFE,$(1),963281TAN,6328,963481TAN-8M-flash-generic,,--pad 4)
$(call 
Image/Build/CFE,$(1),963281TAN,6328,963481TAN-16M-flash-generic,,--pad 8)
+   $(call Image/Build/CFE,$(1),963281T_TEF,6328,963281T_TEF-generic,,--pad 
8)
$(call Image/Build/CFE,$(1),96345GW2,6345,96345GW2-generic)
$(call Image/Build/CFE,$(1),96345GW2,6345,96348GW2-bc221,,--layoutver 5)
$(call 
Image/Build/CFE,$(1),96345GW2,6345,92345GW2-rev,OpenWRT-$(REVISION))
Index: target/linux/brcm63xx/patches-3.3/902-board-963281T_TEF.patch
===
--- target/linux/brcm63xx/patches-3.3/902-board-963281T_TEF.patch   
(revisión: 0)
+++ target/linux/brcm63xx/patches-3.3/902-board-963281T_TEF.patch   
(revisión: 0)
@@ -0,0 +1,136 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -300,6 +300,125 @@ static struct board_info __initdata boar
+   },
+   },
+ };
++
++static struct board_info __initdata board_963281T_TEF = {
++  .name   = 963281T_TEF,
++  .expected_cpu_id= 0x6328,
++
++  .has_uart0  = 1,
++  .has_pci= 1,
++  .has_ohci0  = 1,
++  .has_ehci0  = 1,
++  .has_enetsw = 1,
++
++  .enetsw = {
++  .used_ports = {
++  [0] = {
++  .used   = 1,
++  .phy_id = 1,
++  .name   = Port 1,
++  },
++  [1] = {
++  .used   = 1,
++  .phy_id = 2,
++  .name   = Port 2,
++  },
++  [2] = {
++  .used   = 1,
++  .phy_id = 3,
++  .name   = Port 3,
++  },
++  [3] = {
++  .used   = 1,
++  .phy_id = 4,
++  .name   = Port 4,
++  },
++  },
++  },
++
++  .leds = {
++  {
++  .name   = 963281T_TEF:green:power,
++  .gpio   = 4,
++  .active_low = 1,
++  .default_trigger = default-on,
++  },
++  {
++  .name   = 963281T_TEF:red:power,
++  .gpio   = 8,
++  .active_low = 1,
++  },
++  {
++  .name   = 963281T_TEF:green:inet,
++  .gpio   = 11,
++  .active_low = 1,
++  },
++  {
++  .name   = 963281T_TEF:red:inet,
++  .gpio   = 2,
++  .active_low = 1,
++  },
++  {
++  .name   = 963281T_TEF:green:ppp,
++  .gpio   = 3,
++  .active_low = 1,
++  },
++  {
++  .name   = 963281T_TEF:red:ppp,
++  .gpio   = 5,
++  .active_low = 1,
++  },
++  {
++  .name   = 963281T_TEF:green:3g,
++  .gpio   = 6,
++  .active_low = 1,
++  },
++  {
++  .name   = 963281T_TEF:red:3g,
++  .gpio   = 7,
++  .active_low = 1,
++  },
++  {
++  .name   = 963281T_TEF:green:wlan,
++  .gpio   = 9,
++  .active_low = 1,
++  },
++  {
++  .name   = 963281T_TEF:red:wlan,
++  .gpio   = 10,
++  .active_low = 1,
++  },
++  {
++  .name   = 963281T_TEF:green:eth,
++  .gpio   = 31,
++  .active_low = 1,
++  },
++  {
++ 

Re: [OpenWrt-Devel] Patch formatting for new device support

2012-07-23 Thread LEO Airwarosu Yoichi Shinoda

Bump

Anyone?

--- shinoda

On 2012/07/15, at 14:36, LEO Airwarosu Yoichi Shinoda wrote:

 Hi.
 
 I've finished working on a support for Buffalo WLAE-AG300N,
 and was going to post a patch set.
 
 I noticed that machtype.h and Kconfig are not
 in the directory target/linux/ar71xx/files/arch/mips/ath79/
 any more, but provided as a patch
 (i.e. 610-MIPS-ath79-openwrt-machines.patch)
 in patches-3.3.
 
 Should I create patches for machtype.h and Kconfig,
 or should I create a patch for 610-MIPS-openwrt-machines.patch?
 
 --- shinoda
 
 
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Board dependent base-file files in the source tree?

2012-07-23 Thread LEO Airwarosu Yoichi Shinoda
Folks,

I also have a question regarding how to include a board dependent
base-file file in the source tree.

More specifically, the file is a hotplug script to get the wireless
led work on the buffalo's wlae-ag300n. The wireless led on this board
is not connected to the phy, but controlled independently by gpios.
The script sets up the ledtrig-netdev upon detection of an addition
of a wireless device on wlae-ag300n, and it is written so that it will
ignore other boards.

I wonder if there is a way to specify board-dependent base-file files
so that this script does not go into images for other boards, or
better yet, if there is a way to do this better.

FYI, the script follows.

#!/bin/sh
#
# Manipulate Buffalo WLAE-AG300N wireless led (green only)
#
# If the blinking led is annoying, set the ledmode to link

ledmode=link tx rx

# Check if the device is wireless first, to prevent ar71xx.sh
# from being read.

if [ -e /sys$DEVPATH/phy80211 ]; then

. /lib/ar71xx.sh

if [ `ar71xx_board_name` != wlae-ag300n ]; then
exit 0
fi

leddev=/sys/class/leds/buffalo\:green\:wireless

if [ $ACTION = add ]; then
echo netdev  $leddev/trigger
echo $DEVICENAME  $leddev/device_name
echo $ledmode  $leddev/mode
elif [ $ACTION = remove ]; then
echo none  $leddev/trigger
fi
fi

--- shinoda

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel