[PATCH 8/9] mci: omap_hsmmc: add xload implementation for PBL
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Apr 21 22:26:34 PDT 2025
Luckily, the BootROM does no reset of hardware after handing over
control to the MLO and thus SD card, host and clock/resets are all
configured for barebox MLO to directly send MMC_CMD_READ_MULTIPLE_BLOCK.
Add a PBL driver that does this.
This will be used to enable a single barebox build to produce both MLO
and second stage images for the Beaglebone Black.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/mci/Kconfig | 3 +++
drivers/mci/Makefile | 1 +
drivers/mci/omap_hsmmc_common.c | 2 +-
drivers/mci/omap_hsmmc_pbl.c | 32 ++++++++++++++++++++++++++++++++
4 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 drivers/mci/omap_hsmmc_pbl.c
diff --git a/drivers/mci/Kconfig b/drivers/mci/Kconfig
index 09648aa77150..44fd4716aade 100644
--- a/drivers/mci/Kconfig
+++ b/drivers/mci/Kconfig
@@ -255,3 +255,6 @@ config MCI_ATMEL_PBL
config MCI_ATMEL_SDHCI_PBL
bool
select MCI_SDHCI
+
+config MCI_OMAP_HSMMC_PBL
+ bool
diff --git a/drivers/mci/Makefile b/drivers/mci/Makefile
index b209a86d8873..f76059e7b550 100644
--- a/drivers/mci/Makefile
+++ b/drivers/mci/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_MCI_IMX_ESDHC) += imx-esdhc.o imx-esdhc-common.o
pbl-$(CONFIG_MCI_IMX_ESDHC_PBL) += imx-esdhc-pbl.o imx-esdhc-common.o
obj-$(CONFIG_MCI_MXS) += mxs.o
obj-$(CONFIG_MCI_OMAP_HSMMC) += omap_hsmmc.o omap_hsmmc_common.o
+pbl-$(CONFIG_MCI_OMAP_HSMMC_PBL) += omap_hsmmc_pbl.o omap_hsmmc_common.o
obj-$(CONFIG_MCI_PXA) += pxamci.o
obj-$(CONFIG_MCI_ROCKCHIP_DWCMSHC) += rockchip-dwcmshc-sdhci.o
obj-$(CONFIG_MCI_TEGRA) += tegra-sdmmc.o
diff --git a/drivers/mci/omap_hsmmc_common.c b/drivers/mci/omap_hsmmc_common.c
index 04c712460622..329908a6e4bd 100644
--- a/drivers/mci/omap_hsmmc_common.c
+++ b/drivers/mci/omap_hsmmc_common.c
@@ -468,7 +468,7 @@ int omap_hsmmc_send_cmd(struct omap_hsmmc *hsmmc, struct mci_cmd *cmd,
return mmc_read_data(hsmmc, data->dest,
data->blocksize * data->blocks);
- if (IS_ENABLED(CONFIG_MCI_WRITE))
+ if (IS_ENABLED(CONFIG_MCI_WRITE) && IN_PROPER)
return mmc_write_data(hsmmc, data->src,
data->blocksize * data->blocks);
diff --git a/drivers/mci/omap_hsmmc_pbl.c b/drivers/mci/omap_hsmmc_pbl.c
new file mode 100644
index 000000000000..0e6f39859d24
--- /dev/null
+++ b/drivers/mci/omap_hsmmc_pbl.c
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0-only
+// SPDX-FileCopyrightText: 2008 Texas Instruments (http://www.ti.com/, Sukumar Ghorai <s-ghorai at ti.com>)
+
+#include <pbl/mci.h>
+#include <pbl/bio.h>
+#include <mci.h>
+#include <debug_ll.h>
+#include <mach/omap/xload.h>
+
+#include "omap_hsmmc.h"
+
+static int pbl_omap_hsmmc_send_cmd(struct pbl_mci *mci,
+ struct mci_cmd *cmd,
+ struct mci_data *data)
+{
+ return omap_hsmmc_send_cmd(mci->priv, cmd, data);
+}
+
+static struct omap_hsmmc hsmmc;
+static struct pbl_mci mci;
+
+int omap_hsmmc_bio_init(struct pbl_bio *bio, void __iomem *iobase,
+ unsigned reg_ofs)
+{
+ hsmmc.iobase = iobase;
+ hsmmc.base = iobase + reg_ofs;
+
+ mci.priv = &hsmmc;
+ mci.send_cmd = pbl_omap_hsmmc_send_cmd;
+
+ return pbl_mci_bio_init(&mci, bio);
+}
--
2.39.5
More information about the barebox
mailing list