diff options
author | Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com> | 2010-02-22 01:38:23 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-09 15:02:57 -0500 |
commit | 8197b7118add28f9aaa99c1fb73c0e201c8cde52 (patch) | |
tree | ce6c7c4cb5cdb8113b19d17b98d04929eef5030e /drivers/net/wireless/wl12xx/wl1271_io.c | |
parent | 54f7e5037c95f2beff0252bfcf288f711c185799 (diff) |
wl1271: Implemented abstraction of IO functions.
Changed the driver to use if_ops structure to abstract access to the IO
layer (SPI or SDIO).
Signed-off-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_io.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_io.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_io.c b/drivers/net/wireless/wl12xx/wl1271_io.c index b825cfa30ecf..d00f7ed7f21c 100644 --- a/drivers/net/wireless/wl12xx/wl1271_io.c +++ b/drivers/net/wireless/wl12xx/wl1271_io.c | |||
@@ -31,14 +31,19 @@ | |||
31 | #include "wl1271_spi.h" | 31 | #include "wl1271_spi.h" |
32 | #include "wl1271_io.h" | 32 | #include "wl1271_io.h" |
33 | 33 | ||
34 | struct device *wl1271_wl_to_dev(struct wl1271 *wl) | ||
35 | { | ||
36 | return wl->if_ops->dev(wl); | ||
37 | } | ||
38 | |||
34 | void wl1271_disable_interrupts(struct wl1271 *wl) | 39 | void wl1271_disable_interrupts(struct wl1271 *wl) |
35 | { | 40 | { |
36 | wl1271_spi_disable_interrupts(wl); | 41 | wl->if_ops->disable_irq(wl); |
37 | } | 42 | } |
38 | 43 | ||
39 | void wl1271_enable_interrupts(struct wl1271 *wl) | 44 | void wl1271_enable_interrupts(struct wl1271 *wl) |
40 | { | 45 | { |
41 | wl1271_spi_enable_interrupts(wl); | 46 | wl->if_ops->enable_irq(wl); |
42 | } | 47 | } |
43 | 48 | ||
44 | static int wl1271_translate_addr(struct wl1271 *wl, int addr) | 49 | static int wl1271_translate_addr(struct wl1271 *wl, int addr) |
@@ -127,24 +132,24 @@ int wl1271_set_partition(struct wl1271 *wl, | |||
127 | 132 | ||
128 | void wl1271_io_reset(struct wl1271 *wl) | 133 | void wl1271_io_reset(struct wl1271 *wl) |
129 | { | 134 | { |
130 | wl1271_spi_reset(wl); | 135 | wl->if_ops->reset(wl); |
131 | } | 136 | } |
132 | 137 | ||
133 | void wl1271_io_init(struct wl1271 *wl) | 138 | void wl1271_io_init(struct wl1271 *wl) |
134 | { | 139 | { |
135 | wl1271_spi_init(wl); | 140 | wl->if_ops->init(wl); |
136 | } | 141 | } |
137 | 142 | ||
138 | void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf, | 143 | void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf, |
139 | size_t len, bool fixed) | 144 | size_t len, bool fixed) |
140 | { | 145 | { |
141 | wl1271_spi_raw_write(wl, addr, buf, len, fixed); | 146 | wl->if_ops->write(wl, addr, buf, len, fixed); |
142 | } | 147 | } |
143 | 148 | ||
144 | void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf, | 149 | void wl1271_raw_read(struct wl1271 *wl, int addr, void *buf, |
145 | size_t len, bool fixed) | 150 | size_t len, bool fixed) |
146 | { | 151 | { |
147 | wl1271_spi_raw_read(wl, addr, buf, len, fixed); | 152 | wl->if_ops->read(wl, addr, buf, len, fixed); |
148 | } | 153 | } |
149 | 154 | ||
150 | void wl1271_read(struct wl1271 *wl, int addr, void *buf, size_t len, | 155 | void wl1271_read(struct wl1271 *wl, int addr, void *buf, size_t len, |
@@ -154,7 +159,7 @@ void wl1271_read(struct wl1271 *wl, int addr, void *buf, size_t len, | |||
154 | 159 | ||
155 | physical = wl1271_translate_addr(wl, addr); | 160 | physical = wl1271_translate_addr(wl, addr); |
156 | 161 | ||
157 | wl1271_spi_raw_read(wl, physical, buf, len, fixed); | 162 | wl1271_raw_read(wl, physical, buf, len, fixed); |
158 | } | 163 | } |
159 | 164 | ||
160 | void wl1271_write(struct wl1271 *wl, int addr, void *buf, size_t len, | 165 | void wl1271_write(struct wl1271 *wl, int addr, void *buf, size_t len, |
@@ -164,7 +169,7 @@ void wl1271_write(struct wl1271 *wl, int addr, void *buf, size_t len, | |||
164 | 169 | ||
165 | physical = wl1271_translate_addr(wl, addr); | 170 | physical = wl1271_translate_addr(wl, addr); |
166 | 171 | ||
167 | wl1271_spi_raw_write(wl, physical, buf, len, fixed); | 172 | wl1271_raw_write(wl, physical, buf, len, fixed); |
168 | } | 173 | } |
169 | 174 | ||
170 | u32 wl1271_read32(struct wl1271 *wl, int addr) | 175 | u32 wl1271_read32(struct wl1271 *wl, int addr) |