]> git.karo-electronics.de Git - mv-sheeva.git/blob - drivers/staging/brcm80211/brcmfmac/bcmsdbus.h
staging: brcm80211: moved /include/sdio_host.h to /brcmfmac dir
[mv-sheeva.git] / drivers / staging / brcm80211 / brcmfmac / bcmsdbus.h
1 /*
2  * Copyright (c) 2010 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef _sdio_api_h_
18 #define _sdio_api_h_
19
20 #include "sdio_host.h"
21
22 #define SDIOH_API_RC_SUCCESS                          (0x00)
23 #define SDIOH_API_RC_FAIL                             (0x01)
24 #define SDIOH_API_SUCCESS(status) (status == 0)
25
26 #define SDIOH_READ              0       /* Read request */
27 #define SDIOH_WRITE             1       /* Write request */
28
29 #define SDIOH_DATA_FIX          0       /* Fixed addressing */
30 #define SDIOH_DATA_INC          1       /* Incremental addressing */
31
32 #define SDIOH_CMD_TYPE_NORMAL   0       /* Normal command */
33 #define SDIOH_CMD_TYPE_APPEND   1       /* Append command */
34 #define SDIOH_CMD_TYPE_CUTTHRU  2       /* Cut-through command */
35
36 #define SDIOH_DATA_PIO          0       /* PIO mode */
37 #define SDIOH_DATA_DMA          1       /* DMA mode */
38
39 typedef int SDIOH_API_RC;
40
41 /* SDio Host structure */
42 typedef struct sdioh_info sdioh_info_t;
43
44 /* callback function, taking one arg */
45 typedef void (*sdioh_cb_fn_t) (void *);
46
47 /* attach, return handler on success, NULL if failed.
48  *  The handler shall be provided by all subsequent calls. No local cache
49  *  cfghdl points to the starting address of pci device mapped memory
50  */
51 extern sdioh_info_t *sdioh_attach(void *cfghdl, uint irq);
52 extern SDIOH_API_RC sdioh_detach(sdioh_info_t *si);
53 extern SDIOH_API_RC sdioh_interrupt_register(sdioh_info_t *si,
54                                              sdioh_cb_fn_t fn, void *argh);
55 extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *si);
56
57 /* query whether SD interrupt is enabled or not */
58 extern SDIOH_API_RC sdioh_interrupt_query(sdioh_info_t *si, bool *onoff);
59
60 /* enable or disable SD interrupt */
61 extern SDIOH_API_RC sdioh_interrupt_set(sdioh_info_t *si, bool enable_disable);
62
63 #if defined(DHD_DEBUG)
64 extern bool sdioh_interrupt_pending(sdioh_info_t *si);
65 #endif
66
67 extern int sdioh_claim_host_and_lock(sdioh_info_t *si);
68 extern int sdioh_release_host_and_unlock(sdioh_info_t *si);
69
70 /* read or write one byte using cmd52 */
71 extern SDIOH_API_RC sdioh_request_byte(sdioh_info_t *si, uint rw, uint fnc,
72                                        uint addr, u8 *byte);
73
74 /* read or write 2/4 bytes using cmd53 */
75 extern SDIOH_API_RC sdioh_request_word(sdioh_info_t *si, uint cmd_type,
76                                        uint rw, uint fnc, uint addr,
77                                        u32 *word, uint nbyte);
78
79 /* read or write any buffer using cmd53 */
80 extern SDIOH_API_RC sdioh_request_buffer(sdioh_info_t *si, uint pio_dma,
81                                          uint fix_inc, uint rw, uint fnc_num,
82                                          u32 addr, uint regwidth,
83                                          u32 buflen, u8 *buffer,
84                                          struct sk_buff *pkt);
85
86 /* get cis data */
87 extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, u8 *cis,
88                                    u32 length);
89
90 extern SDIOH_API_RC sdioh_cfg_read(sdioh_info_t *si, uint fuc, u32 addr,
91                                    u8 *data);
92 extern SDIOH_API_RC sdioh_cfg_write(sdioh_info_t *si, uint fuc, u32 addr,
93                                     u8 *data);
94
95 /* query number of io functions */
96 extern uint sdioh_query_iofnum(sdioh_info_t *si);
97
98 /* handle iovars */
99 extern int sdioh_iovar_op(sdioh_info_t *si, const char *name,
100                           void *params, int plen, void *arg, int len, bool set);
101
102 /* Issue abort to the specified function and clear controller as needed */
103 extern int sdioh_abort(sdioh_info_t *si, uint fnc);
104
105 /* Start and Stop SDIO without re-enumerating the SD card. */
106 extern int sdioh_start(sdioh_info_t *si, int stage);
107 extern int sdioh_stop(sdioh_info_t *si);
108
109 /* Reset and re-initialize the device */
110 extern int sdioh_sdio_reset(sdioh_info_t *si);
111
112 /* Helper function */
113 void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh);
114
115 #endif                          /* _sdio_api_h_ */