diff options
author | Lee Leahy <leroy.p.leahy@intel.com> | 2017-05-08 16:56:03 -0700 |
---|---|---|
committer | Lee Leahy <leroy.p.leahy@intel.com> | 2017-05-12 18:20:33 +0200 |
commit | 48dbc663d75e6b7e45e50cd099acb88b35e65a0a (patch) | |
tree | f60c19148b8be447c5350f939ac9d832e379579c /src/commonlib/include/commonlib/sdhci.h | |
parent | f542aca0908ead68314a6d9603dde8849abcff19 (diff) | |
download | coreboot-48dbc663d75e6b7e45e50cd099acb88b35e65a0a.tar.gz coreboot-48dbc663d75e6b7e45e50cd099acb88b35e65a0a.tar.bz2 coreboot-48dbc663d75e6b7e45e50cd099acb88b35e65a0a.zip |
commonlib: Move drivers/storage into commonlib/storage
Move drivers/storage into commonlib/storage to enable access by
libpayload and indirectly by payloads.
* Remove SD/MMC specific include files from include/device
* Remove files from drivers/storage
* Add SD/MMC specific include files to commonlib/include
* Add files to commonlib/storage
* Fix header file references
* Add subdir entry in commonlib/Makefile.inc to build the SD/MMC driver
* Add Kconfig source for commonlib/storage
* Rename *DEVICE* to *COMMONLIB*
* Rename *DRIVERS_STORAGE* to *COMMONLIB_STORAGE*
TEST=Build and run on Galileo Gen2
Change-Id: I4339e4378491db9a0da1f2dc34e1906a5ba31ad6
Signed-off-by: Lee Leahy <Leroy.P.Leahy@intel.com>
Reviewed-on: https://review.coreboot.org/19672
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/commonlib/include/commonlib/sdhci.h')
-rw-r--r-- | src/commonlib/include/commonlib/sdhci.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/commonlib/include/commonlib/sdhci.h b/src/commonlib/include/commonlib/sdhci.h new file mode 100644 index 000000000000..ffeb6625d95e --- /dev/null +++ b/src/commonlib/include/commonlib/sdhci.h @@ -0,0 +1,76 @@ +/* + * Copyright 2011, Marvell Semiconductor Inc. + * Lei Wen <leiwen@marvell.com> + * + * Copyright 2017 Intel Corporation + * + * SD host controller specific definitions + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#ifndef __COMMONLIB_SDHCI_H__ +#define __COMMONLIB_SDHCI_H__ + +#include <commonlib/sd_mmc_ctrlr.h> + +/* Driver specific capabilities */ +#define DRVR_CAP_1V8_VDD 0x00010000 +#define DRVR_CAP_32BIT_DMA_ADDR 0x00020000 +#define DRVR_CAP_BROKEN_R1B 0x00040000 +#define DRVR_CAP_NO_CD 0x00080000 +#define DRVR_CAP_NO_HISPD_BIT 0x00100000 +#define DRVR_CAP_NO_SIMULT_VDD_AND_POWER 0x00200000 +#define DRVR_CAP_REG32_RW 0x00400000 +#define DRVR_CAP_SPI 0x00800000 +#define DRVR_CAP_WAIT_SEND_CMD 0x01000000 + +/* ADMA packet descriptor */ +struct sdhci_adma { + u16 attributes; + u16 length; + u32 addr; +}; + +struct sdhci_adma64 { + u16 attributes; + u16 length; + u32 addr; + u32 addr_hi; +}; + +struct sdhci_ctrlr { + struct sd_mmc_ctrlr sd_mmc_ctrlr; + void *ioaddr; + uint32_t b_max; + + /* + * Dynamically allocated array of ADMA descriptors to use for data + * transfers + */ + struct sdhci_adma *adma_descs; + struct sdhci_adma64 *adma64_descs; + + /* Number of ADMA descriptors currently in the array. */ + int adma_desc_count; +}; + +int add_sdhci(struct sdhci_ctrlr *sdhci_ctrlr); +int sdhci_controller_init(struct sdhci_ctrlr *sdhci_ctrlr, void *ioaddr); +void sdhci_update_pointers(struct sdhci_ctrlr *sdhci_ctrlr); +void sdhci_display_setup(struct sdhci_ctrlr *sdhci_ctrlr); + +/* Add SDHCI controller from PCI */ +struct sd_mmc_ctrlr *new_pci_sdhci_controller(uint32_t dev); + +/* Add SDHCI controller with memory address */ +struct sd_mmc_ctrlr *new_mem_sdhci_controller(void *ioaddr); + +#endif /* __COMMONLIB_SDHCI_H__ */ |