aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma/driver_chipcommon.c
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2012-12-05 12:46:00 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-12-06 14:58:56 -0500
commitf6354c8cf9a3be15de441fad593ce53e63e9bf2a (patch)
treef104ed39606c8ae9e15cb1374f2381efd3f88cc7 /drivers/bcma/driver_chipcommon.c
parent56fd5f077223df1284a3501d1e3ba2e5b19d154a (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/driver_chipcommon.c')
-rw-r--r--drivers/bcma/driver_chipcommon.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c
index ef6855398b8..7c132e5eceb 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
34static 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
34void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) 56void 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 */
86void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) 108void 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
92void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value) 130void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value)