2021-06-03 18:25:18

by A, Rashmi

[permalink] [raw]
Subject: [“PATCH” 0/2] [KMB] mmc clock-frequency property update and

From: Rashmi A <[email protected]>

Patch1: If clock-frequency property is set and it is not the same as the
current clock rate of clk_xin(base clock frequency), set clk_xin
to use the provided clock rate.

Patch2: Since the EMMC clock in KMB was changed from 200Mhz to 175Mhz in
FIP,there were some warnings introduced, as the frequency values
being checked was still wrt 200Mhz in code. Hence, the frequency
checks are now updated based on the current 175Mhz EMMC clock
changed in FIP.

Review comments from Adrian Hunter have been incorporated.
Above 2 patches are tested with Keem Bay evaluation module board.

Please help to review this patch set.


Rashmi A (2):
mmc: sdhci-of-arasan: Use clock-frequency property to update clk_xin
phy: intel: Fix for warnings due to EMMC clock 175Mhz change in FIP

drivers/mmc/host/sdhci-of-arasan.c | 14 ++++++++++++--
drivers/phy/intel/phy-intel-keembay-emmc.c | 3 ++-
2 files changed, 14 insertions(+), 3 deletions(-)

--
2.17.1


2021-06-03 18:25:18

by A, Rashmi

[permalink] [raw]
Subject: [“PATCH” 1/2] mmc: sdhci-of-arasan: Use clock-frequency property to update clk_xin

From: Rashmi A <[email protected]>

If clock-frequency property is set and it is not the same as the current
clock rate of clk_xin(base clock frequency), set clk_xin to use the
provided clock rate.

Signed-off-by: Rashmi A <[email protected]>
Reviewed-by: Adrian Hunter <[email protected]>
---
drivers/mmc/host/sdhci-of-arasan.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 839965f7c717..0e7c07ed9690 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -1542,6 +1542,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
}
}

+ sdhci_get_of_property(pdev);
+
sdhci_arasan->clk_ahb = devm_clk_get(dev, "clk_ahb");
if (IS_ERR(sdhci_arasan->clk_ahb)) {
ret = dev_err_probe(dev, PTR_ERR(sdhci_arasan->clk_ahb),
@@ -1561,14 +1563,22 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
goto err_pltfm_free;
}

+ /* If clock-frequency property is set, use the provided value */
+ if (pltfm_host->clock &&
+ pltfm_host->clock != clk_get_rate(clk_xin)) {
+ ret = clk_set_rate(clk_xin, pltfm_host->clock);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to set SD clock rate\n");
+ goto clk_dis_ahb;
+ }
+ }
+
ret = clk_prepare_enable(clk_xin);
if (ret) {
dev_err(dev, "Unable to enable SD clock.\n");
goto clk_dis_ahb;
}

- sdhci_get_of_property(pdev);
-
if (of_property_read_bool(np, "xlnx,fails-without-test-cd"))
sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_FORCE_CDTEST;

--
2.17.1

2021-06-03 18:26:09

by A, Rashmi

[permalink] [raw]
Subject: [“PATCH” 2/2] phy: intel: Fix for warnings due to EMMC clock 175Mhz change in FIP

From: Rashmi A <[email protected]>

Since the EMMC clock was changed from 200Mhz to 175Mhz in FIP,
there were some warnings introduced, as the frequency values
being checked was still wrt 200Mhz in code. Hence, the frequency
checks are now updated based on the current 175Mhz EMMC clock changed
in FIP.

Spamming kernel log msg:
"phy phy-20290000.mmc_phy.2: Unsupported rate: 43750000"

Signed-off-by: Rashmi A <[email protected]>
Reviewed-by: Adrian Hunter <[email protected]>
---
drivers/phy/intel/phy-intel-keembay-emmc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/intel/phy-intel-keembay-emmc.c b/drivers/phy/intel/phy-intel-keembay-emmc.c
index eb7c635ed89a..0eb11ac7c2e2 100644
--- a/drivers/phy/intel/phy-intel-keembay-emmc.c
+++ b/drivers/phy/intel/phy-intel-keembay-emmc.c
@@ -95,7 +95,8 @@ static int keembay_emmc_phy_power(struct phy *phy, bool on_off)
else
freqsel = 0x0;

- if (mhz < 50 || mhz > 200)
+ /* Check for EMMC clock rate*/
+ if (mhz > 175)
dev_warn(&phy->dev, "Unsupported rate: %d MHz\n", mhz);

/*
--
2.17.1

2021-06-04 06:15:49

by Michal Simek

[permalink] [raw]
Subject: Re: [“PATCH” 1/2] mmc: sdhci-of-arasan : Use clock-frequency property to update clk_xin



On 6/3/21 8:22 PM, [email protected] wrote:
> From: Rashmi A <[email protected]>
>
> If clock-frequency property is set and it is not the same as the current
> clock rate of clk_xin(base clock frequency), set clk_xin to use the
> provided clock rate.
>
> Signed-off-by: Rashmi A <[email protected]>
> Reviewed-by: Adrian Hunter <[email protected]>
> ---
> drivers/mmc/host/sdhci-of-arasan.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index 839965f7c717..0e7c07ed9690 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -1542,6 +1542,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
> }
> }
>
> + sdhci_get_of_property(pdev);
> +
> sdhci_arasan->clk_ahb = devm_clk_get(dev, "clk_ahb");
> if (IS_ERR(sdhci_arasan->clk_ahb)) {
> ret = dev_err_probe(dev, PTR_ERR(sdhci_arasan->clk_ahb),
> @@ -1561,14 +1563,22 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
> goto err_pltfm_free;
> }
>
> + /* If clock-frequency property is set, use the provided value */
> + if (pltfm_host->clock &&
> + pltfm_host->clock != clk_get_rate(clk_xin)) {
> + ret = clk_set_rate(clk_xin, pltfm_host->clock);
> + if (ret) {
> + dev_err(&pdev->dev, "Failed to set SD clock rate\n");
> + goto clk_dis_ahb;
> + }
> + }
> +
> ret = clk_prepare_enable(clk_xin);
> if (ret) {
> dev_err(dev, "Unable to enable SD clock.\n");
> goto clk_dis_ahb;
> }
>
> - sdhci_get_of_property(pdev);
> -
> if (of_property_read_bool(np, "xlnx,fails-without-test-cd"))
> sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_FORCE_CDTEST;
>
>

Manish/Sai: Please retest this on Xilinx SOC.

Thanks,
Michal

2021-06-08 12:57:16

by Ulf Hansson

[permalink] [raw]
Subject: Re: [“PATCH” 2/2] phy: intel: Fix for warnings d ue to EMMC clock 175Mhz change in FIP

On Thu, 3 Jun 2021 at 20:22, <[email protected]> wrote:
>
> From: Rashmi A <[email protected]>
>
> Since the EMMC clock was changed from 200Mhz to 175Mhz in FIP,
> there were some warnings introduced, as the frequency values
> being checked was still wrt 200Mhz in code. Hence, the frequency
> checks are now updated based on the current 175Mhz EMMC clock changed
> in FIP.
>
> Spamming kernel log msg:
> "phy phy-20290000.mmc_phy.2: Unsupported rate: 43750000"
>
> Signed-off-by: Rashmi A <[email protected]>
> Reviewed-by: Adrian Hunter <[email protected]>

I guess $subject patch should be queued together with patch1/2 (via
the mmc tree?), no?

Vinod, Kishion, if that's okay I need an ack from you to pick it up.

Kind regards
Uffe

> ---
> drivers/phy/intel/phy-intel-keembay-emmc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/intel/phy-intel-keembay-emmc.c b/drivers/phy/intel/phy-intel-keembay-emmc.c
> index eb7c635ed89a..0eb11ac7c2e2 100644
> --- a/drivers/phy/intel/phy-intel-keembay-emmc.c
> +++ b/drivers/phy/intel/phy-intel-keembay-emmc.c
> @@ -95,7 +95,8 @@ static int keembay_emmc_phy_power(struct phy *phy, bool on_off)
> else
> freqsel = 0x0;
>
> - if (mhz < 50 || mhz > 200)
> + /* Check for EMMC clock rate*/
> + if (mhz > 175)
> dev_warn(&phy->dev, "Unsupported rate: %d MHz\n", mhz);
>
> /*
> --
> 2.17.1
>

2021-06-09 12:38:51

by Vinod Koul

[permalink] [raw]
Subject: Re: [“PATCH” 2/2] phy : intel : Fix for warnings due to EMMC clock 175Mhz change in FIP

On 08-06-21, 14:52, Ulf Hansson wrote:
> On Thu, 3 Jun 2021 at 20:22, <[email protected]> wrote:
> >
> > From: Rashmi A <[email protected]>
> >
> > Since the EMMC clock was changed from 200Mhz to 175Mhz in FIP,
> > there were some warnings introduced, as the frequency values
> > being checked was still wrt 200Mhz in code. Hence, the frequency
> > checks are now updated based on the current 175Mhz EMMC clock changed
> > in FIP.
> >
> > Spamming kernel log msg:
> > "phy phy-20290000.mmc_phy.2: Unsupported rate: 43750000"
> >
> > Signed-off-by: Rashmi A <[email protected]>
> > Reviewed-by: Adrian Hunter <[email protected]>
>
> I guess $subject patch should be queued together with patch1/2 (via
> the mmc tree?), no?
>
> Vinod, Kishion, if that's okay I need an ack from you to pick it up.

Sure:

Acked-By: Vinod Koul <[email protected]>

--
~Vinod

2021-06-17 10:20:20

by Ulf Hansson

[permalink] [raw]
Subject: Re: [“PATCH” 1/2] mmc: sdhci-of-arasan: Use cloc k-frequency property to update clk_xin

On Fri, 4 Jun 2021 at 08:13, Michal Simek <[email protected]> wrote:
>
>
>
> On 6/3/21 8:22 PM, [email protected] wrote:
> > From: Rashmi A <[email protected]>
> >
> > If clock-frequency property is set and it is not the same as the current
> > clock rate of clk_xin(base clock frequency), set clk_xin to use the
> > provided clock rate.
> >
> > Signed-off-by: Rashmi A <[email protected]>
> > Reviewed-by: Adrian Hunter <[email protected]>
> > ---
> > drivers/mmc/host/sdhci-of-arasan.c | 14 ++++++++++++--
> > 1 file changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> > index 839965f7c717..0e7c07ed9690 100644
> > --- a/drivers/mmc/host/sdhci-of-arasan.c
> > +++ b/drivers/mmc/host/sdhci-of-arasan.c
> > @@ -1542,6 +1542,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
> > }
> > }
> >
> > + sdhci_get_of_property(pdev);
> > +
> > sdhci_arasan->clk_ahb = devm_clk_get(dev, "clk_ahb");
> > if (IS_ERR(sdhci_arasan->clk_ahb)) {
> > ret = dev_err_probe(dev, PTR_ERR(sdhci_arasan->clk_ahb),
> > @@ -1561,14 +1563,22 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
> > goto err_pltfm_free;
> > }
> >
> > + /* If clock-frequency property is set, use the provided value */
> > + if (pltfm_host->clock &&
> > + pltfm_host->clock != clk_get_rate(clk_xin)) {
> > + ret = clk_set_rate(clk_xin, pltfm_host->clock);
> > + if (ret) {
> > + dev_err(&pdev->dev, "Failed to set SD clock rate\n");
> > + goto clk_dis_ahb;
> > + }
> > + }
> > +
> > ret = clk_prepare_enable(clk_xin);
> > if (ret) {
> > dev_err(dev, "Unable to enable SD clock.\n");
> > goto clk_dis_ahb;
> > }
> >
> > - sdhci_get_of_property(pdev);
> > -
> > if (of_property_read_bool(np, "xlnx,fails-without-test-cd"))
> > sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_FORCE_CDTEST;
> >
> >
>
> Manish/Sai: Please retest this on Xilinx SOC.
>
> Thanks,
> Michal

I am about to queue this patch, but it would be nice to get your
confirmation and tested-by tags before doing so. Would that be
possible within the next couple of days?

Kind regards
Uffe

2021-06-17 12:35:08

by Sai Krishna Potthuri

[permalink] [raw]
Subject: RE: [“PATCH” 1/2] mmc: sdhci-of-arasan: U se clock-frequency property to update clk_xin

Hi,

> -----Original Message-----
> From: Ulf Hansson <[email protected]>
> Sent: Thursday, June 17, 2021 3:34 PM
> To: Michal Simek <[email protected]>; Manish Narani
> <[email protected]>; Sai Krishna Potthuri <[email protected]>
> Cc: [email protected]; [email protected];
> linux-mmc <[email protected]>; Linux ARM <linux-arm-
> [email protected]>; Linux Kernel Mailing List <linux-
> [email protected]>; Kishon <[email protected]>; Vinod Koul
> <[email protected]>; Andy Shevchenko
> <[email protected]>; [email protected]; Mark
> Gross <[email protected]>; [email protected];
> [email protected]; [email protected]; Adrian
> Hunter <[email protected]>; [email protected];
> [email protected]; Raja Subramanian, Lakshmi Bai
> <[email protected]>
> Subject: Re: [“PATCH” 1/2] mmc: sdhci-of-arasan: Use clock-frequency
> property to update clk_xin
>
> On Fri, 4 Jun 2021 at 08:13, Michal Simek <[email protected]> wrote:
> >
> >
> >
> > On 6/3/21 8:22 PM, [email protected] wrote:
> > > From: Rashmi A <[email protected]>
> > >
> > > If clock-frequency property is set and it is not the same as the
> > > current clock rate of clk_xin(base clock frequency), set clk_xin to
> > > use the provided clock rate.
> > >
> > > Signed-off-by: Rashmi A <[email protected]>
> > > Reviewed-by: Adrian Hunter <[email protected]>
> > > ---
> > > drivers/mmc/host/sdhci-of-arasan.c | 14 ++++++++++++--
> > > 1 file changed, 12 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/mmc/host/sdhci-of-arasan.c
> > > b/drivers/mmc/host/sdhci-of-arasan.c
> > > index 839965f7c717..0e7c07ed9690 100644
> > > --- a/drivers/mmc/host/sdhci-of-arasan.c
> > > +++ b/drivers/mmc/host/sdhci-of-arasan.c
> > > @@ -1542,6 +1542,8 @@ static int sdhci_arasan_probe(struct
> platform_device *pdev)
> > > }
> > > }
> > >
> > > + sdhci_get_of_property(pdev);
> > > +
> > > sdhci_arasan->clk_ahb = devm_clk_get(dev, "clk_ahb");
> > > if (IS_ERR(sdhci_arasan->clk_ahb)) {
> > > ret = dev_err_probe(dev,
> > > PTR_ERR(sdhci_arasan->clk_ahb), @@ -1561,14 +1563,22 @@ static int
> sdhci_arasan_probe(struct platform_device *pdev)
> > > goto err_pltfm_free;
> > > }
> > >
> > > + /* If clock-frequency property is set, use the provided value */
> > > + if (pltfm_host->clock &&
> > > + pltfm_host->clock != clk_get_rate(clk_xin)) {
> > > + ret = clk_set_rate(clk_xin, pltfm_host->clock);
> > > + if (ret) {
> > > + dev_err(&pdev->dev, "Failed to set SD clock rate\n");
> > > + goto clk_dis_ahb;
> > > + }
> > > + }
> > > +
> > > ret = clk_prepare_enable(clk_xin);
> > > if (ret) {
> > > dev_err(dev, "Unable to enable SD clock.\n");
> > > goto clk_dis_ahb;
> > > }
> > >
> > > - sdhci_get_of_property(pdev);
> > > -
> > > if (of_property_read_bool(np, "xlnx,fails-without-test-cd"))
> > > sdhci_arasan->quirks |=
> > > SDHCI_ARASAN_QUIRK_FORCE_CDTEST;
> > >
> > >
> >
> > Manish/Sai: Please retest this on Xilinx SOC.
> >
> > Thanks,
> > Michal
>
> I am about to queue this patch, but it would be nice to get your confirmation
> and tested-by tags before doing so. Would that be possible within the next
> couple of days?
Tested this patch on Xilinx platforms.
Tested-by: Sai Krishna Potthuri <[email protected]>

Regards
Sai Krishna

2021-06-29 15:10:57

by Ulf Hansson

[permalink] [raw]
Subject: Re: [“PATCH” 0/2] [KMB] mmc clock-frequency prop erty update and

On Thu, 3 Jun 2021 at 20:22, <[email protected]> wrote:
>
> From: Rashmi A <[email protected]>
>
> Patch1: If clock-frequency property is set and it is not the same as the
> current clock rate of clk_xin(base clock frequency), set clk_xin
> to use the provided clock rate.
>
> Patch2: Since the EMMC clock in KMB was changed from 200Mhz to 175Mhz in
> FIP,there were some warnings introduced, as the frequency values
> being checked was still wrt 200Mhz in code. Hence, the frequency
> checks are now updated based on the current 175Mhz EMMC clock
> changed in FIP.
>
> Review comments from Adrian Hunter have been incorporated.
> Above 2 patches are tested with Keem Bay evaluation module board.
>
> Please help to review this patch set.
>
>
> Rashmi A (2):
> mmc: sdhci-of-arasan: Use clock-frequency property to update clk_xin
> phy: intel: Fix for warnings due to EMMC clock 175Mhz change in FIP
>
> drivers/mmc/host/sdhci-of-arasan.c | 14 ++++++++++++--
> drivers/phy/intel/phy-intel-keembay-emmc.c | 3 ++-
> 2 files changed, 14 insertions(+), 3 deletions(-)
>
> --
> 2.17.1
>

Applied for fixes, thanks!

Kind regards
Uffe