Skip to contentSkip to conversation

Add AST2700 support for aspeed sdhci

PATCH In review Ryan Chen 2 participants 4 messages Mar 24

Subsystems (5)
lore
Share & tools
lore

Ryan Chen

author reviewer
#0 lore raw

v4 cover Add AST2700 support for aspeed sdhci

This series add aspeed sdhci support for AST2700. The AST2700 sdhci requires an reset. This series updates the binding and driver to support reset requirements.

---
Changes in v4:
- 2/2 rebase git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git
next branch fix the conflit.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- 1/2 Add items list const for ast2700 ast2600 compatible
- 1/2 Move if/then/else block after required: (per example-schema)
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- 1/2 use items for ast2700 compatible.
- 2/2 use devm_reset_control_get_optional_exclusive_deasserted for
reset.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Ryan Chen (2):
dt-bindings: mmc: sdhci-of-aspeed: Add AST2700 compatible
mmc: sdhci-of-aspeed: Handle optional controller reset

 .../devicetree/bindings/mmc/aspeed,sdhci.yaml      | 41 +++++++++++++++++-----
 drivers/mmc/host/sdhci-of-aspeed.c                 |  6 ++++
 2 files changed, 39 insertions(+), 8 deletions(-)

---
base-commit: 50d349cb70cdb6db352dec114e6381a31870b4ff
change-id: 20260313-sdhci-269d319fdbde

Best regards,

Signature · 1 line
Ryan Chen <[email protected]>
author reviewer
#1 lore raw

PATCH v4 1/2 dt-bindings: mmc: sdhci-of-aspeed: Add AST2700 compatible

AST2700 SDHCI controller is fully compatible with AST2600.

However, it is necessary to take the AST2700 SD controller out of reset, so require the 'resets' property.

---
Changes in v3:
- Add items list const for ast2700 ast2600 compatible
- Move if/then/else block after required: (per example-schema) Changes in v2:
- add missing blank line
- modify ast2700 compatible items const

---
 .../devicetree/bindings/mmc/aspeed,sdhci.yaml      | 41 +++++++++++++++++-----
 1 file changed, 33 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/mmc/aspeed,sdhci.yaml +33 -8
index d24950ccea95..e4a9c2810893 100644
@@ -22,10 +22,15 @@ description: |+
 
 properties:
   compatible:
-    enum:
-      - aspeed,ast2400-sd-controller
-      - aspeed,ast2500-sd-controller
-      - aspeed,ast2600-sd-controller
+    oneOf:
+      - enum:
+          - aspeed,ast2400-sd-controller
+          - aspeed,ast2500-sd-controller
+          - aspeed,ast2600-sd-controller
+      - items:
+          - const: aspeed,ast2700-sd-controller
+          - const: aspeed,ast2600-sd-controller
+
   reg:
     maxItems: 1
     description: Common configuration registers
@@ -38,6 +43,9 @@ properties:
     maxItems: 1
     description: The SD/SDIO controller clock gate
 
+  resets:
+    maxItems: 1
+
 patternProperties:
   "^sdhci@[0-9a-f]+$":
     type: object
@@ -46,10 +54,15 @@ patternProperties:
 
     properties:
       compatible:
-        enum:
-          - aspeed,ast2400-sdhci
-          - aspeed,ast2500-sdhci
-          - aspeed,ast2600-sdhci
+        oneOf:
+          - enum:
+              - aspeed,ast2400-sdhci
+              - aspeed,ast2500-sdhci
+              - aspeed,ast2600-sdhci
+          - items:
+              - const: aspeed,ast2700-sdhci
+              - const: aspeed,ast2600-sdhci
+
       reg:
         maxItems: 1
         description: The SDHCI registers
@@ -78,6 +91,18 @@ required:
   - ranges
   - clocks
 
+if:
+  properties:
+    compatible:
+      contains:
+        const: aspeed,ast2700-sd-controller
+then:
+  required:
+    - resets
+else:
+  properties:
+    resets: false
+
 examples:
   - |
     #include <dt-bindings/clock/aspeed-clock.h>
Signature · 1 line
2.34.1
author reviewer
#2 lore raw

PATCH v4 2/2 mmc: sdhci-of-aspeed: Handle optional controller reset

In reply to Ryan Chen

Get the optional reset line for the ASPEED SD controller during probe by using devm_reset_control_get_optional_exclusive_deasserted().

This allows platforms such as AST2700, which require the SD controller to be taken out of reset before use, to work with the existing driver.

---
Changes in v4:
- rebase git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git
next branch fix the conflit.
Changes in v2:
- use devm_reset_control_get_optional_exclusive_deasserted replace reset_control_get_optional_exclusive.
- add include reset.h

---
 drivers/mmc/host/sdhci-of-aspeed.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/mmc/host/sdhci-of-aspeed.c +6 -0
index 4296def69436..f5d973783cbe 100644
@@ -13,6 +13,7 @@
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
+#include <linux/reset.h>
 #include <linux/spinlock.h>
 
 #include "sdhci-pltfm.h"
@@ -519,6 +520,7 @@ static struct platform_driver aspeed_sdhci_driver = {
 static int aspeed_sdc_probe(struct platform_device *pdev)
 
 {
+	struct reset_control *reset;
 	struct device_node *parent;
 	struct aspeed_sdc *sdc;
 	int ret;
@@ -529,6 +531,10 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
 
 	spin_lock_init(&sdc->lock);
 
+	reset = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, NULL);
+	if (IS_ERR(reset))
+		return dev_err_probe(&pdev->dev, PTR_ERR(reset), "unable to acquire reset\n");
+
 	sdc->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(sdc->clk))
 		return PTR_ERR(sdc->clk);
Signature · 1 line
2.34.1
#3 lore raw
In reply to Ryan Chen
Quoted 5 lines · Ryan Chen

This series add aspeed sdhci support for AST2700. The AST2700 sdhci requires an reset. This series updates the binding and driver to support reset requirements.

Quoted 7 lines

---
Changes in v4:
- 2/2 rebase git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git
next branch fix the conflit.
- Link to v3: https://lore.kernel.org/r/[email protected]

The series applied for next, thanks!

[...]

Kind regards
Uffe