diff mbox series

ARM: dts: bcm2711: Use bcm2711 compatible for sdhci

Message ID 20200120041740.193485-1-stephen@brennan.io (mailing list archive)
State New, archived
Headers show
Series ARM: dts: bcm2711: Use bcm2711 compatible for sdhci | expand

Commit Message

Stephen Brennan Jan. 20, 2020, 4:17 a.m. UTC
When booting Raspberry Pi 4B using a micro SDHC UHS class 1 card, the SD
card partitions never appear in /dev.  According to the device tree
bindings for Broadcom IPROC SDHCI controller, we should use
"brcm,bcm2711-emmc2" compatible string on BCM2711. Set this compatible
string, which allows these cards to be mounted.

Signed-off-by: Stephen Brennan <stephen@brennan.io>
---
 arch/arm/boot/dts/bcm2711.dtsi | 1 +
 1 file changed, 1 insertion(+)

Comments

Matthias Brugger Jan. 20, 2020, 8:59 a.m. UTC | #1
On 20/01/2020 05:17, Stephen Brennan wrote:
> When booting Raspberry Pi 4B using a micro SDHC UHS class 1 card, the SD
> card partitions never appear in /dev.  According to the device tree
> bindings for Broadcom IPROC SDHCI controller, we should use
> "brcm,bcm2711-emmc2" compatible string on BCM2711. Set this compatible
> string, which allows these cards to be mounted.
> 
> Signed-off-by: Stephen Brennan <stephen@brennan.io>
> ---
>  arch/arm/boot/dts/bcm2711.dtsi | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
> index b64865ad5a41..48e3b0162bda 100644
> --- a/arch/arm/boot/dts/bcm2711.dtsi
> +++ b/arch/arm/boot/dts/bcm2711.dtsi
> @@ -853,6 +853,7 @@ &mailbox {
>  };
>  
>  &sdhci {
> +	compatible = "brcm,bcm2711-emmc2";
>  	interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
>  };
>  
> 

hm, sdhci is used to drive the wifi chip:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/bcm2711-rpi-4-b.dts?h=v5.5-rc7#n79

Are you sure you use the upstream devicetree?

Regards,
Matthias
Nicolas Saenz Julienne Jan. 20, 2020, 11:03 a.m. UTC | #2
Hi Stephen,

On Sun, 2020-01-19 at 20:17 -0800, Stephen Brennan wrote:
> When booting Raspberry Pi 4B using a micro SDHC UHS class 1 card, the SD
> card partitions never appear in /dev.  According to the device tree
> bindings for Broadcom IPROC SDHCI controller, we should use
> "brcm,bcm2711-emmc2" compatible string on BCM2711. Set this compatible
> string, which allows these cards to be mounted.
> 
> Signed-off-by: Stephen Brennan <stephen@brennan.io>

Your UHS class 1 card should work out of the box using the current kernel
version. Note that the device node is defined here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/bcm2711.dtsi?h=v5.5-rc7#n255

and enabled here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/bcm2711-rpi-4-b.dts?h=v5.5-rc7#n98

Regards,
Nicolas
Stephen Brennan Jan. 20, 2020, 7:59 p.m. UTC | #3
Hi Nicolas,

You're right, this patch doesn't work (it doesn't even touch the correct 
device tree node). My bad.

> Your UHS class 1 card should work out of the box using the current
> kernel version.

I've been debugging an issue (reproduced on today's linux-next) in which my 
UHS class 1 card's partitions don't show up in `/dev`. For example, if I do 
`ls /dev | grep mmc`, I get just one result, "mmcblk1". I thought my patch 
fixed the issue, but it turns out that the issue is sporadic: on some 
boots, the issue manifests. On others, the partitions appear in /dev as 
normal. When I tested this patch, the issue had sporadically disappeared, 
leading me to believe the patch was effective.

Sorry for the noise! If you have any suggestions on debugging this, I'd 
appreciate it. As far as I know it could be anything - the particular card, 
the particular Pi, etc.

Thanks,
Stephen
Nicolas Saenz Julienne Jan. 20, 2020, 8:01 p.m. UTC | #4
Hi Stephen,

On Mon Jan 20, 2020 at 11:59 AM, Stephen Brennan wrote:
> Hi Nicolas,
>
> You're right, this patch doesn't work (it doesn't even touch the correct
> device tree node). My bad.
>
> > Your UHS class 1 card should work out of the box using the current
> > kernel version.
>
> I've been debugging an issue (reproduced on today's linux-next) in which
> my
> UHS class 1 card's partitions don't show up in `/dev`. For example, if I
> do
> `ls /dev | grep mmc`, I get just one result, "mmcblk1". I thought my
> patch
> fixed the issue, but it turns out that the issue is sporadic: on some
> boots, the issue manifests. On others, the partitions appear in /dev as
> normal. When I tested this patch, the issue had sporadically
> disappeared,
> leading me to believe the patch was effective.

Have you been playing with different device-trees? notably with the
Raspberry Pi foundation ones. Your mmc numbers could change, which might
be confusing.

If 100% sure it's failing, i.e. nothing happens for the mmc device after
seeing:

	mmc1: SDHCI controller on fe340000.emmc2 [fe340000.emmc2] using ADMA

I suggest enabling some extra debug options. Build the kernel with
DYNAMIC_DEBUG enabled and add dyndbg="module sdhci +mfp; module mmc_core
+mfp" to your kernel command line. It'll be extremely verbose for the
working case, but we can compare both and try to find something fishy.

Note that I use two UHS class 1 cards myself without issue.

> Sorry for the noise!

On the contrary, the more we are the better :)

Regards,
Nicolas
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index b64865ad5a41..48e3b0162bda 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -853,6 +853,7 @@  &mailbox {
 };
 
 &sdhci {
+	compatible = "brcm,bcm2711-emmc2";
 	interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
 };