mmc: add support for BST C1200 SDHCI controller
Subsystems (4)
v5 cover mmc: add support for BST C1200 SDHCI controller
This series adds MMC/eMMC controller support for Black Sesame Technologies C1200 SoC. BST is a leading automotive-grade computing SoC provider focusing on intelligent driving, computer vision, and AI capabilities for ADAS and autonomous driving applications. More information: https://bst.ai
== Background ==
This is the MMC portion split from the original v4 series [1] following feedback from Arnd Bergmann [2]. The platform support (vendor-prefix, SoC bindings, Kconfig ARCH_BST, base DTS, defconfig ARCH_BST) has already been merged into Linux 6.19 through the SoC tree [3].
== Series Overview ==
Patch 1: dt-bindings: mmc: add binding for BST DWCMSHC SDHCI controller Patch 2: mmc: sdhci: allow drivers to pre-allocate bounce buffer Patch 3: mmc: sdhci: add Black Sesame Technologies BST C1200 controller driver Patch 4: arm64: dts: bst: enable eMMC controller in C1200 CDCU1.0 board Patch 5: arm64: defconfig: enable BST SDHCI controller
Patch 6: MAINTAINERS: add MMC files to BST entry
== Testing ==
- checkpatch.pl: PASS (all patches)
- dt_binding_check: PASS
- dtbs_check (CHECK_DTBS=y): PASS
- Build tested with ARCH=arm64 defconfig
== Changes since v4 ==
- Split: Platform patches merged separately via SoC tree; this series is MMC-only, submitted to MMC maintainers
DT binding (patch 1):
- Rename file from bst,dwcmshc-sdhci.yaml to bst,c1200-sdhci.yaml
- Fix example compatible string to match property definition
Driver (patch 3):
- Fix compatible string to match dt-bindings (bst,c1200-sdhci)
- Simplify clock divider calculation with clearer frequency range logic
- Add linux/bits.h and linux/bitfield.h headers
- Remove unused linux/ioport.h header
- Rename SDHCI_TUNING_COUNT to BST_TUNING_COUNT
- Rename BST_EMMC_CTRL_BIT2 to BST_EMMC_CTRL_RST_N
- Fix BST_DEFAULT_MAX_FREQ from 2MHz to 200MHz
- Convert kernel-doc to regular comments (per Adrian Hunter)
- Add sdhci_bst_free_bounce_buffer() helper (per Adrian Hunter)
== References ==
[1] v4: https://lore.kernel.org/lkml/[email protected]/
[2] Split: https://lore.kernel.org/lkml/[email protected]/
[3] Merged via soc-newsoc-6.19
Albert Yang (6):
dt-bindings: mmc: add binding for BST DWCMSHC SDHCI controller
mmc: sdhci: allow drivers to pre-allocate bounce buffer
mmc: sdhci: add Black Sesame Technologies BST C1200 controller driver
arm64: dts: bst: enable eMMC controller in C1200 CDCU1.0 board
arm64: defconfig: enable BST SDHCI controller
MAINTAINERS: add MMC files to BST entry
.../bindings/mmc/bst,c1200-sdhci.yaml | 70 +++ MAINTAINERS | 2 + .../dts/bst/bstc1200-cdcu1.0-adas_4c2g.dts | 19 + arch/arm64/boot/dts/bst/bstc1200.dtsi | 18 + arch/arm64/configs/defconfig | 1 + drivers/mmc/host/Kconfig | 14 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-of-bst.c | 521 ++++++++++++++++++ drivers/mmc/host/sdhci.c | 7 + 9 files changed, 653 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/bst,c1200-sdhci.yaml create mode 100644 drivers/mmc/host/sdhci-of-bst.c
base-commit: 0f61b1860cc3f52aef9036d7235ed1f017632193
Signature · 1 line
2.43.0
PATCH v5 1/6 dt-bindings: mmc: add binding for BST DWCMSHC SDHCI controller
Add device tree bindings for the Black Sesame Technologies DWCMSHC SDHCI controller used in C1200 SoC.
The binding describes a Synopsys DesignWare Cores Mobile Storage Host Controller with BST-specific extensions including:
- Two register regions (core SDHCI and CRM registers)
- Optional memory-region for bounce buffer support
- Fixed clock input
---
Changes for v5:
- Rename file from bst,dwcmshc-sdhci.yaml to bst,c1200-sdhci.yaml
- Fix example compatible string to match property definition
- Split from platform series per Arnd's feedback
Changes for v4:
- Change \$ref to sdhci-common.yaml#
- Change compatible to bst,c1200-sdhci
Changes for v3:
- Switch reg schema to explicit items with descriptions
- Improve example with bus node wrapper
Changes for v2:
- Simplify description, correct compatible string
--- .../bindings/mmc/bst,c1200-sdhci.yaml | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/bst,c1200-sdhci.yaml
Documentation/devicetree/bindings/mmc/bst,c1200-sdhci.yaml new file +70 -0
@@ -0,0 +1,70 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mmc/bst,c1200-sdhci.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Black Sesame Technologies DWCMSHC SDHCI Controller + +maintainers: + - Ge Gordon <[email protected]> + +allOf: + - $ref: sdhci-common.yaml# + +properties: + compatible: + const: bst,c1200-sdhci + + reg: + items: + - description: Core SDHCI registers + - description: CRM registers + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: core + + memory-region: + maxItems: 1 + + dma-coherent: true + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + bus { + #address-cells = <2>; + #size-cells = <2>; + + mmc@22200000 { + compatible = "bst,c1200-sdhci"; + reg = <0x0 0x22200000 0x0 0x1000>, + <0x0 0x23006000 0x0 0x1000>; + interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk_mmc>; + clock-names = "core"; + memory-region = <&mmc0_reserved>; + max-frequency = <200000000>; + bus-width = <8>; + non-removable; + dma-coherent; + }; + };
Signature · 1 line
2.43.0
PATCH v5 2/6 mmc: sdhci: allow drivers to pre-allocate bounce buffer
In reply to Albert YangAllow platform drivers to pre-allocate bounce buffer by checking if host->bounce_buffer is already set before attempting allocation.
This enables platforms with specific DMA constraints (such as 32-bit DMA on controllers that cannot access high memory) to use their own reserved memory regions for the bounce buffer.
---
Changes for v5:
- Split from platform series per Arnd's feedback
Changes for v4:
- New patch suggested by Adrian Hunter
--- drivers/mmc/host/sdhci.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/mmc/host/sdhci.c +7 -0
@@ -4193,6 +4193,12 @@ static void sdhci_allocate_bounce_buffer(struct sdhci_host *host)unsigned int bounce_size;int ret; +/* Drivers may have already allocated the buffer */ +if (host->bounce_buffer) { + bounce_size = host->bounce_buffer_size; + max_blocks = bounce_size /512 ; + goto out; + }/* * Cap the bounce buffer at 64KB. Using a bigger bounce buffer * has diminishing returns, this is probably because SD/MMC
@@ -4241,6 +4247,7 @@ static void sdhci_allocate_bounce_buffer(struct sdhci_host *host) host->bounce_buffer_size = bounce_size; +out:/* Lie about this since we're bouncing */ mmc->max_segs = max_blocks; mmc->max_seg_size = bounce_size;
Signature · 1 line
2.43.0
PATCH v5 3/6 mmc: sdhci: add Black Sesame Technologies BST C1200 controller driver
In reply to Albert YangAdd SDHCI controller driver for Black Sesame Technologies C1200 SoC.
This driver supports the DWCMSHC SDHCI controller with BST-specific enhancements including:
- Custom clock management and tuning
- Power management support
- BST-specific register configurations
- Support for eMMC and SD card interfaces
- Hardware limitation workaround for 32-bit DMA addressing
The driver addresses specific hardware constraints where:
- System memory uses 64-bit bus, eMMC controller uses 32-bit bus
- eMMC controller cannot access memory through SMMU due to hardware bug
- All system DRAM is configured outside 4GB boundary (ZONE_DMA32)
- Uses SRAM-based bounce buffer within 32-bit address space
---
Changes for v5:
- Split from platform series per Arnd's feedback
- Fix compatible string to match dt-bindings (bst,c1200-sdhci)
- Simplify clock divider calculation with clearer frequency range logic
- Add linux/bits.h and linux/bitfield.h headers
- Remove unused linux/ioport.h header
- Rename SDHCI_TUNING_COUNT to BST_TUNING_COUNT
- Rename BST_EMMC_CTRL_BIT2 to BST_EMMC_CTRL_RST_N
- Fix BST_DEFAULT_MAX_FREQ from 2MHz to 200MHz
- Convert kernel-doc to regular comments (per Adrian Hunter)
- Add sdhci_bst_free_bounce_buffer() helper (per Adrian Hunter)
Changes for v4:
- Rename functions from bst_* to sdhci_bst_*
- Rename driver file to sdhci-of-bst.c
- Replace manual polling with read_poll_timeout()
- Add SDHCI_QUIRK_BROKEN_ADMA quirk
- Add Acked-by: Arnd Bergmann
Changes for v3:
- Simplify dwcmshc_priv structure
- Use devm_platform_ioremap_resource()
Changes for v2:
- Remove COMMON_CLK dependency
- Add ARCH_BST || COMPILE_TEST dependency
- Replace temporary ioremap with persistent mapping
--- drivers/mmc/host/Kconfig | 14 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-of-bst.c | 521 ++++++++++++++++++++++++++++++++ 3 files changed, 536 insertions(+) create mode 100644 drivers/mmc/host/sdhci-of-bst.c
drivers/mmc/host/Kconfig +14 -0
@@ -429,6 +429,20 @@ config MMC_SDHCI_BCM_KONA If you have a controller with this interface, say Y or M here. +config MMC_SDHCI_BST + tristate "SDHCI support for Black Sesame Technologies BST C1200 controller" + depends on ARCH_BST || COMPILE_TEST + depends on MMC_SDHCI_PLTFM + depends on OF + help + This selects the Secure Digital Host Controller Interface (SDHCI) + for Black Sesame Technologies BST C1200 SoC. The controller is + based on Synopsys DesignWare Cores Mobile Storage Controller but + requires platform-specific workarounds for hardware limitations. + + If you have a controller with this interface, say Y or M here. + If unsure, say N. + config MMC_SDHCI_F_SDH30 tristate "SDHCI support for Fujitsu Semiconductor F_SDH30" depends on MMC_SDHCI_PLTFM
drivers/mmc/host/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_MMC_MXS) += mxs-mmc.o obj-$(CONFIG_MMC_SDHCI) += sdhci.o obj-$(CONFIG_MMC_SDHCI_UHS2) += sdhci-uhs2.o obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o +obj-$(CONFIG_MMC_SDHCI_BST) += sdhci-of-bst.o sdhci-pci-y += sdhci-pci-core.o sdhci-pci-o2micro.o sdhci-pci-arasan.o \ sdhci-pci-dwc-mshc.o sdhci-pci-gli.o obj-$(CONFIG_MMC_SDHCI_ACPI) += sdhci-acpi.o
drivers/mmc/host/sdhci-of-bst.c new file +521 -0
521 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v5 4/6 arm64: dts: bst: enable eMMC controller in C1200 CDCU1.0 board
In reply to Albert YangAdd eMMC controller support to the BST C1200 device tree:
- bstc1200.dtsi: Add mmc0 node for the DWCMSHC SDHCI controller with basic configuration (disabled by default)
- bstc1200.dtsi: Add fixed clock definition for MMC controller
- bstc1200-cdcu1.0-adas_4c2g.dts: Enable mmc0 with board-specific configuration including 8-bit bus width and reserved SRAM buffer
The bounce buffer in reserved SRAM addresses hardware constraints where the eMMC controller cannot access main system memory through SMMU due to a hardware bug, and all DRAM is located outside the 4GB boundary.
---
Changes for v5:
- Split from platform series per Arnd's feedback
Changes for v4:
- Change compatible to bst,c1200-sdhci
- Move bus-width and non-removable to board dts
Changes for v3:
- Split defconfig into dedicated patch
Changes for v2:
- Reorganize memory map, standardize interrupt definitions
--- .../dts/bst/bstc1200-cdcu1.0-adas_4c2g.dts | 19 +++++++++++++++++++ arch/arm64/boot/dts/bst/bstc1200.dtsi | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+)
arch/arm64/boot/dts/bst/bstc1200-cdcu1.0-adas_4c2g.dts +19 -0
@@ -17,6 +17,25 @@ memory@810000000 { <0x8 0xc0000000 0x1 0x0>, <0xc 0x00000000 0x0 0x40000000>; }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + mmc0_reserved: mmc0-reserved@5160000 { + compatible = "shared-dma-pool"; + reg = <0x0 0x5160000 0x0 0x10000>; + no-map; + }; + }; +}; + +&mmc0 { + bus-width = <8>; + memory-region = <&mmc0_reserved>; + non-removable; + status = "okay"; }; &uart0 {
arch/arm64/boot/dts/bst/bstc1200.dtsi +18 -0
@@ -7,6 +7,12 @@ / { #address-cells = <2>; #size-cells = <2>; + clk_mmc: clock-4000000 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <4000000>; + }; + cpus { #address-cells = <1>; #size-cells = <0>;
@@ -72,6 +78,18 @@ uart0: serial@20008000 { status = "disabled"; }; + mmc0: mmc@22200000 { + compatible = "bst,c1200-sdhci"; + reg = <0x0 0x22200000 0x0 0x1000>, + <0x0 0x23006000 0x0 0x1000>; + clocks = <&clk_mmc>; + clock-names = "core"; + dma-coherent; + interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>; + max-frequency = <200000000>; + status = "disabled"; + }; + gic: interrupt-controller@32800000 { compatible = "arm,gic-v3"; reg = <0x0 0x32800000 0x0 0x10000>,
Signature · 1 line
2.43.0
PATCH v5 5/6 arm64: defconfig: enable BST SDHCI controller
In reply to Albert YangEnable CONFIG_MMC_SDHCI_BST to support eMMC on Black Sesame Technologies C1200 boards.
---
Changes for v5:
- Split from platform series per Arnd's feedback
Changes for v4:
- Move CONFIG_MMC_SDHCI_BST before CONFIG_MMC_SDHCI_F_SDH30
Changes for v3:
- Split from arm64: dts patch
Changes for v2:
- Initial defconfig change included in DTS patch
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -1222,6 +1222,7 @@ CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_ARMMMCI=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ACPI=y +CONFIG_MMC_SDHCI_BST=y CONFIG_MMC_SDHCI_PLTFM=y CONFIG_MMC_SDHCI_OF_ARASAN=y CONFIG_MMC_SDHCI_OF_ESDHC=y
Signature · 1 line
2.43.0
Re: [PATCH v5 5/6] arm64: defconfig: enable BST SDHCI controller
arch/arm64/configs/defconfig CONFIG_MMC_BLOCK_MINORS=32 · line 1225
Quoted 9 lines · Albert Yang
arch/arm64/configs/defconfig +1
-0@@ -1222,6 +1222,7 @@ CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_ARMMMCI=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ACPI=y +CONFIG_MMC_SDHCI_BST=y
This is still wrongly ordered. Look at your Kconfig. Run savedefconfig.
Best regards,
Krzysztof
Re: [PATCH v5 5/6] arm64: defconfig: enable BST SDHCI controller
Quoted 12 lines · Krzysztof Kozlowski
arch/arm64/configs/defconfig CONFIG_MMC_BLOCK_MINORS=32 · line 1225
Quoted 9 lines · Albert Yang
arch/arm64/configs/defconfig +1
-0@@ -1222,6 +1222,7 @@ CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_ARMMMCI=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ACPI=y +CONFIG_MMC_SDHCI_BST=yThis is still wrongly ordered. Look at your
Kconfig. Run savedefconfig.
Hi Krzysztof,
Thank you for catching this again. Sorry for the repeated mistake.
I incorrectly placed CONFIG_MMC_SDHCI_BST right after CONFIG_MMC_SDHCI_ACPI, but in Kconfig, MMC_SDHCI_BST is defined after MMC_SDHCI_BCM_KONA (much later than MMC_SDHCI_ACPI). I have now run savedefconfig and confirmed the correct position is between CONFIG_MMC_SDHCI_TEGRA and CONFIG_MMC_SDHCI_F_SDH30:
CONFIG_MMC_SDHCI_TEGRA=y
+CONFIG_MMC_SDHCI_BST=y
CONFIG_MMC_SDHCI_F_SDH30=y
Will fix this in v6 along with the DTS patch, which will be submitted to the SoC tree as per Ulf's direction.
Best regards,
Albert
PATCH v5 6/6 MAINTAINERS: add MMC files to BST entry
In reply to Albert YangAdd the MMC device tree binding and driver files to the existing ARM/BST SOC SUPPORT maintainer entry.
---
Changes for v5:
- Split from platform series per Arnd's feedback
Changes for v4:
- Changed driver file name to sdhci-of-bst.c
Changes for v3:
- Consolidate BST maintainer entries
Changes for v2:
- Initial MAINTAINERS entry in platform patch
--- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
@@ -2596,7 +2596,9 @@ R: BST Linux Kernel Upstream Group <[email protected]> L: [email protected] (moderated for non-subscribers) S: Supported F: Documentation/devicetree/bindings/arm/bst.yaml +F: Documentation/devicetree/bindings/mmc/bst,c1200-sdhci.yaml F: arch/arm64/boot/dts/bst/ +F: drivers/mmc/host/sdhci-of-bst.c ARM/CALXEDA HIGHBANK ARCHITECTURE M: Andre Przywara <[email protected]>
Signature · 1 line
2.43.0
Quoted 77 lines · Albert Yang
This series adds MMC/eMMC controller support for Black Sesame Technologies C1200 SoC. BST is a leading automotive-grade computing SoC provider focusing on intelligent driving, computer vision, and AI capabilities for ADAS and autonomous driving applications. More information: https://bst.ai
== Background ==
This is the MMC portion split from the original v4 series [1] following feedback from Arnd Bergmann [2]. The platform support (vendor-prefix, SoC bindings,
KconfigARCH_BST, base DTS, defconfigARCH_BST) has already been merged into Linux 6.19 through the SoC tree [3].== Series Overview ==
Patch 1: dt-bindings: mmc: add binding for BST DWCMSHC SDHCI controller Patch 2: mmc: sdhci: allow drivers to pre-allocate bounce buffer Patch 3: mmc: sdhci: add Black Sesame Technologies BST C1200 controller driver Patch 4: arm64: dts: bst: enable eMMC controller in C1200 CDCU1.0 board Patch 5: arm64: defconfig: enable BST SDHCI controller
Patch 6:MAINTAINERS: add MMC files to BST entry== Testing ==
- checkpatch.pl: PASS (all patches)
-dt_binding_check: PASS
-dtbs_check(CHECK_DTBS=y): PASS
- Build tested with ARCH=arm64 defconfig== Changes since v4 ==
- Split: Platform patches merged separately via SoC tree; this series is MMC-only, submitted to MMC maintainers
DT binding (patch 1):
- Rename file from bst,dwcmshc-sdhci.yaml to bst,c1200-sdhci.yaml
- Fix example compatible string to match property definitionDriver (patch 3):
- Fix compatible string to match dt-bindings (bst,c1200-sdhci)
- Simplify clock divider calculation with clearer frequency range logic
- Addlinux/bits.handlinux/bitfield.hheaders
- Remove unusedlinux/ioport.hheader
- RenameSDHCI_TUNING_COUNTtoBST_TUNING_COUNT
- RenameBST_EMMC_CTRL_BIT2toBST_EMMC_CTRL_RST_N
- FixBST_DEFAULT_MAX_FREQfrom 2MHz to 200MHz
- Convert kernel-doc to regular comments (per Adrian Hunter)
- Addsdhci_bst_free_bounce_buffer()helper (per Adrian Hunter)== References ==
[1] v4: https://lore.kernel.org/lkml/[email protected]/
[2] Split: https://lore.kernel.org/lkml/[email protected]/
[3] Merged via soc-newsoc-6.19Albert Yang (6):
dt-bindings: mmc: add binding for BST DWCMSHC SDHCI controller
mmc: sdhci: allow drivers to pre-allocate bounce buffer
mmc: sdhci: add Black Sesame Technologies BST C1200 controller driver
arm64: dts: bst: enable eMMC controller in C1200 CDCU1.0 board
arm64: defconfig: enable BST SDHCI controller
MAINTAINERS: add MMC files to BST entry.../bindings/mmc/bst,c1200-sdhci.yaml | 70 +++ MAINTAINERS | 2 + .../dts/bst/bstc1200-cdcu1.0-adas_4c2g.dts | 19 + arch/arm64/boot/dts/bst/bstc1200.dtsi | 18 + arch/arm64/configs/defconfig | 1 + drivers/mmc/host/Kconfig | 14 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-of-bst.c | 521 ++++++++++++++++++ drivers/mmc/host/sdhci.c | 7 + 9 files changed, 653 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/bst,c1200-sdhci.yaml create mode 100644 drivers/mmc/host/sdhci-of-bst.c
Quoted 4 lines
base-commit:
0f61b1860cc3f52aef9036d7235ed1f017632193--
2.43.0
Patch 1 to 3 and patch 6 applied for next, thanks!
The DTS patches (patch 4 and patch 5) should be picked up by the SoC maintainer.
Kind regards
Uffe
Hi Ulf,
Quoted 4 lines · Ulf Hansson
Patch 1 to 3 and patch 6 applied for next, thanks!
The DTS patches (patch 4 and patch 5) should be picked up by the SoC maintainer.
Thank you for the review!
I will send the DTS and defconfig patches (original v5 patches 4 and 5) separately to the SoC maintainers as a v6 series.
Best regards,
Albert