From patchwork Thu Sep 20 01:37:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 147071 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1374645ljw; Wed, 19 Sep 2018 18:35:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY472mJLeU70A71rQgVF8pk3XJmtAu9RvjN+WWElaQhLwTzeQlQ4duf/Ant9fYexm0d8Hwo X-Received: by 2002:a62:411a:: with SMTP id o26-v6mr38903970pfa.111.1537407302241; Wed, 19 Sep 2018 18:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537407302; cv=none; d=google.com; s=arc-20160816; b=MfY9/B6s2kP7TSED1BIEuvBAp2FGwMVfVeaEij/dbFxvUeq//HQMRIPRlhdH0kSyCi PjjtqUgTL1iAjeO8se25w7O4WC6PyQb3go5AtzKwlLoYFAO4KipJMung9HYEg+lBNidk OTXJqVOMaUMvWpeKSWe0BPo882C9fXNQDZEvG+HQ1QSETHb3iD7cgFiBoFzJ5mwbne3b lz9jLy9Xb/YOgCQQ/QI+5d0kurUlaBIhBkEDLKCeYnLWCG5AW/oAaix5Sg5TMuO+L8Zu 2wpKjHCY6MM2R/rxuC95xiKMjfyduCfji01fln3CdRiodtUHxfVgvnna4gNHbBSPm/A2 nnSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=nNvAonLYhhMyL2rVaMZj5rHBUVBtZQTJDv7L7fgoZM4=; b=hginl8J8XrwvUcYPl4ANwvGWnVKXHpO7xkNB8cZNxGzpqJXxTZFUyW/s42EDU9dL5O fSnlx4UWDuGpI6QWj6g5BJnPOwAw85l8awJxKZIRdqKmNebowP6pEs2WRMk4RvGPzKfM q27PCb/Fl0pFnuZyg3ZYWtYobxzmt5DgSTGzRYYVrmRhp4M9HEoQN1vnYi/c+weVGjxQ gbav1MIX7Jv9450MNJEIHEOcXly8dcY8BfDBSHnvXujoxaLQgemxRBJbFJc+IM+ks0zo wlf8Oojq/C0eXVoQ8vibA7b71Q/xwRlREvNincQB91c3nRUcMQyxbIBWNHVGCZ2pJ7bP Dplw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PDQhPqAs; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-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. [209.132.180.67]) by mx.google.com with ESMTP id 32-v6si23327846plf.0.2018.09.19.18.35.02; Wed, 19 Sep 2018 18:35:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PDQhPqAs; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-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 S1732317AbeITHPl (ORCPT + 5 others); Thu, 20 Sep 2018 03:15:41 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:47003 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732079AbeITHPk (ORCPT ); Thu, 20 Sep 2018 03:15:40 -0400 Received: by mail-pf1-f196.google.com with SMTP id u24-v6so3525647pfn.13 for ; Wed, 19 Sep 2018 18:34:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nNvAonLYhhMyL2rVaMZj5rHBUVBtZQTJDv7L7fgoZM4=; b=PDQhPqAsHAdjtLGgmVFX1lrnqYoP20zYSfccmOboeA/4PRJJYr4shIxQSjUffLXkyv mULvdbMliVOgXPyfDF1yWIk4x2NUE0kRrgza3+HkzAYfn3NT1gg8ZZpS4D10/1KhzLrk 1ifznVcXrJ9SqzNEZEI2cOjmjo6BkbA5MdKF4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nNvAonLYhhMyL2rVaMZj5rHBUVBtZQTJDv7L7fgoZM4=; b=CazlpcqhJdWzlivWsHmByuL7dA07FO99koBuAvgc1EPfMgSu1Eb5dmRMtr4D/Jki4N CVeQDcE6p82n6fVjSlPwrQ9cYXFOpf5AsqkC4sdasTZ1kHiwPS3XNQHXd9POuo5h//9V uxlkk7cm+eMAvbVTBTQFoxezcx1uUvjEcHBD3C7UQVOA1Vw9YmnfsNDFrCK/TDgXeVMV UJ+5yUHjj+ErBCN8fqb0gI+VYqAQzEHllNkSp59r3yqgnov0fSV1ikQcA9vdX4Eiu8ET y9xWzJOiNSzyaM6uSiRgrsGOjFqByHI6tXvHjLw9ohq18ag76W2S9ocnUXmpUwkvRaOZ F3Mw== X-Gm-Message-State: APzg51AdV7r9nBtU4j6NnaRgGEk/4bhAs/E/Y9vbmfFD8WPJpGbW/W5Z SQDu4rRlb6fudYO+qO4fOgAtJg== X-Received: by 2002:a63:d70e:: with SMTP id d14-v6mr35107396pgg.110.1537407298413; Wed, 19 Sep 2018 18:34:58 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id l127-v6sm38753943pfc.55.2018.09.19.18.34.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Sep 2018 18:34:57 -0700 (PDT) From: Bjorn Andersson To: Bjorn Andersson , Linus Walleij Cc: Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] pinctrl: qcom: Support dispersed tiles Date: Wed, 19 Sep 2018 18:37:10 -0700 Message-Id: <20180920013712.2361-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180920013712.2361-1-bjorn.andersson@linaro.org> References: <20180920013712.2361-1-bjorn.andersson@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On some new platforms the tiles have been placed too far apart to be covered in a single ioremap. Turn "regs" into an array of base addresses and make the pingroup carry the information about which tile the pin resides in. For existing platforms we map the first entry regs and the existing pingroups will all use tile 0, meaning that there's no functional change. Signed-off-by: Bjorn Andersson --- drivers/pinctrl/qcom/pinctrl-msm.c | 30 +++++++++++++++++++++--------- drivers/pinctrl/qcom/pinctrl-msm.h | 4 ++++ 2 files changed, 25 insertions(+), 9 deletions(-) -- 2.18.0 diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index 86fbb5fe4d0e..0726c8a09065 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -37,6 +37,7 @@ #include "../pinctrl-utils.h" #define MAX_NR_GPIO 300 +#define MAX_NR_TILES 4 #define PS_HOLD_OFFSET 0x820 /** @@ -52,7 +53,7 @@ * @dual_edge_irqs: Bitmap of irqs that need sw emulated dual edge * detection. * @soc; Reference to soc_data of platform specific data. - * @regs: Base address for the TLMM register map. + * @regs: Base addresses for the TLMM tiles. */ struct msm_pinctrl { struct device *dev; @@ -70,19 +71,19 @@ struct msm_pinctrl { DECLARE_BITMAP(enabled_irqs, MAX_NR_GPIO); const struct msm_pinctrl_soc_data *soc; - void __iomem *regs; + void __iomem *regs[MAX_NR_TILES]; }; #define MSM_ACCESSOR(name) \ static u32 msm_readl_##name(struct msm_pinctrl *pctrl, \ const struct msm_pingroup *g) \ { \ - return readl(pctrl->regs + g->name##_reg); \ + return readl(pctrl->regs[g->tile] + g->name##_reg); \ } \ static void msm_writel_##name(u32 val, struct msm_pinctrl *pctrl, \ const struct msm_pingroup *g) \ { \ - writel(val, pctrl->regs + g->name##_reg); \ + writel(val, pctrl->regs[g->tile] + g->name##_reg); \ } MSM_ACCESSOR(ctl) @@ -1046,7 +1047,7 @@ static int msm_ps_hold_restart(struct notifier_block *nb, unsigned long action, { struct msm_pinctrl *pctrl = container_of(nb, struct msm_pinctrl, restart_nb); - writel(0, pctrl->regs + PS_HOLD_OFFSET); + writel(0, pctrl->regs[0] + PS_HOLD_OFFSET); mdelay(1000); return NOTIFY_DONE; } @@ -1082,6 +1083,7 @@ int msm_pinctrl_probe(struct platform_device *pdev, struct msm_pinctrl *pctrl; struct resource *res; int ret; + int i; pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); if (!pctrl) @@ -1093,10 +1095,20 @@ int msm_pinctrl_probe(struct platform_device *pdev, raw_spin_lock_init(&pctrl->lock); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - pctrl->regs = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(pctrl->regs)) - return PTR_ERR(pctrl->regs); + if (soc_data->tiles) { + for (i = 0; i < soc_data->ntiles; i++) { + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, + soc_data->tiles[i]); + pctrl->regs[i] = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(pctrl->regs[i])) + return PTR_ERR(pctrl->regs[i]); + } + } else { + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + pctrl->regs[0] = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(pctrl->regs[0])) + return PTR_ERR(pctrl->regs[0]); + } msm_pinctrl_setup_pm_reset(pctrl); diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h index 9b9feea540ff..0ad4bc55e2e1 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.h +++ b/drivers/pinctrl/qcom/pinctrl-msm.h @@ -76,6 +76,8 @@ struct msm_pingroup { u32 intr_status_reg; u32 intr_target_reg; + unsigned int tile:2; + unsigned mux_bit:5; unsigned pull_bit:5; @@ -117,6 +119,8 @@ struct msm_pinctrl_soc_data { unsigned ngroups; unsigned ngpios; bool pull_no_keeper; + const char **tiles; + unsigned int ntiles; }; int msm_pinctrl_probe(struct platform_device *pdev,