From patchwork Sun Nov 21 16:05:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 1557763 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=kHQv+IqI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HxwHK07zDz9t5K for ; Mon, 22 Nov 2021 03:05:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C94D8833E6; Sun, 21 Nov 2021 17:05:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.b="kHQv+IqI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 268CB8321B; Sun, 21 Nov 2021 17:05:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 41B218344C for ; Sun, 21 Nov 2021 17:05:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=oleksandr.suvorov@foundries.io Received: by mail-lf1-x133.google.com with SMTP id b1so68386995lfs.13 for ; Sun, 21 Nov 2021 08:05:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tlDwMOs/10xauJPsl3WGRpu+6fpmt03ZDceHYJEt3VM=; b=kHQv+IqIBEJ33QLvK4zSIlCIuRFYexRe8RusKfcClrfuJtxqgA3uhOdmdEGbOsjBqf Smsry5yDGugNbspylu4zpolNYIDO5GX+wBHG3kBu+yRfuU2bkB+UilWhsVF1sWwMAPSS 366Y4gTfPpMKDZUC19i8NaFh7EEpgx1uaGN1CBoyrXs1kmNG5xaVd+xyOVqnZiTZZgxz DNBxJmVIsGBh5jCTSRRf3HfKE+lm/Fh5qR3MzDoRUOMeBYpXBzVu9Bo2tkI+9gUMOsbw TtuC7pIBcb37dL+3VyrDTJMeQIR1fkbdiqlQE2TmzJo75pIIbo8f5u+yN1Nnn4dicXS8 6/Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tlDwMOs/10xauJPsl3WGRpu+6fpmt03ZDceHYJEt3VM=; b=cbRlW/u9FgFg1ws+ChtaW7uaDYRkozdC94U56B6Ys5O02/TZxSKSzOY4Yz3Z81lASO DlSiaYvS4X75870XGVtyXSR3C0+w8tjPThDbVxmyr2BbsbSVUZDZCG6CzfWiy7C25UMY SEVn1QRSwfWgvgbEjwfuz6h3JRLXQ92hLysaGb3Z5KR1EA5wyhyy4KvT6Y2eB6BIWuvv mHV8b17T6qJSmTaDFvpAdO5x8fIF6228L58X/NNE2RY133QxOUT1eb7hVLR3fFtdSV4X WacH26oAXjYoxrrMzcRQsrg1VbjMEdgwoSakp1nzglMjttIn37guSYXR0amSKcw0wer0 NBVg== X-Gm-Message-State: AOAM5309y2Jz/yx0X8wt0hlukWBX+UaPy07HUdyxaFbeXfToyrU0aiSd e+s6K46SE9w8x9xpsIdnBaK+tl9V1L2FpA== X-Google-Smtp-Source: ABdhPJx37cddZxXARvQuWfH/9Tv53n2viE1lmqJyOTT1BTNkpRsD40hjhzwi9/XjqtGgoraAEAcT1g== X-Received: by 2002:a2e:8991:: with SMTP id c17mr42772127lji.361.1637510724336; Sun, 21 Nov 2021 08:05:24 -0800 (PST) Received: from cryobook.. ([83.218.251.13]) by smtp.gmail.com with ESMTPSA id j22sm680131lfu.155.2021.11.21.08.05.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 08:05:23 -0800 (PST) From: Oleksandr Suvorov To: u-boot@lists.denx.de Cc: Marcel Ziswiler , Philippe Schenker , Max Krummenacher , Michal Simek , Oleksandr Suvorov , Oleksandr Suvorov , Oleksandr Suvorov , Fabio Estevam , "NXP i.MX U-Boot Team" , Stefano Babic Subject: [PATCH v4 2/2] colibri-imx8x: add on-module gpio expander fxl6408 Date: Sun, 21 Nov 2021 18:05:17 +0200 Message-Id: <20211121180505.v4.2.4c49798950@changeid> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211121180505.v4.1.ce74fbdbdc@changeid> References: <20211121160517.684719-1-oleksandr.suvorov@foundries.io> <20211121180505.v4.1.ce74fbdbdc@changeid> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean From: Oleksandr Suvorov 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 Signed-off-by: Oleksandr Suvorov --- 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