diff mbox series

drivers:optee:rpmb: initialize drivers of mmc devices in UCLASS_BLK for rpmb access

Message ID HK0P153MB024453F818B19491BAB362BDDCD09@HK0P153MB0244.APCP153.PROD.OUTLOOK.COM
State Accepted
Commit 05947cb1d8d651b6b4e5f5dcbcef8e58d5ec4b44
Delegated to: Tom Rini
Headers show
Series drivers:optee:rpmb: initialize drivers of mmc devices in UCLASS_BLK for rpmb access | expand

Commit Message

Judy Wang May 19, 2022, 4:03 a.m. UTC
From bc1eae1b8883dca98c2874efca1d3e492db20cf3 Mon Sep 17 00:00:00 2001
From: judyw <wangjudy@microsoft.com>
Date: Tue, 3 May 2022 14:04:40 +0800
Subject: [PATCH] drivers:optee:rpmb: initialize drivers of mmc devices in UCLASS_BLK for rpmb access

    CONFIG_MMC only initializes drivers for devices in UCLASS_MMC,
    we need to initialize drivers for devices of type IF_TYPE_MMC
    in UCLASS_BLK as well because they are the child devices of
    devices in UCLASS_MMC. This is required for feature RPMB
    since it will access eMMC in optee-os.

Signed-off-by: judyw <wangjudy@microsoft.com>
---
 drivers/tee/optee/rpmb.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/drivers/tee/optee/rpmb.c b/drivers/tee/optee/rpmb.c
index 0804fc963c..cf5e0a08e6 100644
--- a/drivers/tee/optee/rpmb.c
+++ b/drivers/tee/optee/rpmb.c
@@ -72,6 +72,10 @@  static struct mmc *get_mmc(struct optee_private *priv, int dev_id)
 		debug("Cannot find RPMB device\n");
 		return NULL;
 	}
+	if (mmc_init(mmc)) {
+		log(LOGC_BOARD, LOGL_ERR, "%s:MMC device %d init failed\n", __func__, dev_id);
+		return NULL;
+	}
 	if (!(mmc->version & MMC_VERSION_MMC)) {
 		debug("Device id %d is not an eMMC device\n", dev_id);
 		return NULL;
@@ -104,6 +108,11 @@  static u32 rpmb_get_dev_info(u16 dev_id, struct rpmb_dev_info *info)
 	if (!mmc)
 		return TEE_ERROR_ITEM_NOT_FOUND;
 
+	if (mmc_init(mmc)) {
+		log(LOGC_BOARD, LOGL_ERR, "%s:MMC device %d init failed\n", __func__, dev_id);
+		return TEE_ERROR_NOT_SUPPORTED;
+	}
+
 	if (!mmc->ext_csd)
 		return TEE_ERROR_GENERIC;