1 /*****************************************************************************
3 (c) Cambridge Silicon Radio Limited 2011
4 All rights reserved and confidential information of CSR
6 Refer to LICENSE.txt included with this source for details
9 *****************************************************************************/
11 #ifndef CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__
12 #define CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__
15 #include "csr_wifi_hip_chiphelper.h"
17 /* This GP stuff should be somewhere else? */
19 /* Memory spaces encoded in top byte of Generic Pointer type */
20 #define UNIFI_SH_DMEM 0x01 /* Shared Data Memory */
21 #define UNIFI_EXT_FLASH 0x02 /* External FLASH */
22 #define UNIFI_EXT_SRAM 0x03 /* External SRAM */
23 #define UNIFI_REGISTERS 0x04 /* Registers */
24 #define UNIFI_PHY_DMEM 0x10 /* PHY Data Memory */
25 #define UNIFI_PHY_PMEM 0x11 /* PHY Program Memory */
26 #define UNIFI_PHY_ROM 0x12 /* PHY ROM */
27 #define UNIFI_MAC_DMEM 0x20 /* MAC Data Memory */
28 #define UNIFI_MAC_PMEM 0x21 /* MAC Program Memory */
29 #define UNIFI_MAC_ROM 0x22 /* MAC ROM */
30 #define UNIFI_BT_DMEM 0x30 /* BT Data Memory */
31 #define UNIFI_BT_PMEM 0x31 /* BT Program Memory */
32 #define UNIFI_BT_ROM 0x32 /* BT ROM */
34 #define MAKE_GP(R, O) (((UNIFI_ ## R) << 24) | (O))
35 #define GP_OFFSET(GP) ((GP) & 0xFFFFFF)
36 #define GP_SPACE(GP) (((GP) >> 24) & 0xFF)
39 /* Address value pairs */
43 const struct chip_helper_init_values *vals;
46 /* Just a (counted) u16 array */
56 const struct chip_helper_reset_values *vals;
59 /* The addresses of registers that are equivalent but on
60 different host transports. */
61 struct chip_map_address_t
69 const struct chip_map_address_t *vals;
72 struct chip_device_regs_per_transport_t
76 u16 window1_page; /* PROG_PMEM1 or GW1 */
77 u16 window2_page; /* PROG_PMEM2 or GW2 */
78 u16 window3_page; /* SHARED or GW3 */
82 struct chip_device_regs_t
87 struct chip_device_regs_per_transport_t host;
88 struct chip_device_regs_per_transport_t spi;
92 u16 dbg_reset_warn_value;
103 u16 shared_io_interrupt;
104 u16 sdio_hip_handshake;
105 u16 coex_status; /* Allows WAPI detection */
108 /* If allowed is false then this window does not provide this
110 This describes how addresses should be shifted to make the
111 "page" address. The address is shifted left by 'page_shift'
112 and then has 'page_offset' added. This value should then be
113 written to the page register. */
114 struct window_shift_info_t
121 /* Each window has an address and size. These are obvious. It then
122 has a description for each type of memory that might be accessed
123 through it. There might also be a start to the offset of the window.
124 This means that that number of addresses at the start of the window
131 const struct window_shift_info_t *mode;
134 /* If GBL_CHIP_VERSION and'ed with 'mask' and is equal to 'result'
135 then this is the correct set of info. If pre_bc7 is true then the
136 address of GBL_CHIP_VERSION is FF9A, else its FE81. */
137 struct chip_version_t
145 struct chip_device_desc_t
147 struct chip_version_t chip_version;
149 /* This is a text string that a human might find useful (BC02, UF105x) */
150 const char *friendly_name;
151 /* This is what we show to customers */
152 const char *marketing_name;
154 /* Initialisation values to write following a reset */
155 struct val_array_t init;
157 /* Binary sequence for hard reset */
158 struct reset_prog_t reset_prog;
160 /* The register map */
161 const struct chip_device_regs_t *regs;
163 /* Some misc. info on the chip */
167 u32 has_ext_sram : 1;
173 /* This table is used to remap register addresses depending on what
174 host interface is used. On the BC7 and later chips there are
175 multiple sets of memory window registers, on for each host
176 interafce (SDIO / SPI). The correct one is needed. */
177 struct map_array_t map;
179 /* The offsets into the program address space of the different types of memory.
180 The RAM offset is probably the most useful. */
189 /* The offsets into the data address space of interesting things. */
193 /* maybe add shared / page tables? */
196 /* Information on the different windows */
197 const struct window_info_t *windows[CHIP_HELPER_WINDOW_COUNT];
200 #endif /* CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__ */