| .. | .. |
|---|
| 1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | 1 | /* |
|---|
| 3 | 2 | * SDIO host client driver interface of Broadcom HNBU |
|---|
| 4 | 3 | * export functions to client drivers |
|---|
| 5 | 4 | * abstract OS and BUS specific details of SDIO |
|---|
| 6 | 5 | * |
|---|
| 7 | | - * Copyright (C) 1999-2019, Broadcom Corporation |
|---|
| 8 | | - * |
|---|
| 6 | + * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation |
|---|
| 7 | + * |
|---|
| 8 | + * Copyright (C) 1999-2017, Broadcom Corporation |
|---|
| 9 | + * |
|---|
| 9 | 10 | * Unless you and Broadcom execute a separate written software license |
|---|
| 10 | 11 | * agreement governing use of this software, this software is licensed to you |
|---|
| 11 | 12 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
|---|
| 12 | 13 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
|---|
| 13 | 14 | * following added to such license: |
|---|
| 14 | | - * |
|---|
| 15 | + * |
|---|
| 15 | 16 | * As a special exception, the copyright holders of this software give you |
|---|
| 16 | 17 | * permission to link this software with independent modules, and to copy and |
|---|
| 17 | 18 | * distribute the resulting executable under terms of your choice, provided that |
|---|
| .. | .. |
|---|
| 19 | 20 | * the license of that module. An independent module is a module which is not |
|---|
| 20 | 21 | * derived from this software. The special exception does not apply to any |
|---|
| 21 | 22 | * modifications of the software. |
|---|
| 22 | | - * |
|---|
| 23 | + * |
|---|
| 23 | 24 | * Notwithstanding the above, under no circumstances may you combine this |
|---|
| 24 | 25 | * software in any way with any other Broadcom software provided under a license |
|---|
| 25 | 26 | * other than the GPL, without Broadcom's express prior written consent. |
|---|
| .. | .. |
|---|
| 27 | 28 | * |
|---|
| 28 | 29 | * <<Broadcom-WL-IPTag/Open:>> |
|---|
| 29 | 30 | * |
|---|
| 30 | | - * $Id: bcmsdh.h 572557 2015-07-20 07:12:29Z $ |
|---|
| 31 | + * $Id: bcmsdh.h 690946 2017-03-20 05:24:19Z $ |
|---|
| 31 | 32 | */ |
|---|
| 32 | 33 | |
|---|
| 33 | 34 | /** |
|---|
| .. | .. |
|---|
| 52 | 53 | /* forward declarations */ |
|---|
| 53 | 54 | typedef struct bcmsdh_info bcmsdh_info_t; |
|---|
| 54 | 55 | typedef void (*bcmsdh_cb_fn_t)(void *); |
|---|
| 56 | + |
|---|
| 57 | +#if defined(BT_OVER_SDIO) |
|---|
| 58 | +typedef enum { |
|---|
| 59 | + NO_HANG_STATE = 0, |
|---|
| 60 | + HANG_START_STATE = 1, |
|---|
| 61 | + HANG_RECOVERY_STATE = 2 |
|---|
| 62 | +} dhd_hang_state_t; |
|---|
| 63 | +#endif // endif |
|---|
| 55 | 64 | |
|---|
| 56 | 65 | extern bcmsdh_info_t *bcmsdh_attach(osl_t *osh, void *sdioh, ulong *regsva); |
|---|
| 57 | 66 | /** |
|---|
| .. | .. |
|---|
| 88 | 97 | #if defined(DHD_DEBUG) |
|---|
| 89 | 98 | /* Query pending interrupt status from the host controller */ |
|---|
| 90 | 99 | extern bool bcmsdh_intr_pending(void *sdh); |
|---|
| 91 | | -#endif |
|---|
| 100 | +#endif // endif |
|---|
| 92 | 101 | |
|---|
| 93 | 102 | /* Register a callback to be called if and when bcmsdh detects |
|---|
| 94 | 103 | * device removal. No-op in the case of non-removable/hardwired devices. |
|---|
| .. | .. |
|---|
| 122 | 131 | * size: register width in bytes (2 or 4) |
|---|
| 123 | 132 | * data: data for register write |
|---|
| 124 | 133 | */ |
|---|
| 125 | | -extern uint32 bcmsdh_reg_read(void *sdh, uint32 addr, uint size); |
|---|
| 126 | | -extern uint32 bcmsdh_reg_write(void *sdh, uint32 addr, uint size, uint32 data); |
|---|
| 134 | +extern uint32 bcmsdh_reg_read(void *sdh, uintptr addr, uint size); |
|---|
| 135 | +extern uint32 bcmsdh_reg_write(void *sdh, uintptr addr, uint size, uint32 data); |
|---|
| 127 | 136 | |
|---|
| 128 | 137 | /* set sb address window */ |
|---|
| 129 | 138 | extern int bcmsdhsdio_set_sbaddr_window(void *sdh, uint32 address, bool force_set); |
|---|
| .. | .. |
|---|
| 193 | 202 | |
|---|
| 194 | 203 | /* Miscellaneous knob tweaker. */ |
|---|
| 195 | 204 | extern int bcmsdh_iovar_op(void *sdh, const char *name, |
|---|
| 196 | | - void *params, int plen, void *arg, int len, bool set); |
|---|
| 205 | + void *params, uint plen, void *arg, uint len, bool set); |
|---|
| 197 | 206 | |
|---|
| 198 | 207 | /* Reset and reinitialize the device */ |
|---|
| 199 | 208 | extern int bcmsdh_reset(bcmsdh_info_t *sdh); |
|---|
| .. | .. |
|---|
| 223 | 232 | extern int bcmsdh_reg_sdio_notify(void* semaphore); |
|---|
| 224 | 233 | extern void bcmsdh_unreg_sdio_notify(void); |
|---|
| 225 | 234 | |
|---|
| 226 | | -#if defined(OOB_INTR_ONLY) |
|---|
| 235 | +#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) |
|---|
| 227 | 236 | extern int bcmsdh_oob_intr_register(bcmsdh_info_t *bcmsdh, bcmsdh_cb_fn_t oob_irq_handler, |
|---|
| 228 | 237 | void* oob_irq_handler_context); |
|---|
| 229 | 238 | extern void bcmsdh_oob_intr_unregister(bcmsdh_info_t *sdh); |
|---|
| 230 | 239 | extern void bcmsdh_oob_intr_set(bcmsdh_info_t *sdh, bool enable); |
|---|
| 231 | | -#endif |
|---|
| 240 | +#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */ |
|---|
| 232 | 241 | extern void bcmsdh_dev_pm_stay_awake(bcmsdh_info_t *sdh); |
|---|
| 233 | 242 | extern void bcmsdh_dev_relax(bcmsdh_info_t *sdh); |
|---|
| 234 | 243 | extern bool bcmsdh_dev_pm_enabled(bcmsdh_info_t *sdh); |
|---|
| .. | .. |
|---|
| 248 | 257 | /* Function to pass chipid and rev to lower layers for controlling pr's */ |
|---|
| 249 | 258 | extern void bcmsdh_chipinfo(void *sdh, uint32 chip, uint32 chiprev); |
|---|
| 250 | 259 | |
|---|
| 260 | +#ifdef BCMSPI |
|---|
| 261 | +extern void bcmsdh_dwordmode(void *sdh, bool set); |
|---|
| 262 | +#endif /* BCMSPI */ |
|---|
| 251 | 263 | |
|---|
| 252 | 264 | extern int bcmsdh_sleep(void *sdh, bool enab); |
|---|
| 253 | 265 | |
|---|