From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 8/9] mci: omap_hsmmc: add xload implementation for PBL
Date: Tue, 22 Apr 2025 07:26:34 +0200 [thread overview]
Message-ID: <20250422052635.3423961-9-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250422052635.3423961-1-a.fatoum@pengutronix.de>
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@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@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
next prev parent reply other threads:[~2025-04-22 5:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-22 5:26 [PATCH 0/9] ARM: OMAP: beaglebone: add PBL SD xload support Ahmad Fatoum
2025-04-22 5:26 ` [PATCH 1/9] clocksource: make available in PBL Ahmad Fatoum
2025-04-22 5:26 ` [PATCH 2/9] clocksource: ti-dm: " Ahmad Fatoum
2025-04-22 5:26 ` [PATCH 3/9] mci: move mci_setup_cmd definition into header Ahmad Fatoum
2025-04-22 5:26 ` [PATCH 4/9] mci: add common PBL helper for chainloading after BootROM initialization Ahmad Fatoum
2025-04-22 5:26 ` [PATCH 5/9] mci: pbl: add autodetection of BootROM-initialized standard capacity cards Ahmad Fatoum
2025-04-22 5:26 ` [PATCH 6/9] mci: omap_hsmmc: split out common code Ahmad Fatoum
2025-04-22 5:26 ` [PATCH 7/9] ARM: OMAP: add am33xx_hsmmc_start_image for PBL Ahmad Fatoum
2025-04-22 5:26 ` Ahmad Fatoum [this message]
2025-04-22 5:26 ` [PATCH 9/9] ARM: OMAP: beaglebone: add PBL SD xload support Ahmad Fatoum
2025-04-22 10:55 ` [PATCH 0/9] " Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250422052635.3423961-9-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox