public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
To: u-boot@lists.denx.de
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>,
	Philippe Schenker <philippe.schenker@toradex.com>,
	Max Krummenacher <max.krummenacher@toradex.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Oleksandr Suvorov <oleksandr.suvorov@toradex.com>,
	Oleksandr Suvorov <cryosay@gmail.com>,
	Oleksandr Suvorov <oleksandr.suvorov@foundries.io>,
	Fabio Estevam <festevam@gmail.com>,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	Stefano Babic <sbabic@denx.de>
Subject: [PATCH v4 2/2] colibri-imx8x: add on-module gpio expander fxl6408
Date: Sun, 21 Nov 2021 18:05:17 +0200	[thread overview]
Message-ID: <20211121180505.v4.2.4c49798950@changeid> (raw)
In-Reply-To: <20211121180505.v4.1.ce74fbdbdc@changeid>

From: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>

The FXL6408 GPIO expander manages critical devices,
including on-module USB hub. Configure the expander to
switch the USB hub into bypass mode, allowing to use
on-carrier-board USB hub.

Signed-off-by: Oleksandr Suvorov <cryosay@gmail.com>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
---

Changes in v4:
- fix misuse of MF_ID_x instead of FW_REV_x in fxl6408_probe().
- fix kernel doc formatting.
- sort headers.
- fix hex numbers style.
- explicitly claim values of enum io_direction.
- simplify fxl6408_get_function().
- make variable naming better in fxl6408_probe().

Changes in v3:
- fix a warning:
    "drivers/gpio/gpio-fxl6408.c:348:15: warning: format
    ‘%ld’ expects argument of type ‘long int’, but argument
    3 has type ‘int’ [-Wformat=]"
- add Tested-by record.

Changes in v2:
- Kconfig: add better description for the config option.
- gpio-fxl6408.c:
-- improve registers' naming.
-- fix code style (comments, etc.).
-- reimplement fxl6408_read() reducing number of parameters.
-- change return value of fxl6408_is_output() to bool.
-- replace IS_ERR_VALUE() macros with simple x < 0 where it's
   possible.
-- fxl6408_set_direction(): fix type of parameter "dir".
-- fix return error codes to avoid using the predefined in the driver
   model ones.
-- removed extra debug code.
-- expand TODO list.

 arch/arm/dts/fsl-imx8qxp-colibri.dts | 27 +++++++++++++++++++++++++++
 configs/colibri-imx8x_defconfig      |  1 +
 2 files changed, 28 insertions(+)

diff --git a/arch/arm/dts/fsl-imx8qxp-colibri.dts b/arch/arm/dts/fsl-imx8qxp-colibri.dts
index 11ece34c024..df992ac6396 100644
--- a/arch/arm/dts/fsl-imx8qxp-colibri.dts
+++ b/arch/arm/dts/fsl-imx8qxp-colibri.dts
@@ -129,6 +129,14 @@
 			>;
 		};
 
+		/* On Module I2C */
+		pinctrl_i2c0: i2c0grp {
+			fsl,pins = <
+				SC_P_MIPI_CSI0_GPIO0_00_ADMA_I2C0_SCL	0x06000021
+				SC_P_MIPI_CSI0_GPIO0_01_ADMA_I2C0_SDA	0x06000021
+			>;
+		};
+
 		/* Off Module I2C */
 		pinctrl_i2c1: i2c1grp {
 			fsl,pins = <
@@ -298,6 +306,25 @@
 	};
 };
 
+&i2c0 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clock-frequency = <100000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c0>;
+	status = "okay";
+
+	/* GPIO expander */
+	gpio_expander_43: gpio-expander@43 {
+		compatible = "fcs,fxl6408";
+		gpio-controller;
+		#gpio-cells = <2>;
+		reg = <0x43>;
+		initial_io_dir = <0xff>;
+		initial_output = <0x05>;
+	};
+};
+
 &i2c1 {
 	#address-cells = <1>;
 	#size-cells = <0>;
diff --git a/configs/colibri-imx8x_defconfig b/configs/colibri-imx8x_defconfig
index 22bed95324a..a9b0f357163 100644
--- a/configs/colibri-imx8x_defconfig
+++ b/configs/colibri-imx8x_defconfig
@@ -41,6 +41,7 @@ CONFIG_TFTP_BLOCKSIZE=4096
 CONFIG_TFTP_TSIZE=y
 CONFIG_CLK_IMX8=y
 CONFIG_CPU=y
+CONFIG_FXL6408_GPIO=y
 CONFIG_MXC_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_IMX_LPI2C=y
-- 
2.33.1


  reply	other threads:[~2021-11-21 16:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-21 16:05 [PATCH v4 0/2] Add support of the FXL6408 GPIO expander Oleksandr Suvorov
2021-11-21 16:05 ` [PATCH v4 1/2] GPIO: fxl6408: Add support for " Oleksandr Suvorov
2021-11-21 16:05   ` Oleksandr Suvorov [this message]
2022-02-05 16:42     ` [PATCH v4 2/2] colibri-imx8x: add on-module gpio expander fxl6408 sbabic
2022-02-05 16:44   ` [PATCH v4 1/2] GPIO: fxl6408: Add support for FXL6408 GPIO expander sbabic
2022-02-07 17:50     ` Oleksandr Suvorov
2022-02-02 16:10 ` [PATCH v4 0/2] Add support of the " Marcel Ziswiler

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=20211121180505.v4.2.4c49798950@changeid \
    --to=oleksandr.suvorov@foundries.io \
    --cc=cryosay@gmail.com \
    --cc=festevam@gmail.com \
    --cc=marcel.ziswiler@toradex.com \
    --cc=max.krummenacher@toradex.com \
    --cc=michal.simek@xilinx.com \
    --cc=oleksandr.suvorov@toradex.com \
    --cc=philippe.schenker@toradex.com \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    /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