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: Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH v1 1/2] ARM: boards: protonic-imx6: add board specific BBU SD handlers
Date: Mon, 21 Mar 2022 10:21:02 +0100	[thread overview]
Message-ID: <20220321092103.1357659-1-o.rempel@pengutronix.de> (raw)

Add barebox update handler for the SD ports.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 arch/arm/boards/protonic-imx6/board.c | 34 +++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/arch/arm/boards/protonic-imx6/board.c b/arch/arm/boards/protonic-imx6/board.c
index adde1be8d9..5ca80bd306 100644
--- a/arch/arm/boards/protonic-imx6/board.c
+++ b/arch/arm/boards/protonic-imx6/board.c
@@ -74,6 +74,7 @@ struct prt_machine_data {
 	unsigned int i2c_addr;
 	unsigned int i2c_adapter;
 	unsigned int emmc_usdhc;
+	unsigned int sd_usdhc;
 	unsigned int flags;
 	int (*init)(struct prt_imx6_priv *priv);
 };
@@ -442,6 +443,16 @@ static int prt_imx6_bbu(struct prt_imx6_priv *priv)
 	if (ret)
 		goto exit_bbu;
 
+	devicefile = basprintf("mmc%d", dcfg->sd_usdhc);
+	if (!devicefile) {
+		ret = -ENOMEM;
+		goto exit_bbu;
+	}
+
+	ret = imx6_bbu_internal_mmc_register_handler("SD", devicefile, 0);
+	if (ret)
+		goto exit_bbu;
+
 	return 0;
 exit_bbu:
 	dev_err(priv->dev, "Failed to register bbu: %pe\n", ERR_PTR(ret));
@@ -850,6 +861,7 @@ static const struct prt_machine_data prt_imx6_cfg_alti6p[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_EMMC,
 	}, {
 		.hw_id = UINT_MAX
@@ -863,6 +875,7 @@ static const struct prt_machine_data prt_imx6_cfg_victgo[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.init = prt_imx6_init_victgo,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -877,6 +890,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1[] = {
 		.i2c_addr = 0x50,
 		.i2c_adapter = 1,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = HW_TYPE_VICUT1,
@@ -884,6 +898,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.init = prt_imx6_init_kvg_yaco,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -892,6 +907,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.init = prt_imx6_init_kvg_new,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -906,6 +922,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1q[] = {
 		.i2c_addr = 0x50,
 		.i2c_adapter = 1,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = HW_TYPE_VICUT1,
@@ -913,6 +930,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1q[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.init = prt_imx6_init_kvg_yaco,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -921,6 +939,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1q[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.init = prt_imx6_init_kvg_yaco,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -929,6 +948,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicut1q[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.init = prt_imx6_init_kvg_new,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -943,6 +963,7 @@ static const struct prt_machine_data prt_imx6_cfg_vicutp[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.init = prt_imx6_init_kvg_new,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
@@ -957,6 +978,7 @@ static const struct prt_machine_data prt_imx6_cfg_lanmcu[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_EMMC | PRT_IMX6_BOOTCHOOSER,
 	}, {
 		.hw_id = UINT_MAX
@@ -970,6 +992,7 @@ static const struct prt_machine_data prt_imx6_cfg_plybas[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR | PRT_IMX6_USB_LONG_DELAY,
 	}, {
 		.hw_id = UINT_MAX
@@ -983,6 +1006,7 @@ static const struct prt_machine_data prt_imx6_cfg_plym2m[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR | PRT_IMX6_USB_LONG_DELAY,
 	}, {
 		.hw_id = UINT_MAX
@@ -996,6 +1020,7 @@ static const struct prt_machine_data prt_imx6_cfg_prti6g[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 1,
+		.sd_usdhc = 0,
 		.init = prt_imx6_init_prti6g,
 		.flags = PRT_IMX6_BOOTSRC_EMMC | PRT_IMX6_BOOTCHOOSER,
 	}, {
@@ -1010,6 +1035,7 @@ static const struct prt_machine_data prt_imx6_cfg_prti6q[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 2,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = HW_TYPE_PRTI6Q,
@@ -1017,6 +1043,7 @@ static const struct prt_machine_data prt_imx6_cfg_prti6q[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = UINT_MAX
@@ -1030,6 +1057,7 @@ static const struct prt_machine_data prt_imx6_cfg_prtmvt[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = UINT_MAX
@@ -1043,6 +1071,7 @@ static const struct prt_machine_data prt_imx6_cfg_prtrvt[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_SPI_NOR,
 	}, {
 		.hw_id = UINT_MAX
@@ -1056,6 +1085,7 @@ static const struct prt_machine_data prt_imx6_cfg_prtvt7[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.init = prt_imx6_init_prtvt7,
 		.flags = PRT_IMX6_BOOTSRC_EMMC | PRT_IMX6_BOOTCHOOSER |
 			PRT_IMX6_USB_LONG_DELAY,
@@ -1071,6 +1101,7 @@ static const struct prt_machine_data prt_imx6_cfg_prtwd2[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_EMMC,
 	}, {
 		.hw_id = UINT_MAX
@@ -1084,6 +1115,7 @@ static const struct prt_machine_data prt_imx6_cfg_prtwd3[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 2,
+		.sd_usdhc = 0,
 		.flags = PRT_IMX6_BOOTSRC_EMMC,
 	}, {
 		.hw_id = UINT_MAX
@@ -1097,6 +1129,7 @@ static const struct prt_machine_data prt_imx6_cfg_jozacp[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 0,
+		.sd_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_EMMC | PRT_IMX6_BOOTCHOOSER,
 	}, {
 		.hw_id = HW_TYPE_JOZACPP,
@@ -1104,6 +1137,7 @@ static const struct prt_machine_data prt_imx6_cfg_jozacp[] = {
 		.i2c_addr = 0x51,
 		.i2c_adapter = 0,
 		.emmc_usdhc = 0,
+		.sd_usdhc = 2,
 		.flags = PRT_IMX6_BOOTSRC_EMMC | PRT_IMX6_BOOTCHOOSER,
 	}, {
 		.hw_id = UINT_MAX
-- 
2.30.2


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


             reply	other threads:[~2022-03-21  9:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21  9:21 Oleksij Rempel [this message]
2022-03-21  9:21 ` [PATCH v1 2/2] ARM: boards: protonic-imx6: properly configure RGMII direction for the FEC MAC Oleksij Rempel
2022-03-28  8:48 ` [PATCH v1 1/2] ARM: boards: protonic-imx6: add board specific BBU SD handlers 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=20220321092103.1357659-1-o.rempel@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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