1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * SD host controller specific definitions 4 */ 5 #ifndef __COMMONLIB_SDHCI_H__ 6 #define __COMMONLIB_SDHCI_H__ 7 8 #include <commonlib/sd_mmc_ctrlr.h> 9 10 /* Driver specific capabilities */ 11 #define DRVR_CAP_1V8_VDD 0x00010000 12 #define DRVR_CAP_32BIT_DMA_ADDR 0x00020000 13 #define DRVR_CAP_BROKEN_R1B 0x00040000 14 #define DRVR_CAP_NO_CD 0x00080000 15 #define DRVR_CAP_NO_HISPD_BIT 0x00100000 16 #define DRVR_CAP_NO_SIMULT_VDD_AND_POWER 0x00200000 17 #define DRVR_CAP_REG32_RW 0x00400000 18 #define DRVR_CAP_SPI 0x00800000 19 #define DRVR_CAP_WAIT_SEND_CMD 0x01000000 20 21 /* ADMA packet descriptor */ 22 struct sdhci_adma { 23 u16 attributes; 24 u16 length; 25 u32 addr; 26 }; 27 28 struct sdhci_adma64 { 29 u16 attributes; 30 u16 length; 31 u32 addr; 32 u32 addr_hi; 33 }; 34 35 struct sdhci_ctrlr { 36 struct sd_mmc_ctrlr sd_mmc_ctrlr; 37 void *ioaddr; 38 uint32_t b_max; 39 40 /* 41 * Dynamically allocated array of ADMA descriptors to use for data 42 * transfers 43 */ 44 struct sdhci_adma *adma_descs; 45 struct sdhci_adma64 *adma64_descs; 46 47 /* Number of ADMA descriptors currently in the array. */ 48 int adma_desc_count; 49 50 /* 51 * Point to function to run before running initialization. 52 * This would include anything non-standard. 53 */ 54 int (*attach)(struct sdhci_ctrlr *ctrlr); 55 }; 56 57 int add_sdhci(struct sdhci_ctrlr *sdhci_ctrlr); 58 int sdhci_controller_init(struct sdhci_ctrlr *sdhci_ctrlr, void *ioaddr); 59 void sdhci_update_pointers(struct sdhci_ctrlr *sdhci_ctrlr); 60 void sdhci_display_setup(struct sdhci_ctrlr *sdhci_ctrlr); 61 62 /* Add SDHCI controller from PCI */ 63 struct sd_mmc_ctrlr *new_pci_sdhci_controller(uint32_t dev); 64 65 /* Add SDHCI controller with memory address */ 66 struct sd_mmc_ctrlr *new_mem_sdhci_controller(void *ioaddr, 67 int (*pre_init_func)(struct sdhci_ctrlr *host)); 68 69 #endif /* __COMMONLIB_SDHCI_H__ */ 70