CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/cache/sources/wl/include/bcmsdbus.h
Views: 3959
1
/*
2
* Definitions for API from sdio common code (bcmsdh) to individual
3
* host controller drivers.
4
*
5
* $Copyright Open Broadcom Corporation$
6
*
7
* $Id: bcmsdbus.h 299859 2011-12-01 03:53:27Z $
8
*/
9
10
#ifndef _sdio_api_h_
11
#define _sdio_api_h_
12
13
14
#define SDIOH_API_RC_SUCCESS (0x00)
15
#define SDIOH_API_RC_FAIL (0x01)
16
#define SDIOH_API_SUCCESS(status) (status == 0)
17
18
#define SDIOH_READ 0 /* Read request */
19
#define SDIOH_WRITE 1 /* Write request */
20
21
#define SDIOH_DATA_FIX 0 /* Fixed addressing */
22
#define SDIOH_DATA_INC 1 /* Incremental addressing */
23
24
#define SDIOH_CMD_TYPE_NORMAL 0 /* Normal command */
25
#define SDIOH_CMD_TYPE_APPEND 1 /* Append command */
26
#define SDIOH_CMD_TYPE_CUTTHRU 2 /* Cut-through command */
27
28
#define SDIOH_DATA_PIO 0 /* PIO mode */
29
#define SDIOH_DATA_DMA 1 /* DMA mode */
30
31
32
typedef int SDIOH_API_RC;
33
34
/* SDio Host structure */
35
typedef struct sdioh_info sdioh_info_t;
36
37
/* callback function, taking one arg */
38
typedef void (*sdioh_cb_fn_t)(void *);
39
40
/* attach, return handler on success, NULL if failed.
41
* The handler shall be provided by all subsequent calls. No local cache
42
* cfghdl points to the starting address of pci device mapped memory
43
*/
44
extern sdioh_info_t * sdioh_attach(osl_t *osh, void *cfghdl, uint irq);
45
extern SDIOH_API_RC sdioh_detach(osl_t *osh, sdioh_info_t *si);
46
extern SDIOH_API_RC sdioh_interrupt_register(sdioh_info_t *si, sdioh_cb_fn_t fn, void *argh);
47
extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *si);
48
49
/* query whether SD interrupt is enabled or not */
50
extern SDIOH_API_RC sdioh_interrupt_query(sdioh_info_t *si, bool *onoff);
51
52
/* enable or disable SD interrupt */
53
extern SDIOH_API_RC sdioh_interrupt_set(sdioh_info_t *si, bool enable_disable);
54
55
#if defined(DHD_DEBUG)
56
extern bool sdioh_interrupt_pending(sdioh_info_t *si);
57
#endif
58
59
/* read or write one byte using cmd52 */
60
extern SDIOH_API_RC sdioh_request_byte(sdioh_info_t *si, uint rw, uint fnc, uint addr, uint8 *byte);
61
62
/* read or write 2/4 bytes using cmd53 */
63
extern SDIOH_API_RC sdioh_request_word(sdioh_info_t *si, uint cmd_type, uint rw, uint fnc,
64
uint addr, uint32 *word, uint nbyte);
65
66
/* read or write any buffer using cmd53 */
67
extern SDIOH_API_RC sdioh_request_buffer(sdioh_info_t *si, uint pio_dma, uint fix_inc,
68
uint rw, uint fnc_num, uint32 addr, uint regwidth, uint32 buflen, uint8 *buffer,
69
void *pkt);
70
71
/* get cis data */
72
extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, uint8 *cis, uint32 length);
73
74
extern SDIOH_API_RC sdioh_cfg_read(sdioh_info_t *si, uint fuc, uint32 addr, uint8 *data);
75
extern SDIOH_API_RC sdioh_cfg_write(sdioh_info_t *si, uint fuc, uint32 addr, uint8 *data);
76
77
/* query number of io functions */
78
extern uint sdioh_query_iofnum(sdioh_info_t *si);
79
80
/* handle iovars */
81
extern int sdioh_iovar_op(sdioh_info_t *si, const char *name,
82
void *params, int plen, void *arg, int len, bool set);
83
84
/* Issue abort to the specified function and clear controller as needed */
85
extern int sdioh_abort(sdioh_info_t *si, uint fnc);
86
87
/* Start and Stop SDIO without re-enumerating the SD card. */
88
extern int sdioh_start(sdioh_info_t *si, int stage);
89
extern int sdioh_stop(sdioh_info_t *si);
90
91
/* Wait system lock free */
92
extern int sdioh_waitlockfree(sdioh_info_t *si);
93
94
/* Reset and re-initialize the device */
95
extern int sdioh_sdio_reset(sdioh_info_t *si);
96
97
/* Helper function */
98
void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh);
99
100
101
#ifdef BCMSPI
102
/* Function to pass gSPI specific device-status bits to dhd. */
103
extern uint32 sdioh_get_dstatus(sdioh_info_t *si);
104
105
/* chipid and chiprev info for lower layers to control sw WAR's for hw bugs. */
106
extern void sdioh_chipinfo(sdioh_info_t *si, uint32 chip, uint32 chiprev);
107
extern void sdioh_dwordmode(sdioh_info_t *si, bool set);
108
#endif /* BCMSPI */
109
110
#if defined(BCMSDIOH_STD)
111
#define SDIOH_SLEEP_ENABLED
112
#endif
113
extern SDIOH_API_RC sdioh_sleep(sdioh_info_t *si, bool enab);
114
115
/* GPIO support */
116
extern SDIOH_API_RC sdioh_gpio_init(sdioh_info_t *sd);
117
extern bool sdioh_gpioin(sdioh_info_t *sd, uint32 gpio);
118
extern SDIOH_API_RC sdioh_gpioouten(sdioh_info_t *sd, uint32 gpio);
119
extern SDIOH_API_RC sdioh_gpioout(sdioh_info_t *sd, uint32 gpio, bool enab);
120
121
#endif /* _sdio_api_h_ */
122
123