Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6467540imu; Sun, 2 Dec 2018 19:07:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/XCBIdHjAInXPESa2YVVbjATFphn/ztSWXz4F8Z4orlk6ZVRZGGZqHy6J8YuT60SlpxcTb7 X-Received: by 2002:a17:902:8687:: with SMTP id g7mr14151762plo.96.1543806475250; Sun, 02 Dec 2018 19:07:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543806475; cv=none; d=google.com; s=arc-20160816; b=yx82GEWCIqPdvPNgcJnOZToBU4/c90hzFXdA02mGvpepW/pzYbPw3MtBQrV3cQA8PD 0h9m20ozPdDkTsQZPiACjHfxla3gbc/VGPyYcbeomQ8ViuLcQJTaMQBIiD8zcfu0PshS +dxnaX63O4DZH2LILvVRKMVY4gjkXj6krfWlOUGsRANeRQAlE97EWMW2rNKdTzzGtmWN AGNrtcONZp6pLCv5cT8B99eJ1ukT3lbeLhRv+EkE6EG1ot7c92QkRtpjEhsqV0VfuLWk uGiT226YcN8iInMxqWLfXBITBXOKcwnWPdCLpUwdwwf5qKQrvVbLoCsRf1EHZd+RvmXR AXnA== 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 :message-id:date:subject:cc:to:from; bh=dhhs8oqCo6uJ9KRL7N1wLzK2rrIzKtG+YYOvDKtbDQI=; b=aStdR3eGnq/G7eCKWdIM/hU6LWl4j3z3e7RTzaKtVRdirIJvfxZPyCOwkzmPQlSjWd 9FojXG4WC6Rbpcbo9gTW+fNvaj61Dq4I5Fj0pPAYuX//JqpG8og/AXgBOkI4lkZN9gHB Aon9qGuc+caqyEAd2QT3PFpMECWq6xf3v/Zrqtuw8iyQK5d3Kxmyf7SxzBA+O6s88EL5 7pgeVGiKuh0+geoZMQ37sY+QRHhhLrUVNllpyrL5a4oZGGFB7/Nnr8kUJ+OrL3GQYNe/ +oqMv+UWVK15P3t0+cbGaPNjuVmGkHJKOjCztZPNFo+TWsxBdDL6oaMmTuPPc0EeM84L ZmjA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r22si11012225pgl.537.2018.12.02.19.07.40; Sun, 02 Dec 2018 19:07:55 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725899AbeLCDFy (ORCPT + 99 others); Sun, 2 Dec 2018 22:05:54 -0500 Received: from mail-sh2.amlogic.com ([58.32.228.45]:43349 "EHLO mail-sh2.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725798AbeLCDFx (ORCPT ); Sun, 2 Dec 2018 22:05:53 -0500 Received: from localhost.localdomain (10.28.8.22) by mail-sh2.amlogic.com (10.18.11.6) with Microsoft SMTP Server id 15.0.1320.4; Mon, 3 Dec 2018 11:05:57 +0800 From: Xingyu Chen To: , CC: , , , , , , , , , , Subject: [PATCH] pinctrl: meson: fix G12A ao pull registers base address Date: Mon, 3 Dec 2018 11:05:33 +0800 Message-ID: <20181203030533.10989-1-xingyu.chen@amlogic.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.28.8.22] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 53d449076dee..7ff40cd7a0cb 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. @@ -487,23 +490,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.2