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/bcmsdbrcm.h
Views: 3959
1
/*
2
* BRCM SDIO HOST CONTROLLER driver
3
*
4
* Copyright (C) 2012, 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: bcmsdbrcm.h 241182 2011-02-17 21:50:03Z gmo $
13
*/
14
15
/* global msglevel for debug messages */
16
#ifdef BCMDBG
17
#define sd_err(x) do { if (sd_msglevel & SDH_ERROR_VAL) printf x; } while (0)
18
#define sd_trace(x) do { if (sd_msglevel & SDH_TRACE_VAL) printf x; } while (0)
19
#define sd_info(x) do { if (sd_msglevel & SDH_INFO_VAL) printf x; } while (0)
20
#define sd_debug(x) do { if (sd_msglevel & SDH_DEBUG_VAL) printf x; } while (0)
21
#define sd_data(x) do { if (sd_msglevel & SDH_DATA_VAL) printf x; } while (0)
22
#define sd_ctrl(x) do { if (sd_msglevel & SDH_CTRL_VAL) printf x; } while (0)
23
#else
24
#define sd_err(x)
25
#define sd_trace(x)
26
#define sd_info(x)
27
#define sd_debug(x)
28
#define sd_data(x)
29
#define sd_ctrl(x)
30
#endif
31
32
#ifdef BCMPERFSTATS
33
#define sd_log(x) do { if (sd_msglevel & SDH_LOG_VAL) bcmlog x; } while (0)
34
#else
35
#define sd_log(x)
36
#endif
37
38
/* SDIOH public information, used by per-port code */
39
struct sdioh_pubinfo {
40
int local_intrcount; /* Controller interrupt count */
41
bool dev_init_done; /* Client SDIO interface initted */
42
bool host_init_done; /* Controller initted */
43
bool intr_registered; /* Client handler registered */
44
bool dev_intr_enabled; /* Device interrupt enabled/disabled */
45
uint lockcount; /* Next count of sdbrcm_lock() calls */
46
void *sdos_info; /* Pointer to per-OS private data */
47
};
48
49
50
#define BLOCK_SIZE_4318 64
51
#define BLOCK_SIZE_4328 512
52
53
/* private bus modes */
54
/* move to API or hardware header. */
55
#define SDIOH_MODE_SPI 0
56
#define SDIOH_MODE_SD1 1
57
#define SDIOH_MODE_SD4 2
58
59
/* Expected dev status value for CMD7 */
60
#define SDIOH_CMD7_EXP_STATUS 0x00001E00
61
62
#define RETRIES_SMALL 20
63
#define RETRIES_LARGE 500000
64
#define SD_TIMEOUT 250000 /* Timeout after several ms if CMD not complete. */
65
66
#define ARVM_MASK 0xFF10
67
68
#define USE_PIO 0x0 /* DMA or PIO */
69
#define USE_DMA 0x1
70
71
#define NTXD 4
72
#define NRXD 4
73
#define RXBUFSZ 8192
74
#define NRXBUFPOST 4
75
#define HWRXOFF 8
76
77
#define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */
78
#define USE_MULTIBLOCK 0x4
79
80
#define EXT_CLK 0xffffffff /* external clock improve comment. */
81
82
extern int isr_sdbrcm_check_dev_intr(struct sdioh_pubinfo *sd);
83
extern uint sd_msglevel;
84
85
extern uint32 *sdbrcm_reg_map(osl_t *osh, int32 addr, int size);
86
extern void sdbrcm_reg_unmap(osl_t *osh, int32 addr, int size);
87
extern int sdbrcm_register_irq(sdioh_info_t *sd, uint irq);
88
extern void sdbrcm_free_irq(uint irq, sdioh_info_t *sd);
89
90
extern void sdbrcm_lock(sdioh_info_t *sd);
91
extern void sdbrcm_unlock(sdioh_info_t *sd);
92
93
extern void sdbrcm_devintr_on(sdioh_info_t *sd);
94
extern void sdbrcm_devintr_off(sdioh_info_t *sd);
95
96
/* Allocate/init/free per-OS private data */
97
extern int sdbrcm_osinit(sdioh_info_t *sd, osl_t *osh);
98
extern void sdbrcm_osfree(sdioh_info_t *sd, osl_t *osh);
99
100