Skip to contentSkip to conversation

dt-bindings: mmc: mtk-sd: Document support for Airoha AN7581 SoC

PATCH Superseded Christian Marangi 2 participants 3 messages Oct 26

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dt-bindings: mmc: mtk-sd: Document support for Airoha AN7581 SoC

Add dedicated compatible for Airoha AN7581 SoC integrated MMC controller. The MMC controller is based on the MT7988 with the difference that it does have a single clock controlling it.

Add the dedicated compatible to describe the 2 register requirement and permit to define only 2 clock (the main one and a fixed clock for HS)

---
 Documentation/devicetree/bindings/mmc/mtk-sd.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mmc/mtk-sd.yaml +2 -0
index a4d032224dce..49ad2a8a390d 100644
@@ -14,6 +14,7 @@ properties:
   compatible:
     oneOf:
       - enum:
+          - airoha,an7581-mmc
           - mediatek,mt2701-mmc
           - mediatek,mt2712-mmc
           - mediatek,mt6779-mmc
@@ -238,6 +239,7 @@ allOf:
         compatible:
           contains:
             enum:
+              - airoha,an7581-mmc
               - mediatek,mt7986-mmc
               - mediatek,mt7988-mmc
               - mediatek,mt8183-mmc
Signature · 1 line
2.55.0
#1 lore raw

PATCH 2/2 mmc: mtk-sd: Add Airoha AN7581 MMC compatible

Add dedicated compatible for Airoha AN7581 SoC that implement a dedicated MMC controller based on MT7988 with the difference of having a single clock controlling it.

---
 drivers/mmc/host/mtk-sd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/mtk-sd.c +1 -0
index 5b160fdad3f0..736cff2783e2 100644
@@ -713,6 +713,7 @@ static const struct mtk_mmc_compatible mt8196_compat = {
 };
 
 static const struct of_device_id msdc_of_ids[] = {
+	{ .compatible = "airoha,an7581-mmc", .data = &mt7986_compat},
 	{ .compatible = "mediatek,mt2701-mmc", .data = &mt2701_compat},
 	{ .compatible = "mediatek,mt2712-mmc", .data = &mt2712_compat},
 	{ .compatible = "mediatek,mt6779-mmc", .data = &mt6779_compat},
Signature · 1 line
2.55.0
#2 lore raw
In reply to Christian Marangi
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] dt-bindings: mmc: mtk-sd: missing clocks constraints for airoha,an7581-mmc --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dt-bindings: mmc: mtk-sd: missing clocks constraints for airoha,an7581-mmc --

commit c2ecb5aa718b8cb2478402c7db169bd4c820f420
Author: Christian Marangi <[email protected]>

dt-bindings: mmc: mtk-sd: Document support for Airoha AN7581 SoC

This commit adds the airoha,an7581-mmc compatible string to the MediaTek MMC controller binding and updates the register count constraint for two register regions.

Quoted 13 lines
Documentation/devicetree/bindings/mmc/mtk-sd.yaml +1 -0
index a4d032224dcee..49ad2a8a390d6 100644
@@ -14,6 +14,7 @@ properties:
   compatible:
     oneOf:
       - enum:
+          - airoha,an7581-mmc
           - mediatek,mt2701-mmc
           - mediatek,mt2712-mmc
           - mediatek,mt6779-mmc

Documentation/devicetree/bindings/mmc/mtk-sd.yaml allOf: · line 245

Quoted 7 lines
Documentation/devicetree/bindings/mmc/mtk-sd.yaml +1 -0
@@ -238,6 +239,7 @@ allOf:
         compatible:
           contains:
             enum:
+              - airoha,an7581-mmc
               - mediatek,mt7986-mmc
               - mediatek,mt7988-mmc
               - mediatek,mt8183-mmc

[Severity: Medium]
Should airoha,an7581-mmc also be added to a clocks and clock-names conditional block under allOf in Documentation/devicetree/bindings/mmc/mtk-sd.yaml?

The commit message notes that this compatible is added to permit defining only 2 clocks, and in drivers/mmc/host/mtk-sd.c, msdc_drv_probe() -> msdc_of_clock_parse() requires the source and hclk clocks.

However, the top-level properties:clocks and properties:clock-names definitions in Documentation/devicetree/bindings/mmc/mtk-sd.yaml only bound the array length:

clocks:
description:
Should contain phandle for the clock feeding the MMC controller.
minItems: 2
maxItems: 7

clock-names:
minItems: 2
maxItems: 7

While per-SoC clock counts and clock-names constants are constrained in allOf conditional blocks such as:

- if:
properties:
compatible:
enum:
- mediatek,mt2701-mmc
...
then:
properties:
clocks:
minItems: 2
items:
- description: source clock
- description: HCLK which used for host
- description: independent source clock gate
clock-names:
minItems: 2
items:
- const: source
- const: hclk
- const: source_cg

Without a corresponding allOf constraint for airoha,an7581-mmc, device tree nodes using this compatible can specify between 2 and 7 clocks with arbitrary clock-names and pass dt_binding_check, only to fail at runtime in msdc_of_clock_parse().

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1