aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ssb/driver_extif.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ssb/driver_extif.c')
-rw-r--r--drivers/ssb/driver_extif.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/ssb/driver_extif.c b/drivers/ssb/driver_extif.c
index fe55eb8b038a..c3e1d3e6d610 100644
--- a/drivers/ssb/driver_extif.c
+++ b/drivers/ssb/driver_extif.c
@@ -27,12 +27,14 @@ static inline void extif_write32(struct ssb_extif *extif, u16 offset, u32 value)
27 ssb_write32(extif->dev, offset, value); 27 ssb_write32(extif->dev, offset, value);
28} 28}
29 29
30static inline void extif_write32_masked(struct ssb_extif *extif, u16 offset, 30static inline u32 extif_write32_masked(struct ssb_extif *extif, u16 offset,
31 u32 mask, u32 value) 31 u32 mask, u32 value)
32{ 32{
33 value &= mask; 33 value &= mask;
34 value |= extif_read32(extif, offset) & ~mask; 34 value |= extif_read32(extif, offset) & ~mask;
35 extif_write32(extif, offset, value); 35 extif_write32(extif, offset, value);
36
37 return value;
36} 38}
37 39
38#ifdef CONFIG_SSB_SERIAL 40#ifdef CONFIG_SSB_SERIAL
@@ -110,20 +112,35 @@ void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
110 *m = extif_read32(extif, SSB_EXTIF_CLOCK_SB); 112 *m = extif_read32(extif, SSB_EXTIF_CLOCK_SB);
111} 113}
112 114
115void ssb_extif_watchdog_timer_set(struct ssb_extif *extif,
116 u32 ticks)
117{
118 extif_write32(extif, SSB_EXTIF_WATCHDOG, ticks);
119}
120
113u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask) 121u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask)
114{ 122{
115 return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask; 123 return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
116} 124}
117 125
118void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value) 126u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
119{ 127{
120 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0), 128 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0),
121 mask, value); 129 mask, value);
122} 130}
123 131
124void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value) 132u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
125{ 133{
126 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0), 134 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0),
127 mask, value); 135 mask, value);
128} 136}
129 137
138u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value)
139{
140 return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTPOL, mask, value);
141}
142
143u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value)
144{
145 return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTMASK, mask, value);
146}