[PATCH v1 0/3] colibri-imx8x: configure module usb hub to bypass mode

From: Andrejs Cainikovs andrejs.cainikovs@toradex.com
This series: - Drops -u-boot.dtsi includes in apalis-imx8 and colibri-imx8x device trees. This file is included automatically since quite some time now. - Configures Toradex Colibri iMX8X SoM USB hub to bypass mode, and brings out of the reset state.
Andrejs Cainikovs (3): apalis-imx8: remove -u-boot.dtsi include colibri-imx8x: remove -u-boot.dtsi include colibri-imx8x: configure usb hub to bypass mode
arch/arm/dts/fsl-imx8qm-apalis.dts | 1 - arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi | 15 +++++++++++++++ arch/arm/dts/fsl-imx8qxp-colibri.dts | 3 --- configs/colibri-imx8x_defconfig | 1 + 4 files changed, 16 insertions(+), 4 deletions(-)

From: Andrejs Cainikovs andrejs.cainikovs@toradex.com
This file is included automatically since quite some time now.
From documentation:
U-Boot automatically looks for and includes a file with updates to the standard devicetree for your board, searching for them in the same directory as the main file, in this order:
<orig_filename>-u-boot.dtsi <CONFIG_SYS_SOC>-u-boot.dtsi <CONFIG_SYS_CPU>-u-boot.dtsi <CONFIG_SYS_VENDOR>-u-boot.dtsi u-boot.dtsi
Signed-off-by: Andrejs Cainikovs andrejs.cainikovs@toradex.com --- arch/arm/dts/fsl-imx8qm-apalis.dts | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/fsl-imx8qm-apalis.dts b/arch/arm/dts/fsl-imx8qm-apalis.dts index bc7c75d3372..e089ddb8468 100644 --- a/arch/arm/dts/fsl-imx8qm-apalis.dts +++ b/arch/arm/dts/fsl-imx8qm-apalis.dts @@ -9,7 +9,6 @@ /memreserve/ 0x80000000 0x00020000;
#include "fsl-imx8qm.dtsi" -#include "fsl-imx8qm-apalis-u-boot.dtsi"
/ { model = "Toradex Apalis iMX8";

From: Andrejs Cainikovs andrejs.cainikovs@toradex.com
This file is included automatically since quite some time now.
From documentation:
U-Boot automatically looks for and includes a file with updates to the standard devicetree for your board, searching for them in the same directory as the main file, in this order:
<orig_filename>-u-boot.dtsi <CONFIG_SYS_SOC>-u-boot.dtsi <CONFIG_SYS_CPU>-u-boot.dtsi <CONFIG_SYS_VENDOR>-u-boot.dtsi u-boot.dtsi
Signed-off-by: Andrejs Cainikovs andrejs.cainikovs@toradex.com --- arch/arm/dts/fsl-imx8qxp-colibri.dts | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/dts/fsl-imx8qxp-colibri.dts b/arch/arm/dts/fsl-imx8qxp-colibri.dts index df992ac6396..295090ad711 100644 --- a/arch/arm/dts/fsl-imx8qxp-colibri.dts +++ b/arch/arm/dts/fsl-imx8qxp-colibri.dts @@ -6,7 +6,6 @@ /dts-v1/;
#include "fsl-imx8qxp.dtsi" -#include "fsl-imx8qxp-colibri-u-boot.dtsi"
/ { model = "Toradex Colibri iMX8X";

From: Andrejs Cainikovs andrejs.cainikovs@toradex.com
This change configures Toradex Colibri iMX8X SoM USB hub to bypass mode, and brings out of the reset state.
Signed-off-by: Andrejs Cainikovs andrejs.cainikovs@toradex.com --- arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi | 15 +++++++++++++++ arch/arm/dts/fsl-imx8qxp-colibri.dts | 2 -- configs/colibri-imx8x_defconfig | 1 + 3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi index a6af4e5e2b7..6ab6b1f9ee6 100644 --- a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi +++ b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi @@ -84,6 +84,21 @@ bootph-some-ram; };
+&gpio_expander_43 { + usb-bypass-n-hog { + gpio-hog; + gpios = <5 GPIO_ACTIVE_LOW>; + line-name = "usb-bypass-n"; + output-high; + }; + usb-reset-n-hog { + gpio-hog; + gpios = <4 GPIO_ACTIVE_LOW>; + line-name = "usb-reset-n"; + output-low; + }; +}; + &gpio0 { bootph-some-ram; }; diff --git a/arch/arm/dts/fsl-imx8qxp-colibri.dts b/arch/arm/dts/fsl-imx8qxp-colibri.dts index 295090ad711..b479921aff9 100644 --- a/arch/arm/dts/fsl-imx8qxp-colibri.dts +++ b/arch/arm/dts/fsl-imx8qxp-colibri.dts @@ -319,8 +319,6 @@ gpio-controller; #gpio-cells = <2>; reg = <0x43>; - initial_io_dir = <0xff>; - initial_output = <0x05>; }; };
diff --git a/configs/colibri-imx8x_defconfig b/configs/colibri-imx8x_defconfig index 13c16bde3d8..ce60c509582 100644 --- a/configs/colibri-imx8x_defconfig +++ b/configs/colibri-imx8x_defconfig @@ -65,6 +65,7 @@ CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_ENV=y CONFIG_CLK_IMX8=y CONFIG_CPU=y +CONFIG_GPIO_HOG=y CONFIG_FXL6408_GPIO=y CONFIG_MXC_GPIO=y CONFIG_DM_I2C=y

Hi Andrejs,
On Wed, Dec 20, 2023 at 7:39 AM Andrejs Cainikovs andrejs.cainikovs@gmail.com wrote:
diff --git a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi index a6af4e5e2b7..6ab6b1f9ee6 100644 --- a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi +++ b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi @@ -84,6 +84,21 @@ bootph-some-ram; };
+&gpio_expander_43 {
usb-bypass-n-hog {
gpio-hog;
gpios = <5 GPIO_ACTIVE_LOW>;
line-name = "usb-bypass-n";
output-high;
};
usb-reset-n-hog {
gpio-hog;
gpios = <4 GPIO_ACTIVE_LOW>;
line-name = "usb-reset-n";
output-low;
};
+};
Patch looks good from a U-Boot perspective, but just want to understand why the imx8qxp/imx8qm boards in U-Boot use devicetrees based on downstream NXP instead of the mainline kernel dts?
Shouldn't this 'hub out of reset' be added in mainline Linux first and then just sync the dts in U-Boot?

Hello Fabio,
On Wed, Dec 20, 2023 at 07:48:50AM -0300, Fabio Estevam wrote:
On Wed, Dec 20, 2023 at 7:39 AM Andrejs Cainikovs andrejs.cainikovs@gmail.com wrote:
diff --git a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi index a6af4e5e2b7..6ab6b1f9ee6 100644 --- a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi +++ b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi @@ -84,6 +84,21 @@ bootph-some-ram; };
+&gpio_expander_43 {
usb-bypass-n-hog {
gpio-hog;
gpios = <5 GPIO_ACTIVE_LOW>;
line-name = "usb-bypass-n";
output-high;
};
usb-reset-n-hog {
gpio-hog;
gpios = <4 GPIO_ACTIVE_LOW>;
line-name = "usb-reset-n";
output-low;
};
+};
Patch looks good from a U-Boot perspective, but just want to understand why the imx8qxp/imx8qm boards in U-Boot use devicetrees based on downstream NXP instead of the mainline kernel dts?
Shouldn't this 'hub out of reset' be added in mainline Linux first and then just sync the dts in U-Boot?
Valid point.
In general re-using the DTS for the kernel would not work.
The bypass and reset signals are part of the USB HUB node [1], and we would need to add such a driver to U-Boot to be able to properly implement it (despite the recent plans to make SPL a full blown bootloader and U-Boot proper the operating system and kick out Linux I would not go into that direction ;-)
Given that I believe that overriding the Linux DTS to use these 2 signals are simple GPIO HOG for U-Boot is the correct approach.
Francesco
[1] Linux: Documentation/devicetree/bindings/usb/smsc,usb3503.yaml

Hi Francesco,
On Wed, Dec 20, 2023 at 8:30 AM Francesco Dolcini francesco@dolcini.it wrote:
Valid point.
In general re-using the DTS for the kernel would not work.
The bypass and reset signals are part of the USB HUB node [1], and we would need to add such a driver to U-Boot to be able to properly implement it (despite the recent plans to make SPL a full blown bootloader and U-Boot proper the operating system and kick out Linux I would not go into that direction ;-)
Given that I believe that overriding the Linux DTS to use these 2 signals are simple GPIO HOG for U-Boot is the correct approach.
Yes, this series can go as-is.
My main concern is why U-Boot still uses the NXP-based fsl-imx8qxp-mek.dts, fsl-imx8qxp-colibri.dts variant instead of the mainline versions.
The other i.MX SoCs in U-Boot are better synced with the Linux kernel DTs.
I don't have access to i.MX8QXP/i.MX8QM boards to help on this, but for better long-term support it would be nice if someone could sync the U-Boot i.MX8QXP/i.MX8QM DTs with Linux.

On Wed, Dec 20, 2023 at 08:39:38AM -0300, Fabio Estevam wrote:
Hi Francesco,
On Wed, Dec 20, 2023 at 8:30 AM Francesco Dolcini francesco@dolcini.it wrote:
Valid point.
In general re-using the DTS for the kernel would not work.
The bypass and reset signals are part of the USB HUB node [1], and we would need to add such a driver to U-Boot to be able to properly implement it (despite the recent plans to make SPL a full blown bootloader and U-Boot proper the operating system and kick out Linux I would not go into that direction ;-)
Given that I believe that overriding the Linux DTS to use these 2 signals are simple GPIO HOG for U-Boot is the correct approach.
Yes, this series can go as-is.
My main concern is why U-Boot still uses the NXP-based fsl-imx8qxp-mek.dts, fsl-imx8qxp-colibri.dts variant instead of the mainline versions.
The other i.MX SoCs in U-Boot are better synced with the Linux kernel DTs.
I don't have access to i.MX8QXP/i.MX8QM boards to help on this, but for better long-term support it would be nice if someone could sync the U-Boot i.MX8QXP/i.MX8QM DTs with Linux.
Understood. Yes, this is some real work that someone should take up. Just doing the sync will likely break everything now.
At the moment the situation with i.MX8QXP/i.MX8QM is not as good as i.MX8M* neither in U-Boot nor in Linux :-/
Francesco

On Wed, Dec 20, 2023 at 8:45 AM Francesco Dolcini francesco@dolcini.it wrote:
Understood. Yes, this is some real work that someone should take up. Just doing the sync will likely break everything now.
Exactly.
At the moment the situation with i.MX8QXP/i.MX8QM is not as good as i.MX8M* neither in U-Boot nor in Linux :-/
The NXP folks are on Cc here, so hopefully they could help improving this.
Thanks

On Wed, Dec 20, 2023 at 7:39 AM Andrejs Cainikovs andrejs.cainikovs@gmail.com wrote:
From: Andrejs Cainikovs andrejs.cainikovs@toradex.com
This series:
- Drops -u-boot.dtsi includes in apalis-imx8 and colibri-imx8x device trees. This file is included automatically since quite some time now.
- Configures Toradex Colibri iMX8X SoM USB hub to bypass mode, and brings out of the reset state.
Andrejs Cainikovs (3): apalis-imx8: remove -u-boot.dtsi include colibri-imx8x: remove -u-boot.dtsi include colibri-imx8x: configure usb hub to bypass mode
Applied all to u-boot-imx/next, thanks.
participants (3)
-
Andrejs Cainikovs
-
Fabio Estevam
-
Francesco Dolcini