Hi Hauke,

thanks for picking this up!

Am Do, 13.12.2012, 20:45 schrieb Hauke Mehrtens:
> On 11/11/2012 09:38 PM, Mathias Adam wrote:
>> ping...
>> Am So, 14.10.2012, 21:13 schrieb Mathias Adam:
>>> This patch adds support for Huawei E970 wireless gateway devices. It
has been tested on an E970 labelled as T-Mobile web'n'walk Box IV.
E960/B970 should work too, from what I know it's basically the same
hardware.
>>> The device has a Broadcom BCM5354 SoC and a built-in 3G USB modem. For
reference, it has already been addressed in this open ticket:
<https://dev.openwrt.org/ticket/2711>
>>> The device has a hardware watchdog which needs GPIO-7 to be toggled at
least
>>> every 1-2 seconds. Therefore a timer is being setup early in the boot
process
>>> in order to take care of this  (see arch/mips/bcm47xx/time.c). Tested
and works:  3G wan,  wlan+LED,  VLAN config,  failsafe using reset
>>> button,   image to be used for upgrade from OEM firmware's web interface
>>> Link to the wiki page I've created:
>>> <http://wiki.openwrt.org/toh/huawei/e970>
>>> Issue:
>>> * lzma-loader crashes, so gzipped kernel is used. Presumably due to
watchdog
>>>   reset during kernel decompress.
>>> Signed-off-by: Mathias Adam <m.adam--open...@adamis.de>
>>> ---
>>> Changes from previous patch:
>>> * rebased to svn-rev. 33761
>>> * b43 wireless now works out of box (no changes were necessary on my
part)
>>> * modifications according to comments by Hauke Mehrtens on 2012-04-25
* header for factory update package now created using dd and echo, no
need
>>>   for binary header template file anymore
> I just had a closer look at the patch.
> I do not like the way how this is added, but if you just have 2 seconds
time to call the gpio I do not know a better way.
> How long do you have to send the ping on the gpio after the boot? Do you
have a log for me without this patch, so that I can see if there is a
better position for this code?

I'm not completely happy with this solution either. At least it's known to
be working stable so far (I have one of my E970 routers running for nearly
a year now without problems).

I think it doesn't have to be that early in the boot process as it is now.
Two reasons I remember:
1) when trying to get lzma-loader to work I wanted the GPIO toggle as
early as possible within the kernel. But as lzma-loader doesn't work yet
anyway I'd suggest to stay with gzipped kernel for the moment.
2) AFAIR the original firmware does it in a similar way (I'll look for a
download link as you asked later)


Here's a log snippet from my notes without the watchdog reset:

...
serial8250.0: ttyS0 at MMIO 0xb8000300 (irq = 3) is a U6_16550A
serial8250.0: ttyS1 at MMIO 0xb8000400 (irq = 3) is a U6_16550A
bcm47xx_pflash: flash init: 0x1c000000 0x02000000
Physically mapped flash: Found 1 x16 devices at 0x0 in 16-bit bank.
Manufacturer ID 0x000001 Chip ID 0x001a01
Amd/Fujitsu Extended Query Table at 0x0040
  Amd/Fujitsu Extended Query version 1.3.
Physically mapped flash: Swapping erase regions for top-boot CFI table.
number of CFI chips: 1
bcm47xx_pflash: Flash device: 0x2000000 at 0xbfc00000
bcm47xx_part: bootloader size: 262144
bcm47xx_part: Looking for dual image
bcm47xx_part: TRX offset : 0
bcm47xx_part: Updating TRX offsets and length:
bcm47xx_part: old trx = [0x0000001c, 0x0012cc00, 0x00000000],
len=0x002e1000 crc32=0x729db7c4
bcm47xx_part: new trx = [0x0000001c, 0x0012cc00, 0x00000000],
len=0x0012cc00 crc32=0x48f25a83


CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
Build Date: <C8><FD>  2<D4><C2> 13 14:50:54 CST 2008
(w114501@localhost.localdomain)
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.

Initializing Arena
Initializing Devices.
Boot partition size = 262144(0x40000)
et0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller
CFE reboot flag0 = 0x12345678, flag1 = 0x0,flag2 =
0xffffffff,reboot_number = 0x1
CPU type 0x29029: 240MHz
Total memory: 32768 KBytes
...


After that I found the first 64kiB behind CFE being erased, so I guess the
watchdog reset happened during updating the TRX header. As the flash write
usually takes a rather long time, in a second test I manually modified TRX
headers (len and crc) before the first boot so that the kernel doesn't
have to update them:

...
bcm47xx_pflash: Flash device: 0x2000000 at 0xbfc00000
bcm47xx_part: bootloader size: 262144
bcm47xx_part: Looking for dual image
bcm47xx_part: TRX offset : 0
4 bcm47xx partitions found on MTD device Physically mapped flash
Creating 4 MTD partitions on "Physically mapped flash":
0x000000000000-0x000000040000 : "cfe"
0x000000040000-0x0000003f0000 : "linux"
0x00000016cc00-0x0000003f0000 : "rootfs"
mtd: partition "rootfs" must either start or end on erase block boundary
or be smaller than an erase block -- forcing read-oy
mtd: partition "rootfs" set to be root filesystem
mtd: partition "rootfs_data" created automatically, ofs=2E0000, len=110000

0x0000002e0000-0x0000003f0000 : "rootfs_data"
0x0000003f0000-0x000000400000 : "nvram"
bcm47xx_sflash: error registering platform driver: -19
b44: b44.c:v2.0
b44 ssb0:0: eth0: Broadcom 44xx/47xx 10/100BaseT Ethernet
00:90:4c:c0:85:59
BCM47xx Watchdog Timer enabled (30 seconds, nowayout)
TCP westwood registered
NET: Registered protocol family 17
802.1Q VLAN Support v1.8
VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
Freeing unused kernel memory: 156k freed


CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
Build Date: &#65533;&#65533;  2&#65533;&#65533; 13 14:50:54 CST 2008
(w114501@localhost.localdomain)
...



The "BCM47xx Watchdog Timer" module might be a good position,
unfortunately it's being loaded after the flash driver, so this would be
too late in case the TRX headers have to be updated...
However I remember I first had it somewhere else while developing last
year. I'll go find my notes and get back then.


Mathias

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

Reply via email to