Skip to contentSkip to conversation

mmc: atmel-sdhci: do not check clk_set_rate return value

PATCH New Eugen Hristev 2 participants 5 messages Aug 27, 2020 – Aug 28, 2020

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

PATCH v2 4/6 mmc: atmel-sdhci: do not check clk_set_rate return value

clk_set_rate will return rate in case of success and zero in case of error, however it can also return -ev, but it's an ulong function. To avoid any issues, disregard the return value of this call. In case this call actually fails, nothing much we can do anyway, but we can at least try with the previous values (or DT assigned-clocks)

---
 drivers/mmc/atmel_sdhci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/atmel_sdhci.c +1 -3
index f03c0457e1..54b660c34a 100644
@@ -79,9 +79,7 @@ static int atmel_sdhci_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
-	ret = clk_set_rate(&clk, ATMEL_SDHC_GCK_RATE);
-	if (ret)
-		return ret;
+	clk_set_rate(&clk, ATMEL_SDHC_GCK_RATE);
 
 	max_clk = clk_get_rate(&clk);
 	if (!max_clk)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 5/6 mmc: atmel-sdhci: enable the required generic clock

The second clock of the IP block (the generic clock), must be explicitly enabled.

---
 drivers/mmc/atmel_sdhci.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/atmel_sdhci.c +4 -0
index 54b660c34a..c67b065061 100644
@@ -85,6 +85,10 @@ static int atmel_sdhci_probe(struct udevice *dev)
 	if (!max_clk)
 		return -EINVAL;
 
+	ret = clk_enable(&clk);
+	if (ret)
+		return ret;
+
 	host->max_clk = max_clk;
 	host->mmc = &plat->mmc;
 	host->mmc->dev = dev;
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 5/6 mmc: atmel-sdhci: enable the required generic clock

Quoted 15 lines

Subject: [PATCH v2 5/6] mmc: atmel-sdhci: enable the required generic clock

The second clock of the IP block (the generic clock), must be explicitly enabled.

---
 drivers/mmc/atmel_sdhci.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/atmel_sdhci.c index renamed from drivers/mmc/atmel_sdhci.c +0 -0

54b660c34a..c67b065061 100644

drivers/mmc/atmel_sdhci.c static int atmel_sdhci_probe(struct udevice *dev) · line 94

Quoted 10 lines
drivers/mmc/atmel_sdhci.c +4 -0
@@ -85,6 +85,10 @@ static int atmel_sdhci_probe(struct udevice *dev)
 	if (!max_clk)
 		return -EINVAL;
 
+	ret = clk_enable(&clk);
+	if (ret)
+		return ret;
+
 	host->max_clk = max_clk;
 	host->mmc = &plat->mmc;
 	host->mmc->dev = dev;
Quoted 2 lines

--
2.25.1

#3 lore raw

PATCH v2 6/6 mmc: atmel-sdhci: use mmc_of_parse to get the DT properties

In reply to Eugen Hristev

Call mmc_of_parse at probe time to fetch all the host properties from the DT.

---
 drivers/mmc/atmel_sdhci.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/atmel_sdhci.c +4 -0
index c67b065061..f56ae63bc2 100644
@@ -89,6 +89,10 @@ static int atmel_sdhci_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	ret = mmc_of_parse(dev, &plat->cfg);
+	if (ret)
+		return ret;
+
 	host->max_clk = max_clk;
 	host->mmc = &plat->mmc;
 	host->mmc->dev = dev;
Signature · 1 line
2.25.1
#4 lore raw

PATCH v2 6/6 mmc: atmel-sdhci: use mmc_of_parse to get the DT properties

Quoted 7 lines

Subject: [PATCH v2 6/6] mmc: atmel-sdhci: use mmc_of_parse to get the DT properties

Call mmc_of_parse at probe time to fetch all the host properties from the DT.

---

Please add a changelog for future new version patches.

Quoted 8 lines
 drivers/mmc/atmel_sdhci.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/atmel_sdhci.c index renamed from drivers/mmc/atmel_sdhci.c +0 -0

c67b065061..f56ae63bc2 100644

drivers/mmc/atmel_sdhci.c static int atmel_sdhci_probe(struct udevice *dev) · line 98

Quoted 10 lines
drivers/mmc/atmel_sdhci.c +4 -0
@@ -89,6 +89,10 @@ static int atmel_sdhci_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	ret = mmc_of_parse(dev, &plat->cfg);
+	if (ret)
+		return ret;
+
 	host->max_clk = max_clk;
 	host->mmc = &plat->mmc;
 	host->mmc->dev = dev;

Thanks,
Peng.

Quoted 2 lines

--
2.25.1