summaryrefslogtreecommitdiffstats
path: root/src/commonlib/storage/sdhci.c
diff options
context:
space:
mode:
authorShelley Chen <shchen@google.com>2023-01-30 14:46:38 -0800
committerShelley Chen <shchen@google.com>2023-02-08 16:59:28 +0000
commit8c692d7dfaede453d8c974819c3f3bec67b24e55 (patch)
tree6ae39906a9978eeab260dc4e1c19ee3b8b97b708 /src/commonlib/storage/sdhci.c
parent3ecf377e305e1a026ddfa66adf800a28993f4075 (diff)
downloadcoreboot-8c692d7dfaede453d8c974819c3f3bec67b24e55.tar.gz
coreboot-8c692d7dfaede453d8c974819c3f3bec67b24e55.tar.bz2
coreboot-8c692d7dfaede453d8c974819c3f3bec67b24e55.zip
commonlib/storage: Add attach callback to sdhci_ctrlr
Adding a attach callback function pointer in case a platform needs to execute anything before the standard initialization of the sdhci mem controller. BUG=b:254092907 BRANCH=None TEST=emerge-herobrine coreboot Change-Id: I0f37ec09d083922cad5ecd3c47b184cf3311fe2d Signed-off-by: Shelley Chen <shchen@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/72633 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Douglas Anderson <dianders@chromium.org>
Diffstat (limited to 'src/commonlib/storage/sdhci.c')
-rw-r--r--src/commonlib/storage/sdhci.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/commonlib/storage/sdhci.c b/src/commonlib/storage/sdhci.c
index 3a01f62af175..882920d6a40d 100644
--- a/src/commonlib/storage/sdhci.c
+++ b/src/commonlib/storage/sdhci.c
@@ -585,6 +585,16 @@ static int sdhci_pre_init(struct sdhci_ctrlr *sdhci_ctrlr)
struct sd_mmc_ctrlr *ctrlr = &sdhci_ctrlr->sd_mmc_ctrlr;
unsigned int caps, caps_1;
+ /*
+ * If the device needs to do anything non-standard before
+ * sdhci initialization, run it here.
+ */
+ if (sdhci_ctrlr->attach) {
+ int rv = sdhci_ctrlr->attach(sdhci_ctrlr);
+ if (rv)
+ return rv;
+ }
+
/* Get controller version and capabilities */
ctrlr->version = sdhci_readw(sdhci_ctrlr, SDHCI_HOST_VERSION) & 0xff;
caps = sdhci_readl(sdhci_ctrlr, SDHCI_CAPABILITIES);