diff options
Diffstat (limited to 'drivers/bcma/driver_chipcommon.c')
-rw-r--r-- | drivers/bcma/driver_chipcommon.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c index 7c132e5eceb0..117222697e1f 100644 --- a/drivers/bcma/driver_chipcommon.c +++ b/drivers/bcma/driver_chipcommon.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "bcma_private.h" | 12 | #include "bcma_private.h" |
13 | #include <linux/bcm47xx_wdt.h> | ||
13 | #include <linux/export.h> | 14 | #include <linux/export.h> |
14 | #include <linux/bcma/bcma.h> | 15 | #include <linux/bcma/bcma.h> |
15 | 16 | ||
@@ -52,6 +53,39 @@ static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc) | |||
52 | return (1 << nb) - 1; | 53 | return (1 << nb) - 1; |
53 | } | 54 | } |
54 | 55 | ||
56 | static u32 bcma_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, | ||
57 | u32 ticks) | ||
58 | { | ||
59 | struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt); | ||
60 | |||
61 | return bcma_chipco_watchdog_timer_set(cc, ticks); | ||
62 | } | ||
63 | |||
64 | static u32 bcma_chipco_watchdog_timer_set_ms_wdt(struct bcm47xx_wdt *wdt, | ||
65 | u32 ms) | ||
66 | { | ||
67 | struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt); | ||
68 | u32 ticks; | ||
69 | |||
70 | ticks = bcma_chipco_watchdog_timer_set(cc, cc->ticks_per_ms * ms); | ||
71 | return ticks / cc->ticks_per_ms; | ||
72 | } | ||
73 | |||
74 | static int bcma_chipco_watchdog_ticks_per_ms(struct bcma_drv_cc *cc) | ||
75 | { | ||
76 | struct bcma_bus *bus = cc->core->bus; | ||
77 | |||
78 | if (cc->capabilities & BCMA_CC_CAP_PMU) { | ||
79 | if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) | ||
80 | /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */ | ||
81 | return bcma_chipco_alp_clock(cc) / 4000; | ||
82 | else | ||
83 | /* based on 32KHz ILP clock */ | ||
84 | return 32; | ||
85 | } else { | ||
86 | return bcma_chipco_alp_clock(cc) / 1000; | ||
87 | } | ||
88 | } | ||
55 | 89 | ||
56 | void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) | 90 | void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) |
57 | { | 91 | { |
@@ -100,12 +134,13 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) | |||
100 | ((leddc_on << BCMA_CC_GPIOTIMER_ONTIME_SHIFT) | | 134 | ((leddc_on << BCMA_CC_GPIOTIMER_ONTIME_SHIFT) | |
101 | (leddc_off << BCMA_CC_GPIOTIMER_OFFTIME_SHIFT))); | 135 | (leddc_off << BCMA_CC_GPIOTIMER_OFFTIME_SHIFT))); |
102 | } | 136 | } |
137 | cc->ticks_per_ms = bcma_chipco_watchdog_ticks_per_ms(cc); | ||
103 | 138 | ||
104 | cc->setup_done = true; | 139 | cc->setup_done = true; |
105 | } | 140 | } |
106 | 141 | ||
107 | /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ | 142 | /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ |
108 | void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) | 143 | u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) |
109 | { | 144 | { |
110 | u32 maxt; | 145 | u32 maxt; |
111 | enum bcma_clkmode clkmode; | 146 | enum bcma_clkmode clkmode; |
@@ -125,6 +160,7 @@ void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) | |||
125 | /* instant NMI */ | 160 | /* instant NMI */ |
126 | bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks); | 161 | bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks); |
127 | } | 162 | } |
163 | return ticks; | ||
128 | } | 164 | } |
129 | 165 | ||
130 | void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value) | 166 | void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value) |