Skip to contentSkip to conversation

mx6cuboxi: add support for detecting Revision 1.5 SoMs

PATCH New Peter Robinson 2 participants 3 messages Mar 4, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mx6cuboxi: add support for detecting Revision 1.5 SoMs

Solid Run have a rev 1.5 SoM with different a different WiFi/BT module and some other changes. Their downstream commit 99e18b7f14 adds support for detecting this new SoM revision. This adds that support and sets up the new device tree naming that landed in the linux 4.16 kernel.

Tested on a Hummingboard2 Gate.

---
 board/solidrun/mx6cuboxi/mx6cuboxi.c | 30 +++++++++++++++++++++++++++---
 include/configs/mx6cuboxi.h          | 12 ++++++------
 2 files changed, 33 insertions(+), 9 deletions(-)
board/solidrun/mx6cuboxi/mx6cuboxi.c +27 -3
index ee9e4f7c01..bea6275b78 100644
@@ -79,9 +79,11 @@ static iomux_v3_cfg_t const usdhc2_pads[] = {
 };
 
 static iomux_v3_cfg_t const hb_cbi_sense[] = {
-	/* These pins are for sensing if it is a CuBox-i or a HummingBoard */
-	IOMUX_PADS(PAD_KEY_ROW1__GPIO4_IO09  | MUX_PAD_CTRL(UART_PAD_CTRL)),
-	IOMUX_PADS(PAD_EIM_DA4__GPIO3_IO04   | MUX_PAD_CTRL(UART_PAD_CTRL)),
+	/* These pins are for sensing if it is a CuBox-i, HummingBoard(2) and SoM rev */
+	IOMUX_PADS(PAD_KEY_ROW1__GPIO4_IO09   | MUX_PAD_CTRL(UART_PAD_CTRL)),
+	IOMUX_PADS(PAD_EIM_DA4__GPIO3_IO04    | MUX_PAD_CTRL(UART_PAD_CTRL)),
+	IOMUX_PADS(PAD_CSI0_DAT14__GPIO6_IO00 | MUX_PAD_CTRL(UART_PAD_CTRL)),
+	IOMUX_PADS(PAD_CSI0_DAT18__GPIO6_IO04 | MUX_PAD_CTRL(UART_PAD_CTRL)),
 };
 
 static iomux_v3_cfg_t const usb_pads[] = {
@@ -390,6 +392,25 @@ static bool is_hummingboard2(void)
 		return false;
 }
 
+static bool is_som_rev15(void)
+{
+	int val1;
+	int val2;
+
+	SETUP_IOMUX_PADS(hb_cbi_sense);
+
+	gpio_direction_input(IMX_GPIO_NR(6, 0));
+	gpio_direction_input(IMX_GPIO_NR(6, 4));
+
+	val1 = gpio_get_value(IMX_GPIO_NR(6, 0));
+	val2 = gpio_get_value(IMX_GPIO_NR(6, 4));
+
+	if (val1 == 1 && val2 == 0)
+		return true;
+	else
+		return false;
+}
+
 int checkboard(void)
 {
 	if (is_hummingboard2())
@@ -412,6 +433,9 @@ int board_late_init(void)
 	else
 		env_set("board_name", "CUBOXI");
 
+	if (is_som_rev15())
+		env_set("som_rev", "-som-v15");
+
 	if (is_mx6dq())
 		env_set("board_rev", "MX6Q");
 	else
include/configs/mx6cuboxi.h +6 -6
index 0e1d18cad8..076fd2c40e 100644
@@ -104,17 +104,17 @@
 		"fi\0" \
 	"findfdt="\
 		"if test $board_name = HUMMINGBOARD2 && test $board_rev = MX6Q ; then " \
-			"setenv fdtfile imx6q-hummingboard2.dtb; fi; " \
+			"setenv fdtfile imx6q-hummingboard2${som_rev}.dtb; fi; " \
 		"if test $board_name = HUMMINGBOARD2 && test $board_rev = MX6DL ; then " \
-			"setenv fdtfile imx6dl-hummingboard2.dtb; fi; " \
+			"setenv fdtfile imx6dl-hummingboard2${som_rev}.dtb; fi; " \
 		"if test $board_name = HUMMINGBOARD && test $board_rev = MX6Q ; then " \
-			"setenv fdtfile imx6q-hummingboard.dtb; fi; " \
+			"setenv fdtfile imx6q-hummingboard${som_rev}.dtb; fi; " \
 		"if test $board_name = HUMMINGBOARD && test $board_rev = MX6DL ; then " \
-			"setenv fdtfile imx6dl-hummingboard.dtb; fi; " \
+			"setenv fdtfile imx6dl-hummingboard${som_rev}.dtb; fi; " \
 		"if test $board_name = CUBOXI && test $board_rev = MX6Q ; then " \
-			"setenv fdtfile imx6q-cubox-i.dtb; fi; " \
+			"setenv fdtfile imx6q-cubox-i${som_rev}.dtb; fi; " \
 		"if test $board_name = CUBOXI && test $board_rev = MX6DL ; then " \
-			"setenv fdtfile imx6dl-cubox-i.dtb; fi; " \
+			"setenv fdtfile imx6dl-cubox-i${som_rev}.dtb; fi; " \
 		"if test $fdtfile = undefined; then " \
 			"echo WARNING: Could not determine dtb to use; fi; \0" \
 	BOOTENV
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/1 mx6cuboxi: add support for detecting Revision 1.5 SoMs

Hi Peter,

[Adding Jon and Baruch]

Quoted 8 lines · Peter Robinson

Solid Run have a rev 1.5 SoM with different a different WiFi/BT module and some other changes. Their downstream commit 99e18b7f14 adds support for detecting this new SoM revision. This adds that support and sets up the new device tree naming that landed in the linux 4.16 kernel.

Tested on a Hummingboard2 Gate.

Shouldn't we use Jon's recent board version detection implementation instead?
https://github.com/SolidRun/u-boot/commit/5d9cf6d848bb33aa3933ce10a3defdaee62cd6b1

Thanks

Quoted 95 lines
---
 board/solidrun/mx6cuboxi/mx6cuboxi.c | 30 +++++++++++++++++++++++++++---
 include/configs/mx6cuboxi.h          | 12 ++++++------
 2 files changed, 33 insertions(+), 9 deletions(-)
board/solidrun/mx6cuboxi/mx6cuboxi.c +27 -3
index ee9e4f7c01..bea6275b78 100644
@@ -79,9 +79,11 @@ static iomux_v3_cfg_t const usdhc2_pads[] = {
 };
 
 static iomux_v3_cfg_t const hb_cbi_sense[] = {
-       /* These pins are for sensing if it is a CuBox-i or a HummingBoard */
-       IOMUX_PADS(PAD_KEY_ROW1__GPIO4_IO09  | MUX_PAD_CTRL(UART_PAD_CTRL)),
-       IOMUX_PADS(PAD_EIM_DA4__GPIO3_IO04   | MUX_PAD_CTRL(UART_PAD_CTRL)),
+       /* These pins are for sensing if it is a CuBox-i, HummingBoard(2) and SoM rev */
+       IOMUX_PADS(PAD_KEY_ROW1__GPIO4_IO09   | MUX_PAD_CTRL(UART_PAD_CTRL)),
+       IOMUX_PADS(PAD_EIM_DA4__GPIO3_IO04    | MUX_PAD_CTRL(UART_PAD_CTRL)),
+       IOMUX_PADS(PAD_CSI0_DAT14__GPIO6_IO00 | MUX_PAD_CTRL(UART_PAD_CTRL)),
+       IOMUX_PADS(PAD_CSI0_DAT18__GPIO6_IO04 | MUX_PAD_CTRL(UART_PAD_CTRL)),
 };
 
 static iomux_v3_cfg_t const usb_pads[] = {
@@ -390,6 +392,25 @@ static bool is_hummingboard2(void)
                return false;
 }
 
+static bool is_som_rev15(void)
+{
+       int val1;
+       int val2;
+
+       SETUP_IOMUX_PADS(hb_cbi_sense);
+
+       gpio_direction_input(IMX_GPIO_NR(6, 0));
+       gpio_direction_input(IMX_GPIO_NR(6, 4));
+
+       val1 = gpio_get_value(IMX_GPIO_NR(6, 0));
+       val2 = gpio_get_value(IMX_GPIO_NR(6, 4));
+
+       if (val1 == 1 && val2 == 0)
+               return true;
+       else
+               return false;
+}
+
 int checkboard(void)
 {
        if (is_hummingboard2())
@@ -412,6 +433,9 @@ int board_late_init(void)
        else
                env_set("board_name", "CUBOXI");
 
+       if (is_som_rev15())
+               env_set("som_rev", "-som-v15");
+
        if (is_mx6dq())
                env_set("board_rev", "MX6Q");
        else
include/configs/mx6cuboxi.h +6 -7
index 0e1d18cad8..076fd2c40e 100644
@@ -104,17 +104,17 @@
                "fi\0" \
        "findfdt="\
                "if test $board_name = HUMMINGBOARD2 && test $board_rev = MX6Q ; then " \
-                       "setenv fdtfile imx6q-hummingboard2.dtb; fi; " \
+                       "setenv fdtfile imx6q-hummingboard2${som_rev}.dtb; fi; " \
                "if test $board_name = HUMMINGBOARD2 && test $board_rev = MX6DL ; then " \
-                       "setenv fdtfile imx6dl-hummingboard2.dtb; fi; " \
+                       "setenv fdtfile imx6dl-hummingboard2${som_rev}.dtb; fi; " \
                "if test $board_name = HUMMINGBOARD && test $board_rev = MX6Q ; then " \
-                       "setenv fdtfile imx6q-hummingboard.dtb; fi; " \
+                       "setenv fdtfile imx6q-hummingboard${som_rev}.dtb; fi; " \
                "if test $board_name = HUMMINGBOARD && test $board_rev = MX6DL ; then " \
-                       "setenv fdtfile imx6dl-hummingboard.dtb; fi; " \
+                       "setenv fdtfile imx6dl-hummingboard${som_rev}.dtb; fi; " \
                "if test $board_name = CUBOXI && test $board_rev = MX6Q ; then " \
-                       "setenv fdtfile imx6q-cubox-i.dtb; fi; " \
+                       "setenv fdtfile imx6q-cubox-i${som_rev}.dtb; fi; " \
                "if test $board_name = CUBOXI && test $board_rev = MX6DL ; then " \
-                       "setenv fdtfile imx6dl-cubox-i.dtb; fi; " \
+                       "setenv fdtfile imx6dl-cubox-i${som_rev}.dtb; fi; " \
                "if test $fdtfile = undefined; then " \
                        "echo WARNING: Could not determine dtb to use; fi; \0" \
        BOOTENV
--

2.14.3

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#2 lore raw

PATCH 1/1 mx6cuboxi: add support for detecting Revision 1.5 SoMs

Quoted 10 lines · Fabio Estevam

Hi Peter,

[Adding Jon and Baruch]

Quoted 5 lines · Peter Robinson

Solid Run have a rev 1.5 SoM with different a different WiFi/BT module and some other changes. Their downstream commit 99e18b7f14 adds support for detecting this new SoM revision. This adds that support and sets up the new device tree naming that landed in the linux 4.16 kernel.

Quoted 6 lines
Quoted 3 lines

Tested on a Hummingboard2 Gate.

Shouldn't we use Jon's recent board version detection implementation instead?
https://github.com/SolidRun/u-boot/commit/5d9cf6d848bb33aa3933ce10a3defdaee62cd6b1

Possibly, I didn't know if it was better to use the upstream or downstream way of doing things, they're quite a bit different and this was the least change.

Quoted 95 lines
Quoted 95 lines
---
 board/solidrun/mx6cuboxi/mx6cuboxi.c | 30 +++++++++++++++++++++++++++---
 include/configs/mx6cuboxi.h          | 12 ++++++------
 2 files changed, 33 insertions(+), 9 deletions(-)
board/solidrun/mx6cuboxi/mx6cuboxi.c +27 -3
index ee9e4f7c01..bea6275b78 100644
@@ -79,9 +79,11 @@ static iomux_v3_cfg_t const usdhc2_pads[] = {
 };
 
 static iomux_v3_cfg_t const hb_cbi_sense[] = {
-       /* These pins are for sensing if it is a CuBox-i or a HummingBoard */
-       IOMUX_PADS(PAD_KEY_ROW1__GPIO4_IO09  | MUX_PAD_CTRL(UART_PAD_CTRL)),
-       IOMUX_PADS(PAD_EIM_DA4__GPIO3_IO04   | MUX_PAD_CTRL(UART_PAD_CTRL)),
+       /* These pins are for sensing if it is a CuBox-i, HummingBoard(2) and SoM rev */
+       IOMUX_PADS(PAD_KEY_ROW1__GPIO4_IO09   | MUX_PAD_CTRL(UART_PAD_CTRL)),
+       IOMUX_PADS(PAD_EIM_DA4__GPIO3_IO04    | MUX_PAD_CTRL(UART_PAD_CTRL)),
+       IOMUX_PADS(PAD_CSI0_DAT14__GPIO6_IO00 | MUX_PAD_CTRL(UART_PAD_CTRL)),
+       IOMUX_PADS(PAD_CSI0_DAT18__GPIO6_IO04 | MUX_PAD_CTRL(UART_PAD_CTRL)),
 };
 
 static iomux_v3_cfg_t const usb_pads[] = {
@@ -390,6 +392,25 @@ static bool is_hummingboard2(void)
                return false;
 }
 
+static bool is_som_rev15(void)
+{
+       int val1;
+       int val2;
+
+       SETUP_IOMUX_PADS(hb_cbi_sense);
+
+       gpio_direction_input(IMX_GPIO_NR(6, 0));
+       gpio_direction_input(IMX_GPIO_NR(6, 4));
+
+       val1 = gpio_get_value(IMX_GPIO_NR(6, 0));
+       val2 = gpio_get_value(IMX_GPIO_NR(6, 4));
+
+       if (val1 == 1 && val2 == 0)
+               return true;
+       else
+               return false;
+}
+
 int checkboard(void)
 {
        if (is_hummingboard2())
@@ -412,6 +433,9 @@ int board_late_init(void)
        else
                env_set("board_name", "CUBOXI");
 
+       if (is_som_rev15())
+               env_set("som_rev", "-som-v15");
+
        if (is_mx6dq())
                env_set("board_rev", "MX6Q");
        else
include/configs/mx6cuboxi.h +6 -7
index 0e1d18cad8..076fd2c40e 100644
@@ -104,17 +104,17 @@
                "fi\0" \
        "findfdt="\
                "if test $board_name = HUMMINGBOARD2 && test $board_rev = MX6Q ; then " \
-                       "setenv fdtfile imx6q-hummingboard2.dtb; fi; " \
+                       "setenv fdtfile imx6q-hummingboard2${som_rev}.dtb; fi; " \
                "if test $board_name = HUMMINGBOARD2 && test $board_rev = MX6DL ; then " \
-                       "setenv fdtfile imx6dl-hummingboard2.dtb; fi; " \
+                       "setenv fdtfile imx6dl-hummingboard2${som_rev}.dtb; fi; " \
                "if test $board_name = HUMMINGBOARD && test $board_rev = MX6Q ; then " \
-                       "setenv fdtfile imx6q-hummingboard.dtb; fi; " \
+                       "setenv fdtfile imx6q-hummingboard${som_rev}.dtb; fi; " \
                "if test $board_name = HUMMINGBOARD && test $board_rev = MX6DL ; then " \
-                       "setenv fdtfile imx6dl-hummingboard.dtb; fi; " \
+                       "setenv fdtfile imx6dl-hummingboard${som_rev}.dtb; fi; " \
                "if test $board_name = CUBOXI && test $board_rev = MX6Q ; then " \
-                       "setenv fdtfile imx6q-cubox-i.dtb; fi; " \
+                       "setenv fdtfile imx6q-cubox-i${som_rev}.dtb; fi; " \
                "if test $board_name = CUBOXI && test $board_rev = MX6DL ; then " \
-                       "setenv fdtfile imx6dl-cubox-i.dtb; fi; " \
+                       "setenv fdtfile imx6dl-cubox-i${som_rev}.dtb; fi; " \
                "if test $fdtfile = undefined; then " \
                        "echo WARNING: Could not determine dtb to use; fi; \0" \
        BOOTENV
--

2.14.3

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot