2012-06-19 17:15:42 -06:00
|
|
|
/*****************************************************************************
|
|
|
|
|
|
|
|
(c) Cambridge Silicon Radio Limited 2011
|
|
|
|
All rights reserved and confidential information of CSR
|
|
|
|
|
|
|
|
Refer to LICENSE.txt included with this source for details
|
|
|
|
on the license terms.
|
|
|
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__
|
|
|
|
#define CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include "csr_wifi_hip_chiphelper.h"
|
|
|
|
|
|
|
|
/* This GP stuff should be somewhere else? */
|
|
|
|
|
|
|
|
/* Memory spaces encoded in top byte of Generic Pointer type */
|
|
|
|
#define UNIFI_SH_DMEM 0x01 /* Shared Data Memory */
|
|
|
|
#define UNIFI_EXT_FLASH 0x02 /* External FLASH */
|
|
|
|
#define UNIFI_EXT_SRAM 0x03 /* External SRAM */
|
|
|
|
#define UNIFI_REGISTERS 0x04 /* Registers */
|
|
|
|
#define UNIFI_PHY_DMEM 0x10 /* PHY Data Memory */
|
|
|
|
#define UNIFI_PHY_PMEM 0x11 /* PHY Program Memory */
|
|
|
|
#define UNIFI_PHY_ROM 0x12 /* PHY ROM */
|
|
|
|
#define UNIFI_MAC_DMEM 0x20 /* MAC Data Memory */
|
|
|
|
#define UNIFI_MAC_PMEM 0x21 /* MAC Program Memory */
|
|
|
|
#define UNIFI_MAC_ROM 0x22 /* MAC ROM */
|
|
|
|
#define UNIFI_BT_DMEM 0x30 /* BT Data Memory */
|
|
|
|
#define UNIFI_BT_PMEM 0x31 /* BT Program Memory */
|
|
|
|
#define UNIFI_BT_ROM 0x32 /* BT ROM */
|
|
|
|
|
|
|
|
#define MAKE_GP(R, O) (((UNIFI_ ## R) << 24) | (O))
|
|
|
|
#define GP_OFFSET(GP) ((GP) & 0xFFFFFF)
|
|
|
|
#define GP_SPACE(GP) (((GP) >> 24) & 0xFF)
|
|
|
|
|
|
|
|
|
|
|
|
/* Address value pairs */
|
|
|
|
struct val_array_t
|
|
|
|
{
|
2012-07-20 13:05:42 -06:00
|
|
|
u32 len;
|
2012-06-19 17:15:42 -06:00
|
|
|
const struct chip_helper_init_values *vals;
|
|
|
|
};
|
|
|
|
|
2012-07-20 13:00:10 -06:00
|
|
|
/* Just a (counted) u16 array */
|
2012-06-19 17:15:42 -06:00
|
|
|
struct data_array_t
|
|
|
|
{
|
2012-07-20 13:05:42 -06:00
|
|
|
u32 len;
|
2012-07-20 13:00:10 -06:00
|
|
|
const u16 *vals;
|
2012-06-19 17:15:42 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct reset_prog_t
|
|
|
|
{
|
2012-07-20 13:05:42 -06:00
|
|
|
u32 len;
|
2012-06-19 17:15:42 -06:00
|
|
|
const struct chip_helper_reset_values *vals;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The addresses of registers that are equivalent but on
|
|
|
|
different host transports. */
|
|
|
|
struct chip_map_address_t
|
|
|
|
{
|
2012-07-20 13:00:10 -06:00
|
|
|
u16 spi, host;
|
2012-06-19 17:15:42 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct map_array_t
|
|
|
|
{
|
2012-07-20 13:05:42 -06:00
|
|
|
u32 len;
|
2012-06-19 17:15:42 -06:00
|
|
|
const struct chip_map_address_t *vals;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct chip_device_regs_per_transport_t
|
|
|
|
{
|
2012-07-20 13:00:10 -06:00
|
|
|
u16 dbg_proc_select;
|
|
|
|
u16 dbg_stop_status;
|
|
|
|
u16 window1_page; /* PROG_PMEM1 or GW1 */
|
|
|
|
u16 window2_page; /* PROG_PMEM2 or GW2 */
|
|
|
|
u16 window3_page; /* SHARED or GW3 */
|
|
|
|
u16 io_log_addr;
|
2012-06-19 17:15:42 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct chip_device_regs_t
|
|
|
|
{
|
2012-07-20 13:00:10 -06:00
|
|
|
u16 gbl_chip_version;
|
|
|
|
u16 gbl_misc_enables;
|
|
|
|
u16 dbg_emu_cmd;
|
2012-06-19 17:15:42 -06:00
|
|
|
struct chip_device_regs_per_transport_t host;
|
|
|
|
struct chip_device_regs_per_transport_t spi;
|
2012-07-20 13:00:10 -06:00
|
|
|
u16 dbg_reset;
|
|
|
|
u16 dbg_reset_value;
|
|
|
|
u16 dbg_reset_warn;
|
|
|
|
u16 dbg_reset_warn_value;
|
|
|
|
u16 dbg_reset_result;
|
|
|
|
u16 xap_pch;
|
|
|
|
u16 xap_pcl;
|
|
|
|
u16 proc_pc_snoop;
|
|
|
|
u16 watchdog_disable;
|
|
|
|
u16 mailbox0;
|
|
|
|
u16 mailbox1;
|
|
|
|
u16 mailbox2;
|
|
|
|
u16 mailbox3;
|
|
|
|
u16 sdio_host_int;
|
|
|
|
u16 shared_io_interrupt;
|
|
|
|
u16 sdio_hip_handshake;
|
|
|
|
u16 coex_status; /* Allows WAPI detection */
|
2012-06-19 17:15:42 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
/* If allowed is false then this window does not provide this
|
|
|
|
type of access.
|
|
|
|
This describes how addresses should be shifted to make the
|
|
|
|
"page" address. The address is shifted left by 'page_shift'
|
|
|
|
and then has 'page_offset' added. This value should then be
|
|
|
|
written to the page register. */
|
|
|
|
struct window_shift_info_t
|
|
|
|
{
|
2012-07-20 13:07:25 -06:00
|
|
|
s32 allowed;
|
2012-07-20 13:05:42 -06:00
|
|
|
u32 page_shift;
|
2012-07-20 13:00:10 -06:00
|
|
|
u16 page_offset;
|
2012-06-19 17:15:42 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Each window has an address and size. These are obvious. It then
|
|
|
|
has a description for each type of memory that might be accessed
|
|
|
|
through it. There might also be a start to the offset of the window.
|
|
|
|
This means that that number of addresses at the start of the window
|
|
|
|
are unusable. */
|
|
|
|
struct window_info_t
|
|
|
|
{
|
2012-07-20 13:00:10 -06:00
|
|
|
u16 address;
|
|
|
|
u16 size;
|
|
|
|
u16 blocked;
|
2012-06-19 17:15:42 -06:00
|
|
|
const struct window_shift_info_t *mode;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* If GBL_CHIP_VERSION and'ed with 'mask' and is equal to 'result'
|
|
|
|
then this is the correct set of info. If pre_bc7 is true then the
|
|
|
|
address of GBL_CHIP_VERSION is FF9A, else its FE81. */
|
|
|
|
struct chip_version_t
|
|
|
|
{
|
2012-07-20 13:07:25 -06:00
|
|
|
s32 pre_bc7;
|
2012-07-20 13:00:10 -06:00
|
|
|
u16 mask;
|
|
|
|
u16 result;
|
2012-07-20 12:51:01 -06:00
|
|
|
u8 sdio;
|
2012-06-19 17:15:42 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct chip_device_desc_t
|
|
|
|
{
|
|
|
|
struct chip_version_t chip_version;
|
|
|
|
|
|
|
|
/* This is a text string that a human might find useful (BC02, UF105x) */
|
2012-07-20 13:22:32 -06:00
|
|
|
const char *friendly_name;
|
2012-06-19 17:15:42 -06:00
|
|
|
/* This is what we show to customers */
|
2012-07-20 13:22:32 -06:00
|
|
|
const char *marketing_name;
|
2012-06-19 17:15:42 -06:00
|
|
|
|
|
|
|
/* Initialisation values to write following a reset */
|
|
|
|
struct val_array_t init;
|
|
|
|
|
|
|
|
/* Binary sequence for hard reset */
|
|
|
|
struct reset_prog_t reset_prog;
|
|
|
|
|
|
|
|
/* The register map */
|
|
|
|
const struct chip_device_regs_t *regs;
|
|
|
|
|
|
|
|
/* Some misc. info on the chip */
|
|
|
|
struct
|
|
|
|
{
|
2012-07-20 13:05:42 -06:00
|
|
|
u32 has_flash : 1;
|
|
|
|
u32 has_ext_sram : 1;
|
|
|
|
u32 has_rom : 1;
|
|
|
|
u32 has_bt : 1;
|
|
|
|
u32 has_wlan : 1;
|
2012-06-19 17:15:42 -06:00
|
|
|
} bools;
|
|
|
|
|
|
|
|
/* This table is used to remap register addresses depending on what
|
|
|
|
host interface is used. On the BC7 and later chips there are
|
|
|
|
multiple sets of memory window registers, on for each host
|
|
|
|
interafce (SDIO / SPI). The correct one is needed. */
|
|
|
|
struct map_array_t map;
|
|
|
|
|
|
|
|
/* The offsets into the program address space of the different types of memory.
|
|
|
|
The RAM offset is probably the most useful. */
|
|
|
|
struct
|
|
|
|
{
|
2012-07-20 13:05:42 -06:00
|
|
|
u32 ram;
|
|
|
|
u32 rom;
|
|
|
|
u32 flash;
|
|
|
|
u32 ext_sram;
|
2012-06-19 17:15:42 -06:00
|
|
|
} prog_offset;
|
|
|
|
|
|
|
|
/* The offsets into the data address space of interesting things. */
|
|
|
|
struct
|
|
|
|
{
|
2012-07-20 13:00:10 -06:00
|
|
|
u16 ram;
|
2012-06-19 17:15:42 -06:00
|
|
|
/* maybe add shared / page tables? */
|
|
|
|
} data_offset;
|
|
|
|
|
|
|
|
/* Information on the different windows */
|
|
|
|
const struct window_info_t *windows[CHIP_HELPER_WINDOW_COUNT];
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__ */
|