Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6777084imu; Mon, 3 Dec 2018 02:37:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/WGMfEI9KAeji7sHD6EQxkJay9N82ZTjpKUFrGf+jMieZd6ZCtxM3O7VQ/6YMgrabNOJLYW X-Received: by 2002:a17:902:720c:: with SMTP id ba12mr15485556plb.79.1543833464198; Mon, 03 Dec 2018 02:37:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543833464; cv=none; d=google.com; s=arc-20160816; b=ElsFjFkXyCXckLvgYDMfKzuvNlim/lbLb7V4z0g4mA3ZbjfD6eM0ecOTm6K+3l/VHP IZ2JYJT/J4T3whYkxKS9Tib70KWJdNujbOWqp3INXfZ0IeI6qhLnkZowZhtPT2cwTLpn OGC63M8b4mMLURyGa+EnocnnejOZgb3/kih+In8m+fJ+JoSt41MFEIK3ncW4hKTMjmGw KZh5XSzUHngt9Q0Xu2emCtzKNWII1TEE6n70GYJNNU90m40Cm0oZPPl5W07EFd7i6o+N X6Y9FGJuA7Sn9qPjh5LWPwG/k7SRCJ5oMoFvAL2F+wvuCv5LzWRerYBY7Zv2w9kmOcwa Fbcg== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=up5LcSgEp00Z28NCqSzII18i1J7FDVHnKHI1LcaQ96Q=; b=K1pqKoqMZz3hcvYasU5BrYW+BRQxTF1ZjNCKi8zuH2yiasB5ISIBFNGr6q/gGzsekn 8XiClzD0DLtilK7TYzQ3aizAY8CpgFtXFswKlKC/132RfJV4qUx79EbGugPh5346x8Vf FlNgsmKe1z7k6djRk6zD9hYg7OwvQI2q/Jabq65Lk8ez9T4lPdsy+Q5aazsmv52h9wmL Osw2Qhqf9DAwJt5MiqJ7LVPRQnR5Pwgb0r5jIIdf7HFG7czlyLWF5migydyarfIqF3TS Z7kJrbhZHOtyaaXlvd3n5wx1VOknueyksmGcg8q590AosIDepp8bnEWB8qLNQSKKFbz+ Ad6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=LwDBkBhU; 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 26si12007464pgq.402.2018.12.03.02.37.29; Mon, 03 Dec 2018 02:37:44 -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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=LwDBkBhU; 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 S1726209AbeLCKhG (ORCPT + 99 others); Mon, 3 Dec 2018 05:37:06 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:40591 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726052AbeLCKhF (ORCPT ); Mon, 3 Dec 2018 05:37:05 -0500 Received: by mail-wm1-f65.google.com with SMTP id q26so5062950wmf.5 for ; Mon, 03 Dec 2018 02:36:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=up5LcSgEp00Z28NCqSzII18i1J7FDVHnKHI1LcaQ96Q=; b=LwDBkBhUzLzsiQyW8lPHWGQGrmJiUXwE83VXqUAXoDiQphRD14Eq1+67nHQv+UDsAg GOmrIccai+Vj9+3iAPibTN94keNWrOXUSPjj6UpPBouRxFrH52WgCfWcaqD6o7MUzHgv j2n2BMpFv8vJNbaeJTm2YTfMP9trEJBL6ZJN9ynSb1IqZkAbNd40U5PxPdN7pwILuoXE 3IRxGPFPpYqjT+Zp31h3jTpx0fDyNlzrriIRKEi8gB812OqUO5JJVQG9NQxZaEIEsE4d a9AmMZcCk+wim8mIQde31fcW+pgno6Oxeo9UeB9ShuroHlP+LaQplnAOwzhLrTGlOjV7 GG4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=up5LcSgEp00Z28NCqSzII18i1J7FDVHnKHI1LcaQ96Q=; b=DuwKvSR8hF7bJ3S+n2A6UPY0r5z0FioMEC0eg8+EP3DSwAOiaH0Jmn4sbK33y4VEYQ 2pgttAaS1akfh35z4JQr8yWb8+BlBhjjwORbZfvGjapdNbEqp4N1tHIiEZLveWePWF0s 2CSu4J5k1LnAAcpoHBzfdOecMRBzkWXZYvGj9n+o3UKP1gYOq+P8hcuDVW1yuRbP3QuK oj/gXzOg8sIw/NSqGZ6u1Pxr+ZMPLJLKvwevafCfWseTg1XSSfC8I0NOR1wMNl2Dw6PR VJ+68DK/gI/MRJ1O4qJUGGblWsVQKRaMxt+Qae8IIRhivyTTFJbGpSawXPrMsxmdctXp NZzg== X-Gm-Message-State: AA+aEWbbBQKNieVfkjCf0e7ve5rrvnv79cndESICURcJrZN2SlRamVFS BB0UVqzJmEFc5LweIOud3iLKIQ== X-Received: by 2002:a1c:9513:: with SMTP id x19mr7527589wmd.112.1543833394984; Mon, 03 Dec 2018 02:36:34 -0800 (PST) Received: from boomer.baylibre.com ([2a01:e34:eeb6:4690:106b:bae3:31ed:7561]) by smtp.gmail.com with ESMTPSA id k26sm3011479wmi.28.2018.12.03.02.36.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Dec 2018 02:36:34 -0800 (PST) Message-ID: Subject: Re: [PATCH] pinctrl: meson: fix G12A ao pull registers base address From: Jerome Brunet To: Neil Armstrong , Xingyu Chen , linus.walleij@linaro.org, linux-gpio@vger.kernel.org Cc: khilman@baylibre.com, carlo@caione.org, martin.blumenstingl@googlemail.com, robh@kernel.org, jianxin.pan@amlogic.com, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 03 Dec 2018 11:36:32 +0100 In-Reply-To: References: <20181203030533.10989-1-xingyu.chen@amlogic.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.2 (3.30.2-2.fc29) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2018-12-03 at 11:27 +0100, Neil Armstrong wrote: > Hi Xingyu, > > > On 03/12/2018 04:05, Xingyu Chen wrote: > > 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; > > } > > > > > Doesn't it need an update of the bindings ? Going even further, shouldn't we stop trying make multiple regions out of this, and have just one ? On all the Amlogic SoC we have seen so far, all the regions a very (VERY) close to each other. It seems very unlikely that there something unrelated to GPIO in between. It looks like everything is mostly there in the driver to deal with offset, so change would be minimal. Of course, for DT stability we will need to carry the legacy, but for newer SoC, such as the g12, does it really makes sense to have multiple regions ? > > Neil >