Skip to contentSkip to conversation

mmc: sdhci-bcm2835: Actually enable the clock

PATCH In review Eric Anholt 2 participants 3 messages May 29, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: sdhci-bcm2835: Actually enable the clock

We're currently using a fixed frequency clock specified in the DT, so enabling is a no-op. However, the RPi firmware-based clocks driver can actually disable unused clocks, so when switching to use it we ended up losing our MMC clock once all devices were probed.

---
 drivers/mmc/host/sdhci-bcm2835.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mmc/host/sdhci-bcm2835.c +5 -0
index 0ef0343..09aff3a 100644
@@ -172,6 +172,11 @@ static int bcm2835_sdhci_probe(struct platform_device *pdev)
 		ret = PTR_ERR(pltfm_host->clk);
 		goto err;
 	}
+	ret = clk_prepare_enable(pltfm_host->clk);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to enable host clk\n");
+		goto err;
+	}
 
 	return sdhci_add_host(host);
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 15 lines · Eric Anholt

We're currently using a fixed frequency clock specified in the DT, so enabling is a no-op. However, the RPi firmware-based clocks driver can actually disable unused clocks, so when switching to use it we ended up losing our MMC clock once all devices were probed.

---
 drivers/mmc/host/sdhci-bcm2835.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mmc/host/sdhci-bcm2835.c +0 -0
index 0ef0343..09aff3a 100644

drivers/mmc/host/sdhci-bcm2835.c static int bcm2835_sdhci_probe(struct platform_device *pdev) · line 181

Quoted 10 lines
drivers/mmc/host/sdhci-bcm2835.c +5 -0
@@ -172,6 +172,11 @@ static int bcm2835_sdhci_probe(struct platform_device *pdev)
 		ret = PTR_ERR(pltfm_host->clk);
 		goto err;
 	}
+	ret = clk_prepare_enable(pltfm_host->clk);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to enable host clk\n");
+		goto err;
+	}
 
 	return sdhci_add_host(host);

Where's the error clean-up path for a failed sdhci_add_host()?

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#2 lore raw
Quoted 25 lines · Russell King - ARM Linux
Quoted 24 lines · Eric Anholt

We're currently using a fixed frequency clock specified in the DT, so enabling is a no-op. However, the RPi firmware-based clocks driver can actually disable unused clocks, so when switching to use it we ended up losing our MMC clock once all devices were probed.

---
 drivers/mmc/host/sdhci-bcm2835.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mmc/host/sdhci-bcm2835.c +5 -0
index 0ef0343..09aff3a 100644
@@ -172,6 +172,11 @@ static int bcm2835_sdhci_probe(struct platform_device *pdev)
 		ret = PTR_ERR(pltfm_host->clk);
 		goto err;
 	}
+	ret = clk_prepare_enable(pltfm_host->clk);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to enable host clk\n");
+		goto err;
+	}
 
Quoted 3 lines

drivers/mmc/host/sdhci-bcm2835.c static int bcm2835_sdhci_probe(struct platform_device *pdev) · line 181

Quoted 1 line
drivers/mmc/host/sdhci-bcm2835.c +0 -0
 	return sdhci_add_host(host);

Where's the error clean-up path for a failed sdhci_add_host()?

We were already missing required cleanup in that path, so I didn't
notice. Sending a new version with a fix for that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150529/40b0dfcb/attachment-0001.sig>