From patchwork Thu Sep 9 20:44:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oleksandr Suvorov X-Patchwork-Id: 1526319 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=llkPLwGR; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 ozlabs.org (Postfix) with ESMTPS id 4H59xM1zRbz9sRf for ; Fri, 10 Sep 2021 06:45:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B274D83572; Thu, 9 Sep 2021 22:44:48 +0200 (CEST) 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="llkPLwGR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C040F8353C; Thu, 9 Sep 2021 22:44:40 +0200 (CEST) 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=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) (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 7B31083577 for ; Thu, 9 Sep 2021 22:44:30 +0200 (CEST) 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-x131.google.com with SMTP id f18so6163062lfk.12 for ; Thu, 09 Sep 2021 13:44:30 -0700 (PDT) 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=GiIoBI019vOLu7KXXFP6KRCmtcqzTZqUZwP9v8RsUmU=; b=llkPLwGRqoflN5cqVq5Xqryo6FPn72RME3Y159RVSv1A8I75sk0R3vTAK60zxPyl5v zEfSP46u8OivzZevpqbu5oqF8AB+1Zns3TfJlogm6YaWR/BfEX2YCDrqWVcwGdkzvkjG sZ4cCflUlkfVMJQ6GrIrCsYIp2AjiNTjS1/jzXzjjiKsbbXValBZSQ4Cfia8ByNQELuD sr758XiyOH7sflaIX5hpUD3d9d70evvdq4kABSk6QzoIE5FmB4hpzR3pDs3rtTfhiFn3 47tIRavuGk0Ag3gF8yK5bG9J4d1r/w+EwAdN2nAcFIHqLXBlFfRpLojVefIgHtx8JNT3 8rsg== 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=GiIoBI019vOLu7KXXFP6KRCmtcqzTZqUZwP9v8RsUmU=; b=nZALGpLBo501ZRk7uqeu4qqccIztcQ2xP3Y51zeohvjHsEkVgx+0UNOM0MHHd6Rmnm ImYQzmt+BSgKqFdDKDc7Lu7bVQE8IPfdUp2cdkdieot1yIOqDEw1PTf/lUvwFF+eKHIQ y/yweikK+YLLyzeuais1aUNZH/d0rw4aJeuQxjsQf41fHk7n3UIMnzGYEGT4kyNnoemc DRD2Wr37vhnKlXPLy36Hxhj3NXj8wotQBV3Chi6PjLzrURyQZmNEWmfSQkySdkyZTNr5 JyMuDJVoSossxzCfjhcJC2MWmnACTkVa2uCtGC9pj9R8UE3WYRaqvTEpqt+XIfGQgBQX tOfQ== X-Gm-Message-State: AOAM5312vi4gbhjUKc6VeOwR2NFTWyDTRFcvvLT+ElxULJLAPtsXvxbD 7+NibWxW8ST6WJ/E3Yv6l1i7FGQ4pQqAIA== X-Google-Smtp-Source: ABdhPJwcKXoKhnUGmUtSyHLMxHwnQDiuHKMk9R12GbEZjfXpDw2XMwR93MikttMAdlvL0vURW6wbUw== X-Received: by 2002:ac2:5ec4:: with SMTP id d4mr1244315lfq.127.1631220269622; Thu, 09 Sep 2021 13:44:29 -0700 (PDT) Received: from cryobook.bearlog ([82.193.109.226]) by smtp.gmail.com with ESMTPSA id b40sm306462lfv.182.2021.09.09.13.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 13:44:29 -0700 (PDT) From: Oleksandr Suvorov To: u-boot@lists.denx.de Cc: Marcel Ziswiler , Philippe Schenker , Max Krummenacher , Oleksandr Suvorov , Oleksandr Suvorov , Fabio Estevam , Igor Opaniuk , "NXP i.MX U-Boot Team" , Stefano Babic , Tero Kristo Subject: [PATCH v3 2/2] colibri-imx8x: add on-module gpio expander fxl6408 Date: Thu, 9 Sep 2021 23:44:22 +0300 Message-Id: <20210909234212.v3.2.4c49798950@changeid> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210909234212.v3.1.ce74fbdbdc@changeid> References: <20210909204422.55749-1-oleksandr.suvorov@foundries.io> <20210909234212.v3.1.ce74fbdbdc@changeid> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 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 11ece34c02..df992ac639 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 a0816acc27..fbe6e575a3 100644 --- a/configs/colibri-imx8x_defconfig +++ b/configs/colibri-imx8x_defconfig @@ -38,6 +38,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