All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Yixun Lan <dlan@gentoo.org>
Cc: u-boot@lists.denx.de, linux-sunxi@lists.linux.dev,
	Jagan Teki <jagan@amarulasolutions.com>,
	Tom Rini <trini@konsulko.com>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Paul Kocialkowski <contact@paulk.fr>,
	Samuel Holland <samuel@sholland.org>
Subject: Re: [PATCH v2 10/10] sunxi: mmc: enable support for A733
Date: Fri, 2 Jan 2026 01:41:24 +0100	[thread overview]
Message-ID: <20260102014124.3b35207c@minigeek.lan> (raw)
In-Reply-To: <20251130-01-a733-soc-support-v2-10-18bdd4376fad@gentoo.org>

On Sun, 30 Nov 2025 21:45:19 +0000
Yixun Lan <dlan@gentoo.org> wrote:

> Minor clock adjustment for new A733 MMC controller, the SMHC0_CLK_REG
> start at offset 0x400, and with step size of 0x10.
> 
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---
>  drivers/mmc/sunxi_mmc.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
> index e28c81afffe..689bec6693c 100644
> --- a/drivers/mmc/sunxi_mmc.c
> +++ b/drivers/mmc/sunxi_mmc.c
> @@ -112,6 +112,9 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
>  			if (priv->mmc_no == 2)
>  				pll_hz *= 2;
>  		}
> +
> +		if (IS_ENABLED(CONFIG_MACH_SUN60I_A733))
> +			pll_hz /= 3;
>  	}
>  
>  	div = pll_hz / hz;
> @@ -167,7 +170,8 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
>  	}
>  
>  	/* The A523 has a second divider, not a shift. */
> -	if (IS_ENABLED(CONFIG_MACH_SUN55I_A523))
> +	if (IS_ENABLED(CONFIG_MACH_SUN55I_A523) ||
> +		IS_ENABLED(CONFIG_MACH_SUN60I_A733))
>  		n = (1U << n) - 1;
>  
>  	writel(CCM_MMC_CTRL_ENABLE| pll | CCM_MMC_CTRL_N(n) |
> @@ -661,17 +665,28 @@ static const struct dm_mmc_ops sunxi_mmc_ops = {
>  	.get_cd		= sunxi_mmc_getcd,
>  };
>  
> -static unsigned get_mclk_offset(void)
> +static unsigned int get_mclk_offset(void)
>  {
>  	if (IS_ENABLED(CONFIG_MACH_SUN9I_A80))
>  		return 0x410;
>  
> +	if (IS_ENABLED(CONFIG_MACH_SUN60I_A733))
> +		return 0xd00;
> +
>  	if (IS_ENABLED(CONFIG_SUN50I_GEN_H6) || IS_ENABLED(CONFIG_SUNXI_GEN_NCAT2))
>  		return 0x830;
>  
>  	return 0x88;
>  };
>  
> +static unsigned int get_mclk_size(void)

Can you please fold this function into the one above, passing in the
MMC controller number?
static unsigned int get_mclk_offset(int mmc_no);

Thanks,
Andre

> +{
> +	if (IS_ENABLED(CONFIG_MACH_SUN60I_A733))
> +		return 0x10;
> +
> +	return 0x4;
> +};
> +
>  static int sunxi_mmc_probe(struct udevice *dev)
>  {
>  	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
> @@ -707,7 +722,7 @@ static int sunxi_mmc_probe(struct udevice *dev)
>  	ccu_reg = (u32 *)(uintptr_t)ofnode_get_addr(args.node);
>  
>  	priv->mmc_no = ((uintptr_t)priv->reg - SUNXI_MMC0_BASE) / 0x1000;
> -	priv->mclkreg = (void *)ccu_reg + get_mclk_offset() + priv->mmc_no * 4;
> +	priv->mclkreg = (void *)ccu_reg + get_mclk_offset() + priv->mmc_no * get_mclk_size();
>  
>  	ret = clk_get_by_name(dev, "ahb", &gate_clk);
>  	if (!ret)
> 


      reply	other threads:[~2026-01-02  0:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-30 21:45 [PATCH v2 00/10] sunxi: Add support for A733 SoC Yixun Lan
2025-11-30 21:45 ` [PATCH v2 01/10] sunxi: sun60i: initial " Yixun Lan
2026-01-02  0:40   ` Andre Przywara
2026-01-13  1:31     ` Yixun Lan
2025-11-30 21:45 ` [PATCH v2 02/10] sunxi: spl: a733: config text and stack address Yixun Lan
2026-01-02  0:40   ` Andre Przywara
2026-01-13  1:22     ` Yixun Lan
2025-11-30 21:45 ` [PATCH v2 03/10] sunxi: a733: uart: setup serial console Yixun Lan
2025-11-30 21:45 ` [PATCH v2 04/10] clock: a733: implement support for mmc/uart Yixun Lan
2025-11-30 21:45 ` [PATCH v2 05/10] clock: reset: a733: add initial support Yixun Lan
2025-11-30 21:45 ` [PATCH v2 06/10] gpio: " Yixun Lan
2025-11-30 22:09   ` Fabio Estevam
2025-11-30 22:20     ` Yixun Lan
2026-01-02  0:39       ` Andre Przywara
2025-12-01  0:01   ` Tom Rini
2025-12-01 10:37     ` Yixun Lan
2025-11-30 21:45 ` [PATCH v2 07/10] pinctrl: sunxi: " Yixun Lan
2025-11-30 21:45 ` [PATCH v2 08/10] pmu: axp318w: implement pmic/regulator support Yixun Lan
2026-01-02  0:40   ` Andre Przywara
2025-11-30 21:45 ` [PATCH v2 09/10] power: pmic: sunxi: add SPL support for the AXP318W Yixun Lan
2025-11-30 21:45 ` [PATCH v2 10/10] sunxi: mmc: enable support for A733 Yixun Lan
2026-01-02  0:41   ` Andre Przywara [this message]

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=20260102014124.3b35207c@minigeek.lan \
    --to=andre.przywara@arm.com \
    --cc=contact@paulk.fr \
    --cc=dlan@gentoo.org \
    --cc=jagan@amarulasolutions.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=samuel@sholland.org \
    --cc=trini@konsulko.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.