aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ssb/driver_extif.c
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2012-12-05 12:46:07 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-12-06 14:58:58 -0500
commit9f640a6376e54fa9ae834c32cbe92cefeec970dc (patch)
tree84e02c5cd758f6d52d595414ccc162279a19037a /drivers/ssb/driver_extif.c
parent7280b51a29f8e6cc7d449d565182d1e1b6183907 (diff)
ssb: extif: add methods for watchdog driver
The watchdog driver wants to set the watchdog timeout in ms and not in ticks, add a method converting ms to ticks before setting the watchdog register. Return the ticks or millisecond the timer was set to in case the provided value was bigger than the max allowed value. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb/driver_extif.c')
-rw-r--r--drivers/ssb/driver_extif.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/ssb/driver_extif.c b/drivers/ssb/driver_extif.c
index 0aa4c2a85774..553227a3062d 100644
--- a/drivers/ssb/driver_extif.c
+++ b/drivers/ssb/driver_extif.c
@@ -112,11 +112,30 @@ void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
112 *m = extif_read32(extif, SSB_EXTIF_CLOCK_SB); 112 *m = extif_read32(extif, SSB_EXTIF_CLOCK_SB);
113} 113}
114 114
115void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks) 115u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks)
116{
117 struct ssb_extif *extif = bcm47xx_wdt_get_drvdata(wdt);
118
119 return ssb_extif_watchdog_timer_set(extif, ticks);
120}
121
122u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms)
123{
124 struct ssb_extif *extif = bcm47xx_wdt_get_drvdata(wdt);
125 u32 ticks = (SSB_EXTIF_WATCHDOG_CLK / 1000) * ms;
126
127 ticks = ssb_extif_watchdog_timer_set(extif, ticks);
128
129 return (ticks * 1000) / SSB_EXTIF_WATCHDOG_CLK;
130}
131
132u32 ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks)
116{ 133{
117 if (ticks > SSB_EXTIF_WATCHDOG_MAX_TIMER) 134 if (ticks > SSB_EXTIF_WATCHDOG_MAX_TIMER)
118 ticks = SSB_EXTIF_WATCHDOG_MAX_TIMER; 135 ticks = SSB_EXTIF_WATCHDOG_MAX_TIMER;
119 extif_write32(extif, SSB_EXTIF_WATCHDOG, ticks); 136 extif_write32(extif, SSB_EXTIF_WATCHDOG, ticks);
137
138 return ticks;
120} 139}
121 140
122u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask) 141u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask)