Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5643009img; Wed, 27 Mar 2019 12:17:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLjtiR0G+LgiTBqjKEryzQn5Fo6VfIiUbWpeF+zMg0YgRzFDcmVvcrsqE1b8lrpOmR7ZRi X-Received: by 2002:a62:174c:: with SMTP id 73mr37066913pfx.33.1553714262659; Wed, 27 Mar 2019 12:17:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714262; cv=none; d=google.com; s=arc-20160816; b=VlK2RuQOCXjGT/sEWZcDsK85JgIFqAlwLsACMg8O+YjeGm5JF4aMTQZFbIgwKnzaIx zSFnSeYkJe3HtSueuqJ696TuqAiCjPq/yZCdHmb/4b9bf8ZZGsVvscyHsjMqZHwTlcv7 VM7SdSkudRyGsCzIHtK78liFEai0va7sIokf3ZJdkOF4rAr9CcWYc7+HbD1r9qCO3dxN AJDveilBI55a6lpsJvAIjQDX6oL+qaMRTmzo97yzEe35Sb6Cl8Snq66db2FdQ5xoQegz dQHqXP5Q2/Ltk3xAHla8PqIqO0iu2sCdEScrXJvmb6HAjBEJoTIjV5jmeCKS5bpb6rQE yXIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MRHmDrtX95RBNGZD7hHpmp4oil1HDJNL2cksh47WOSs=; b=a11RkEYv4/wRw+L83Isz+Ienokyp1WIk6LskctGTIxIAgofnzQyLdfH8AVVDvN0dC5 wmIGzqOXEgsHBroy3qs81AlzfMbzOAbFptf/nK86IwIGvh6BudFUO8EeZgRjJbErA7dE 7FlqsiHWtSUYgf1MTygcCQCGIpjMsu1+01XSnvqR4jtIGtLLgFk/YzyUVk3HzeW235Hl BlXZhcSa87RkeE8GXQIN1AfKn9wNPXI4eHTxf5BsXI0/X++ma2DNvkJAm2YeQu8746VW oVhKt4PlmnoHwH8HJe/NUx2qhDV3VGe+FI599mbdanyWpPjEWsjD18Et4PGAn93FaIjd zZwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d8b+G11y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si19821772pge.192.2019.03.27.12.17.27; Wed, 27 Mar 2019 12:17:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@kernel.org header.s=default header.b=d8b+G11y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387937AbfC0TPm (ORCPT + 99 others); Wed, 27 Mar 2019 15:15:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:51138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388543AbfC0SJT (ORCPT ); Wed, 27 Mar 2019 14:09:19 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ECF8B217D9; Wed, 27 Mar 2019 18:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710159; bh=U5EPkZcf/N+CmLptqtDmvKPoya9zYkggJDEyzh93mPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d8b+G11yjtrPo2P7q03ZnuiDJykQoGJ2Jxl0QkHDm+X415dC59EZzH3e0qkEeJBEF hrE/7zKgOz/YJbm0Jl+/bIKf5vpUOAitMOzVZsJ06iHLTuk5CHDm/DHWYWDel1zbgs SdZR0FPciTAFVOa/g5RyAVDM8i+0Cgtgkhrud5Ag= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xingyu Chen , Jianxin Pan , Jerome Brunet , Linus Walleij , Sasha Levin , linux-gpio@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH AUTOSEL 5.0 226/262] pinctrl: meson: fix G12A ao pull registers base address Date: Wed, 27 Mar 2019 14:01:21 -0400 Message-Id: <20190327180158.10245-226-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xingyu Chen [ Upstream commit e66dd48e8b0dee104d16417d30361074b08baca8 ] Since Meson G12A SoC, Introduce new ao registers AO_RTI_PULL_UP_EN_REG and AO_GPIO_O. These bits of controlling output level are remapped to the new register AO_GPIO_O, and the AO_GPIO_O_EN_N support only controlling output enable. These bits of controlling pull enable are remapped to the new register AO_RTI_PULL_UP_EN_REG, and the AO_RTI_PULL_UP_REG support only controlling pull type(up/down). The new layout of ao gpio/pull registers is as follows: - AO_GPIO_O_EN_N [offset: 0x9 << 2] - AO_GPIO_I [offset: 0xa << 2] - AO_RTI_PULL_UP_REG [offset: 0xb << 2] - AO_RTI_PULL_UP_EN_REG [offset: 0xc << 2] - AO_GPIO_O [offset: 0xd << 2] From above, we can see ao GPIO registers region has been separated by the ao pull registers. In order to ensure the continuity of the region on software, the ao GPIO and ao pull registers use the same base address, but can be identified by the offset. Fixes: 29ae0952e85f ("pinctrl: meson-g12a: add pinctrl driver support") Signed-off-by: Xingyu Chen Signed-off-by: Jianxin Pan Signed-off-by: Jerome Brunet Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/meson/pinctrl-meson.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index ea87d739f534..a4ae1ac5369e 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c @@ -31,6 +31,9 @@ * In some cases the register ranges for pull enable and pull * direction are the same and thus there are only 3 register ranges. * + * Since Meson G12A SoC, the ao register ranges for gpio, pull enable + * and pull direction are the same, so there are only 2 register ranges. + * * For the pull and GPIO configuration every bank uses a contiguous * set of bits in the register sets described above; the same register * can be shared by more banks with different offsets. @@ -488,23 +491,22 @@ static int meson_pinctrl_parse_dt(struct meson_pinctrl *pc, return PTR_ERR(pc->reg_mux); } - pc->reg_pull = meson_map_resource(pc, gpio_np, "pull"); - if (IS_ERR(pc->reg_pull)) { - dev_err(pc->dev, "pull registers not found\n"); - return PTR_ERR(pc->reg_pull); + pc->reg_gpio = meson_map_resource(pc, gpio_np, "gpio"); + if (IS_ERR(pc->reg_gpio)) { + dev_err(pc->dev, "gpio registers not found\n"); + return PTR_ERR(pc->reg_gpio); } + pc->reg_pull = meson_map_resource(pc, gpio_np, "pull"); + /* Use gpio region if pull one is not present */ + if (IS_ERR(pc->reg_pull)) + pc->reg_pull = pc->reg_gpio; + pc->reg_pullen = meson_map_resource(pc, gpio_np, "pull-enable"); /* Use pull region if pull-enable one is not present */ if (IS_ERR(pc->reg_pullen)) pc->reg_pullen = pc->reg_pull; - pc->reg_gpio = meson_map_resource(pc, gpio_np, "gpio"); - if (IS_ERR(pc->reg_gpio)) { - dev_err(pc->dev, "gpio registers not found\n"); - return PTR_ERR(pc->reg_gpio); - } - return 0; } -- 2.19.1