mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Sascha Hauer" <s.hauer@pengutronix.de>
To: "Oleksij Rempel" <o.rempel@pengutronix.de>
Cc: barebox@lists.infradead.org, "Oleksij Rempel" <o.rempel@pengutronix.de>
Subject: Re: [PATCH v1 06/10] mci: atmel-sdhci: add Microchip LAN9691 / LAN969X SDHCI support
Date: Mon, 15 Jun 2026 07:25:51 +0000	[thread overview]
Message-ID: <E1wZ1hf-00000006FOJ-3b9a@pty.whiteo.stw.pengutronix.de> (raw)
In-Reply-To: <20260612055930.635833-6-o.rempel@pengutronix.de>

On 2026-06-12 07:59, Oleksij Rempel wrote:
> Match the "microchip,lan9691-sdhci" compatible and allow building on
> ARCH_MICROCHIP (and COMPILE_TEST). LAN969X uses a different GCK rate
> (100 MHz) than the AT91 SAMA5D2 (240 MHz), so plumb the per-compatible
> rate through device_get_match_data() and fall back to the SAMA5D2 rate
> when no match data is supplied.
> 
> The LAN969X SDHCI binding doesn't expose the PMC base clock that
> sama5d2/sam9x60 carry as "baseclk" (the GCK driver handles the upstream
> source internally), so make that lookup optional.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  drivers/mci/Kconfig       |  6 +++---
>  drivers/mci/atmel-sdhci.c | 22 ++++++++++++++++++----
>  2 files changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mci/Kconfig b/drivers/mci/Kconfig
> index b38f7a3bdf8b..8108c7b14848 100644
> --- a/drivers/mci/Kconfig
> +++ b/drivers/mci/Kconfig
> @@ -197,12 +197,12 @@ config MCI_ATMEL
>  	  Atmel AT91.
>  
>  config MCI_ATMEL_SDHCI
> -	bool "ATMEL SDHCI (sama5d2)"
> +	bool "ATMEL SDHCI (sama5d2, lan9691)"
>  	select MCI_SDHCI
> -	depends on ARCH_AT91
> +	depends on ARCH_AT91 || ARCH_MICROCHIP || COMPILE_TEST
>  	help
>  	  Enable this entry to add support to read and write SD cards on an
> -	  Atmel sama5d2
> +	  Atmel sama5d2 or Microchip LAN969X.
>  
>  config MCI_MMCI
>  	bool "ARM PL180 MMCI"
> diff --git a/drivers/mci/atmel-sdhci.c b/drivers/mci/atmel-sdhci.c
> index 462cf21bc25f..458d022fa3fa 100644
> --- a/drivers/mci/atmel-sdhci.c
> +++ b/drivers/mci/atmel-sdhci.c
> @@ -18,6 +18,7 @@
>  
>  #define ATMEL_SDHC_MIN_FREQ	400000
>  #define ATMEL_SDHC_GCK_RATE	240000000
> +#define LAN969X_GCK_RATE	100000000
>  
>  struct at91_sdhci_priv {
>  	struct at91_sdhci host;
> @@ -55,7 +56,8 @@ static int at91_sdhci_mci_init(struct mci_host *mci, struct device *dev)
>  			       priv->mci.non_removable, priv->cal_always_on);
>  }
>  
> -static int at91_sdhci_conf_clks(struct at91_sdhci_priv *priv)
> +static int at91_sdhci_conf_clks(struct at91_sdhci_priv *priv,
> +				unsigned long gck_rate)
>  {
>  	unsigned long real_gck_rate;
>  	int ret;
> @@ -66,7 +68,7 @@ static int at91_sdhci_conf_clks(struct at91_sdhci_priv *priv)
>  	 * base clock rate and the clock mult from capabilities.
>  	 */
>  	clk_enable(priv->hclock);
> -	ret = clk_set_rate(priv->gck, ATMEL_SDHC_GCK_RATE);
> +	ret = clk_set_rate(priv->gck, gck_rate);

Do we need this clk_set_rate() call at all?
dts/src/arm/microchip/sama5d2.dtsi sets this clock via
assigned-clock-rates, so we shouldn't have to repeat that here. Only
thing is that it's set to 480MHz in the dtsi and 240MHz in the driver.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  parent reply	other threads:[~2026-06-15  7:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12  5:59 [PATCH v1 01/10] ARM: introduce ARCH_MICROCHIP for ARM64 Microchip SoCs Oleksij Rempel
2026-06-12  5:59 ` [PATCH v1 02/10] serial: atmel: add lan9696 (Microchip LAN969X) support Oleksij Rempel
2026-06-12 12:49   ` Marco Felsch
2026-06-12  5:59 ` [PATCH v1 03/10] clk: add Microchip LAN966X / LAN969X generic clock controller driver Oleksij Rempel
2026-06-12 12:58   ` Marco Felsch
2026-06-15  7:02     ` Sascha Hauer
2026-06-15  7:46   ` Sascha Hauer
2026-06-12  5:59 ` [PATCH v1 04/10] clk: tolerate clocks registered without a name Oleksij Rempel
2026-06-12  5:59 ` [PATCH v1 05/10] pinctrl: ocelot: port Microsemi/Microchip Ocelot pinctrl from Linux Oleksij Rempel
2026-06-12  5:59 ` [PATCH v1 06/10] mci: atmel-sdhci: add Microchip LAN9691 / LAN969X SDHCI support Oleksij Rempel
2026-06-15  6:17   ` Marco Felsch
2026-06-15  7:25   ` Sascha Hauer [this message]
2026-06-12  5:59 ` [PATCH v1 07/10] gpio: add Microchip SGPIO (serial GPIO) driver Oleksij Rempel
2026-06-15  7:32   ` Sascha Hauer
2026-06-12  5:59 ` [PATCH v1 08/10] reset: add Microchip sparx5 / LAN969X / LAN966X switch reset driver Oleksij Rempel
2026-06-12  5:59 ` [PATCH v1 09/10] spi: atmel-quadspi: add Microchip LAN966X / LAN969X support Oleksij Rempel
2026-06-12  5:59 ` [PATCH v1 10/10] ARM: add Microchip LAN9696 (LAN969X) SoC and EV23X71A board Oleksij Rempel

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=E1wZ1hf-00000006FOJ-3b9a@pty.whiteo.stw.pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=o.rempel@pengutronix.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