2022-10-22 10:39:42

by Frank Wunderlich

[permalink] [raw]
Subject: [PATCH v2 0/5] Add mmc-support for mt7986

From: Frank Wunderlich <[email protected]>

I've noticed the mtk-sd binding needs a bit more work get into a more
clean state.

There are 2 properties missing that maybe need to be added later or
dropped from devicetrees:
drv-type (which is used in mt8183-kukui.dtsi and set to <2>)
and
r_smpl (used in mt7622-rfb1.dts and mt7622-bananapi-bpi-r64.dts, both
times set to <1>)

i don't know their function and boundaries and i do not find them in
driver. I guess they are added by accident, but before removing them i
want to fix the other problems.

Frank Wunderlich (2):
arm64: dts: mediatek: mt2712e: swap last 2 clocks to match binding
dt-bindings: mmc: mtk-sd: add mt7986

NĂ­colas F. R. A. Prado (1):
dt-bindings: mmc: mtk-sd: Set clocks based on compatible

Sam Shih (2):
dt-bindings: mmc: Add compatible for Mediatek MT7986
mmc: mediatek: add support for MT7986 SoC

.../devicetree/bindings/mmc/mtk-sd.yaml | 140 ++++++++++++++----
arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 6 +-
drivers/mmc/host/mtk-sd.c | 14 ++
3 files changed, 127 insertions(+), 33 deletions(-)

--
2.34.1


2022-10-22 10:59:12

by Frank Wunderlich

[permalink] [raw]
Subject: [PATCH v2 2/5] mmc: mediatek: add support for MT7986 SoC

From: Sam Shih <[email protected]>

Adding mt7986 own characteristics and of_device_id to have support
of MT7986 SoC.

Signed-off-by: Sam Shih <[email protected]>
Signed-off-by: Frank Wunderlich <[email protected]>
---
drivers/mmc/host/mtk-sd.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index df941438aef5..3f7f3a1e0df8 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -552,6 +552,19 @@ static const struct mtk_mmc_compatible mt7622_compat = {
.support_64g = false,
};

+static const struct mtk_mmc_compatible mt7986_compat = {
+ .clk_div_bits = 12,
+ .recheck_sdio_irq = true,
+ .hs400_tune = false,
+ .pad_tune_reg = MSDC_PAD_TUNE0,
+ .async_fifo = true,
+ .data_tune = true,
+ .busy_check = true,
+ .stop_clk_fix = true,
+ .enhance_rx = true,
+ .support_64g = true,
+};
+
static const struct mtk_mmc_compatible mt8135_compat = {
.clk_div_bits = 8,
.recheck_sdio_irq = true,
@@ -609,6 +622,7 @@ static const struct of_device_id msdc_of_ids[] = {
{ .compatible = "mediatek,mt6795-mmc", .data = &mt6795_compat},
{ .compatible = "mediatek,mt7620-mmc", .data = &mt7620_compat},
{ .compatible = "mediatek,mt7622-mmc", .data = &mt7622_compat},
+ { .compatible = "mediatek,mt7986-mmc", .data = &mt7986_compat},
{ .compatible = "mediatek,mt8135-mmc", .data = &mt8135_compat},
{ .compatible = "mediatek,mt8173-mmc", .data = &mt8173_compat},
{ .compatible = "mediatek,mt8183-mmc", .data = &mt8183_compat},
--
2.34.1

2022-10-22 11:01:30

by Frank Wunderlich

[permalink] [raw]
Subject: [PATCH v2 1/5] dt-bindings: mmc: Add compatible for Mediatek MT7986

From: Sam Shih <[email protected]>

This commit adds dt-binding documentation of mmc for Mediatek MT7986 SoC
Platform.

Signed-off-by: Sam Shih <[email protected]>
Signed-off-by: Frank Wunderlich <[email protected]>
Acked-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/mmc/mtk-sd.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
index d8e1e2e9adf2..3cbf0208f1b4 100644
--- a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
+++ b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
@@ -23,6 +23,7 @@ properties:
- mediatek,mt6795-mmc
- mediatek,mt7620-mmc
- mediatek,mt7622-mmc
+ - mediatek,mt7986-mmc
- mediatek,mt8135-mmc
- mediatek,mt8173-mmc
- mediatek,mt8183-mmc
--
2.34.1

2022-10-22 11:21:37

by Frank Wunderlich

[permalink] [raw]
Subject: [PATCH v2 5/5] dt-bindings: mmc: mtk-sd: add mt7986

From: Frank Wunderlich <[email protected]>

Add SoC specific section for defining clock configuration.

Add compatible in "not" section to avoid override the settings again.

Signed-off-by: Frank Wunderlich <[email protected]>
---
.../devicetree/bindings/mmc/mtk-sd.yaml | 28 +++++++++++++++++++
1 file changed, 28 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
index c7bcf0c3dd5d..9df63c461f1f 100644
--- a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
+++ b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
@@ -229,6 +229,33 @@ allOf:
- const: hclk
- const: source_cg
- const: bus_clk
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - mediatek,mt7986-mmc
+ then:
+ properties:
+ assigned-clock-parents:
+ maxItems: 2
+ assigned-clocks:
+ maxItems: 2
+ clocks:
+ minItems: 3
+ items:
+ - description: source clock
+ - description: HCLK which used for host
+ - description: independent source clock gate
+ - description: bus clock used for internal register access
+ - description: msdc subsys clock gate
+ clock-names:
+ minItems: 3
+ items:
+ - const: source
+ - const: hclk
+ - const: axi_cg
+ - const: ahb_cg
- if:
not:
properties:
@@ -237,6 +264,7 @@ allOf:
enum:
- mediatek,mt2712-mmc
- mediatek,mt8192-mmc
+ - mediatek,mt7986-mmc
then:
properties:
clocks:
--
2.34.1

2022-10-22 16:38:53

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 5/5] dt-bindings: mmc: mtk-sd: add mt7986

On 22/10/2022 05:05, Frank Wunderlich wrote:
> From: Frank Wunderlich <[email protected]>
>
> Add SoC specific section for defining clock configuration.
>
> Add compatible in "not" section to avoid override the settings again.
>
> Signed-off-by: Frank Wunderlich <[email protected]>
> ---
> .../devicetree/bindings/mmc/mtk-sd.yaml | 28 +++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
> index c7bcf0c3dd5d..9df63c461f1f 100644
> --- a/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
> +++ b/Documentation/devicetree/bindings/mmc/mtk-sd.yaml
> @@ -229,6 +229,33 @@ allOf:
> - const: hclk
> - const: source_cg
> - const: bus_clk

Blank line

> + - if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - mediatek,mt7986-mmc
> + then:
> + properties:
> + assigned-clock-parents:
> + maxItems: 2
> + assigned-clocks:
> + maxItems: 2

Define these two only if they are required for the hardware to operate
and only such setup (two assigned parents) is allowed. Otherwise you put
some constraints on board design.

> + clocks:
> + minItems: 3

Best regards,
Krzysztof