summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ti/wlcore/io.h
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2011-11-21 18:37:14 (GMT)
committerLuciano Coelho <coelho@ti.com>2012-04-12 05:43:56 (GMT)
commit25a43d78eb63281294793fdaab6108bef81d7648 (patch)
tree72504d547dde54d573fcbe314d50ea203d6f032d /drivers/net/wireless/ti/wlcore/io.h
parentc31be25a7144ebc9b7a22128909bac7654d4c46b (diff)
downloadlinux-25a43d78eb63281294793fdaab6108bef81d7648.tar.xz
wlcore/wl12xx: implement chip-specific partition tables
Add partition tables to wlcore, move and reorganize partition setting functions. Move wl12xx partition table to use the wlcore partition table instead. Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/ti/wlcore/io.h')
-rw-r--r--drivers/net/wireless/ti/wlcore/io.h43
1 files changed, 10 insertions, 33 deletions
diff --git a/drivers/net/wireless/ti/wlcore/io.h b/drivers/net/wireless/ti/wlcore/io.h
index 4fb3dab..495ab33 100644
--- a/drivers/net/wireless/ti/wlcore/io.h
+++ b/drivers/net/wireless/ti/wlcore/io.h
@@ -43,8 +43,6 @@
#define HW_ACCESS_PRAM_MAX_RANGE 0x3c000
-extern struct wl1271_partition_set wl12xx_part_table[PART_TABLE_LEN];
-
struct wl1271;
void wl1271_disable_interrupts(struct wl1271 *wl);
@@ -52,6 +50,7 @@ void wl1271_enable_interrupts(struct wl1271 *wl);
void wl1271_io_reset(struct wl1271 *wl);
void wl1271_io_init(struct wl1271 *wl);
+int wlcore_translate_addr(struct wl1271 *wl, int addr);
/* Raw target IO, address is not translated */
static inline void wl1271_raw_write(struct wl1271 *wl, int addr, void *buf,
@@ -81,36 +80,12 @@ static inline void wl1271_raw_write32(struct wl1271 *wl, int addr, u32 val)
sizeof(wl->buffer_32), false);
}
-/* Translated target IO */
-static inline int wl1271_translate_addr(struct wl1271 *wl, int addr)
-{
- /*
- * To translate, first check to which window of addresses the
- * particular address belongs. Then subtract the starting address
- * of that window from the address. Then, add offset of the
- * translated region.
- *
- * The translated regions occur next to each other in physical device
- * memory, so just add the sizes of the preceding address regions to
- * get the offset to the new region.
- *
- * Currently, only the two first regions are addressed, and the
- * assumption is that all addresses will fall into either of those
- * two.
- */
- if ((addr >= wl->part.reg.start) &&
- (addr < wl->part.reg.start + wl->part.reg.size))
- return addr - wl->part.reg.start + wl->part.mem.size;
- else
- return addr - wl->part.mem.start;
-}
-
static inline void wl1271_read(struct wl1271 *wl, int addr, void *buf,
size_t len, bool fixed)
{
int physical;
- physical = wl1271_translate_addr(wl, addr);
+ physical = wlcore_translate_addr(wl, addr);
wl1271_raw_read(wl, physical, buf, len, fixed);
}
@@ -120,7 +95,7 @@ static inline void wl1271_write(struct wl1271 *wl, int addr, void *buf,
{
int physical;
- physical = wl1271_translate_addr(wl, addr);
+ physical = wlcore_translate_addr(wl, addr);
wl1271_raw_write(wl, physical, buf, len, fixed);
}
@@ -134,19 +109,19 @@ static inline void wl1271_read_hwaddr(struct wl1271 *wl, int hwaddr,
/* Addresses are stored internally as addresses to 32 bytes blocks */
addr = hwaddr << 5;
- physical = wl1271_translate_addr(wl, addr);
+ physical = wlcore_translate_addr(wl, addr);
wl1271_raw_read(wl, physical, buf, len, fixed);
}
static inline u32 wl1271_read32(struct wl1271 *wl, int addr)
{
- return wl1271_raw_read32(wl, wl1271_translate_addr(wl, addr));
+ return wl1271_raw_read32(wl, wlcore_translate_addr(wl, addr));
}
static inline void wl1271_write32(struct wl1271 *wl, int addr, u32 val)
{
- wl1271_raw_write32(wl, wl1271_translate_addr(wl, addr), val);
+ wl1271_raw_write32(wl, wlcore_translate_addr(wl, addr), val);
}
static inline void wl1271_power_off(struct wl1271 *wl)
@@ -169,8 +144,8 @@ static inline int wl1271_power_on(struct wl1271 *wl)
void wl1271_top_reg_write(struct wl1271 *wl, int addr, u16 val);
u16 wl1271_top_reg_read(struct wl1271 *wl, int addr);
-int wl1271_set_partition(struct wl1271 *wl,
- struct wl1271_partition_set *p);
+void wlcore_set_partition(struct wl1271 *wl,
+ const struct wlcore_partition_set *p);
bool wl1271_set_block_size(struct wl1271 *wl);
@@ -178,4 +153,6 @@ bool wl1271_set_block_size(struct wl1271 *wl);
int wl1271_tx_dummy_packet(struct wl1271 *wl);
+void wlcore_select_partition(struct wl1271 *wl, u8 part);
+
#endif