diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2012-12-05 12:46:00 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-12-06 14:58:56 -0500 |
commit | f6354c8cf9a3be15de441fad593ce53e63e9bf2a (patch) | |
tree | f104ed39606c8ae9e15cb1374f2381efd3f88cc7 /drivers/bcma | |
parent | 56fd5f077223df1284a3501d1e3ba2e5b19d154a (diff) |
bcma: set the pmu watchdog if available
Mostly all bcma based devices have a PMU and the PMU watchdog should be
used and not the old one in chip common. This patch also calculates the
maximal number the watchdog could be set to.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma')
-rw-r--r-- | drivers/bcma/driver_chipcommon.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c index ef6855398b86..7c132e5eceb0 100644 --- a/drivers/bcma/driver_chipcommon.c +++ b/drivers/bcma/driver_chipcommon.c | |||
@@ -31,6 +31,28 @@ static u32 bcma_chipco_alp_clock(struct bcma_drv_cc *cc) | |||
31 | return 20000000; | 31 | return 20000000; |
32 | } | 32 | } |
33 | 33 | ||
34 | static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc) | ||
35 | { | ||
36 | struct bcma_bus *bus = cc->core->bus; | ||
37 | u32 nb; | ||
38 | |||
39 | if (cc->capabilities & BCMA_CC_CAP_PMU) { | ||
40 | if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) | ||
41 | nb = 32; | ||
42 | else if (cc->core->id.rev < 26) | ||
43 | nb = 16; | ||
44 | else | ||
45 | nb = (cc->core->id.rev >= 37) ? 32 : 24; | ||
46 | } else { | ||
47 | nb = 28; | ||
48 | } | ||
49 | if (nb == 32) | ||
50 | return 0xffffffff; | ||
51 | else | ||
52 | return (1 << nb) - 1; | ||
53 | } | ||
54 | |||
55 | |||
34 | void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) | 56 | void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) |
35 | { | 57 | { |
36 | if (cc->early_setup_done) | 58 | if (cc->early_setup_done) |
@@ -85,8 +107,24 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) | |||
85 | /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ | 107 | /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ |
86 | void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) | 108 | void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) |
87 | { | 109 | { |
88 | /* instant NMI */ | 110 | u32 maxt; |
89 | bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks); | 111 | enum bcma_clkmode clkmode; |
112 | |||
113 | maxt = bcma_chipco_watchdog_get_max_timer(cc); | ||
114 | if (cc->capabilities & BCMA_CC_CAP_PMU) { | ||
115 | if (ticks == 1) | ||
116 | ticks = 2; | ||
117 | else if (ticks > maxt) | ||
118 | ticks = maxt; | ||
119 | bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks); | ||
120 | } else { | ||
121 | clkmode = ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC; | ||
122 | bcma_core_set_clockmode(cc->core, clkmode); | ||
123 | if (ticks > maxt) | ||
124 | ticks = maxt; | ||
125 | /* instant NMI */ | ||
126 | bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks); | ||
127 | } | ||
90 | } | 128 | } |
91 | 129 | ||
92 | void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value) | 130 | void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value) |