Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1614354pxb; Mon, 20 Sep 2021 00:35:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKGPTEopq1/D2IKBsR6KuEvOfEmjs8737e8AmzRedPIKuOC/nIPsMxydHQaiL9KKOoFWIf X-Received: by 2002:a92:1952:: with SMTP id e18mr15744320ilm.291.1632123307776; Mon, 20 Sep 2021 00:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632123307; cv=none; d=google.com; s=arc-20160816; b=DHejpysZ/hoYbtDyK+gB4EX0LIC/ybC9I+nkEkJW5e1gybw3sVmYx4qSsYOKBzWnGb P66NN3s9XGEV/xo2rhMKNr9kGUnAKTSSAdck9oh5Bd0wZUF7O2bkhBKg/QX0ckKZq0Pp fgm0wYh5+ONIVZnGW7xNPg+/3/FssA0kvnAYPkaW/wG5QqbL1oqZevJaJehIebn/ijh7 JQw5SLYKGXvLAunJz156+z26z7flSfEEnBhQ8WwnPjXNiqhlPqm7+GhkvQMadys6vnqq Ipldp2oAk04YZHUVotIbo53L0S6tip8EryrpLl18tdmACCBPd8LBdwlQu1LP2DsJ8ZgJ EktA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lzKqB+hvLZ/JMccnjIuEIhViBFYa45nTJzf1VzPKkQM=; b=ps21t11ENZmgPlyNKLsizNfypGkhRDTRlRLw79byKrgTzBLYhXxxttyq2HnflllCtN NRtWauvqPz/HCEX1VIIAs5Mv9i1Y4hJn/XBFrwrIyHD6H5ouIoe3IsxIxIuV4m1L6uE0 cZd817EDdONzBcJewIGcFenqB8JNXIvVQLR+ygID3/VvSedFR8ywjoYweKJoTRwsI92U RK1RFA7OXvSbIiiiP36LD6hrXRJWPU6Khu/5c5UlJriiJK3oTzLPVSLtvzuMOUzAj6wz 89ZEsm4SkUlTwwOQDSYztBEOLwZ4yelp6JS81LBb3fNEbWqPHlmryu4v5DLyNfIGFztp P8TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=geuYnnJg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g11si6107645ion.10.2021.09.20.00.34.56; Mon, 20 Sep 2021 00:35:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=geuYnnJg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229719AbhITAqA (ORCPT + 99 others); Sun, 19 Sep 2021 20:46:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231520AbhITAp7 (ORCPT ); Sun, 19 Sep 2021 20:45:59 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91E1CC061760 for ; Sun, 19 Sep 2021 17:44:33 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id c42-20020a05683034aa00b0051f4b99c40cso21405576otu.0 for ; Sun, 19 Sep 2021 17:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lzKqB+hvLZ/JMccnjIuEIhViBFYa45nTJzf1VzPKkQM=; b=geuYnnJgB8GKQG9MHXQWQ9qCeznG/2qiKgr26NIQ2RlTKID2Ai8AQTzC3FHNsffvYm xFN1q2LncnS//Ppt4czKmDJrFUaKFoGGrYNGfSAFV1rHAGpX6VbQHBHZCAeJvMAUukme n+5jxW4GOHoZrPsQ9IJFXuF53SOqYumNaLk00sAzPmCiRFrhvfheG5AcgE4EPYbXrAYc foy2vaQbKs6ykHcdMPF3c0+3ZJNbrKi9sd54wmJ5sCQXx3kAnzmQTew0dDLyuvbdSUMm Mj+Ij/We8jLSmbGR25LHHIYRTEPjqyN7XUufwr59RgN4DDL2OH8bTm7l5BUiZaip99d1 Q3oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lzKqB+hvLZ/JMccnjIuEIhViBFYa45nTJzf1VzPKkQM=; b=WHzytEa+qZ7zgo0se9UO8QtU8vrPLxhQBSjjgP0w6TPiUS8NOdz6oXm3Eajuog0/Dq dIgcgpdEGuicNOTxefnsU4Z6+DVHOGysUA13KHamXztLZ6KZtXjnO7ukvVjFKdqNQOAG klcx+i12j4sfPZYITpngL/f+0FO2teNyArQUI6aMELDnY8KDR7oa1A1P4ZfX95maFP0j sNwJduixW1j0t3EC5Y0PIsfuSOmQTnLZrGiDHHjTFSPbokJIWpjizwE2hvjlDIdrB+Ak JVf3Wc+EaHvpR7Bj+xGGe8JSC9oSsdIvR4rIZAZ5CEUpAboUPX7KjI4GhHWx8C+1GQgV jJaw== X-Gm-Message-State: AOAM530P+vLy2vrklRH9XxTwFNLmej2Jnh3Ys2IlGV5paWkeGLwg/Yi9 hrYvpcKBNKFH0Hlff9VmfIhDwQ== X-Received: by 2002:a9d:5a9b:: with SMTP id w27mr18814468oth.29.1632098672900; Sun, 19 Sep 2021 17:44:32 -0700 (PDT) Received: from builder.lan (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id f17sm1884382ook.9.2021.09.19.17.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Sep 2021 17:44:32 -0700 (PDT) Date: Sun, 19 Sep 2021 19:44:30 -0500 From: Bjorn Andersson To: Rajendra Nayak Cc: agross@kernel.org, linus.walleij@linaro.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Prasad Sodagudi Subject: Re: [PATCH] pinctrl: qcom: Add egpio feature support Message-ID: References: <1631860648-31774-1-git-send-email-rnayak@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1631860648-31774-1-git-send-email-rnayak@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 17 Sep 01:37 CDT 2021, Rajendra Nayak wrote: > From: Prasad Sodagudi > > egpio is a scheme which allows special power Island Domain IOs > (LPASS,SSC) to be reused as regular chip GPIOs by muxing regular > TLMM functions with Island Domain functions. > With this scheme, an IO can be controlled both by the cpu running > linux and the Island processor. This provides great flexibility to > re-purpose the Island IOs for regular TLMM usecases. > > 2 new bits are added to ctl_reg, egpio_present is a read only bit > which shows if egpio feature is available or not on a given gpio. > egpio_enable is the read/write bit and only effective if egpio_present > is 1. Once its set, the Island IO is controlled from Chip TLMM. > egpio_enable when set to 0 means the GPIO is used as Island Domain IO. > > The support exists on most recent qcom SoCs, and we add support > for sm8150/sm8250/sm8350 and sc7280 as part of this patch. > I was under the impression that this feature would allow you to repurpose pins for use either by the remote island or by apps. But if I understand your proposal, you check to see if the pin is "egpio capable" for a pin and if so just sets the bit - muxing it to apps (or the island?). It seems reasonable that this would be another pinmux state for these pins, rather than just flipping them all in one or the other direction. PS. When I spoke with Prasad about this a couple of years ago, I think we talked about representing this as a pinconf property, but it seems to make more sense to me now that it would be a pinmux state. Regards, Bjorn > Signed-off-by: Prasad Sodagudi > [rnayak: rewrite commit log, minor rebase] > Signed-off-by: Rajendra Nayak > --- > drivers/pinctrl/qcom/pinctrl-msm.c | 4 ++++ > drivers/pinctrl/qcom/pinctrl-msm.h | 2 ++ > drivers/pinctrl/qcom/pinctrl-sc7280.c | 2 ++ > drivers/pinctrl/qcom/pinctrl-sm8150.c | 2 ++ > drivers/pinctrl/qcom/pinctrl-sm8250.c | 2 ++ > drivers/pinctrl/qcom/pinctrl-sm8350.c | 2 ++ > 6 files changed, 14 insertions(+) > > diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c > index 8476a8a..f4a2343 100644 > --- a/drivers/pinctrl/qcom/pinctrl-msm.c > +++ b/drivers/pinctrl/qcom/pinctrl-msm.c > @@ -220,6 +220,10 @@ static int msm_pinmux_set_mux(struct pinctrl_dev *pctldev, > val = msm_readl_ctl(pctrl, g); > val &= ~mask; > val |= i << g->mux_bit; > + /* Check if egpio present and enable that feature */ > + if (val & BIT(g->egpio_present)) > + val |= BIT(g->egpio_enable); > + > msm_writel_ctl(val, pctrl, g); > > raw_spin_unlock_irqrestore(&pctrl->lock, flags); > diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h > index e31a516..3635b31 100644 > --- a/drivers/pinctrl/qcom/pinctrl-msm.h > +++ b/drivers/pinctrl/qcom/pinctrl-msm.h > @@ -77,6 +77,8 @@ struct msm_pingroup { > unsigned drv_bit:5; > > unsigned od_bit:5; > + unsigned egpio_enable:5; > + unsigned egpio_present:5; > unsigned oe_bit:5; > unsigned in_bit:5; > unsigned out_bit:5; > diff --git a/drivers/pinctrl/qcom/pinctrl-sc7280.c b/drivers/pinctrl/qcom/pinctrl-sc7280.c > index afddf6d..607d459 100644 > --- a/drivers/pinctrl/qcom/pinctrl-sc7280.c > +++ b/drivers/pinctrl/qcom/pinctrl-sc7280.c > @@ -43,6 +43,8 @@ > .mux_bit = 2, \ > .pull_bit = 0, \ > .drv_bit = 6, \ > + .egpio_enable = 12, \ > + .egpio_present = 11, \ > .oe_bit = 9, \ > .in_bit = 0, \ > .out_bit = 1, \ > diff --git a/drivers/pinctrl/qcom/pinctrl-sm8150.c b/drivers/pinctrl/qcom/pinctrl-sm8150.c > index 7359bae..63a625a 100644 > --- a/drivers/pinctrl/qcom/pinctrl-sm8150.c > +++ b/drivers/pinctrl/qcom/pinctrl-sm8150.c > @@ -56,6 +56,8 @@ enum { > .mux_bit = 2, \ > .pull_bit = 0, \ > .drv_bit = 6, \ > + .egpio_enable = 12, \ > + .egpio_present = 11, \ > .oe_bit = 9, \ > .in_bit = 0, \ > .out_bit = 1, \ > diff --git a/drivers/pinctrl/qcom/pinctrl-sm8250.c b/drivers/pinctrl/qcom/pinctrl-sm8250.c > index af144e7..ad4fd94 100644 > --- a/drivers/pinctrl/qcom/pinctrl-sm8250.c > +++ b/drivers/pinctrl/qcom/pinctrl-sm8250.c > @@ -57,6 +57,8 @@ enum { > .mux_bit = 2, \ > .pull_bit = 0, \ > .drv_bit = 6, \ > + .egpio_enable = 12, \ > + .egpio_present = 11, \ > .oe_bit = 9, \ > .in_bit = 0, \ > .out_bit = 1, \ > diff --git a/drivers/pinctrl/qcom/pinctrl-sm8350.c b/drivers/pinctrl/qcom/pinctrl-sm8350.c > index 4d8f863..bb436dc 100644 > --- a/drivers/pinctrl/qcom/pinctrl-sm8350.c > +++ b/drivers/pinctrl/qcom/pinctrl-sm8350.c > @@ -46,6 +46,8 @@ > .mux_bit = 2, \ > .pull_bit = 0, \ > .drv_bit = 6, \ > + .egpio_enable = 12, \ > + .egpio_present = 11, \ > .oe_bit = 9, \ > .in_bit = 0, \ > .out_bit = 1, \ > -- > QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member > of Code Aurora Forum, hosted by The Linux Foundation >