mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Robin van der Gracht <robin@protonic.nl>,
	Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH v1 5/6] ARM: boards: protonic-imx6: Add emmc_usdhc machine data variable
Date: Wed, 18 Aug 2021 14:19:44 +0200	[thread overview]
Message-ID: <20210818121945.26089-6-o.rempel@pengutronix.de> (raw)
In-Reply-To: <20210818121945.26089-1-o.rempel@pengutronix.de>

From: Robin van der Gracht <robin@protonic.nl>

The i.MX6 ultralite only has 2 usdhc ports which will be indexed as '0'
and '1'. The bbu setup code assumes it is attached as '/dev/mmc2'.

Signed-off-by: Robin van der Gracht <robin@protonic.nl>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 arch/arm/boards/protonic-imx6/board.c | 30 ++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/protonic-imx6/board.c b/arch/arm/boards/protonic-imx6/board.c
index 38630dc2af..0cfafdcc26 100644
--- a/arch/arm/boards/protonic-imx6/board.c
+++ b/arch/arm/boards/protonic-imx6/board.c
@@ -70,6 +70,7 @@ struct prt_machine_data {
 	unsigned int hw_rev;
 	unsigned int i2c_addr;
 	unsigned int i2c_adapter;
+	unsigned int emmc_usdhc;
 	unsigned int flags;
 	int (*init)(struct prt_imx6_priv *priv);
 };
@@ -411,6 +412,7 @@ static int prt_imx6_bbu(struct prt_imx6_priv *priv)
 {
 	const struct prt_machine_data *dcfg = priv->dcfg;
 	u32 emmc_flags = 0;
+	char *devicefile;
 	int ret;
 
 	if (dcfg->flags & PRT_IMX6_BOOTSRC_SPI_NOR) {
@@ -422,7 +424,12 @@ static int prt_imx6_bbu(struct prt_imx6_priv *priv)
 		emmc_flags = BBU_HANDLER_FLAG_DEFAULT;
 	}
 
-	ret = imx6_bbu_internal_mmcboot_register_handler("eMMC", "/dev/mmc2",
+	devicefile = basprintf("mmc%d", dcfg->emmc_usdhc);
+	if (!devicefile) {
+		ret = -ENOMEM;
+		goto exit_bbu;
+	}
+	ret = imx6_bbu_internal_mmcboot_register_handler("eMMC", devicefile,
 						   emmc_flags);
 	if (ret)
 		goto exit_bbu;
@@ -807,6 +814,7 @@ static const struct prt_machine_data prt_imx6_cfg_alti6p[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_EMMC,
 	}, {
 		.hw_id = UINT_MAX
@@ -819,6 +827,7 @@ static const struct prt_machine_data prt_imx6_cfg_victgo[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.init = prt_imx6_init_victgo,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -832,12 +841,14 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x50,
 		.i2c_adapter = 1,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = HW_TYPE_VICUT1,
 		.hw_rev = 1,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.init = prt_imx6_init_kvg_yaco,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -845,6 +856,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1[] = {
 		.hw_rev = 1,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.init = prt_imx6_init_kvg_new,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -858,12 +870,14 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1q[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x50,
 		.i2c_adapter = 1,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = HW_TYPE_VICUT1,
 		.hw_rev = 1,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.init = prt_imx6_init_kvg_yaco,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -871,6 +885,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1q[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.init = prt_imx6_init_kvg_yaco,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -878,6 +893,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1q[] = {
 		.hw_rev = 1,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.init = prt_imx6_init_kvg_new,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -891,6 +907,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicutp[] = {
 		.hw_rev = 1,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.init = prt_imx6_init_kvg_new,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -904,6 +921,7 @@ static const struct prt_machine_data prt_imx6_cfg_lanmcu[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_EMMC | PRT_IMX6_BOOTCHOOSER,
 	}, {
 		.hw_id = UINT_MAX
@@ -916,6 +934,7 @@ static const struct prt_machine_data prt_imx6_cfg_plybas[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR | PRT_IMX6_USB_LONG_DELAY,
 	}, {
 		.hw_id = UINT_MAX
@@ -928,6 +947,7 @@ static const struct prt_machine_data prt_imx6_cfg_plym2m[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR | PRT_IMX6_USB_LONG_DELAY,
 	}, {
 		.hw_id = UINT_MAX
@@ -940,6 +960,7 @@ static const struct prt_machine_data prt_imx6_cfg_prti6g[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 1,
 		.init = prt_imx6_init_prti6g,
 		.flags = PRT_IMX6_BOOTSRC_EMMC,
 	}, {
@@ -953,12 +974,14 @@ static const struct prt_machine_data prt_imx6_cfg_prti6q[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 2,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = HW_TYPE_PRTI6Q,
 		.hw_rev = 1,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = UINT_MAX
@@ -971,6 +994,7 @@ static const struct prt_machine_data prt_imx6_cfg_prtmvt[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = UINT_MAX
@@ -983,6 +1007,7 @@ static const struct prt_machine_data prt_imx6_cfg_prtrvt[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = UINT_MAX
@@ -995,6 +1020,7 @@ static const struct prt_machine_data prt_imx6_cfg_prtvt7[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_EMMC | PRT_IMX6_BOOTCHOOSER,
 	}, {
 		.hw_id = UINT_MAX
@@ -1007,6 +1033,7 @@ static const struct prt_machine_data prt_imx6_cfg_prtwd2[] = {
 		.hw_rev = 0,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_EMMC,
 	}, {
 		.hw_id = UINT_MAX
@@ -1019,6 +1046,7 @@ static const struct prt_machine_data prt_imx6_cfg_prtwd3[] = {
 		.hw_rev = 2,
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
+		.emmc_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_EMMC,
 	}, {
 		.hw_id = UINT_MAX
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-08-18 12:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18 12:19 [PATCH v1 0/6] protonic: fix and maintaining Oleksij Rempel
2021-08-18 12:19 ` [PATCH v1 1/6] ARM: boards: protonic-imx6: Run usb boot entry instead of bare device Oleksij Rempel
2021-08-18 12:19 ` [PATCH v1 2/6] ARM: boards: protonic-imx6: Don't fixup MAC address for disabled device Oleksij Rempel
2021-08-18 12:19 ` [PATCH v1 3/6] ARM: dts: imx6dl-prtvt7: Add brand state variable Oleksij Rempel
2021-08-18 12:19 ` [PATCH v1 4/6] ARM: boards: protonic-imx6: Don't register SD with bbu Oleksij Rempel
2021-08-18 12:19 ` Oleksij Rempel [this message]
2021-08-18 12:19 ` [PATCH v1 6/6] ARM: boards: protonic-imx6: Enable bootchooser on prti6g board Oleksij Rempel
2021-08-23 13:45 ` [PATCH v1 0/6] protonic: fix and maintaining Sascha Hauer

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=20210818121945.26089-6-o.rempel@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=robin@protonic.nl \
    /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