Subject: [PATCH v4 0/8] MediaTek UFS fixes and cleanups - Part 1

Changes in v4:
- Replaced Stanley Chu with myself in maintainers as his email is gone
- Fixed commit [5/8]

Changes in v3:
- Disallowed mt8192 compatible in isolation
- Added maxItems to clocks

Changes in v2:
- Rebased over next-20240409 (because of merge issue for patch 1)
- Added ufs: prefix to patch 1
- Added forgotten ufs-rx-symbol clock to the binding


This series performs some fixes and cleanups for the MediaTek UFSHCI
controller driver.

In particular, while adding the MT8195 compatible to the mediatek,ufs
binding, I noticed that it was allowing just one clock, completely
ignoring the optional ones, including the crypt-xxx clocks, all of
the optional regulators, and other properties.

Between all the other properties, two are completely useless, as they
are there just to activate features that, on SoCs that don't support
these, won't anyway be activated because of missing clocks or missing
regulators, or missing other properties;
as for the other vendor-specific properties, like ufs-disable-ah8,
ufs-broken-vcc, ufs-pmc-via-fastauto, since the current merge window
is closing, I didn't do extensive research so I've left them in place
but didn't add them to the devicetree binding yet.

The plan is to check those later and eventually give them a removal
treatment, or add them to the bindings in a part two series.

For now, at least, this is already a big improvement.

P.S.: The only SoC having UFSHCI upstream is MT8183, which only has
just one clock, and *nothing else* uses properties, clocks, etc that
were renamed in this cleanup.

Cheers!

AngeloGioacchino Del Regno (8):
scsi: ufs: ufs-mediatek: Remove useless mediatek,ufs-support-va09
property
scsi: ufs: ufs-mediatek: Fix property name for crypt boost voltage
scsi: ufs: ufs-mediatek: Remove useless mediatek,ufs-boost-crypt
property
scsi: ufs: ufs-mediatek: Avoid underscores in crypt clock names
dt-bindings: ufs: mediatek,ufs: Document MT8192 compatible with MT8183
dt-bindings: ufs: mediatek,ufs: Document MT8195 compatible
dt-bindings: ufs: mediatek,ufs: Document additional clocks
dt-bindings: ufs: mediatek,ufs: Document optional dvfsrc/va09
regulators

.../devicetree/bindings/ufs/mediatek,ufs.yaml | 29 +++++-
drivers/ufs/host/ufs-mediatek.c | 91 +++++++++++--------
2 files changed, 79 insertions(+), 41 deletions(-)

--
2.44.0



Subject: [PATCH v4 7/8] dt-bindings: ufs: mediatek,ufs: Document additional clocks

Add additional clocks, used on all MediaTek SoCs' UFSHCI controllers:
some of these clocks are optional and used only for scaling purposes
to save power, or to improve performance in the case of the crypt
clocks.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
.../devicetree/bindings/ufs/mediatek,ufs.yaml | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml b/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
index 5728e750761f..1df8779ee902 100644
--- a/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
+++ b/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
@@ -23,11 +23,24 @@ properties:
- const: mediatek,mt8183-ufshci

clocks:
- maxItems: 1
+ minItems: 1
+ maxItems: 12

clock-names:
+ minItems: 1
items:
- const: ufs
+ - const: ufs-aes
+ - const: ufs-tick
+ - const: unipro-sys
+ - const: unipro-tick
+ - const: ufs-sap
+ - const: ufs-tx-symbol
+ - const: ufs-rx-symbol
+ - const: ufs-mem
+ - const: crypt-mux
+ - const: crypt-lp
+ - const: crypt-perf

phys:
maxItems: 1
--
2.44.0


Subject: [PATCH v4 4/8] scsi: ufs: ufs-mediatek: Avoid underscores in crypt clock names

Change all of crypt_{mux,lp,perf} clock names to crypt-{mux,lp-perf}:
retaining compatibility with the old names is ignored as there is no
user of this driver declaring any of those clocks, and the binding
also doesn't allow these ones at all.

Fixes: 590b0d2372fe ("scsi: ufs-mediatek: Support performance mode for inline encryption engine")
Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
drivers/ufs/host/ufs-mediatek.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 47f16e6720f4..5db6d27f75af 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -604,15 +604,15 @@ static int ufs_mtk_init_boost_crypt(struct ufs_hba *hba)
return -ENOMEM;

cfg = host->crypt;
- ret = ufs_mtk_init_host_clk(hba, "crypt_mux", &cfg->clk_crypt_mux);
+ ret = ufs_mtk_init_host_clk(hba, "crypt-mux", &cfg->clk_crypt_mux);
if (ret)
goto out;

- ret = ufs_mtk_init_host_clk(hba, "crypt_lp", &cfg->clk_crypt_lp);
+ ret = ufs_mtk_init_host_clk(hba, "crypt-lp", &cfg->clk_crypt_lp);
if (ret)
goto out;

- ret = ufs_mtk_init_host_clk(hba, "crypt_perf", &cfg->clk_crypt_perf);
+ ret = ufs_mtk_init_host_clk(hba, "crypt-perf", &cfg->clk_crypt_perf);
if (ret)
goto out;

--
2.44.0


Subject: [PATCH v4 6/8] dt-bindings: ufs: mediatek,ufs: Document MT8195 compatible

Add the new mediatek,mt8195-ufshci string.
This SoC's UFSHCI controller is compatible with MT8183.

Acked-by: Conor Dooley <[email protected]>
Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml b/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
index f14887ea6fdc..5728e750761f 100644
--- a/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
+++ b/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
@@ -19,6 +19,7 @@ properties:
- items:
- enum:
- mediatek,mt8192-ufshci
+ - mediatek,mt8195-ufshci
- const: mediatek,mt8183-ufshci

clocks:
--
2.44.0


Subject: [PATCH v4 5/8] dt-bindings: ufs: mediatek,ufs: Document MT8192 compatible with MT8183

The MT8192 UFS controller is compatible with the MT8183 one:
document this by allowing to assign both compatible strings
"mediatek,mt8192-ufshci", "mediatek,mt8183-ufshci" to the UFSHCI node.

Moreover, since no MT8192 devicetree ever declared any UFSHCI node,
disallow specifying only the MT8192 compatible.

In preparation for adding MT8195 to the mix, the MT8192 compatible
was added as enum instead of const.

Also, while at it, replace Stanley Chu with me in the maintainers
field, as he is unreachable and his email isn't active anymore.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
.../devicetree/bindings/ufs/mediatek,ufs.yaml | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml b/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
index 32fd535a514a..f14887ea6fdc 100644
--- a/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
+++ b/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
@@ -7,16 +7,19 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Mediatek Universal Flash Storage (UFS) Controller

maintainers:
- - Stanley Chu <[email protected]>
+ - AngeloGioacchino Del Regno <[email protected]>

allOf:
- $ref: ufs-common.yaml

properties:
compatible:
- enum:
- - mediatek,mt8183-ufshci
- - mediatek,mt8192-ufshci
+ oneOf:
+ - const: mediatek,mt8183-ufshci
+ - items:
+ - enum:
+ - mediatek,mt8192-ufshci
+ - const: mediatek,mt8183-ufshci

clocks:
maxItems: 1
--
2.44.0


2024-04-15 13:19:02

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v4 5/8] dt-bindings: ufs: mediatek,ufs: Document MT8192 compatible with MT8183

On Mon, Apr 15, 2024 at 01:00:09PM +0200, AngeloGioacchino Del Regno wrote:
> The MT8192 UFS controller is compatible with the MT8183 one:
> document this by allowing to assign both compatible strings
> "mediatek,mt8192-ufshci", "mediatek,mt8183-ufshci" to the UFSHCI node.
>
> Moreover, since no MT8192 devicetree ever declared any UFSHCI node,
> disallow specifying only the MT8192 compatible.
>
> In preparation for adding MT8195 to the mix, the MT8192 compatible
> was added as enum instead of const.
>
> Also, while at it, replace Stanley Chu with me in the maintainers
> field, as he is unreachable and his email isn't active anymore.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>

Acked-by: Conor Dooley <[email protected]>


Attachments:
(No filename) (803.00 B)
signature.asc (235.00 B)
Download all attachments

2024-04-15 13:26:50

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v4 7/8] dt-bindings: ufs: mediatek,ufs: Document additional clocks

On Mon, Apr 15, 2024 at 01:00:11PM +0200, AngeloGioacchino Del Regno wrote:
> Add additional clocks, used on all MediaTek SoCs' UFSHCI controllers:
> some of these clocks are optional and used only for scaling purposes
> to save power, or to improve performance in the case of the crypt
> clocks.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>

Acked-by: Conor Dooley <[email protected]>

> ---
> .../devicetree/bindings/ufs/mediatek,ufs.yaml | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml b/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
> index 5728e750761f..1df8779ee902 100644
> --- a/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
> +++ b/Documentation/devicetree/bindings/ufs/mediatek,ufs.yaml
> @@ -23,11 +23,24 @@ properties:
> - const: mediatek,mt8183-ufshci
>
> clocks:
> - maxItems: 1
> + minItems: 1
> + maxItems: 12
>
> clock-names:
> + minItems: 1
> items:
> - const: ufs
> + - const: ufs-aes
> + - const: ufs-tick
> + - const: unipro-sys
> + - const: unipro-tick
> + - const: ufs-sap
> + - const: ufs-tx-symbol
> + - const: ufs-rx-symbol
> + - const: ufs-mem
> + - const: crypt-mux
> + - const: crypt-lp
> + - const: crypt-perf
>
> phys:
> maxItems: 1
> --
> 2.44.0
>


Attachments:
(No filename) (1.48 kB)
signature.asc (235.00 B)
Download all attachments