mmc: bcm2835: Add new driver for the sdhost controller
Subsystems (5)
v3 cover mmc: bcm2835: Add new driver for the sdhost controller
Hi,
Next version if the bcm2835 sdhost patch series.
New in v3:
* squashed in cleanups by Stefan.
* use one dma channel only.
* improve commit messages.
New in v2:
* DMA fixed.
* updated docs (kconfig, file comment, commit message) clarifying the two sd controller situation.
* some code cleanups, as pointed out by Stefan.
* dt bindings use mmc at ... now.
* added patches to update defconfigs.
* added patch for rpi3 device tree, so wifi is actually enabled.
please review & test,
Gerd
Eric Anholt (2):
dt-bindings: Add binding for brcm,bcm2835-sdhost.
mmc: bcm2835: Add new driver for the sdhost controller.
Gerd Hoffmann (5):
mmc: bcm2835: add sdhost controller to devicetree
arm: set CONFIG_MMC_BCM2835=y in bcm2835_defconfig and
multi_v7_defconfig
arm64: set CONFIG_MMC_BCM2835=y in defconfig
ARM: dts: bcm283x: switch from &sdhci to &sdhost
ARM: dts: bcm2837: add &sdhci and &sdhost
.../bindings/mmc/brcm,bcm2835-sdhost.txt | 23 + arch/arm/boot/dts/bcm2835-rpi.dtsi | 6 + arch/arm/boot/dts/bcm283x.dtsi | 10 + arch/arm/configs/bcm2835_defconfig | 1 + arch/arm/configs/multi_v7_defconfig | 1 + arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 17 + arch/arm64/configs/defconfig | 1 + drivers/mmc/host/Kconfig | 14 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/bcm2835.c | 1471 ++++++++++++++++++++ 10 files changed, 1545 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt create mode 100644 drivers/mmc/host/bcm2835.c
Signature · 1 line
1.8.3.1
PATCH v3 1/7 dt-bindings: Add binding for brcm,bcm2835-sdhost.
From: Eric Anholt <[email protected]>
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 | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt
Documentation/devicetree/bindings/mmc/brcm,bcm2835-sdhost.txt new file +23 -0
@@ -0,0 +1,23 @@ +Broadcom BCM2835 SDHOST controller + +This file documents differences between the core properties described +by mmc.txt and the properties that represent the BCM2835 controller. + +Required properties: +- compatible: Should be "brcm,bcm2835-sdhost". +- clocks: The clock feeding the SDHOST controller. + +Optional properties: +- dmas: DMA channel for read and write. + See Documentation/devicetree/bindings/dma/dma.txt for details + +Example: + +sdhost: mmc at 7e202000 { + compatible = "brcm,bcm2835-sdhost"; + reg = <0x7e202000 0x100>; + interrupts = <2 24>; + clocks = <&clocks BCM2835_CLOCK_VPU>; + dmas = <&dma 13>; + dma-names = "rx-tx"; +};
Signature · 1 line
1.8.3.1
PATCH v3 2/7 mmc: bcm2835: Add new driver for the sdhost controller.
In reply to Gerd HoffmannFrom: Eric Anholt <[email protected]>
The 2835 has two SD controllers: The Arasan sdhci controller (supported by the iproc driver) and a custom sdhost controller. This patch adds a driver for the latter.
The sdhci controller supports both sdcard and sdio. The sdhost controller supports the sdcard only, but has better performance. Also note that the rpi3 has sdio wifi, so driving the sdcard with the sdhost controller allows to use the sdhci controller for wifi support.
The configuration is done by devicetree via pin muxing. Both SD controller are available on the same pins (2 pin groups = pin 22 to 27 + pin 48 to 53). So it's possible to use both SD controllers at the same time with different pin groups.
The code was originally written by Phil Elwell in the downstream Rasbperry Pi tree, and I did a major cleanup on it (+319, -707 lines out of the original 2055) for inclusion.
cleanups by Gerd Hoffmann
mmc: bcm2835: zap mmiowb()
mmc: bcm2835: reset tweaks.
mmc: bcm2835: more reset tweaks.
mmc: bcm2835: rename bcm2835_sdhost to bcm2835
mmc: bcm2835: whitespace & comment style
mmc: bcm2835: zap bcm2835_write
mmc: bcm2835: zap bcm2835_read
mmc: bcm2835: zap bcm2835_read_relaxed
mmc: bcm2835: zap bcm2835_set_ios fwd decl
mmc: bcm2835: use dev_dbg()
mmc: bcm2835: use dev_err()
mmc: bcm2835: use dev_warn() + dev_into()
cleanups by Stefan Wahren
mmc: bcm2835: Fix checkpatch.pl warning
mmc: bcm2835: replace spaces with tabs
mmc: bcm2835: remove bcm2835_set_power
mmc: bcm2835: remove bcm2835_init()
mmc: bcm2835: Avoid separate init statement
mmc: bcm2835: Use local device ptr to make code more compact
mmc: bcm2835: Use local ptr to make code more compact
mmc: bcm2835: Use __func__ macro
mmc: bcm2835: sort includes alphabetical
mmc: bcm2835: fix includes
mmc: bcm2835: refactor bcm2835_wait_transfer_complete()
mmc: bcm2835: Handle error case of of_get_address
mmc: bcm2835: Use MMC_SEND_OP_COND instead of number
mmc: bcm2835: Rearrange mmc capabilities
mmc: bcm2835: Add missing include for threaded irq
mmc: bcm2835: Remove CMD_DALLY_US
mmc: bcm2835: Fix pio_timeout handling
mmc: bcm2835: Remove unnecessary return in bcm2835_data_irq
mmc: bcm2835: Handle error cases during probe
mmc: bcm2835: Print clk_max as decimal
mmc: bcm2835: Downrate message in case of PIO fallback
mmc: bcm2835: Don't unveil the data pointer
mmc: bcm2835: remove unused host members
mmc: bcm2835: Avoid unnecessary linebreaks
mmc: bcm2835: Add leading zero to register dumps
mmc: bcm2835: Align struct members with tabs
mmc: bcm2835: Rearrange bcm2835_finish_request()
mmc: bcm2835: Rearrange bcm2835_dma_complete_work()
mmc: bcm2835: Rename Kconfig switch
mmc: bcm2835: replace pio_limit with define
mmc: bcm2835: Increase max_blk_size to 1024
mmc: bcm2835: make internal functions static
mmc: bcm2835: reduce variable scope within bcm2835_transfer_block_pio
mmc: bcm2835: simplify burst words calculation
mmc: bcm2835: remove unnecessary debug messages
driver modernizations:
* run most driver code in thread context.
- use threaded irq handler.
- schedule worker for timeout handling.
* use mutex for locking, so we can easily sleep.
* simplify poll/wait code, drop tasklet and work queue.
* fix DMA support.
* use only one dma channel (port from downstream)
--- drivers/mmc/host/Kconfig | 14 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/bcm2835.c | 1471 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1486 insertions(+) create mode 100644 drivers/mmc/host/bcm2835.c
drivers/mmc/host/Kconfig +14 -0
@@ -790,6 +790,20 @@ config MMC_TOSHIBA_PCI depends on PCI help +config MMC_BCM2835 + tristate "Broadcom BCM2835 SDHOST MMC Controller support" + depends on ARCH_BCM2835 || COMPILE_TEST + depends on HAS_DMA + help + This selects the BCM2835 SDHOST MMC controller. If you have + a BCM2835 platform with SD or MMC devices, say Y or M here. + + Note that the BCM2835 has two SD controllers: The Arasan + sdhci controller (supported by MMC_SDHCI_IPROC) and a custom + sdhost controller (supported by this driver). + + If unsure, say N. + config MMC_MTK tristate "MediaTek SD/MMC Card Interface support" depends on HAS_DMA
drivers/mmc/host/Makefile +1 -0
@@ -58,6 +58,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) += bcm2835.o obj-$(CONFIG_MMC_REALTEK_PCI) += rtsx_pci_sdmmc.o obj-$(CONFIG_MMC_REALTEK_USB) += rtsx_usb_sdmmc.o
drivers/mmc/host/bcm2835.c new file +1471 -0
1,471 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 3/7 mmc: bcm2835: add sdhost controller to devicetree
In reply to Gerd Hoffmann--- arch/arm/boot/dts/bcm2835-rpi.dtsi | 6 ++++++ arch/arm/boot/dts/bcm283x.dtsi | 10 ++++++++++ 2 files changed, 16 insertions(+)
arch/arm/boot/dts/bcm2835-rpi.dtsi +6 -0
@@ -69,6 +69,12 @@ bus-width = <4>; }; +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; +}; + &pwm { pinctrl-names = "default"; pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>;
arch/arm/boot/dts/bcm283x.dtsi +10 -0
@@ -450,6 +450,16 @@ status = "disabled"; }; + sdhost: mmc at 7e202000 { + compatible = "brcm,bcm2835-sdhost"; + reg = <0x7e202000 0x100>; + interrupts = <2 24>; + clocks = <&clocks BCM2835_CLOCK_VPU>; + dmas = <&dma 13>; + dma-names = "rx-tx"; + status = "disabled"; + }; + hvs at 7e400000 { compatible = "brcm,bcm2835-hvs"; reg = <0x7e400000 0x6000>;
Signature · 1 line
1.8.3.1
PATCH v3 4/7 arm: set CONFIG_MMC_BCM2835=y in bcm2835_defconfig and multi_v7_defconfig
In reply to Gerd HoffmannWe need to enable this controller so that we can switch the SD card's pinmux over to it by default, which will improve storage performance.
Read access (dd with 64k blocks on rpi2):
CONFIG_MMC_SDHCI_IPROC: 11-12 MB/s
CONFIG_MMC_BCM2835: 19-20 MB/s
Differences on write access are pretty much in the noise.
--- arch/arm/configs/bcm2835_defconfig | 1 + arch/arm/configs/multi_v7_defconfig | 1 + 2 files changed, 2 insertions(+)
arch/arm/configs/bcm2835_defconfig +1 -0
@@ -92,6 +92,7 @@ CONFIG_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_PLTFM=y CONFIG_MMC_SDHCI_IPROC=y +CONFIG_MMC_BCM2835=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_GPIO=y
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -727,6 +727,7 @@ CONFIG_MMC_DW_EXYNOS=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SH_MMCIF=y CONFIG_MMC_SUNXI=y +CONFIG_MMC_BCM2835=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_CLASS_FLASH=m
Signature · 1 line
1.8.3.1
PATCH v3 5/7 arm64: set CONFIG_MMC_BCM2835=y in defconfig
In reply to Gerd HoffmannWe need to enable this controller so that we can switch the SD card's pinmux over to it by default, which will improve storage performance.
Read access (dd with 64k blocks on rpi2):
CONFIG_MMC_SDHCI_IPROC: 11-12 MB/s
CONFIG_MMC_BCM2835: 19-20 MB/s
Differences on write access are pretty much in the noise.
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -391,6 +391,7 @@ CONFIG_MMC_DW_EXYNOS=y CONFIG_MMC_DW_K3=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SUNXI=y +CONFIG_MMC_BCM2835=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_GPIO=y
Signature · 1 line
1.8.3.1
PATCH v3 6/7 ARM: dts: bcm283x: switch from &sdhci to &sdhost
In reply to Gerd Hoffmannsdcard access with the sdhost controller is faster.
Read access (dd with 64k blocks on rpi2):
CONFIG_MMC_SDHCI_IPROC: 11-12 MB/s
CONFIG_MMC_BCM2835: 19-20 MB/s
Differences on write access are pretty much in the noise.
--- arch/arm/boot/dts/bcm2835-rpi.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi.dtsi +1 -1
@@ -65,13 +65,13 @@ &sdhci { pinctrl-names = "default"; pinctrl-0 = <&emmc_gpio48>; - status = "okay"; bus-width = <4>; }; &sdhost { pinctrl-names = "default"; pinctrl-0 = <&sdhost_gpio48>; + status = "okay"; bus-width = <4>; };
Signature · 1 line
1.8.3.1
PATCH v3 7/7 ARM: dts: bcm2837: add &sdhci and &sdhost
In reply to Gerd HoffmannFor the raspberry pi 3 we'll need both sdhci (handles sdio wifi) and sdhost (handles sdcard).
--- arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +17 -0
@@ -22,3 +22,20 @@ &uart1 { status = "okay"; }; + +/* SDHCI is used to control the SDIO for wireless */ +&sdhci { + pinctrl-names = "default"; + pinctrl-0 = <&emmc_gpio34>; + status = "okay"; + bus-width = <4>; + non-removable; +}; + +/* SDHOST is used to drive the SD card */ +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + status = "okay"; + bus-width = <4>; +};
Signature · 1 line
1.8.3.1
Re: [PATCH v3 7/7] ARM: dts: bcm2837: add &sdhci and &sdhost
Hi Gerd,
Quoted 8 lines · Gerd Hoffmann
For the raspberry pi 3 we'll need both sdhci (handles sdio wifi) and sdhost (handles sdcard).
Signed-off-by Gerd Hoffmann <[email protected]>Acked-by Eric Anholt <[email protected]>--- arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
Subject prefix should be 'arm64:'.
baruch
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -Re: [PATCH v3 3/7] mmc: bcm2835: add sdhost controller to devicetree
In reply to Gerd HoffmannAm 21.02.2017 um 10:07 schrieb Gerd Hoffmann:
Quoted 35 lines
Signed-off-by Gerd Hoffmann <[email protected]>Acked-by Eric Anholt <[email protected]>--- arch/arm/boot/dts/bcm2835-rpi.dtsi | 6 ++++++ arch/arm/boot/dts/bcm283x.dtsi | 10 ++++++++++ 2 files changed, 16 insertions(+)arch/arm/boot/dts/bcm2835-rpi.dtsi +6
-0@@ -69,6 +69,12 @@ bus-width = <4>; }; +&sdhost { + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_gpio48>; + bus-width = <4>; +}; + &pwm { pinctrl-names = "default"; pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>;arch/arm/boot/dts/bcm283x.dtsi +3
-0@@ -450,6 +450,16 @@ status = "disabled"; }; + sdhost: mmc at 7e202000 { + compatible = "brcm,bcm2835-sdhost"; + reg = <0x7e202000 0x100>;
arch/arm/boot/dts/bcm283x.dtsi line 465
Quoted 10 lines
arch/arm/boot/dts/bcm283x.dtsi +7
-0+ interrupts = <2 24>; + clocks = <&clocks BCM2835_CLOCK_VPU>; + dmas = <&dma 13>; + dma-names = "rx-tx"; + status = "disabled"; + }; + hvs at 7e400000 { compatible = "brcm,bcm2835-hvs"; reg = <0x7e400000 0x6000>;
Unfortunately this is still the wrong place regarding to the register order. So please be placed it between uart0: serial at 7e201000 and i2s:
i2s at 7e203000.
Re: [PATCH v3 2/7] mmc: bcm2835: Add new driver for the sdhost controller.
In reply to Gerd HoffmannQuoted 16 lines · Gerd Hoffmann
From: Eric Anholt <[email protected]>
The 2835 has two SD controllers: The Arasan sdhci controller (supported by the iproc driver) and a custom sdhost controller. This patch adds a driver for the latter.
The sdhci controller supports both sdcard and sdio. The sdhost controller supports the sdcard only, but has better performance. Also note that the rpi3 has sdio wifi, so driving the sdcard with the sdhost controller allows to use the sdhci controller for wifi support.
The configuration is done by devicetree via pin muxing. Both SD controller are available on the same pins (2 pin groups = pin 22 to 27 + pin 48 to 53). So it's possible to use both SD controllers at the same time with different pin groups.
Quoted 5 lines
The code was originally written by Phil Elwell in the downstream Rasbperry Pi tree, and I did a major cleanup on it (+319, -707 lines out of the original 2055) for inclusion.
Signed-off-by Eric Anholt <[email protected]>
Ulf, what do you need done to this driver patch before it can go in?
The commit message seems like it could use some rewriting at this point
(Personally I would drop the detailed changelogs from Stefan and Gerd,
updating the last paragraph here to give them credit), but what's
important to me is getting the driver in so that distros don't have to
carry this patch for wifi support.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170301/2f4adaaf/attachment.sig>
Re: [PATCH v3 2/7] mmc: bcm2835: Add new driver for the sdhost controller.
Quoted 26 lines
Eric Anholt <[email protected]> hat am 1. M?rz 2017 um 19:00 geschrieben:
Quoted 20 lines · Gerd Hoffmann
From: Eric Anholt <[email protected]>
The 2835 has two SD controllers: The Arasan sdhci controller (supported by the iproc driver) and a custom sdhost controller. This patch adds a driver for the latter.
The sdhci controller supports both sdcard and sdio. The sdhost controller supports the sdcard only, but has better performance. Also note that the rpi3 has sdio wifi, so driving the sdcard with the sdhost controller allows to use the sdhci controller for wifi support.
The configuration is done by devicetree via pin muxing. Both SD controller are available on the same pins (2 pin groups = pin 22 to 27 + pin 48 to 53). So it's possible to use both SD controllers at the same time with different pin groups.
The code was originally written by Phil Elwell in the downstream Rasbperry Pi tree, and I did a major cleanup on it (+319, -707 lines out of the original 2055) for inclusion.
Quoted 8 lines
Quoted 1 line
Signed-off-by Eric Anholt <[email protected]>Ulf, what do you need done to this driver patch before it can go in? The commit message seems like it could use some rewriting at this point (Personally I would drop the detailed changelogs from Stefan and Gerd, updating the last paragraph here to give them credit), but what's important to me is getting the driver in so that distros don't have to carry this patch for wifi support.
I'm still working on 3 small patches for this driver:
1. trivial error in a register comment
2. ignore SDCMD_FAIL_FLAG during bcm2835_finish_command (downstream [1])
3. remove unnecessary call to bcm2835_reset_internal
I plan to submit them on Friday.
[1] - https://github.com/raspberrypi/linux/commit/711cade866c9f865f9b283c9369e9486f27d1fec
Re: [PATCH v3 2/7] mmc: bcm2835: Add new driver for the sdhost controller.
Quoted 36 lines · Stefan Wahren
Quoted 25 lines
Eric Anholt <[email protected]> hat am 1. M?rz 2017 um 19:00 geschrieben:
Quoted 20 lines · Gerd Hoffmann
From: Eric Anholt <[email protected]>
The 2835 has two SD controllers: The Arasan sdhci controller (supported by the iproc driver) and a custom sdhost controller. This patch adds a driver for the latter.
The sdhci controller supports both sdcard and sdio. The sdhost controller supports the sdcard only, but has better performance. Also note that the rpi3 has sdio wifi, so driving the sdcard with the sdhost controller allows to use the sdhci controller for wifi support.
The configuration is done by devicetree via pin muxing. Both SD controller are available on the same pins (2 pin groups = pin 22 to 27 + pin 48 to 53). So it's possible to use both SD controllers at the same time with different pin groups.
The code was originally written by Phil Elwell in the downstream Rasbperry Pi tree, and I did a major cleanup on it (+319, -707 lines out of the original 2055) for inclusion.
Quoted 8 lines
Quoted 1 line
Signed-off-by Eric Anholt <[email protected]>Ulf, what do you need done to this driver patch before it can go in? The commit message seems like it could use some rewriting at this point (Personally I would drop the detailed changelogs from Stefan and Gerd, updating the last paragraph here to give them credit), but what's important to me is getting the driver in so that distros don't have to carry this patch for wifi support.
I'm still working on 3 small patches for this driver:
Quoted 7 lines
1. trivial error in a register comment
2. ignoreSDCMD_FAIL_FLAGduringbcm2835_finish_command(downstream [1])
3. remove unnecessary call tobcm2835_reset_internalI plan to submit them on Friday.
[1] - https://github.com/raspberrypi/linux/commit/711cade866c9f865f9b283c9369e9486f27d1fec
Should any of those changes block merging the current code, though? It
doesn't sound like it to me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170301/84efa163/attachment.sig>
Re: [PATCH v3 2/7] mmc: bcm2835: Add new driver for the sdhost controller.
Quoted 46 lines
Eric Anholt <[email protected]> hat am 1. M?rz 2017 um 20:31 geschrieben:
Quoted 40 lines · Stefan Wahren
Quoted 25 lines
Eric Anholt <[email protected]> hat am 1. M?rz 2017 um 19:00 geschrieben:
Quoted 20 lines · Gerd Hoffmann
From: Eric Anholt <[email protected]>
The 2835 has two SD controllers: The Arasan sdhci controller (supported by the iproc driver) and a custom sdhost controller. This patch adds a driver for the latter.
The sdhci controller supports both sdcard and sdio. The sdhost controller supports the sdcard only, but has better performance. Also note that the rpi3 has sdio wifi, so driving the sdcard with the sdhost controller allows to use the sdhci controller for wifi support.
The configuration is done by devicetree via pin muxing. Both SD controller are available on the same pins (2 pin groups = pin 22 to 27 + pin 48 to 53). So it's possible to use both SD controllers at the same time with different pin groups.
The code was originally written by Phil Elwell in the downstream Rasbperry Pi tree, and I did a major cleanup on it (+319, -707 lines out of the original 2055) for inclusion.
Quoted 8 lines
Quoted 1 line
Signed-off-by Eric Anholt <[email protected]>Ulf, what do you need done to this driver patch before it can go in? The commit message seems like it could use some rewriting at this point (Personally I would drop the detailed changelogs from Stefan and Gerd, updating the last paragraph here to give them credit), but what's important to me is getting the driver in so that distros don't have to carry this patch for wifi support.
I'm still working on 3 small patches for this driver:
1. trivial error in a register comment
2. ignoreSDCMD_FAIL_FLAGduringbcm2835_finish_command(downstream [1])
3. remove unnecessary call tobcm2835_reset_internal
Quoted 5 lines
Quoted 3 lines
I plan to submit them on Friday.
[1] - https://github.com/raspberrypi/linux/commit/711cade866c9f865f9b283c9369e9486f27d1fec
Should any of those changes block merging the current code, though?
No, but the recursion about bcm2835_finish_command() and bcm2835_transfer_complete() is still there.
Hi Gerd,
Quoted 23 lines
Next version if the bcm2835 sdhost patch series.
New in v3:
* squashed in cleanups by Stefan.
* use one dma channel only.
* improve commit messages.New in v2:
* DMA fixed.
* updated docs (kconfig, file comment, commit message) clarifying the two sd controller situation.
* some code cleanups, as pointed out by Stefan.
* dt bindings use mmc at ... now.
* added patches to update defconfigs.
* added patch for rpi3 device tree, so wifi is actually enabled.please review & test,
GerdEric Anholt (2):
dt-bindings: Add binding for brcm,bcm2835-sdhost.
mmc: bcm2835: Add new driver for the sdhost controller.
Quoted 7 lines
Gerd Hoffmann (5):
mmc: bcm2835: add sdhost controller to devicetree
arm: setCONFIG_MMC_BCM2835=yinbcm2835_defconfigand
multi_v7_defconfig
arm64: setCONFIG_MMC_BCM2835=yin defconfig
ARM: dts: bcm283x: switch from &sdhci to &sdhost
ARM: dts: bcm2837: add &sdhci and &sdhost
I know there's a v4, which is the one I tested, but I don't see it on the rpi list. A few things I've found.
First the flipping of the mmc host driver for the SD card slot will cause issues for users that build it as a module. When I tested this on Fedora the first update I ended up with a system that didn't boot. I'm handling in Fedora with a dracut snippet which will pull both in both until that settles down.
Also i often see the device hang for a long period when systemd probes for rfkill status, sometimes it needs to be reset but it generally gets there.
Finally also seeing the following crash with the patches on 4.11rc2
[ 6.337148] sdhci: Secure Digital Host Controller Interface driver [ 6.349263] sdhci: Copyright(c) Pierre Ossman [ 6.362401] sdhci-pltfm: SDHCI platform and OF driver helper [ 6.381331] sdhost-bcm2835 3f202000.mmc: loaded - DMA enabled (>1) [ 6.412548] mmc1: SDHCI controller on 3f300000.sdhci [3f300000.sdhci] using PIO [ 6.445766] mmc1: queuing unknown CIS tuple 0x80 (2 bytes) [ 6.460651] mmc1: queuing unknown CIS tuple 0x80 (3 bytes) [ 6.473431] mmc1: queuing unknown CIS tuple 0x80 (3 bytes) [ 6.487820] mmc1: queuing unknown CIS tuple 0x80 (7 bytes) [ 6.509590] mmc0: host does not support reading read-only switch, assuming write-enable [ 6.511929] mmc0: new high speed SDHC card at address aaaa [ 6.527859] mmcblk0: mmc0:aaaa SL16G 14.8 GiB [ 6.528991] ------------[ cut here ]------------ [ 6.529018] WARNING: CPU: 2 PID: 326 at kernel/workqueue.c:2417 check_flush_dependency+0xac/0x134 [ 6.529033] workqueue: PF_MEMALLOC task 326(mmcqd/0) is flushing !WQ_MEM_RECLAIM events:drain_local_pages_wq [ 6.529036] Modules linked in: mmc_block(+) sdhci_iproc sdhci_pltfm sdhci pwm_bcm2835 bcm2835 i2c_bcm2835 mmc_core bcm2835_dma i2c_dev [ 6.529075] CPU: 2 PID: 326 Comm: mmcqd/0 Not tainted 4.11.0-0.rc2.git0.1.fc26.armv7hl #1 [ 6.529079] Hardware name: Generic DT based system [ 6.529106] [<c0311708>] (unwind_backtrace) from [<c030c438>] (show_stack+0x18/0x1c) [ 6.529122] [<c030c438>] (show_stack) from [<c0639b44>] (dump_stack+0x80/0xa0) [ 6.529137] [<c0639b44>] (dump_stack) from [<c034ca3c>] (__warn+0xe4/0x104) [ 6.529150] [<c034ca3c>] (__warn) from [<c034ca98>] (warn_slowpath_fmt+0x3c/0x4c) [ 6.529166] [<c034ca98>] (warn_slowpath_fmt) from [<c0363b2c>] (check_flush_dependency+0xac/0x134) [ 6.529184] [<c0363b2c>] (check_flush_dependency) from [<c036433c>] (flush_work+0xa0/0x178) [ 6.529201] [<c036433c>] (flush_work) from [<c0458084>] (drain_all_pages+0x1a8/0x1cc) [ 6.529221] [<c0458084>] (drain_all_pages) from [<c04b1d90>] (start_isolate_page_range+0x168/0x1b4) [ 6.529239] [<c04b1d90>] (start_isolate_page_range) from [<c045b854>] (alloc_contig_range+0xd4/0x314) [ 6.529258] [<c045b854>] (alloc_contig_range) from [<c04b6660>] (cma_alloc+0x188/0x300) [ 6.529275] [<c04b6660>] (cma_alloc) from [<c03161e8>] (__alloc_from_contiguous+0x40/0xd8) [ 6.529290] [<c03161e8>] (__alloc_from_contiguous) from [<c03162bc>] (cma_allocator_alloc+0x3c/0x44) [ 6.529303] [<c03162bc>] (cma_allocator_alloc) from [<c0316504>] (__dma_alloc+0x1d4/0x2f0) [ 6.529317] [<c0316504>] (__dma_alloc) from [<c0316698>] (arm_dma_alloc+0x3c/0x48) [ 6.529331] [<c0316698>] (arm_dma_alloc) from [<c049d120>] (dma_pool_alloc+0x124/0x240) [ 6.529356] [<c049d120>] (dma_pool_alloc) from [<bf009568>] (bcm2835_dma_create_cb_chain+0xb0/0x1dc [bcm2835_dma]) [ 6.529385] [<bf009568>] (bcm2835_dma_create_cb_chain [bcm2835_dma]) from [<bf009ad4>] (bcm2835_dma_prep_slave_sg+0xf0/0x25c [bcm2835_dma]) [ 6.529418] [<bf009ad4>] (bcm2835_dma_prep_slave_sg [bcm2835_dma]) from [<bf04af04>] (bcm2835_request+0x2a4/0x3f4 [bcm2835]) [ 6.529548] [<bf04af04>] (bcm2835_request [bcm2835]) from [<bf0145d0>] (mmc_start_request+0x1f8/0x264 [mmc_core]) [ 6.529756] [<bf0145d0>] (mmc_start_request [mmc_core]) from [<bf016204>] (mmc_start_areq+0x2c8/0x318 [mmc_core]) [ 6.529890] [<bf016204>] (mmc_start_areq [mmc_core]) from [<bf07fa1c>] (mmc_blk_issue_rw_rq+0xc0/0x308 [mmc_block]) [ 6.529943] [<bf07fa1c>] (mmc_blk_issue_rw_rq [mmc_block]) from [<bf080f84>] (mmc_blk_issue_rq+0x418/0x428 [mmc_block]) [ 6.529997] [<bf080f84>] (mmc_blk_issue_rq [mmc_block]) from [<bf081138>] (mmc_queue_thread+0x148/0x1bc [mmc_block]) [ 6.530031] [<bf081138>] (mmc_queue_thread [mmc_block]) from [<c036ae30>] (kthread+0x120/0x138) [ 6.530049] [<c036ae30>] (kthread) from [<c0307e58>] (ret_from_fork+0x14/0x3c) [ 6.530055] ---[ end trace 221a5a14ca55fa22 ]--- [ 6.545765] mmcblk0: p1 p2 p3 p4 [ 6.566015] random: fast init done [ 6.623699] mmc1: new high speed SDIO card at address 0001
Other than that you can add a Tested-by for me:
Peter
Hi,
Quoted 3 lines
First the flipping of the mmc host driver for the SD card slot will cause issues for users that build it as a module. When I tested this on Fedora the first update I ended up with a system that didn't boot.
Yep, switching drivers is a pain point here indeed.
Possibly we could fix that by adding a MODULE_SOFTDEP() to the iproc driver? Comments? Better ideas?
Quoted 3 lines
Also i often see the device hang for a long period when systemd probes for rfkill status, sometimes it needs to be reset but it generally gets there.
What device is that? rpi3 with wifi?
Quoted 47 lines
[ 6.529079] Hardware name: Generic DT based system [ 6.529106] [<c0311708>] (unwind_backtrace) from [<c030c438>] (show_stack+0x18/0x1c) [ 6.529122] [<c030c438>] (show_stack) from [<c0639b44>] (dump_stack+0x80/0xa0) [ 6.529137] [<c0639b44>] (dump_stack) from [<c034ca3c>] (__warn+0xe4/0x104) [ 6.529150] [<c034ca3c>] (__warn) from [<c034ca98>] (warn_slowpath_fmt+0x3c/0x4c) [ 6.529166] [<c034ca98>] (warn_slowpath_fmt) from [<c0363b2c>] (check_flush_dependency+0xac/0x134) [ 6.529184] [<c0363b2c>] (check_flush_dependency) from [<c036433c>] (flush_work+0xa0/0x178) [ 6.529201] [<c036433c>] (flush_work) from [<c0458084>] (drain_all_pages+0x1a8/0x1cc) [ 6.529221] [<c0458084>] (drain_all_pages) from [<c04b1d90>] (start_isolate_page_range+0x168/0x1b4) [ 6.529239] [<c04b1d90>] (start_isolate_page_range) from [<c045b854>] (alloc_contig_range+0xd4/0x314) [ 6.529258] [<c045b854>] (alloc_contig_range) from [<c04b6660>] (cma_alloc+0x188/0x300) [ 6.529275] [<c04b6660>] (cma_alloc) from [<c03161e8>] (__alloc_from_contiguous+0x40/0xd8) [ 6.529290] [<c03161e8>] (__alloc_from_contiguous) from [<c03162bc>] (cma_allocator_alloc+0x3c/0x44) [ 6.529303] [<c03162bc>] (cma_allocator_alloc) from [<c0316504>] (__dma_alloc+0x1d4/0x2f0) [ 6.529317] [<c0316504>] (__dma_alloc) from [<c0316698>] (arm_dma_alloc+0x3c/0x48) [ 6.529331] [<c0316698>] (arm_dma_alloc) from [<c049d120>] (dma_pool_alloc+0x124/0x240) [ 6.529356] [<c049d120>] (dma_pool_alloc) from [<bf009568>] (bcm2835_dma_create_cb_chain+0xb0/0x1dc [bcm2835_dma]) [ 6.529385] [<bf009568>] (bcm2835_dma_create_cb_chain [bcm2835_dma]) from [<bf009ad4>] (bcm2835_dma_prep_slave_sg+0xf0/0x25c [bcm2835_dma]) [ 6.529418] [<bf009ad4>] (bcm2835_dma_prep_slave_sg [bcm2835_dma]) from [<bf04af04>] (bcm2835_request+0x2a4/0x3f4 [bcm2835]) [ 6.529548] [<bf04af04>] (bcm2835_request [bcm2835]) from [<bf0145d0>] (mmc_start_request+0x1f8/0x264 [mmc_core]) [ 6.529756] [<bf0145d0>] (mmc_start_request [mmc_core]) from [<bf016204>] (mmc_start_areq+0x2c8/0x318 [mmc_core]) [ 6.529890] [<bf016204>] (mmc_start_areq [mmc_core]) from [<bf07fa1c>] (mmc_blk_issue_rw_rq+0xc0/0x308 [mmc_block]) [ 6.529943] [<bf07fa1c>] (mmc_blk_issue_rw_rq [mmc_block]) from [<bf080f84>] (mmc_blk_issue_rq+0x418/0x428 [mmc_block]) [ 6.529997] [<bf080f84>] (mmc_blk_issue_rq [mmc_block]) from[<
bf081138>] (mmc_queue_thread+0x148/0x1bc[mmc_block])
Quoted 8 lines
[ 6.530031] [<bf081138>] (mmc_queue_thread [mmc_block]) from [<c036ae30>] (kthread+0x120/0x138) [ 6.530049] [<c036ae30>] (kthread) from [<c0307e58>] (ret_from_fork+0x14/0x3c) [ 6.530055] ---[ end trace 221a5a14ca55fa22 ]--- [ 6.545765] mmcblk0: p1 p2 p3 p4 [ 6.566015] random: fast init done [ 6.623699] mmc1: new high speed SDIO card at address 0001
Looks more like a cma allocator issue on a quick glance.
cheers,
Gerd
Quoted 8 lines · Gerd Hoffmann
Hi,
Quoted 3 lines
First the flipping of the mmc host driver for the SD card slot will cause issues for users that build it as a module. When I tested this on Fedora the first update I ended up with a system that didn't boot.
Yep, switching drivers is a pain point here indeed.
Quoted 8 lines
Possibly we could fix that by adding a
MODULE_SOFTDEP()to the iproc driver? Comments? Better ideas?Quoted 3 lines
Also i often see the device hang for a long period when systemd probes for rfkill status, sometimes it needs to be reset but it generally gets there.
What device is that? rpi3 with wifi?
Yes, RPi3, with the brcmfmac43430-sdio.txt added so the firmware loads, interface works.
Quoted 56 lines
Quoted 47 lines
[ 6.529079] Hardware name: Generic DT based system [ 6.529106] [<c0311708>] (unwind_backtrace) from [<c030c438>] (show_stack+0x18/0x1c) [ 6.529122] [<c030c438>] (show_stack) from [<c0639b44>] (dump_stack+0x80/0xa0) [ 6.529137] [<c0639b44>] (dump_stack) from [<c034ca3c>] (__warn+0xe4/0x104) [ 6.529150] [<c034ca3c>] (__warn) from [<c034ca98>] (warn_slowpath_fmt+0x3c/0x4c) [ 6.529166] [<c034ca98>] (warn_slowpath_fmt) from [<c0363b2c>] (check_flush_dependency+0xac/0x134) [ 6.529184] [<c0363b2c>] (check_flush_dependency) from [<c036433c>] (flush_work+0xa0/0x178) [ 6.529201] [<c036433c>] (flush_work) from [<c0458084>] (drain_all_pages+0x1a8/0x1cc) [ 6.529221] [<c0458084>] (drain_all_pages) from [<c04b1d90>] (start_isolate_page_range+0x168/0x1b4) [ 6.529239] [<c04b1d90>] (start_isolate_page_range) from [<c045b854>] (alloc_contig_range+0xd4/0x314) [ 6.529258] [<c045b854>] (alloc_contig_range) from [<c04b6660>] (cma_alloc+0x188/0x300) [ 6.529275] [<c04b6660>] (cma_alloc) from [<c03161e8>] (__alloc_from_contiguous+0x40/0xd8) [ 6.529290] [<c03161e8>] (__alloc_from_contiguous) from [<c03162bc>] (cma_allocator_alloc+0x3c/0x44) [ 6.529303] [<c03162bc>] (cma_allocator_alloc) from [<c0316504>] (__dma_alloc+0x1d4/0x2f0) [ 6.529317] [<c0316504>] (__dma_alloc) from [<c0316698>] (arm_dma_alloc+0x3c/0x48) [ 6.529331] [<c0316698>] (arm_dma_alloc) from [<c049d120>] (dma_pool_alloc+0x124/0x240) [ 6.529356] [<c049d120>] (dma_pool_alloc) from [<bf009568>] (bcm2835_dma_create_cb_chain+0xb0/0x1dc [bcm2835_dma]) [ 6.529385] [<bf009568>] (bcm2835_dma_create_cb_chain [bcm2835_dma]) from [<bf009ad4>] (bcm2835_dma_prep_slave_sg+0xf0/0x25c [bcm2835_dma]) [ 6.529418] [<bf009ad4>] (bcm2835_dma_prep_slave_sg [bcm2835_dma]) from [<bf04af04>] (bcm2835_request+0x2a4/0x3f4 [bcm2835]) [ 6.529548] [<bf04af04>] (bcm2835_request [bcm2835]) from [<bf0145d0>] (mmc_start_request+0x1f8/0x264 [mmc_core]) [ 6.529756] [<bf0145d0>] (mmc_start_request [mmc_core]) from [<bf016204>] (mmc_start_areq+0x2c8/0x318 [mmc_core]) [ 6.529890] [<bf016204>] (mmc_start_areq [mmc_core]) from [<bf07fa1c>] (mmc_blk_issue_rw_rq+0xc0/0x308 [mmc_block]) [ 6.529943] [<bf07fa1c>] (mmc_blk_issue_rw_rq [mmc_block]) from [<bf080f84>] (mmc_blk_issue_rq+0x418/0x428 [mmc_block]) [ 6.529997] [<bf080f84>] (mmc_blk_issue_rq [mmc_block]) from[<
bf081138>] (mmc_queue_thread+0x148/0x1bc[mmc_block])Quoted 8 lines
[ 6.530031] [<bf081138>] (mmc_queue_thread [mmc_block]) from [<c036ae30>] (kthread+0x120/0x138) [ 6.530049] [<c036ae30>] (kthread) from [<c0307e58>] (ret_from_fork+0x14/0x3c) [ 6.530055] ---[ end trace 221a5a14ca55fa22 ]--- [ 6.545765] mmcblk0: p1 p2 p3 p4 [ 6.566015] random: fast init done [ 6.623699] mmc1: new high speed SDIO card at address 0001
Quoted 1 line
Looks more like a cma allocator issue on a quick glance.
Possibly, but only started once I added the dma drive into the initrd and happens right when the MMC driver loads, we're not even past switch root which is long before loading the vc4 driver which is the main cma consumer.