Skip to contentSkip to conversation

mmc: sdhci-brcmstb: Add driver for Broadcom BRCMSTB SoCs

PATCH RESEND Superseded Al Cooper 3 participants 5 messages Mar 4, 2016 – Mar 8, 2016

Subsystems (5)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Al Cooper

author maintainer
#0 lore raw

PATCH RESEND v3 2/2 mmc: sdhci-brcmstb: Add driver for Broadcom BRCMSTB SoCs

---
 .../devicetree/bindings/mmc/sdhci-brcmstb.txt      |  40 ++++++
 MAINTAINERS                                        |   7 +
 drivers/mmc/host/Kconfig                           |  11 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/sdhci-brcmstb.c                   | 154 +++++++++++++++++++++
 5 files changed, 213 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt
 create mode 100644 drivers/mmc/host/sdhci-brcmstb.c
Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt new file +40 -0
new file mode 100644
index 0000000..f8dd6a9d
@@ -0,0 +1,40 @@
+* BROADCOM BRCMSTB/BMIPS SDHCI Controller
+
+This file documents differences between the core properties in mmc.txt
+and the properties used by the sdhci-brcmstb driver.
+
+Required properties:
+- compatible: "brcm,sdhci-brcmstb"
+
+Optional properties:
+- broken-sdr50: The Host Controller's SDR50 mode is broken.
+- broken-ddr50: The Host Controller's DDR50 mode is broken.
+- broken-64-bit-dma: 64 BIT DMA mode is broken, use 32 BIT DMA.
+- broken-timeout-value: The Host Controller CAPABILITY timeout value is incorrrect, use the maximum timeout.
+
+
+Example:
+
+	sdhci@f03e0100 {
+		compatible = "brcm,sdhci-brcmstb";
+		reg = <0xf03e0000 0x100>;
+		interrupts = <0x0 0x26 0x0>;
+		interrupt-names = "sdio0_0";
+		sdhci,auto-cmd12;
+		clocks = <0x13>;
+		clock-names = "sw_sdio";
+		broken-sdr50;
+	};
+
+	sdhci@f03e0300 {
+		no-1-8-v;
+		non-removable;
+		bus-width = <0x8>;
+		compatible = "brcm,sdhci-brcmstb";
+		reg = <0xf03e0200 0x100>;
+		interrupts = <0x0 0x27 0x0>;
+		interrupt-names = "sdio1_0";
+		sdhci,auto-cmd12;
+		clocks = <0x13>;
+		clock-names = "sw_sdio";
+	};
MAINTAINERS +7 -0
index 30aca4a..2d9c90c 100644
@@ -9724,6 +9724,13 @@ F:	tools/testing/selftests/seccomp/*
 K:	\bsecure_computing
 K:	\bTIF_SECCOMP\b
 
+SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) Broadcom BRCMSTB DRIVER
+M:	Al Cooper <[email protected]>
+L:	[email protected]
+L:	[email protected]
+S:	Maintained
+F:	drivers/mmc/host/sdhci-brcmstb*
+
 SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) SAMSUNG DRIVER
 M:	Ben Dooks <[email protected]>
 M:	Jaehoon Chung <[email protected]>
drivers/mmc/host/Kconfig +11 -0
index 4a35ebf..85bf266 100644
@@ -797,3 +797,14 @@ config MMC_SDHCI_MICROCHIP_PIC32
           If you have a controller with this interface, say Y or M here.
 
           If unsure, say N.
+config MMC_SDHCI_BRCMSTB
+	tristate "Broadcom SDIO/SD/MMC support"
+	depends on ARCH_BRCMSTB || BMIPS_GENERIC
+	depends on MMC_SDHCI_PLTFM
+	default y
+	select MMC_SDHCI_IO_ACCESSORS
+	help
+	  This selects support for the SDIO/SD/MMC Host Controller on
+	  Broadcom STB SoCs.
+
+	  If unsure, say Y.
drivers/mmc/host/Makefile +1 -0
index af918d2..2075c11 100644
@@ -76,6 +76,7 @@ obj-$(CONFIG_MMC_SDHCI_IPROC)		+= sdhci-iproc.o
 obj-$(CONFIG_MMC_SDHCI_MSM)		+= sdhci-msm.o
 obj-$(CONFIG_MMC_SDHCI_ST)		+= sdhci-st.o
 obj-$(CONFIG_MMC_SDHCI_MICROCHIP_PIC32)	+= sdhci-pic32.o
+obj-$(CONFIG_MMC_SDHCI_BRCMSTB)		+= sdhci-brcmstb.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
 	CFLAGS-cb710-mmc	+= -DDEBUG
drivers/mmc/host/sdhci-brcmstb.c new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
1.9.0.138.g2de3478
#1 lore raw
Quoted 17 lines · Al Cooper
---
 .../devicetree/bindings/mmc/sdhci-brcmstb.txt      |  40 ++++++
 MAINTAINERS                                        |   7 +
 drivers/mmc/host/Kconfig                           |  11 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/sdhci-brcmstb.c                   | 154 +++++++++++++++++++++
 5 files changed, 213 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt
 create mode 100644 drivers/mmc/host/sdhci-brcmstb.c
Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt new file +0 -0
new file mode 100644
index 0000000..f8dd6a9d

Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt new file +7 -0
@@ -0,0 +1,40 @@
+* BROADCOM BRCMSTB/BMIPS SDHCI Controller
+
+This file documents differences between the core properties in mmc.txt
+and the properties used by the sdhci-brcmstb driver.
+
+Required properties:
+- compatible: "brcm,sdhci-brcmstb"

For many of the other SoC drivers, such as drivers/irqchip/irq-bcm*, we've used the compatible string and/or driver name to denote the oldest SoC that is compatible with the driver. This helps to indicate that the driver is not compatible with previous versions of the core. For instance, the driver you are submitting would be slightly broken on the BCM7468/BCM7208 STB chips, and horrifically broken on BCM7630 (which admittedly isn't quite "brcmstb" but uses some of the same drivers). I assume you don't want to target those ancient parts.

When the hardware block changes frequently, we've gone as far as creating a different compatible string for each variant. For Documentation/devicetree/bindings/net/brcm,bcmgenet.txt we encoded the hardware generation number in the compatible string.

[snip]

Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt line 19

Quoted 12 lines
Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt new file +12 -0
+static int sdhci_brcmstb_probe(struct platform_device *pdev)
+{
+       struct device_node *dn = pdev->dev.of_node;
+       struct sdhci_host *host;
+       struct sdhci_pltfm_host *pltfm_host;
+       struct clk *clk;
+       int res;
+
+       clk = of_clk_get_by_name(dn, "sw_sdio");
+       if (IS_ERR(clk)) {
+               dev_err(&pdev->dev, "Clock not found in Device Tree\n");
+               clk = NULL;

Last time I worked on these chips, they defaulted to "all clocks enabled" in the absence of a clk driver.

So, if this is not treated as a fatal condition, maybe it would be better to downgrade it to dev_warn or dev_info.

Quoted 4 lines
Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt new file +4 -0
+       }
+       res = clk_prepare_enable(clk);
+       if (res)
+               goto undo_clk_get;
author maintainer
#2 lore raw
Quoted 35 lines · Kevin Cernekee
Quoted 17 lines · Al Cooper
---
 .../devicetree/bindings/mmc/sdhci-brcmstb.txt      |  40 ++++++
 MAINTAINERS                                        |   7 +
 drivers/mmc/host/Kconfig                           |  11 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/sdhci-brcmstb.c                   | 154 +++++++++++++++++++++
 5 files changed, 213 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt
 create mode 100644 drivers/mmc/host/sdhci-brcmstb.c
Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt new file +0 -0
new file mode 100644
index 0000000..f8dd6a9d

Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt new file +7 -0
@@ -0,0 +1,40 @@
+* BROADCOM BRCMSTB/BMIPS SDHCI Controller
+
+This file documents differences between the core properties in mmc.txt
+and the properties used by the sdhci-brcmstb driver.
+
+Required properties:
+- compatible: "brcm,sdhci-brcmstb"

For many of the other SoC drivers, such as drivers/irqchip/irq-bcm*, we've used the compatible string and/or driver name to denote the oldest SoC that is compatible with the driver. This helps to indicate that the driver is not compatible with previous versions of the core. For instance, the driver you are submitting would be slightly broken on the BCM7468/BCM7208 STB chips, and horrifically broken on BCM7630 (which admittedly isn't quite "brcmstb" but uses some of the same drivers). I assume you don't want to target those ancient parts.

Quoted 4 lines

When the hardware block changes frequently, we've gone as far as creating a different compatible string for each variant. For Documentation/devicetree/bindings/net/brcm,bcmgenet.txt we encoded the hardware generation number in the compatible string.

Something like "brcm,bcm7425-sdhci"?

Quoted 19 lines

[snip]

Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt

Quoted 12 lines
Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt new file +12 -0
+static int sdhci_brcmstb_probe(struct platform_device *pdev)
+{
+       struct device_node *dn = pdev->dev.of_node;
+       struct sdhci_host *host;
+       struct sdhci_pltfm_host *pltfm_host;
+       struct clk *clk;
+       int res;
+
+       clk = of_clk_get_by_name(dn, "sw_sdio");
+       if (IS_ERR(clk)) {
+               dev_err(&pdev->dev, "Clock not found in Device Tree\n");
+               clk = NULL;

Last time I worked on these chips, they defaulted to "all clocks enabled" in the absence of a clk driver.

Quoted 2 lines

So, if this is not treated as a fatal condition, maybe it would be better to downgrade it to dev_warn or dev_info.

Good point, I'll switch it to dev_warn.

Al

#3 lore raw
Quoted 36 lines · Alan Cooper
Quoted 35 lines · Kevin Cernekee
Quoted 17 lines · Al Cooper
---
 .../devicetree/bindings/mmc/sdhci-brcmstb.txt      |  40 ++++++
 MAINTAINERS                                        |   7 +
 drivers/mmc/host/Kconfig                           |  11 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/sdhci-brcmstb.c                   | 154 +++++++++++++++++++++
 5 files changed, 213 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt
 create mode 100644 drivers/mmc/host/sdhci-brcmstb.c
Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt new file +0 -0
new file mode 100644
index 0000000..f8dd6a9d

Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt new file +7 -0
@@ -0,0 +1,40 @@
+* BROADCOM BRCMSTB/BMIPS SDHCI Controller
+
+This file documents differences between the core properties in mmc.txt
+and the properties used by the sdhci-brcmstb driver.
+
+Required properties:
+- compatible: "brcm,sdhci-brcmstb"

For many of the other SoC drivers, such as drivers/irqchip/irq-bcm*, we've used the compatible string and/or driver name to denote the oldest SoC that is compatible with the driver. This helps to indicate that the driver is not compatible with previous versions of the core. For instance, the driver you are submitting would be slightly broken on the BCM7468/BCM7208 STB chips, and horrifically broken on BCM7630 (which admittedly isn't quite "brcmstb" but uses some of the same drivers). I assume you don't want to target those ancient parts.

Quoted 6 lines
Quoted 4 lines

When the hardware block changes frequently, we've gone as far as creating a different compatible string for each variant. For Documentation/devicetree/bindings/net/brcm,bcmgenet.txt we encoded the hardware generation number in the compatible string.

Something like "brcm,bcm7425-sdhci"?

You certainly know the history more than I do, but that sounds like an appropriate compatible string here. We could list all chips that have such a controller and have been quirky, that is how we are supposed to solve that problem, but that's up to you.

Quoted 20 lines
Quoted 20 lines

[snip]

Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt

Quoted 12 lines
Documentation/devicetree/bindings/mmc/sdhci-brcmstb.txt new file +12 -0
+static int sdhci_brcmstb_probe(struct platform_device *pdev)
+{
+       struct device_node *dn = pdev->dev.of_node;
+       struct sdhci_host *host;
+       struct sdhci_pltfm_host *pltfm_host;
+       struct clk *clk;
+       int res;
+
+       clk = of_clk_get_by_name(dn, "sw_sdio");
+       if (IS_ERR(clk)) {
+               dev_err(&pdev->dev, "Clock not found in Device Tree\n");
+               clk = NULL;

Last time I worked on these chips, they defaulted to "all clocks enabled" in the absence of a clk driver.

Quoted 4 lines
Quoted 2 lines

So, if this is not treated as a fatal condition, maybe it would be better to downgrade it to dev_warn or dev_info.

Good point, I'll switch it to dev_warn.

Since you are going to revisit this part, the binding should also document the need for an optional clocks property, since it currently does not.

Signature · 1 line
Florian
#4 lore raw
In reply to Alan Cooper
Quoted 6 lines · Alan Cooper
Quoted 4 lines

When the hardware block changes frequently, we've gone as far as creating a different compatible string for each variant. For Documentation/devicetree/bindings/net/brcm,bcmgenet.txt we encoded the hardware generation number in the compatible string.

Something like "brcm,bcm7425-sdhci"?

That sounds like a reasonable approximation. Several major design issues like IRQs and endianness got cleaned up in the 40nm generation (although IIRC there were still a lot of fresh bugs in every new chip).