OpenWrt Forum Archive

Topic: AR7 Watchdog; a call for your BOOTCR values

The content of this topic has been archived between 22 Mar 2018 and 8 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi, I've been looking into why the watchdog on my DG834G(v2) has not been rebooting the unit after a kick timeout and I have a bug open at https://dev.openwrt.org/ticket/2378 . Seeing that this code has now gone into the mainline kernel, I was able to ask around on other channels as to what could be happening. I was told on #linuxmips that *some* AR7 devices have their watchdog disabled in hardware (via a resistor). I was also told that this status could be checked by looking at the BOOTCR register at 0xa8611a00. In the linux kernel, this corresponds to AR7_REGS_DCL and the clocks.c code actually makes use of this.

Ideally, one would want to modify  ar7_wdt_init() to check the status of that register and bail out if it's disabled in hardware, but the actually bit encoding of this register is under NDA. sad  One approach to reverse engineering this would be to carry a survey out of this value on openwrt users ar7 devices, and then look for some patterns. I have the following patch that will print this value:

Index: target/linux/ar7/files/arch/mips/ar7/clock.c
===================================================================
--- target/linux/ar7/files/arch/mips/ar7/clock.c        (revision 10156)
+++ target/linux/ar7/files/arch/mips/ar7/clock.c        (working copy)
@@ -257,6 +257,7 @@
 static void __init tnetd7300_init_clocks(void)
 {
        u32 *bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
+       printk("bootcr is %#x \n", *bootcr);
        struct tnetd7300_clocks *clocks =
                                        (struct tnetd7300_clocks *)
                                        ioremap_nocache(AR7_REGS_POWER + 0x20,

You may have to carry out a small modification if you have a 7100/7200. Mine, on a DG834G(v2), is 0x2594281 which is 10010110010100001010000001


It would be really good if some other ar7 peeps could chime in here with their bootcr values.

Hi nabcore,

On my DG834G(v1) bootcr is 0x2594281 as well, and the watchdog doesn't work either.

Do you have any idea which pin(s) might control whether this is enabled? I've got a couple of DG834Gs and wouldn't mind having a go at modding one if we could find out which pins to try?

Hope this helps,

Nick.

NRForbes wrote:

I'll get out my voltmeter tonight and see if I can find it :-)

Sounds like a plan, I was just taking an educated guess at which one it could be.

CPU revision is: 00018448
bootcr 7200 is 0x8291
Clocks: Sync 2:1 mode
Clocks: Setting CPU clock
Adjusted requested frequency 211000000 to 211968000
Clocks: base = 35328000, frequency = 211968000, prediv = 1, postdiv = 1, postdiv2 = -1, mul = 6
Clocks: Setting DSP clock
Clocks: base = 25000000, frequency = 105984000, prediv = 1, postdiv = 2, postdiv2 = 1, mul = 10
Clocks: Setting USB clock
Adjusted requested frequency 48000000 to 47863741
Clocks: base = 105984000, frequency = 48000000, prediv = 1, postdiv = 31, postdiv2 = -1, mul = 14
TI AR7 (TNETD7200), ID: 0x002b, Revision: 0x11

Why 7100 it is detect as 7200?

(Last edited by AndyI on 6 Feb 2008, 09:34)

CPU revision is: 00018448
Unbranded TNETD7300AGDW (5CZDF49): bootcr is 0x6514291
TI AR7 (TNETD7300), ID: 0x0005, Revision: 0x27

CPU revision is: 00018448
Unbranded TNETD7200ZDW (73ZFC49): bootcr is 0x8291
TI AR7 (TNETD7200), ID: 0x002b, Revision: 0x10

CPU revision is: 00018448
Unbranded TNETD7200ZDW (68Z5999): bootcr is 0x8291
TI AR7 (TNETD7200), ID: 0x002b, Revision: 0x11

AndyI wrote:

TI AR7 (TNETD7200), ID: 0x002b, Revision: 0x11

Why 7100 it is detect as 7200?

One of the boards I have is detected as ID: 0x002b, Revision: 0x11.  The chip has the following printed on it:
TNETD7200ZDW
68Z5999

I have no idea why a 7100 and a 7200 would have the same ID and Revision.

Thanks Wodin. Can you confirm if the watchdog works or not on those three models?

Wodin wrote:

CPU revision is: 00018448
Unbranded TNETD7300AGDW (5CZDF49): bootcr is 0x6514291
TI AR7 (TNETD7300), ID: 0x0005, Revision: 0x27

CPU revision is: 00018448
Unbranded TNETD7200ZDW (73ZFC49): bootcr is 0x8291
TI AR7 (TNETD7200), ID: 0x002b, Revision: 0x10

CPU revision is: 00018448
Unbranded TNETD7200ZDW (68Z5999): bootcr is 0x8291
TI AR7 (TNETD7200), ID: 0x002b, Revision: 0x11

AndyI wrote:

TI AR7 (TNETD7200), ID: 0x002b, Revision: 0x11

Why 7100 it is detect as 7200?

One of the boards I have is detected as ID: 0x002b, Revision: 0x11.  The chip has the following printed on it:
TNETD7200ZDW
68Z5999

I have no idea why a 7100 and a 7200 would have the same ID and Revision.

Ok!

nabcore wrote:

Thanks Wodin. Can you confirm if the watchdog works or not on those three models?

CPU revision is: 00018448
bootcr 7200 is 0x8291
TI AR7 (TNETD7200), ID: 0x002b, Revision: 0x11

watchdog work fine.

nabcore wrote:

Thanks Wodin. Can you confirm if the watchdog works or not on those three models?

I'll have to check tomorrow (if I get time.)  Do you know if watchdog support is compiled in by default?  I know on the 7300 I didn't have any trouble, but I don't know if the watchdog was actually working.

Then when I got hold of the 7200 with ID: 0x002b, Revision: 0x10, the board would reboot automatically soon after booting up.  I figured out it was the watchdog (even though the watchdog daemon was doing its thing), so I disabled it and haven't tried it again since then.

Unbranded TNETD7300AGDW (5CZDF49): bootcr is 0x6514291
TI AR7 (TNETD7300), ID: 0x0005, Revision: 0x27
r10405, kernel 2.6.23.1, gcc 3.4.6: watchdog works

Unbranded TNETD7200ZDW (73ZFC49): bootcr is 0x8291
TI AR7 (TNETD7200), ID: 0x002b, Revision: 0x10
r10405, kernel 2.6.23.1, gcc 3.4.6: watchdog works

Unbranded TNETD7200ZDW (68Z5999): bootcr is 0x8291
TI AR7 (TNETD7200), ID: 0x002b, Revision: 0x11
r10405, kernel 2.6.23.1, gcc 3.4.6: watchdog works

By the way, no need to start watchdog and kill it again.  This appears to work just as well:
echo >/dev/watchdog

EDIT: Of course, you would need to kill watchdog if it was automatically started on boot.  It was not when I tested.

The serial console says:
ar7_wdt: watchdog device closed unexpectedly,will not disable the watchdog timer

About a minute later the board reboots.

(Last edited by Wodin on 7 Feb 2008, 09:22)

So, from the above, this is what we have:

00000010 01011001 01000010 10000001    broken
00000000 00000000 10000010 10010001    works
00000110 01010001 01000010 10010001    works

The only bits that are the same for both of the two that work AND that are different in the broken one are bits 4 and 19.

i.e. bit 4 is set in both of the working ones, but unset in the broken one.
bit 19 is unset in both of the working ones, but set in the broken one.

Wodin wrote:

So, from the above, this is what we have:

00000010 01011001 01000010 10000001    broken
00000000 00000000 10000010 10010001    works
00000110 01010001 01000010 10010001    works

The only bits that are the same for both of the two that work AND that are different in the broken one are bits 4 and 19.

i.e. bit 4 is set in both of the working ones, but unset in the broken one.
bit 19 is unset in both of the working ones, but set in the broken one.

bit 4 change if resistor(watchdog enable/disable) install and remove

(Last edited by AndyI on 7 Feb 2008, 10:35)

AndyI wrote:

bit 4 change if resistor(watchdog enable/disable) install and remove

This sounds like what nabcore is looking for smile

How did you find the resistor?

Wodin wrote:
AndyI wrote:

bit 4 change if resistor(watchdog enable/disable) install and remove

This sounds like what nabcore is looking for smile

How did you find the resistor?

Search resistor connected with pin17 flash memory.

It is impossible to change this bit in programm?

(Last edited by AndyI on 7 Feb 2008, 14:49)

AndYI: Can you:

a) Take a photo of this resistor and put it up somewhere; indicate on the picture which resistor it is.

b) You say in the thread that the watchdog works on your unit (with a bootcr value of 0x8291 ), and altering the resistor changes the value of bit 4. Can you confirm that altering this resistor *actually* disables the watchdog.


At this moment, I'm looking at modifying ar7_wdt_init() in ar7_wdt.c in the following way:

#define WDT_HARDWARE_ENABLED 0x10
......
static int __init ar7_wdt_init(void)
{
    int rc;

    u32 *bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
    if !(*bootcr & WDT_HARDWARE_ENABLED){
        printk(KERN_WARNING DRVNAME ": watchdog disabled in hardware\n");
        return -EFAULT;
    }
.....

The above may have errors, but it's first attempt.

nabcore wrote:

AndYI: Can you:

a) Take a photo of this resistor and put it up somewhere; indicate on the picture which resistor it is.

b) You say in the thread that the watchdog works on your unit (with a bootcr value of 0x8291 ), and altering the resistor changes the value of bit 4. Can you confirm that altering this resistor *actually* disables the watchdog.


At this moment, I'm looking at modifying ar7_wdt_init() in ar7_wdt.c in the following way:

#define WDT_HARDWARE_ENABLED 0x10
......
static int __init ar7_wdt_init(void)
{
    int rc;

    u32 *bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
    if !(*bootcr & WDT_HARDWARE_ENABLED){
        printk(KERN_WARNING DRVNAME ": watchdog disabled in hardware\n");
        return -EFAULT;
    }
.....

The above may have errors, but it's first attempt.

Look picture http://wiki.openwrt.org/OpenWrtDocs/Hardware/ADLS2110HR

root@(none):/# /sbin/watchdog -t 5 /dev/watchdog
root@(none):/# date
Sat Jan  1 00:00:38 UTC 2000
root@(none):/# killall watchdog
ar7_wdt: watchdog device closed unexpectedly,will not disable the watchdog timer
root@(none):/# date
Sat Jan  1 00:13:53 UTC 2000
root@(none):/#

(Last edited by AndyI on 7 Feb 2008, 16:44)

Ok, cool. Looks as if we may have identified the correct bit, but I still do not know which resistor you are referring to. That picture you link to has no indication on it and I don't know what you mean by "Search resistor connected with pin17 flash memory." Perhaps, you could describe its location on that picture in the the form: bottom left, marked with "R142"?

Also, out of interest, what was nature of your testing? Did you short the resistor or did you solder it off the board?

nabcore wrote:

Ok, cool. Looks as if we may have identified the correct bit, but I still do not know which resistor you are referring to. That picture you link to has no indication on it and I don't know what you mean by "Search resistor connected with pin17 flash memory." Perhaps, you could describe its location on that picture in the the form: bottom left, marked with "R142"?

Also, out of interest, what was nature of your testing? Did you short the resistor or did you solder it off the board?

All resistor on board are marked as Rxxx.
On its surface usually there is a marks 472=4,7Kom.
For example R44, RP3, RP6.
Please write is easier I understand hardly!

My board dont have this resistor. I added it.

AndyI wrote:

My board dont have this resistor. I added it.

Ok, where did you add it and what was the resistor's resistance.