U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Chee, Tien Fong" <tienfong.chee@altera.com>
To: alif.zakuan.yuslaimi@altera.com, u-boot@lists.denx.de
Cc: Marek Vasut <marex@nabladev.com>,
	Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>,
	Tien Fong Chee <tien.fong.chee@altera.com>,
	Peng Fan <peng.fan@nxp.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Brian Sune <briansune@gmail.com>
Subject: Re: [PATCH v1 4/8] mmc: socfpga_dw_mmc: Restore legacy clkmgr address retrieval
Date: Mon, 1 Dec 2025 11:07:38 +0800	[thread overview]
Message-ID: <3310c44d-28fa-4d88-91f6-3e5a64087569@altera.com> (raw)
In-Reply-To: <20251125081316.17329-5-alif.zakuan.yuslaimi@altera.com>


On 25/11/2025 4:13 pm, alif.zakuan.yuslaimi@altera.com wrote:
> From: Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi@altera.com>
>
> Restore legacy implementation of retrieving clkmgr base address from
> mach-socfpga/misc.c driver for our legacy devices.
>
> Excluding Agilex7/7M from this implementation as these devices' clock
> driver is already following clock driver model and is supporting
> enable/disable APIs.
>
> The legacy devices' clock driver will have to be refactored to support
> driver model which enables us to support enable/disable APIs for these
> devices.
>
> Fixes: ab27182cac8f ("mmc: socfpga_dw_mmc: Enable/disable SDMMC clock via API")
>
> Signed-off-by: Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi@altera.com>
> ---
>   drivers/mmc/socfpga_dw_mmc.c | 46 +++++++++++++++++++++++-------------
>   1 file changed, 30 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c
> index db4e0129c2e..6219284df3e 100644
> --- a/drivers/mmc/socfpga_dw_mmc.c
> +++ b/drivers/mmc/socfpga_dw_mmc.c
> @@ -58,17 +58,24 @@ static int socfpga_dwmci_clksel(struct dwmci_host *host)
>   	u32 sdmmc_mask = ((priv->smplsel & 0x7) << SYSMGR_SDMMC_SMPLSEL_SHIFT) |
>   			 ((priv->drvsel & 0x7) << SYSMGR_SDMMC_DRVSEL_SHIFT);
>   
> -	ret = clk_get_by_name(priv->dev, "ciu", &priv->mmc_clk_ciu);
> -	if (ret) {
> -		debug("%s: Failed to get SDMMC clock from dts\n", __func__);
> -		return ret;
> -	}
> -
> -	/* Disable SDMMC clock. */
> -	ret = clk_disable(&priv->mmc_clk_ciu);
> -	if (ret) {
> -		printf("%s: Failed to disable SDMMC clock\n", __func__);
> -		return ret;
> +	if (!IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX) &&
> +	    !IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)) {
> +		/* Disable SDMMC clock. */
> +		clrbits_le32(socfpga_get_clkmgr_addr() + CLKMGR_PERPLL_EN,
> +			     CLKMGR_PERPLLGRP_EN_SDMMCCLK_MASK);
> +	} else {
> +		ret = clk_get_by_name(priv->dev, "ciu", &priv->mmc_clk_ciu);
> +		if (ret) {
> +			debug("%s: Failed to get SDMMC clock from dts\n", __func__);
> +			return ret;
> +		}
> +
> +		/* Disable SDMMC clock. */
> +		ret = clk_disable(&priv->mmc_clk_ciu);
> +		if (ret) {
> +			printf("%s: Failed to disable SDMMC clock\n", __func__);
> +			return ret;
> +		}
>   	}
>   
>   	debug("%s: drvsel %d smplsel %d\n", __func__,
> @@ -88,11 +95,18 @@ static int socfpga_dwmci_clksel(struct dwmci_host *host)
>   		readl(socfpga_get_sysmgr_addr() + SYSMGR_SDMMC));
>   #endif
>   
> -	/* Enable SDMMC clock */
> -	ret = clk_enable(&priv->mmc_clk_ciu);
> -	if (ret) {
> -		printf("%s: Failed to enable SDMMC clock\n", __func__);
> -		return ret;
> +	if (!IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX) &&
> +	    !IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)) {
> +		/* Enable SDMMC clock */
> +		setbits_le32(socfpga_get_clkmgr_addr() + CLKMGR_PERPLL_EN,
> +			     CLKMGR_PERPLLGRP_EN_SDMMCCLK_MASK);
> +	} else {
> +		/* Enable SDMMC clock */
> +		ret = clk_enable(&priv->mmc_clk_ciu);
> +		if (ret) {
> +			printf("%s: Failed to enable SDMMC clock\n", __func__);
> +			return ret;
> +		}
>   	}
>   
>   	return 0;


Reviewed-by: Tien Fong Chee <tien.fong.chee@altera.com>

Best regards,
Tien Fong


  parent reply	other threads:[~2025-12-01  3:07 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25  8:13 [PATCH v1 0/8]SoCFPGA: Update Boot Support for CycloneV in U-Boot alif.zakuan.yuslaimi
2025-11-25  8:13 ` [PATCH v1 1/8] configs: cyclone5: Disable mkeficapsule tool build alif.zakuan.yuslaimi
2025-12-01  3:06   ` Chee, Tien Fong
2025-11-25  8:13 ` [PATCH v1 2/8] arm: Fix "file truncated" linker errors from empty built-in.a in SPL/TPL/VPL builds alif.zakuan.yuslaimi
2025-11-25 12:23   ` Marek Vasut
2025-11-27  2:12     ` Yuslaimi, Alif Zakuan
2025-11-27 15:09       ` Marek Vasut
2025-11-28  2:11         ` Yuslaimi, Alif Zakuan
2025-11-28 15:31           ` Tom Rini
2025-11-28 16:20             ` Sune Brian
2025-11-28 16:44             ` Ilias Apalodimas
2025-11-28 16:49               ` Tom Rini
2025-11-29  0:46                 ` Sune Brian
2025-12-01 16:44                   ` Tom Rini
2025-12-01 16:52                     ` Sune Brian
2025-12-01 16:54                       ` Tom Rini
2025-12-01 17:07                         ` Sune Brian
2025-12-01 17:09                           ` Tom Rini
2025-12-01 17:59                             ` Sune Brian
2025-12-01 18:27                               ` Tom Rini
2025-12-01 18:37                                 ` Sune Brian
2025-12-01 18:38                                   ` Tom Rini
2025-12-01 18:48                                     ` Sune Brian
2025-12-01 19:10                                     ` Sune Brian
2025-12-02  7:55                 ` Ilias Apalodimas
2025-12-02  8:02                   ` Sune Brian
2025-12-02  8:53                     ` Ilias Apalodimas
2025-12-02  8:59                       ` Sune Brian
2025-12-03  6:46                         ` Yuslaimi, Alif Zakuan
2025-12-03  6:54                           ` Sune Brian
2025-11-25  8:13 ` [PATCH v1 3/8] configs: cyclone5: Enable random MAC address alif.zakuan.yuslaimi
2025-11-25 12:23   ` Marek Vasut
2025-11-27  2:14     ` Yuslaimi, Alif Zakuan
2025-11-25  8:13 ` [PATCH v1 4/8] mmc: socfpga_dw_mmc: Restore legacy clkmgr address retrieval alif.zakuan.yuslaimi
2025-11-25 12:24   ` Marek Vasut
2025-11-27  2:21     ` Yuslaimi, Alif Zakuan
2025-12-01  3:07   ` Chee, Tien Fong [this message]
2025-11-25  8:13 ` [PATCH v1 5/8] spl: Remove ARCH_SOCFPGA from MMC raw mode enablement alif.zakuan.yuslaimi
2025-12-01  3:08   ` Chee, Tien Fong
2025-11-25  8:13 ` [PATCH v1 6/8] configs: cyclone5: Enable SPL FAT support alif.zakuan.yuslaimi
2025-11-25  9:41   ` Jan Kiszka
2025-11-25  9:44     ` Jan Kiszka
2025-11-27  4:34       ` Chee, Tien Fong
2025-11-27  4:32     ` Chee, Tien Fong
2025-11-27  6:37       ` Jan Kiszka
2025-11-27  6:48         ` Sune Brian
2025-11-27  7:05           ` Jan Kiszka
2025-11-27  7:20             ` Sune Brian
2025-11-27  7:29               ` Jan Kiszka
2025-11-27  7:39                 ` Sune Brian
2025-11-27  7:50                   ` Jan Kiszka
2025-11-27  7:56                     ` Sune Brian
2025-11-27  8:22                       ` Jan Kiszka
2025-11-27  9:42                         ` Sune Brian
2025-11-27 17:42                           ` Jan Kiszka
2025-11-27 17:48                             ` Sune Brian
2025-12-01  3:08   ` Chee, Tien Fong
2025-11-25  8:13 ` [PATCH v1 7/8] configs: cyclone5: Update boot command for CycloneV alif.zakuan.yuslaimi
2025-12-01  3:10   ` Chee, Tien Fong
2025-11-25  8:13 ` [PATCH v1 8/8] configs: cyclone5: Disable SPI in SPL alif.zakuan.yuslaimi
2025-12-01  3:10   ` Chee, Tien Fong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3310c44d-28fa-4d88-91f6-3e5a64087569@altera.com \
    --to=tienfong.chee@altera.com \
    --cc=alif.zakuan.yuslaimi@altera.com \
    --cc=briansune@gmail.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jh80.chung@samsung.com \
    --cc=marex@nabladev.com \
    --cc=peng.fan@nxp.com \
    --cc=simon.k.r.goldschmidt@gmail.com \
    --cc=tien.fong.chee@altera.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox