From: Fabio Estevam <festevam@gmail.com>
To: sbabic@denx.de
Cc: pbrobinson@gmail.com, trini@konsulko.com, u-boot@lists.denx.de,
Fabio Estevam <festevam@gmail.com>
Subject: [PATCH 1/6] udoo_spl: Initialize the eSDHC controller in SPL
Date: Sat, 18 Dec 2021 18:10:20 -0300 [thread overview]
Message-ID: <20211218211025.770362-1-festevam@gmail.com> (raw)
Currently, imx6q udoo board fails to boot like this:
U-Boot SPL 2022.01-rc3-00061-g95ca715adad3 (Dec 18 2021 - 18:04:40 -0300)
Trying to boot from MMC1
The reason is that the eSDHC controller is not initialized in SPL.
Initialize the eSDHC controller in SPL via C code as DM is not
used in SPL.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
board/udoo/udoo_spl.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/board/udoo/udoo_spl.c b/board/udoo/udoo_spl.c
index d9afbbb74198..754bd9dfe21e 100644
--- a/board/udoo/udoo_spl.c
+++ b/board/udoo/udoo_spl.c
@@ -254,4 +254,39 @@ void board_init_f(ulong dummy)
/* DDR initialization */
spl_dram_init();
}
+
+#define USDHC3_CD_GPIO IMX_GPIO_NR(7, 0)
+
+#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | \
+ PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \
+ PAD_CTL_SRE_FAST | PAD_CTL_HYS)
+
+static struct fsl_esdhc_cfg usdhc_cfg[2] = {
+ {USDHC3_BASE_ADDR},
+};
+
+static const iomux_v3_cfg_t usdhc3_pads[] = {
+ IOMUX_PADS(PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+ IOMUX_PADS(PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+ IOMUX_PADS(PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+ IOMUX_PADS(PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+ IOMUX_PADS(PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+ IOMUX_PADS(PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
+ IOMUX_PADS(PAD_SD3_DAT5__GPIO7_IO00 | MUX_PAD_CTRL(NO_PAD_CTRL)),
+};
+
+int board_mmc_getcd(struct mmc *mmc)
+{
+ return !gpio_get_value(USDHC3_CD_GPIO);
+}
+
+int board_mmc_init(struct bd_info *bis)
+{
+ SETUP_IOMUX_PADS(usdhc3_pads);
+ usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
+ usdhc_cfg[0].max_bus_width = 4;
+ gpio_direction_input(USDHC3_CD_GPIO);
+
+ return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
+}
#endif
--
2.25.1
next reply other threads:[~2021-12-18 21:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-18 21:10 Fabio Estevam [this message]
2021-12-18 21:10 ` [PATCH 2/6] ARM: dts: imx6qdl-udoo: Properly describe the SD card detect Fabio Estevam
2021-12-19 15:54 ` Peter Robinson
2021-12-19 22:43 ` Fabio Estevam
2022-01-09 1:27 ` Tom Rini
2021-12-18 21:10 ` [PATCH 3/6] udoo: Call gpio_request() Fabio Estevam
2021-12-20 16:10 ` Peter Robinson
2022-01-09 1:27 ` Tom Rini
2021-12-18 21:10 ` [PATCH 4/6] udoo: Adjust the SD card device numbering Fabio Estevam
2021-12-21 9:52 ` Peter Robinson
2022-01-09 1:27 ` Tom Rini
2021-12-18 21:10 ` [PATCH 5/6] udoo: Increase CONFIG_ENV_OFFSET Fabio Estevam
2021-12-21 9:52 ` Peter Robinson
2022-01-09 1:27 ` Tom Rini
2021-12-18 21:10 ` [PATCH 6/6] udoo: Select CMD_DM Fabio Estevam
2021-12-21 9:53 ` Peter Robinson
2022-01-09 1:27 ` Tom Rini
2021-12-20 16:09 ` [PATCH 1/6] udoo_spl: Initialize the eSDHC controller in SPL Peter Robinson
2021-12-23 15:03 ` Fabio Estevam
2022-01-07 20:17 ` Fabio Estevam
2022-01-09 1:27 ` Tom Rini
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=20211218211025.770362-1-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=pbrobinson@gmail.com \
--cc=sbabic@denx.de \
--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.