public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: u-boot@lists.denx.de
Subject: [PATCH 2/4] mx6cuboxi: enable MMC iomux on board_early_init_f
Date: Sun, 08 Mar 2020 06:38:33 +0200	[thread overview]
Message-ID: <878skbxxyu.fsf@tarshish> (raw)
In-Reply-To: <20200304144125.8564-3-walter.lozano@collabora.com>

Hi Walter,

Thanks for your SPL_DM support work on this platform.

One comment inline below.

On Wed, Mar 04 2020, Walter Lozano wrote:
> MMC iomux is done on board_mmc_init which is valid when DM_MMC is not
> enabled. After enabling it, the iomux setup needs to be moved to a
> valid place.
>
> This patch moves the MMC iomux to board_early_init_f where other iomux
> is done.
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>  board/solidrun/mx6cuboxi/mx6cuboxi.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> index 6a96f9ecdb..71c77ad2a2 100644
> --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> @@ -179,6 +179,28 @@ int board_mmc_get_env_dev(int devno)
>  
>  #define USDHC2_CD_GPIO  IMX_GPIO_NR(1, 4)
>  
> +static int setup_iomux_mmc(void)
> +{
> +	struct src *psrc = (struct src *)SRC_BASE_ADDR;
> +	unsigned reg = readl(&psrc->sbmr1) >> 11;

This mostly duplicates the existing mmc_init_spl() routine. As I understand,
mmc_init_spl() becomes dead code once you enable CONFIG_SPL_DM in patch #4 of
this series. Can you remove mmc_init_spl() in a followup patch? Both
struct fsl_esdhc_cfg can also be removed, I believe.

baruch

> +
> +	/*
> +	 * Upon reading BOOT_CFG register the following map is done:
> +	 * Bit 11 and 12 of BOOT_CFG register can determine the current
> +	 * mmc port
> +	 * 0x1                  SD2
> +	 * 0x2                  SD3
> +	 */
> +	switch (reg & 0x3) {
> +	case 0x1:
> +		SETUP_IOMUX_PADS(usdhc2_pads);
> +	case 0x2:
> +		SETUP_IOMUX_PADS(usdhc3_pads);
> +	}
> +
> +	return 0;
> +}
> +
>  int board_mmc_getcd(struct mmc *mmc)
>  {
>  	struct fsl_esdhc_cfg *cfg = mmc->priv;
> @@ -432,9 +454,12 @@ int board_early_init_f(void)
>  {
>  	setup_iomux_uart();
>  
> +	setup_iomux_mmc();
> +
>  #ifdef CONFIG_CMD_SATA
>  	setup_sata();
>  #endif
> +
>  	return 0;
>  }

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

  reply	other threads:[~2020-03-08  4:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04 14:41 [PATCH 0/4] mx6cuboxi: enable support for OF_CONTROL and DM in SPL Walter Lozano
2020-03-04 14:41 ` [PATCH 1/4] mx6cuboxi: enable MMC and eMMC in DT for SPL Walter Lozano
2020-03-04 14:41 ` [PATCH 2/4] mx6cuboxi: enable MMC iomux on board_early_init_f Walter Lozano
2020-03-08  4:38   ` Baruch Siach [this message]
2020-03-09 19:55     ` Walter Lozano
2020-03-04 14:41 ` [PATCH 3/4] mx6cuboxi: customize board_boot_order to access eMMC Walter Lozano
2020-03-08  4:42   ` Baruch Siach
2020-03-09 19:55     ` Walter Lozano
2020-03-04 14:41 ` [PATCH 4/4] mx6cuboxi: enable OF_CONTROL and DM in SPL Walter Lozano

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=878skbxxyu.fsf@tarshish \
    --to=baruch@tkos.co.il \
    --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