aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/bcm4329/include/bcmspibrcm.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/bcm4329/include/bcmspibrcm.h')
-rw-r--r--drivers/net/wireless/bcm4329/include/bcmspibrcm.h134
1 files changed, 134 insertions, 0 deletions
diff --git a/drivers/net/wireless/bcm4329/include/bcmspibrcm.h b/drivers/net/wireless/bcm4329/include/bcmspibrcm.h
new file mode 100644
index 00000000000..9dce878d11e
--- /dev/null
+++ b/drivers/net/wireless/bcm4329/include/bcmspibrcm.h
@@ -0,0 +1,134 @@
1/*
2 * SD-SPI Protocol Conversion - BCMSDH->gSPI Translation Layer
3 *
4 * Copyright (C) 2010, Broadcom Corporation
5 * All Rights Reserved.
6 *
7 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
8 * the contents of this file may not be disclosed to third parties, copied
9 * or duplicated in any form, in whole or in part, without the prior
10 * written permission of Broadcom Corporation.
11 *
12 * $Id: bcmspibrcm.h,v 1.4.4.1.4.3.6.1 2008/09/27 17:03:25 Exp $
13 */
14
15/* global msglevel for debug messages - bitvals come from sdiovar.h */
16
17#define sd_err(x)
18#define sd_trace(x)
19#define sd_info(x)
20#define sd_debug(x)
21#define sd_data(x)
22#define sd_ctrl(x)
23
24#define sd_log(x)
25
26#define SDIOH_ASSERT(exp) \
27 do { if (!(exp)) \
28 printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \
29 } while (0)
30
31#define BLOCK_SIZE_F1 64
32#define BLOCK_SIZE_F2 2048
33#define BLOCK_SIZE_F3 2048
34
35/* internal return code */
36#define SUCCESS 0
37#undef ERROR
38#define ERROR 1
39#define ERROR_UF 2
40#define ERROR_OF 3
41
42/* private bus modes */
43#define SDIOH_MODE_SPI 0
44
45#define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */
46#define USE_MULTIBLOCK 0x4
47
48struct sdioh_info {
49 uint cfg_bar; /* pci cfg address for bar */
50 uint32 caps; /* cached value of capabilities reg */
51 void *bar0; /* BAR0 for PCI Device */
52 osl_t *osh; /* osh handler */
53 void *controller; /* Pointer to SPI Controller's private data struct */
54
55 uint lockcount; /* nest count of spi_lock() calls */
56 bool client_intr_enabled; /* interrupt connnected flag */
57 bool intr_handler_valid; /* client driver interrupt handler valid */
58 sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
59 void *intr_handler_arg; /* argument to call interrupt handler */
60 bool initialized; /* card initialized */
61 uint32 target_dev; /* Target device ID */
62 uint32 intmask; /* Current active interrupts */
63 void *sdos_info; /* Pointer to per-OS private data */
64
65 uint32 controller_type; /* Host controller type */
66 uint8 version; /* Host Controller Spec Compliance Version */
67 uint irq; /* Client irq */
68 uint32 intrcount; /* Client interrupts */
69 uint32 local_intrcount; /* Controller interrupts */
70 bool host_init_done; /* Controller initted */
71 bool card_init_done; /* Client SDIO interface initted */
72 bool polled_mode; /* polling for command completion */
73
74 bool sd_use_dma; /* DMA on CMD53 */
75 bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
76 /* Must be on for sd_multiblock to be effective */
77 bool use_client_ints; /* If this is false, make sure to restore */
78 /* polling hack in wl_linux.c:wl_timer() */
79 int adapter_slot; /* Maybe dealing with multiple slots/controllers */
80 int sd_mode; /* SD1/SD4/SPI */
81 int client_block_size[SPI_MAX_IOFUNCS]; /* Blocksize */
82 uint32 data_xfer_count; /* Current transfer */
83 uint16 card_rca; /* Current Address */
84 uint8 num_funcs; /* Supported funcs on client */
85 uint32 card_dstatus; /* 32bit device status */
86 uint32 com_cis_ptr;
87 uint32 func_cis_ptr[SPI_MAX_IOFUNCS];
88 void *dma_buf;
89 ulong dma_phys;
90 int r_cnt; /* rx count */
91 int t_cnt; /* tx_count */
92 uint32 wordlen; /* host processor 16/32bits */
93 uint32 prev_fun;
94 uint32 chip;
95 uint32 chiprev;
96 bool resp_delay_all;
97 bool dwordmode;
98
99 struct spierrstats_t spierrstats;
100};
101
102/************************************************************
103 * Internal interfaces: per-port references into bcmspibrcm.c
104 */
105
106/* Global message bits */
107extern uint sd_msglevel;
108
109/**************************************************************
110 * Internal interfaces: bcmspibrcm.c references to per-port code
111 */
112
113/* Interrupt (de)registration routines */
114extern int spi_register_irq(sdioh_info_t *sd, uint irq);
115extern void spi_free_irq(uint irq, sdioh_info_t *sd);
116
117/* OS-specific interrupt wrappers (atomic interrupt enable/disable) */
118extern void spi_lock(sdioh_info_t *sd);
119extern void spi_unlock(sdioh_info_t *sd);
120
121/* Allocate/init/free per-OS private data */
122extern int spi_osinit(sdioh_info_t *sd);
123extern void spi_osfree(sdioh_info_t *sd);
124
125#define SPI_RW_FLAG_M BITFIELD_MASK(1) /* Bit [31] - R/W Command Bit */
126#define SPI_RW_FLAG_S 31
127#define SPI_ACCESS_M BITFIELD_MASK(1) /* Bit [30] - Fixed/Incr Access */
128#define SPI_ACCESS_S 30
129#define SPI_FUNCTION_M BITFIELD_MASK(2) /* Bit [29:28] - Function Number */
130#define SPI_FUNCTION_S 28
131#define SPI_REG_ADDR_M BITFIELD_MASK(17) /* Bit [27:11] - Address */
132#define SPI_REG_ADDR_S 11
133#define SPI_LEN_M BITFIELD_MASK(11) /* Bit [10:0] - Packet length */
134#define SPI_LEN_S 0