diff options
-rw-r--r-- | drivers/ssb/driver_extif.c | 21 | ||||
-rw-r--r-- | drivers/ssb/ssb_private.h | 15 | ||||
-rw-r--r-- | include/linux/ssb/ssb_driver_extif.h | 9 |
3 files changed, 40 insertions, 5 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 | ||
115 | void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks) | 115 | u32 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 | |||
122 | u32 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 | |||
132 | u32 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 | ||
122 | u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask) | 141 | u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask) |
diff --git a/drivers/ssb/ssb_private.h b/drivers/ssb/ssb_private.h index 03cc40a71510..50ea02877777 100644 --- a/drivers/ssb/ssb_private.h +++ b/drivers/ssb/ssb_private.h | |||
@@ -217,4 +217,19 @@ extern u32 ssb_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, | |||
217 | u32 ticks); | 217 | u32 ticks); |
218 | extern u32 ssb_chipco_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms); | 218 | extern u32 ssb_chipco_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms); |
219 | 219 | ||
220 | #ifdef CONFIG_SSB_DRIVER_EXTIF | ||
221 | extern u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks); | ||
222 | extern u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms); | ||
223 | #else | ||
224 | static inline u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, | ||
225 | u32 ticks) | ||
226 | { | ||
227 | return 0; | ||
228 | } | ||
229 | static inline u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, | ||
230 | u32 ms) | ||
231 | { | ||
232 | return 0; | ||
233 | } | ||
234 | #endif | ||
220 | #endif /* LINUX_SSB_PRIVATE_H_ */ | 235 | #endif /* LINUX_SSB_PRIVATE_H_ */ |
diff --git a/include/linux/ssb/ssb_driver_extif.h b/include/linux/ssb/ssb_driver_extif.h index b618188939d2..99511d0e931d 100644 --- a/include/linux/ssb/ssb_driver_extif.h +++ b/include/linux/ssb/ssb_driver_extif.h | |||
@@ -153,6 +153,8 @@ | |||
153 | #define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */ | 153 | #define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */ |
154 | 154 | ||
155 | #define SSB_EXTIF_WATCHDOG_MAX_TIMER ((1 << 28) - 1) | 155 | #define SSB_EXTIF_WATCHDOG_MAX_TIMER ((1 << 28) - 1) |
156 | #define SSB_EXTIF_WATCHDOG_MAX_TIMER_MS (SSB_EXTIF_WATCHDOG_MAX_TIMER \ | ||
157 | / (SSB_EXTIF_WATCHDOG_CLK / 1000)) | ||
156 | 158 | ||
157 | 159 | ||
158 | #ifdef CONFIG_SSB_DRIVER_EXTIF | 160 | #ifdef CONFIG_SSB_DRIVER_EXTIF |
@@ -172,8 +174,7 @@ extern void ssb_extif_get_clockcontrol(struct ssb_extif *extif, | |||
172 | extern void ssb_extif_timing_init(struct ssb_extif *extif, | 174 | extern void ssb_extif_timing_init(struct ssb_extif *extif, |
173 | unsigned long ns); | 175 | unsigned long ns); |
174 | 176 | ||
175 | extern void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, | 177 | extern u32 ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks); |
176 | u32 ticks); | ||
177 | 178 | ||
178 | /* Extif GPIO pin access */ | 179 | /* Extif GPIO pin access */ |
179 | u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask); | 180 | u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask); |
@@ -211,9 +212,9 @@ void ssb_extif_timing_init(struct ssb_extif *extif, unsigned long ns) | |||
211 | } | 212 | } |
212 | 213 | ||
213 | static inline | 214 | static inline |
214 | void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, | 215 | u32 ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks) |
215 | u32 ticks) | ||
216 | { | 216 | { |
217 | return 0; | ||
217 | } | 218 | } |
218 | 219 | ||
219 | static inline u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask) | 220 | static inline u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask) |