[PATCH v1 1/2] ARM: boards: protonic-imx6: add board specific BBU SD handlers

Oleksij Rempel o.rempel at pengutronix.de
Mon Mar 21 02:21:02 PDT 2022


Add barebox update handler for the SD ports.

Signed-off-by: Oleksij Rempel <o.rempel at 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




More information about the barebox mailing list