# \[PATCH AUTOSEL 5.10 11/47\] mmc: sdhci-iproc: Add ACPI bindings for the RPi

- Subsystems: MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM, SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) DRIVER, THE REST
- Maintainers: Ulf Hansson, Adrian Hunter, Linus Torvalds
- Status: REVIEWED · 1 review, 1 by a maintainer (M Florian Fainelli)
- Reviewed.
- 1 review trailer.
- List: linux-arm-kernel
- 3 messages, 2 authors
- Page: https://ratatoskr.run/linux-arm-kernel/2021/03/6285664/t

## \[PATCH AUTOSEL 5.10 11/47\] mmc: sdhci-iproc: Add ACPI bindings for the RPi

- From: Sasha Levin \<sashal@kernel.org\>
- Date: 2021-03-02 19:49:12 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/03/6285664.md

```text
From: Jeremy Linton <redacted>

[ Upstream commit 4f9833d3ec8da34861cd0680b00c73e653877eb9 ]

The RPi4 has an Arasan controller it carries over from the RPi3 and a newer
eMMC2 controller.  Because of a couple of quirks, it seems wiser to bind
these controllers to the same driver that DT is using on this platform
rather than the generic sdhci_acpi driver with PNP0D40.

So, BCM2847 describes the older Arasan and BRCME88C describes the newer
eMMC2. The older Arasan is reusing an existing ACPI _HID used by other OSes
booting these tables on the RPi.

With this change, Linux is capable of utilizing the SD card slot, and the
Wi-Fi when booted with UEFI+ACPI on the RPi4.

Signed-off-by: Jeremy Linton <redacted>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20210120000406.1843400-2-jeremy.linton@arm.com
Signed-off-by: Ulf Hansson <redacted>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mmc/host/sdhci-iproc.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index c9434b461aab..ddeaf8e1f72f 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -296,9 +296,27 @@ static const struct of_device_id sdhci_iproc_of_match[] = {
 MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
 
 #ifdef CONFIG_ACPI
+/*
+ * This is a duplicate of bcm2835_(pltfrm_)data without caps quirks
+ * which are provided by the ACPI table.
+ */
+static const struct sdhci_pltfm_data sdhci_bcm_arasan_data = {
+	.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
+		  SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
+		  SDHCI_QUIRK_NO_HISPD_BIT,
+	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+	.ops = &sdhci_iproc_32only_ops,
+};
+
+static const struct sdhci_iproc_data bcm_arasan_data = {
+	.pdata = &sdhci_bcm_arasan_data,
+};
+
 static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
 	{ .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data },
 	{ .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
+	{ .id = "BCM2847",  .driver_data = (kernel_ulong_t)&bcm_arasan_data },
+	{ .id = "BRCME88C", .driver_data = (kernel_ulong_t)&bcm2711_data },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids);
-- 
2.30.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```

## Re: \[PATCH AUTOSEL 5.10 11/47\] mmc: sdhci-iproc: Add ACPI bindings for the RPi

- From: Jeremy Linton \<hidden\>
- Date: 2021-03-02 19:56:55 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/03/6285692.md

```text
Hi,


On 3/2/21 5:56 AM, Sasha Levin wrote:
> From: Jeremy Linton <redacted>
>
> [ Upstream commit 4f9833d3ec8da34861cd0680b00c73e653877eb9 ]
>
> The RPi4 has an Arasan controller it carries over from the RPi3 and a newer
> eMMC2 controller.  Because of a couple of quirks, it seems wiser to bind
> these controllers to the same driver that DT is using on this platform
> rather than the generic sdhci_acpi driver with PNP0D40.
>
> So, BCM2847 describes the older Arasan and BRCME88C describes the newer
> eMMC2. The older Arasan is reusing an existing ACPI _HID used by other OSes
> booting these tables on the RPi.
>
> With this change, Linux is capable of utilizing the SD card slot, and the
> Wi-Fi when booted with UEFI+ACPI on the RPi4.

For this to actually work on kernels < 5.11 you also need:

c5b1c6dc13da mmc: sdhci: Update firmware interface API

Which I don't see in 5.10 yet.

Thanks,

>
> Signed-off-by: Jeremy Linton <redacted>
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> Link: https://lore.kernel.org/r/20210120000406.1843400-2-jeremy.linton@arm.com
> Signed-off-by: Ulf Hansson <redacted>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>   drivers/mmc/host/sdhci-iproc.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index c9434b461aab..ddeaf8e1f72f 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -296,9 +296,27 @@ static const struct of_device_id sdhci_iproc_of_match[] = {
>   MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
>   
>   #ifdef CONFIG_ACPI
> +/*
> + * This is a duplicate of bcm2835_(pltfrm_)data without caps quirks
> + * which are provided by the ACPI table.
> + */
> +static const struct sdhci_pltfm_data sdhci_bcm_arasan_data = {
> +	.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
> +		  SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
> +		  SDHCI_QUIRK_NO_HISPD_BIT,
> +	.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> +	.ops = &sdhci_iproc_32only_ops,
> +};
> +
> +static const struct sdhci_iproc_data bcm_arasan_data = {
> +	.pdata = &sdhci_bcm_arasan_data,
> +};
> +
>   static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
>   	{ .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data },
>   	{ .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
> +	{ .id = "BCM2847",  .driver_data = (kernel_ulong_t)&bcm_arasan_data },
> +	{ .id = "BRCME88C", .driver_data = (kernel_ulong_t)&bcm2711_data },
>   	{ /* sentinel */ }
>   };
>   MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids);
>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```

## Re: \[PATCH AUTOSEL 5.10 11/47\] mmc: sdhci-iproc: Add ACPI bindings for the RPi

- From: Sasha Levin \<sashal@kernel.org\>
- Date: 2021-03-12 22:13:25 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/03/6299012.md

```text
On Tue, Mar 02, 2021 at 10:16:59AM -0600, Jeremy Linton wrote:
>Hi,
>
>
>On 3/2/21 5:56 AM, Sasha Levin wrote:
>>From: Jeremy Linton <redacted>
>>
>>[ Upstream commit 4f9833d3ec8da34861cd0680b00c73e653877eb9 ]
>>
>>The RPi4 has an Arasan controller it carries over from the RPi3 and a newer
>>eMMC2 controller.  Because of a couple of quirks, it seems wiser to bind
>>these controllers to the same driver that DT is using on this platform
>>rather than the generic sdhci_acpi driver with PNP0D40.
>>
>>So, BCM2847 describes the older Arasan and BRCME88C describes the newer
>>eMMC2. The older Arasan is reusing an existing ACPI _HID used by other OSes
>>booting these tables on the RPi.
>>
>>With this change, Linux is capable of utilizing the SD card slot, and the
>>Wi-Fi when booted with UEFI+ACPI on the RPi4.
>
>For this to actually work on kernels < 5.11 you also need:
>
>c5b1c6dc13da mmc: sdhci: Update firmware interface API

I'll take this one for 5.10 then, thanks!

-- 
Thanks,
Sasha

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```
