]> git.karo-electronics.de Git - mv-sheeva.git/blob - drivers/staging/brcm80211/brcmfmac/bcmsdbus.h
staging: brcm80211: move sdio related suspend/resume code to bus interface layer
[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 /* callback function, taking one arg */
40 typedef void (*sdioh_cb_fn_t) (void *);
41
42 /* attach, return handler on success, NULL if failed.
43  *  The handler shall be provided by all subsequent calls. No local cache
44  *  cfghdl points to the starting address of pci device mapped memory
45  */
46 extern struct sdioh_info *brcmf_sdioh_attach(void *cfghdl, uint irq);
47 extern int brcmf_sdioh_detach(struct sdioh_info *si);
48 extern int brcmf_sdioh_interrupt_register(struct sdioh_info *si,
49                                              sdioh_cb_fn_t fn, void *argh);
50 extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *si);
51
52 /* query whether SD interrupt is enabled or not */
53 extern int
54 brcmf_sdioh_interrupt_query(struct sdioh_info *si, bool *onoff);
55
56 /* enable or disable SD interrupt */
57 extern int
58 brcmf_sdioh_interrupt_set(struct sdioh_info *si, bool enable_disable);
59
60 #if defined(BCMDBG)
61 extern bool brcmf_sdioh_interrupt_pending(struct sdioh_info *si);
62 #endif
63
64 extern int brcmf_sdioh_claim_host_and_lock(struct sdioh_info *si);
65 extern int brcmf_sdioh_release_host_and_unlock(struct sdioh_info *si);
66
67 /* read or write one byte using cmd52 */
68 extern int
69 brcmf_sdioh_request_byte(struct sdioh_info *si, uint rw, uint fnc, uint addr,
70                          u8 *byte);
71
72 /* read or write 2/4 bytes using cmd53 */
73 extern int
74 brcmf_sdioh_request_word(struct sdioh_info *si, uint cmd_type,
75                          uint rw, uint fnc, uint addr,
76                          u32 *word, uint nbyte);
77
78 /* read or write any buffer using cmd53 */
79 extern int
80 brcmf_sdioh_request_buffer(struct sdioh_info *si, uint pio_dma,
81                            uint fix_inc, uint rw, uint fnc_num,
82                            u32 addr, uint regwidth,
83                            u32 buflen, u8 *buffer, struct sk_buff *pkt);
84
85 /* get cis data */
86 extern int
87 brcmf_sdioh_cis_read(struct sdioh_info *si, uint fuc, u8 *cis, u32 length);
88
89 extern int
90 brcmf_sdioh_cfg_read(struct sdioh_info *si, uint fuc, u32 addr, u8 *data);
91 extern int
92 brcmf_sdioh_cfg_write(struct sdioh_info *si, uint fuc, u32 addr, u8 *data);
93
94 /* query number of io functions */
95 extern uint brcmf_sdioh_query_iofnum(struct sdioh_info *si);
96
97 /* handle iovars */
98 extern int brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name,
99                           void *params, int plen, void *arg, int len, bool set);
100
101 /* Issue abort to the specified function and clear controller as needed */
102 extern int brcmf_sdioh_abort(struct sdioh_info *si, uint fnc);
103
104 /* Start and Stop SDIO without re-enumerating the SD card. */
105 extern int brcmf_sdioh_start(struct sdioh_info *si, int stage);
106 extern int brcmf_sdioh_stop(struct sdioh_info *si);
107
108 /* Reset and re-initialize the device */
109 extern int brcmf_sdioh_reset(struct sdioh_info *si);
110
111 /* Helper function */
112 void *brcmf_sdcard_get_sdioh(struct brcmf_sdio *sdh);
113
114 /* Watchdog timer interface for pm ops */
115 extern void brcmf_sdio_wdtmr_enable(bool enable);
116
117 #endif                          /* _sdio_api_h_ */