2 * BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
4 * Copyright (C) 1999-2010, Broadcom Corporation
6 * Unless you and Broadcom execute a separate written software license
7 * agreement governing use of this software, this software is licensed to you
8 * under the terms of the GNU General Public License version 2 (the "GPL"),
9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10 * following added to such license:
12 * As a special exception, the copyright holders of this software give you
13 * permission to link this software with independent modules, and to copy and
14 * distribute the resulting executable under terms of your choice, provided that
15 * you also meet, for each linked independent module, the terms and conditions of
16 * the license of that module. An independent module is a module which is not
17 * derived from this software. The special exception does not apply to any
18 * modifications of the software.
20 * Notwithstanding the above, under no circumstances may you combine this
21 * software in any way with any other Broadcom software provided under a license
22 * other than the GPL, without Broadcom's express prior written consent.
24 * $Id: bcmsdh_sdmmc.h,v 13.1.2.1.8.7 2009/10/27 18:22:52 Exp $
27 #ifndef __BCMSDH_SDMMC_H__
28 #define __BCMSDH_SDMMC_H__
37 #define sd_sync_dma(sd, read, nbytes)
38 #define sd_init_dma(sd)
39 #define sd_ack_intr(sd)
40 #define sd_wakeup(sd);
42 /* Allocate/init/free per-OS private data */
43 extern int sdioh_sdmmc_osinit(sdioh_info_t *sd);
44 extern void sdioh_sdmmc_osfree(sdioh_info_t *sd);
48 #define SDIOH_ASSERT(exp) \
50 printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \
53 #define BLOCK_SIZE_4318 64
54 #define BLOCK_SIZE_4328 512
56 /* internal return code */
60 /* private bus modes */
61 #define SDIOH_MODE_SD4 2
62 #define CLIENT_INTR 0x100 /* Get rid of this! */
65 osl_t *osh; /* osh handler */
66 bool client_intr_enabled; /* interrupt connnected flag */
67 bool intr_handler_valid; /* client driver interrupt handler valid */
68 sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
69 void *intr_handler_arg; /* argument to call interrupt handler */
70 uint16 intmask; /* Current active interrupts */
71 void *sdos_info; /* Pointer to per-OS private data */
73 uint irq; /* Client irq */
74 int intrcount; /* Client interrupts */
76 bool sd_use_dma; /* DMA on CMD53 */
77 bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
78 /* Must be on for sd_multiblock to be effective */
79 bool use_client_ints; /* If this is false, make sure to restore */
80 int sd_mode; /* SD1/SD4/SPI */
81 int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
82 uint8 num_funcs; /* Supported funcs on client */
84 uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
86 uint max_dma_descriptors; /* DMA Descriptors supported by this controller. */
87 // SDDMA_DESCRIPTOR SGList[32]; /* Scatter/Gather DMA List */
90 /************************************************************
91 * Internal interfaces: per-port references into bcmsdh_sdmmc.c
94 /* Global message bits */
95 extern uint sd_msglevel;
97 /* OS-independent interrupt handler */
98 extern bool check_client_intr(sdioh_info_t *sd);
100 /* Core interrupt enable/disable of device interrupts */
101 extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd);
102 extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd);
105 /**************************************************************
106 * Internal interfaces: bcmsdh_sdmmc.c references to per-port code
109 /* Register mapping routines */
110 extern uint32 *sdioh_sdmmc_reg_map(osl_t *osh, int32 addr, int size);
111 extern void sdioh_sdmmc_reg_unmap(osl_t *osh, int32 addr, int size);
113 /* Interrupt (de)registration routines */
114 extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq);
115 extern void sdioh_sdmmc_free_irq(uint irq, sdioh_info_t *sd);
117 typedef struct _BCMSDH_SDMMC_INSTANCE {
119 struct sdio_func *func[SDIOD_MAX_IOFUNCS];
120 } BCMSDH_SDMMC_INSTANCE, *PBCMSDH_SDMMC_INSTANCE;
122 #endif /* __BCMSDH_SDMMC_H__ */