diff options
author | hauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-11-24 20:07:25 +0000 |
---|---|---|
committer | hauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-11-24 20:07:25 +0000 |
commit | 9a462204d13bd8acd735f8111dc7f9412e812b33 (patch) | |
tree | 90fc287e9ed841c2ec2972694366a16375b511fd /target/linux/brcm47xx/patches-3.6/546-bcma-set-the-pmu-watchdog-if-available.patch | |
parent | 0b36fa881c11ebe7deae587bd6cae851d70f7477 (diff) |
brcm47xx: update watchdog driver
This watchdog driver should work with SoC having a PMU.
This fixes #11720.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34323 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm47xx/patches-3.6/546-bcma-set-the-pmu-watchdog-if-available.patch')
-rw-r--r-- | target/linux/brcm47xx/patches-3.6/546-bcma-set-the-pmu-watchdog-if-available.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/target/linux/brcm47xx/patches-3.6/546-bcma-set-the-pmu-watchdog-if-available.patch b/target/linux/brcm47xx/patches-3.6/546-bcma-set-the-pmu-watchdog-if-available.patch new file mode 100644 index 000000000..651415eb9 --- /dev/null +++ b/target/linux/brcm47xx/patches-3.6/546-bcma-set-the-pmu-watchdog-if-available.patch @@ -0,0 +1,57 @@ +--- a/drivers/bcma/driver_chipcommon.c ++++ b/drivers/bcma/driver_chipcommon.c +@@ -31,6 +31,28 @@ static u32 bcma_chipco_alp_clock(struct + return 20000000; + } + ++static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc) ++{ ++ struct bcma_bus *bus = cc->core->bus; ++ u32 nb; ++ ++ if (cc->capabilities & BCMA_CC_CAP_PMU) { ++ if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) ++ nb = 32; ++ else if (cc->core->id.rev < 26) ++ nb = 16; ++ else ++ nb = (cc->core->id.rev >= 37) ? 32 : 24; ++ } else { ++ nb = 28; ++ } ++ if (nb == 32) ++ return 0xffffffff; ++ else ++ return (1 << nb) - 1; ++} ++ ++ + void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) + { + if (cc->early_setup_done) +@@ -87,8 +109,23 @@ void bcma_core_chipcommon_init(struct bc + /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ + void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) + { +- /* instant NMI */ +- bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks); ++ u32 maxt; ++ enum bcma_clkmode clkmode; ++ ++ maxt = bcma_chipco_watchdog_get_max_timer(cc); ++ if (cc->capabilities & BCMA_CC_CAP_PMU) { ++ if (ticks == 1) ++ ticks = 2; ++ else if (ticks > maxt) ++ ticks = maxt; ++ bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); ++ } else { ++ clkmode = ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC; ++ bcma_core_set_clockmode(cc->core, clkmode); ++ if (ticks > maxt) ++ ticks = maxt; ++ bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks); ++ } + } + + void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value) |