bcm2835 SDHOST controller
Subsystems (4)
cover bcm2835 SDHOST controller
Here's a series to enable the SDHOST controller. It gives us better performance than our old sdhci-bcm2835.c. The downstream Raspberry Pi kernel appears to be using this controller by default at this point.
I've tried to do some testing on it (mounting filesystem, reading/writing files, speed tests), but I'm not sure what a good testing regimen for storage drivers would be.
Eric Anholt (4):
dt-bindings: Add binding for brcm,bcm2835-sdhost.
mmc: bcm2835-sdhost: Add new driver for the internal SD controller.
ARM: bcm2835: Include SDHOST in the device tree.
ARM: bcm2835: Enable SDHOST by default.
.../bindings/mmc/brcm,bcm2835-sdhost.txt | 25 + arch/arm/boot/dts/bcm2835-rpi.dtsi | 10 +- arch/arm/boot/dts/bcm283x.dtsi | 8 + drivers/mmc/host/Kconfig | 9 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/bcm2835-sdhost.c | 1652 ++++++++++++++++++++ 6 files changed, 1704 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt create mode 100644 drivers/mmc/host/bcm2835-sdhost.c
Signature · 1 line
2.7.0
PATCH 1/4 dt-bindings: Add binding for brcm,bcm2835-sdhost.
This is the other SD controller on the platform, which can be swapped to the role of SD card host using pin muxing.
--- .../bindings/mmc/brcm,bcm2835-sdhost.txt | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt new file +25 -0
@@ -0,0 +1,25 @@ +Broadcom BCM2835 SDHOST controller + +This file documents differences between the core properties described +by mmc.txt and the properties that represent the BCM2835 SDHOST controller. + +Required properties: +- compatible: Must be "brcm,bcm2835-sdhost" +- clocks: The phandle for the clock feeding the SDHOST controller + +Optional properties: +- dmas: DMA channel phandles for read and write +- dma-names: DMA channel names for read and write, must be "rx" and "tx" + See Documentation/devicetree/bindings/dma/dma.txt for details + +Example: + +sdhost: sdhost at 7e202000 { + compatible = "brcm,bcm2835-sdhost"; + reg = <0x7e202000 0x100>; + interrupts = <2 24>; + clocks = <&clocks BCM2835_CLOCK_VPU>; + dmas = <&dma 13>, + <&dma 13>; + dma-names = "tx", "rx"; +};
Signature · 1 line
2.7.0
PATCH 2/4 mmc: bcm2835-sdhost: Add new driver for the internal SD controller.
In reply to Eric AnholtThe 2835 has two SD controllers: The Arasan SDHCI controller that we currently use, and a custom SD controller. The custom one runs faster at 16.7MB/sec reads on PIO (according to hdparm -t on a Pi 2B) instead of 10.15MB/sec, and up to 18.45MB/sec with DMA enabled.
The code was originally written by Phil Elwell in the downstream Rasbperry Pi tree, and I did a major cleanup on it (+319, -721 lines out of the original 2055) for inclusion.
--- drivers/mmc/host/Kconfig | 9 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/bcm2835-sdhost.c | 1652 +++++++++++++++++++++++++++++++++++++ 3 files changed, 1662 insertions(+) create mode 100644 drivers/mmc/host/bcm2835-sdhost.c
drivers/mmc/host/Kconfig +9 -0
@@ -778,6 +778,15 @@ config MMC_TOSHIBA_PCI depends on PCI help +config MMC_BCM2835_SDHOST + tristate "platform support for the BCM2835 SDHOST MMC Controller" + depends on ARCH_BCM2835 || COMPILE_TEST + help + This selects the BCM2835 SDHOST MMC controller. If you have a BCM2835 + platform with SD or MMC devices, say Y or M here. + + If unsure, say N. + config MMC_MTK tristate "MediaTek SD/MMC Card Interface support" depends on HAS_DMA
drivers/mmc/host/Makefile +1 -0
@@ -57,6 +57,7 @@ obj-$(CONFIG_MMC_MOXART) += moxart-mmc.o obj-$(CONFIG_MMC_SUNXI) += sunxi-mmc.o obj-$(CONFIG_MMC_USDHI6ROL0) += usdhi6rol0.o obj-$(CONFIG_MMC_TOSHIBA_PCI) += toshsd.o +obj-$(CONFIG_MMC_BCM2835_SDHOST) += bcm2835-sdhost.o obj-$(CONFIG_MMC_REALTEK_PCI) += rtsx_pci_sdmmc.o obj-$(CONFIG_MMC_REALTEK_USB) += rtsx_usb_sdmmc.o
drivers/mmc/host/bcm2835-sdhost.c new file +1652 -0
1,652 lines not on this page · raw message
Signature · 1 line
2.7.0
PATCH 3/4 ARM: bcm2835: Include SDHOST in the device tree.
In reply to Eric AnholtIt's disabled by default, and will be enabled by a particular board's DT. The DMA channels are also currently left out, because our DMA engine support doesn't yet include slave SG, and there doesn't appear to be a clean way to include "does slave SG" in the channel request/config process.
--- arch/arm/boot/dts/bcm283x.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/bcm283x.dtsi +8 -0
@@ -366,6 +366,14 @@ status = "disabled"; }; + sdhost: sdhost at 7e202000 { + compatible = "brcm,bcm2835-sdhost"; + reg = <0x7e202000 0x100>; + interrupts = <2 24>; + clocks = <&clocks BCM2835_CLOCK_VPU>; + status = "disabled"; + }; + pwm: pwm at 7e20c000 { compatible = "brcm,bcm2835-pwm"; reg = <0x7e20c000 0x28>;
Signature · 1 line
2.7.0
PATCH 4/4 ARM: bcm2835: Enable SDHOST by default.
In reply to Eric AnholtThis improves read speed on my SD card (as reported by hdparm -t) from 10.15MB/sec to 16.70MB/sec. Once we add slave DMA, we can get to 18.45MB/sec.
--- arch/arm/boot/dts/bcm2835-rpi.dtsi | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi.dtsi +9 -1
@@ -65,10 +65,18 @@ pinctrl-names = "default"; pinctrl-0 = <&emmc_gpio48>; - status = "okay"; bus-width = <4>; }; +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + + bus-width = <4>; + + status = "okay"; +}; + &pwm { pinctrl-names = "default"; pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>;
Signature · 1 line
2.7.0
Re: [PATCH 3/4] ARM: bcm2835: Include SDHOST in the device tree.
In reply to Eric AnholtHello.
Quoted 16 lines · Eric Anholt
It's disabled by default, and will be enabled by a particular board's DT. The DMA channels are also currently left out, because our DMA engine support doesn't yet include slave SG, and there doesn't appear to be a clean way to include "does slave SG" in the channel request/config process.
Signed-off-by Eric Anholt <[email protected]>--- arch/arm/boot/dts/bcm283x.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)arch/arm/boot/dts/bcm283x.dtsi +0
-0
arch/arm/boot/dts/bcm283x.dtsi line 369
Quoted 4 lines
arch/arm/boot/dts/bcm283x.dtsi +1
-0@@ -366,6 +366,14 @@ status = "disabled"; }; + sdhost: sdhost at 7e202000 {
Please just sd at 7e202000 to better comply with ePAPR.
[...]
MBR, Sergei
Quoted 11 lines · Eric Anholt
Here's a series to enable the SDHOST controller. It gives us better performance than our old
sdhci-bcm2835.c. The downstream Raspberry Pi kernel appears to be using this controller by default at this point.I've tried to do some testing on it (mounting filesystem, reading/writing files, speed tests), but I'm not sure what a good testing regimen for storage drivers would be.
Quoted 5 lines
Eric Anholt (4):
dt-bindings: Add binding for brcm,bcm2835-sdhost.
mmc: bcm2835-sdhost: Add new driver for the internal SD controller.
ARM: bcm2835: Include SDHOST in the device tree.
ARM: bcm2835: Enable SDHOST by default.
This patchset misses defconfig changes to enable
the new sdhost driver.
So we end up with a default kernel
without the sdhost driver compiled in
but with sdhost enabled in the default device-tree (patch4) resulting in a system that does not boot.
Thanks,
Martin
Re: [PATCH 1/4] dt-bindings: Add binding for brcm,bcm2835-sdhost.
In reply to Eric AnholtQuoted 4 lines · Eric Anholt
This is the other SD controller on the platform, which can be swapped to the role of SD card host using pin muxing.
Signed-off-by Eric Anholt <[email protected]>