From patchwork Fri Apr 12 09:54:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 788282 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp631264wrm; Fri, 12 Apr 2024 02:55:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWnR9Gq2Qp1L92kUy0y6VfnS2fpkHnsUX8OO4QuZ885Yi5nAX/k+d3LchPUZnP6yiM+f7MziNx6pODbHRDk4evC X-Google-Smtp-Source: AGHT+IGzpOG/oXE+YAjbnNgHA2wRdcZWerk3M7BS9DXKPjw+EeYHALnrELRayxoIFe9zB0Ispw1J X-Received: by 2002:a17:906:6d57:b0:a47:30d6:f465 with SMTP id a23-20020a1709066d5700b00a4730d6f465mr1662014ejt.1.1712915737990; Fri, 12 Apr 2024 02:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712915737; cv=none; d=google.com; s=arc-20160816; b=ZJTf05eA2eC4SaAWhCgeNiL5jJZKWNTIqil1bEdIXQ7e9mvBhAve4KdehqjTr+IVDV zg3cnKwYDIy3+s46Q0bX8qa+bfNPOnnlT0sR2awGtepxCaZ3sdBcDiBZ9iaWiOmUSGp3 tIucQvW8QnVD5aMOOKqs+HuNez/rRWg8X6q5y5GuDV669LqSdoWH0VzN0xp87hA3GLqz rkLXPt5SATcH9pFFz8FJNBeoiv6aoASu2QDrQ7b7fgKeFckk1G4daT3IN4J3gYx8NJFz aWrlk0Mvh57NfVIUpDvy0tQegEe3mM4UBzB5AjGAgCtLLcV6t4ImD6KTEgn/nfBXV0yz GJ2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OQQFm53Y6noFLmaH27wGfZfjy164/8YCVf5iflGTt5w=; fh=T5H15yVH0x76eljP78R1SA5aX1AOqAQ+w8cgext4uuk=; b=t0SURSk7I5fa0MAx2JAoAOX8DKUwjP6/WkLANPQwc3qycoRq7mSnYVjODXlNhycHGg SMrJisheJKZoDcAzjblvohckOC6JTrZjBCP3hyXJOy3plqvZN6jvZfQTlRlEwlfLfGuS Rvn6n/ilePvv2j0ZJN9kjWVZSO5G3/HOBe8amBEihHJI/eS/2/8ZeP4z6OARJOof5X4q cLOrxXChPOvaYssddsOmsEyWNW2UX/lFemH30F26nQFCuU5RxLWoo9SfawPBpVPzJPDy mw2EeHoOJe8QmK7dVeXqPZ5J7jBQyOmn2jKiQBvKIETDQhzGGLDg66KLAKeHnOxy+wlM Zf4Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cDjxNxuX; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id qa33-20020a17090786a100b00a522a025a6dsi1138628ejc.883.2024.04.12.02.55.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 02:55:37 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cDjxNxuX; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A58B9881CD; Fri, 12 Apr 2024 11:55:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="cDjxNxuX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E87CC881CA; Fri, 12 Apr 2024 11:55:13 +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=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_SBL_CSS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) (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 743BC881D7 for ; Fri, 12 Apr 2024 11:55:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sumit.garg@linaro.org Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6ed2170d89fso1135127b3a.1 for ; Fri, 12 Apr 2024 02:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712915709; x=1713520509; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OQQFm53Y6noFLmaH27wGfZfjy164/8YCVf5iflGTt5w=; b=cDjxNxuXnlL67GGUoepR4ljQtz8Y7N73ys/iPsZF0hl/NR+kQm1JkLiU62fiYP8CHY 8QjG8psg23eZ5lhyvVKLy4UZJELhrAdGFw7S8Vg38BU1pg8xHMWng4mcw2g1nf7BWsXP 3uX6U4XtA7JeExFJE5ZkyFLiIXPennATyWJmQ8VqsDkLdR9mKW86rWd9foi1nAZ4UxnL bAJZn3z02vhC4wjQlHvxv9TRLCG55DZ0izmMEkaXcvOvxZy3Jkjs8HvurOL6GpCzDmyo Hfp/V7QOc7m9GIkjjpt1r+4835x2wrWynEVgvWDFTKRPWq73jUiQ1vJ9v8AKjLbur9LY n/5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712915709; x=1713520509; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OQQFm53Y6noFLmaH27wGfZfjy164/8YCVf5iflGTt5w=; b=VT+sW4spcw2wGAJRGrQKx50VVAw0Nt8HhQfiyWh7jdzNgNzRYGexHNsbBBsG/46kID Ah6ZsaSjh3Y4cg7I7AcbH6AM2tvmXZuSg3M1TKr0cXGw2BG7hvydx9+3lDHq8EXyXneS Ifrj5y5/AtpyVyRp1kHyPcmUx34/6ApFLw93HxlP5vJQ/SLPW5OKVIeVq7HNfAaZfSOQ XAbibltuudfGyw0vAjon9AAreuNpEMTAYfNjT+RVv5FyUOE7qNGpJtSyMxayH0DK5O4Y Tr2qkOzike7JZMSB7rpOwmBsrhCnoNxSI1AmScnsIStQoISi0d7chY9o0yOIJqoqFPed FUuQ== X-Gm-Message-State: AOJu0Yzyl66AzNwpdbU+AqsODpIncPSWwlzvHduv2pE7Hrn+4ot8BNht BucO4s7u733zt3EwcFYSuyOnWvQTOc91HVUl7ik+ZWVpL909x/bzG1KAy+m08MtxTD/53ZijcWT 9 X-Received: by 2002:a05:6a21:3e07:b0:1a7:a422:7394 with SMTP id bk7-20020a056a213e0700b001a7a4227394mr2727697pzc.17.1712915708383; Fri, 12 Apr 2024 02:55:08 -0700 (PDT) Received: from sumit-X1.. ([223.178.210.92]) by smtp.gmail.com with ESMTPSA id bn19-20020a056a00325300b006ed0b798f1fsm2534839pfb.119.2024.04.12.02.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 02:55:08 -0700 (PDT) From: Sumit Garg To: u-boot@lists.denx.de Cc: caleb.connolly@linaro.org, neil.armstrong@linaro.org, trini@konsulko.com, lukma@denx.de, seanga2@gmail.com, sjg@chromium.org, laetitia.mariottini@se.com, pascal.eberhard@se.com, abdou.saker@se.com, jimmy.lalande@se.com, benjamin.missey@non.se.com, daniel.thompson@linaro.org, stephan@gerhold.net, Sumit Garg Subject: [PATCH v4 4/7] pinctrl: qcom: Add support for driving GPIO pins output Date: Fri, 12 Apr 2024 15:24:35 +0530 Message-Id: <20240412095438.410570-5-sumit.garg@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240412095438.410570-1-sumit.garg@linaro.org> References: <20240412095438.410570-1-sumit.garg@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Add support for driving the GPIO pins as output low or high. Signed-off-by: Sumit Garg Reviewed-by: Neil Armstrong --- drivers/pinctrl/qcom/pinctrl-qcom.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-qcom.c b/drivers/pinctrl/qcom/pinctrl-qcom.c index 909e566acf5..e68971b37ff 100644 --- a/drivers/pinctrl/qcom/pinctrl-qcom.c +++ b/drivers/pinctrl/qcom/pinctrl-qcom.c @@ -29,15 +29,24 @@ struct msm_pinctrl_priv { #define GPIO_CONFIG_REG(priv, x) \ (qcom_pin_offset((priv)->data->pin_data.pin_offsets, x)) -#define TLMM_GPIO_PULL_MASK GENMASK(1, 0) -#define TLMM_FUNC_SEL_MASK GENMASK(5, 2) -#define TLMM_DRV_STRENGTH_MASK GENMASK(8, 6) -#define TLMM_GPIO_DISABLE BIT(9) +#define GPIO_IN_OUT_REG(priv, x) \ + (GPIO_CONFIG_REG(priv, x) + 0x4) + +#define TLMM_GPIO_PULL_MASK GENMASK(1, 0) +#define TLMM_FUNC_SEL_MASK GENMASK(5, 2) +#define TLMM_DRV_STRENGTH_MASK GENMASK(8, 6) +#define TLMM_GPIO_OUTPUT_MASK BIT(1) +#define TLMM_GPIO_OE_MASK BIT(9) + +/* GPIO register shifts. */ +#define GPIO_OUT_SHIFT 1 static const struct pinconf_param msm_conf_params[] = { { "drive-strength", PIN_CONFIG_DRIVE_STRENGTH, 2 }, { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 }, { "bias-pull-up", PIN_CONFIG_BIAS_PULL_UP, 3 }, + { "output-high", PIN_CONFIG_OUTPUT, 1, }, + { "output-low", PIN_CONFIG_OUTPUT, 0, }, }; static int msm_get_functions_count(struct udevice *dev) @@ -90,7 +99,7 @@ static int msm_pinmux_set(struct udevice *dev, unsigned int pin_selector, return 0; clrsetbits_le32(priv->base + GPIO_CONFIG_REG(priv, pin_selector), - TLMM_FUNC_SEL_MASK | TLMM_GPIO_DISABLE, func << 2); + TLMM_FUNC_SEL_MASK | TLMM_GPIO_OE_MASK, func << 2); return 0; } @@ -117,6 +126,12 @@ static int msm_pinconf_set(struct udevice *dev, unsigned int pin_selector, clrsetbits_le32(priv->base + GPIO_CONFIG_REG(priv, pin_selector), TLMM_GPIO_PULL_MASK, argument); break; + case PIN_CONFIG_OUTPUT: + writel(argument << GPIO_OUT_SHIFT, + priv->base + GPIO_IN_OUT_REG(priv, pin_selector)); + setbits_le32(priv->base + GPIO_CONFIG_REG(priv, pin_selector), + TLMM_GPIO_OE_MASK); + break; default: return 0; }