diff mbox series

[U-Boot] mx6cuboxi: add support for detecting Revision 1.5 SoMs

Message ID 20180304133619.28035-1-pbrobinson@gmail.com
State Changes Requested
Delegated to: Stefano Babic
Headers show
Series [U-Boot] mx6cuboxi: add support for detecting Revision 1.5 SoMs | expand

Commit Message

Peter Robinson March 4, 2018, 1:36 p.m. UTC
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.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
---
 board/solidrun/mx6cuboxi/mx6cuboxi.c | 30 +++++++++++++++++++++++++++---
 include/configs/mx6cuboxi.h          | 12 ++++++------
 2 files changed, 33 insertions(+), 9 deletions(-)

Comments

Fabio Estevam March 4, 2018, 2:49 p.m. UTC | #1
Hi Peter,

[Adding Jon and Baruch]

On Sun, Mar 4, 2018 at 10:36 AM, Peter Robinson <pbrobinson@gmail.com> wrote:
> 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.
>
> Signed-off-by: Peter Robinson <pbrobinson@gmail.com>

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

Thanks

> ---
>  board/solidrun/mx6cuboxi/mx6cuboxi.c | 30 +++++++++++++++++++++++++++---
>  include/configs/mx6cuboxi.h          | 12 ++++++------
>  2 files changed, 33 insertions(+), 9 deletions(-)
>
> diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> index ee9e4f7c01..bea6275b78 100644
> --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> @@ -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
> diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h
> index 0e1d18cad8..076fd2c40e 100644
> --- a/include/configs/mx6cuboxi.h
> +++ b/include/configs/mx6cuboxi.h
> @@ -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@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
Peter Robinson March 4, 2018, 3:15 p.m. UTC | #2
On Sun, Mar 4, 2018 at 2:49 PM, Fabio Estevam <festevam@gmail.com> wrote:
> Hi Peter,
>
> [Adding Jon and Baruch]
>
> On Sun, Mar 4, 2018 at 10:36 AM, Peter Robinson <pbrobinson@gmail.com> wrote:
>> 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.
>>
>> Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
>
> 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.

>> ---
>>  board/solidrun/mx6cuboxi/mx6cuboxi.c | 30 +++++++++++++++++++++++++++---
>>  include/configs/mx6cuboxi.h          | 12 ++++++------
>>  2 files changed, 33 insertions(+), 9 deletions(-)
>>
>> diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
>> index ee9e4f7c01..bea6275b78 100644
>> --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
>> +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
>> @@ -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
>> diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h
>> index 0e1d18cad8..076fd2c40e 100644
>> --- a/include/configs/mx6cuboxi.h
>> +++ b/include/configs/mx6cuboxi.h
>> @@ -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@lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
diff mbox series

Patch

diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index ee9e4f7c01..bea6275b78 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -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
diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h
index 0e1d18cad8..076fd2c40e 100644
--- a/include/configs/mx6cuboxi.h
+++ b/include/configs/mx6cuboxi.h
@@ -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