[PATCH v2 7/9] mci: add PCI SDHCI controller support

Sascha Hauer s.hauer at pengutronix.de
Mon Jun 29 01:47:43 PDT 2026


On 2026-06-26 18:19, Ahmad Fatoum wrote:
> QEMU can expose eMMC through the class-compliant sdhci-pci device, but
> barebox only had platform SDHCI glue. Add a PCI host driver that maps BAR0,
> enables bus mastering, initializes the SDHCI core and registers an MCI host.
> 
> This is intentionally small and PIO-based, which is enough for the QEMU RPMB
> test environment while reusing the common SDHCI helpers.

Is this comment wrong? The driver depends on HAS_DMA and even calls
sdhci_setup_adma().

> 
> Assisted-by: Codex:gpt-5.5
> Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
> ---
> v1 -> v2:
>   - new commit
> ---
>  drivers/mci/Kconfig     |   8 ++
>  drivers/mci/Makefile    |   1 +
>  drivers/mci/mci-core.c  |   2 +-
>  drivers/mci/sdhci-pci.c | 203 ++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 213 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/mci/sdhci-pci.c
> 
> diff --git a/drivers/mci/Kconfig b/drivers/mci/Kconfig
> index b38f7a3bdf8b..55e63aad92d4 100644
> --- a/drivers/mci/Kconfig
> +++ b/drivers/mci/Kconfig
> @@ -90,6 +90,14 @@ config MCI_MMC_RPMB
>  
>  comment "--- MCI host drivers ---"
>  
> +config MCI_SDHCI_PCI
> +	bool "PCI SDHCI controller"
> +	depends on PCI && HAS_DMA
> +	select MCI_SDHCI
> +	help
> +	  Enable support for PCI-attached SDHCI controllers, such as QEMU's
> +	  sdhci-pci device used to attach emulated eMMC devices.
> +
>  config MCI_DWC_MSHC
>  	bool "Synopsys DesignWare Cores MSHC"
>  	depends on HAS_DMA
> diff --git a/drivers/mci/Makefile b/drivers/mci/Makefile
> index 67a1f7bf1724..761f4187c079 100644
> --- a/drivers/mci/Makefile
> +++ b/drivers/mci/Makefile
> @@ -2,6 +2,7 @@
>  obj-$(CONFIG_MCI)		+= mci-core.o
>  pbl-$(CONFIG_MCI)		+= mci-pbl.o
>  obj-$(CONFIG_MCI_MMC_RPMB)	+= rpmb.o
> +obj-$(CONFIG_MCI_SDHCI_PCI)	+= sdhci-pci.o
>  obj-$(CONFIG_MCI_AM654)		+= am654-sdhci.o
>  obj-$(CONFIG_MCI_ARASAN)	+= arasan-sdhci.o
>  obj-$(CONFIG_MCI_ATMEL)		+= atmel_mci.o atmel_mci_common.o
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 4413fd1655aa..d6746fbec28f 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -2942,7 +2942,7 @@ static struct device_node *mci_get_partition_node(struct device_node *hwnode,
>  	struct device_node *np;
>  	char partnodename[sizeof("bootx-partitions")];
>  
> -	if (index > 8)
> +	if (!hwnode || index > 8)
>  		return NULL;

Should this be an extra patch?

Sascha

--
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list