Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5636366ybp; Tue, 8 Oct 2019 06:10:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVmvN6AZvHpwXKUydBpLnWkwoaa1k1NxbjrYCNCEQgMC73G34wzi8D6hueDrRHHr7TkhpM X-Received: by 2002:adf:b3d2:: with SMTP id x18mr28384593wrd.264.1570540243913; Tue, 08 Oct 2019 06:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570540243; cv=none; d=google.com; s=arc-20160816; b=UrncWVtVlDFgqD3cGRlXFCCPaNZIBKXsrvdpmrH3NWoSAW41V7sRgb5gqa3rdZvjWL DG3lpdUTfF3vB/jOaMTOAN7y17ZvuLV70QPBeHaacO6+fwLUErOci38RbOotYEM4rF25 Sud7+PZMIa55pQonOmBuE4SHtA4Zh7d+EW8WOWVBOVyCd2RLzIZqGmnQZ8ranBRzwC5E 7zQN5Zz5AR9V+QZ9J60TYdu/yGRs6hVk9GrjYQ0wkpx9N04BwBqQhKHXZ+G8H2/xhoO/ +MWDZEvm2WUYdxxk/HDHxzRHDjn3gyPk18xdfhEndmyuXpXBvAFniZo9nrRooExQXmQs JdBQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:autocrypt:openpgp:from:references:cc:to :subject:dkim-signature; bh=RRTyjbD2nXil/1dTyKHCdNiDSPu44x+R2j9erEJQUzU=; b=eWAsTZQu8S139bdOlR6WFqUACvv5qwFkWxwbCx5R3j1jTz+9CJHlDOBDnndnXape4a qCM0eFoqmeJsNDkfNGuNT501S15SSgmdOswJqduyjWhCzgY/YrQVCOWuLmPisEXW8qLo ozgwenADv3dDGfu3iJ5G7tjrxiESXDKpVTtyCbM1104GHMLSsenQcQbSXFzwdx/VITMO X5uiygqiXMjeWDYryBv3JcEvb1MyTBPTJclxTKb274qZOV0s8r7bh6WI/pyCEqodGLUF T8yY4ilqQ95eBMEbkvhqDZCSZnDxma9963T3eyKBH3B4sH55zzzOfxTElSL7DhpSmHQU Mdyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=PgoBmoAn; 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 b21si8745141ejq.343.2019.10.08.06.10.17; Tue, 08 Oct 2019 06:10:43 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=PgoBmoAn; 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 S1730915AbfJHNHi (ORCPT + 99 others); Tue, 8 Oct 2019 09:07:38 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:52677 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730751AbfJHNHi (ORCPT ); Tue, 8 Oct 2019 09:07:38 -0400 Received: by mail-wm1-f66.google.com with SMTP id r19so3087793wmh.2 for ; Tue, 08 Oct 2019 06:07:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:openpgp:autocrypt:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=RRTyjbD2nXil/1dTyKHCdNiDSPu44x+R2j9erEJQUzU=; b=PgoBmoAn4Pmk6DJ/A1pr574836r+yMWzHutomE9C6qL4oE0ijsVTLgSL1K9UMK6/Fs jTz7R0a2t3LJTmdbUiCDpnbkYANCpGZdY2uMoDQw+5korJHGdRkoEdiWTICcxKX0bktm ZFLyAaLsjdbZYTDf+ALtBRW0CRpOjCFMCzxdu1Q/Y/DAes2cLBDHdbUrvNNiRClEe05f BdpByXprBZAzhIO/68ht/qZs7UQ3CfkWzJZQvqzckgp9+Rz4Ew1wBYk9gUi7Y0bK9Nc1 aMHAqvt6uerOOvdF3UXYc5xXOwiqIKX/iUMhp6/rp/PGYWLX3I5OaYiia45ASkrSOPq8 A4pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=RRTyjbD2nXil/1dTyKHCdNiDSPu44x+R2j9erEJQUzU=; b=NCUV2eEhvu5liSXDG+IwsW/gjAtSNOPuWfYQNMZTTRp3ZHcARXnn3fALB8sK30DyxC UF29wI65hVGsBepgPjZNg0kQeWosTSwXObRrd5ay0+AAzZoZge4QTmpp2LdISRHAGS2v gbPiVlXyygTtF5Gf0HTxgen1/IIafCKCSxwEX/znkhfX8aY0Y5fXSj3OOpGlhAEtbu30 OQ5eWhFkAw/GKvYWccf5aVT2DRMSFFK0h5xaAG2oz+sul5MRxUAZ9K5Ozem2O4hEzBmd 941hn7eiMXVSd4KHujGKyrkXN5lU+m3JjD+kaf7ocj3BB+00HPsdh5uSeR2fqyLbr9QJ rTtg== X-Gm-Message-State: APjAAAURxg+IF5H8bhfdhaIU8eRf69Oh58kPpg/AUaeo+o6YuDqJsVhc +1jxW1pnxdlAQnZbtxhrwOm+Emd58ZE3RA== X-Received: by 2002:a7b:c398:: with SMTP id s24mr3861283wmj.78.1570540053881; Tue, 08 Oct 2019 06:07:33 -0700 (PDT) Received: from [192.168.1.62] (176-150-251-154.abo.bbox.fr. [176.150.251.154]) by smtp.gmail.com with ESMTPSA id p5sm2811685wmi.4.2019.10.08.06.07.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2019 06:07:33 -0700 (PDT) Subject: Re: [PATCH v2 2/3] pinctrl: meson-a1: add pinctrl driver for Meson A1 Soc To: Qianggui Song , Linus Walleij , linux-gpio@vger.kernel.org Cc: Jerome Brunet , Kevin Hilman , Martin Blumenstingl , Carlo Caione , Rob Herring , Xingyu Chen , Jianxin Pan , Hanjie Lin , Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org References: <1570532999-23302-1-git-send-email-qianggui.song@amlogic.com> <1570532999-23302-3-git-send-email-qianggui.song@amlogic.com> From: Neil Armstrong Openpgp: preference=signencrypt Autocrypt: addr=narmstrong@baylibre.com; prefer-encrypt=mutual; keydata= mQENBE1ZBs8BCAD78xVLsXPwV/2qQx2FaO/7mhWL0Qodw8UcQJnkrWmgTFRobtTWxuRx8WWP GTjuhvbleoQ5Cxjr+v+1ARGCH46MxFP5DwauzPekwJUD5QKZlaw/bURTLmS2id5wWi3lqVH4 BVF2WzvGyyeV1o4RTCYDnZ9VLLylJ9bneEaIs/7cjCEbipGGFlfIML3sfqnIvMAxIMZrvcl9 qPV2k+KQ7q+aXavU5W+yLNn7QtXUB530Zlk/d2ETgzQ5FLYYnUDAaRl+8JUTjc0CNOTpCeik 80TZcE6f8M76Xa6yU8VcNko94Ck7iB4vj70q76P/J7kt98hklrr85/3NU3oti3nrIHmHABEB AAG0KE5laWwgQXJtc3Ryb25nIDxuYXJtc3Ryb25nQGJheWxpYnJlLmNvbT6JATsEEwEKACUC GyMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheABQJXDO2CAhkBAAoJEBaat7Gkz/iubGIH/iyk RqvgB62oKOFlgOTYCMkYpm2aAOZZLf6VKHKc7DoVwuUkjHfIRXdslbrxi4pk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Xfe6sOp24PQTHAKGtjTHNP/THomkH24Fum9K3iM /4Wh4V2eqGEgpdeSp5K+LdaNyNgaqzMOtt4HYk86LYLSHfFXywdlbGrY9+TqiJ+ZVW4trmui NIJCOku8SYansq34QzYM0x3UFRwff+45zNBEVzctSnremg1mVgrzOfXU8rt+4N1b2MxorPF8 619aCwVP7U16qNSBaqiAJr4e5SNEnoAq18+1Gp8QsFG0ARY8xp+qaKBByWES7lRi3QbqAKZf yOHS6gmYo9gBmuAhc65/VtHMJtxwjpUeN4Bcs9HUpDMDVHdfeRa73wM+wY5potfQ5zkSp0Jp bxnv/cRBH6+c43stTffprd//4Hgz+nJcCgZKtCYIAPkUxABC85ID2CidzbraErVACmRoizhT KR2OiqSLW2x4xdmSiFNcIWkWJB6Qdri0Fzs2dHe8etD1HYaht1ZhZ810s7QOL7JwypO8dscN KTEkyoTGn6cWj0CX+PeP4xp8AR8ot4d0BhtUY34UPzjE1/xyrQFAdnLd0PP4wXxdIUuRs0+n WLY9Aou/vC1LAdlaGsoTVzJ2gX4fkKQIWhX0WVk41BSFeDKQ3RQ2pnuzwedLO94Bf6X0G48O VsbXrP9BZ6snXyHfebPnno/te5XRqZTL9aJOytB/1iUna+1MAwBxGFPvqeEUUyT+gx1l3Acl ZaTUOEkgIor5losDrePdPgE= Organization: Baylibre Message-ID: Date: Tue, 8 Oct 2019 15:07:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1570532999-23302-3-git-send-email-qianggui.song@amlogic.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 08/10/2019 13:09, Qianggui Song wrote: > Add pinctrl driver for Meson A1 Soc which share the same register layout of > pinmux with previous Meson-G12A, however there is difference for gpio > and pin config register in A1.The main difference is that registers before A1 > are grouped by function while those of A1 are by bank. The new register layout > is as below: > > /* first bank */ /* addr */ > - P_PADCTRL_GPIOP_I base + 0x00 << 2 > - P_PADCTRL_GPIOP_O base + 0x01 << 2 > - P_PADCTRL_GPIOP_OEN base + 0x02 << 2 > - P_PADCTRL_GPIOP_PULL_EN base + 0x03 << 2 > - P_PADCTRL_GPIOP_PULL_UP base + 0x04 << 2 > - P_PADCTRL_GPIOP_DS base + 0x05 << 2 > > /* second bank */ > - P_PADCTRL_GPIOB_I base + 0x10 << 2 > - P_PADCTRL_GPIOB_O base + 0x11 << 2 > - P_PADCTRL_GPIOB_OEN base + 0x12 << 2 > - P_PADCTRL_GPIOB_PULL_EN base + 0x13 << 2 > - P_PADCTRL_GPIOB_PULL_UP base + 0x14 << 2 > - P_PADCTRL_GPIOB_DS base + 0x15 << 2 > > Each bank contains at least 6 registers to be configured, if one bank has > more than 16 gpios, an extra P_PADCTRL_GPIO[X]_DS_EXT is included. Between > two adjacent P_PADCTRL_GPIO[X]_I, there is an offset 0x10, that is to say, > for third bank, the offsets will be 0x20,0x21,0x22,0x23,0x24,0x25 according > to above register layout.For privous chips, registers are grouped > according to their functions while registers of A1 are according to bank. > > Current Meson pinctrl driver can cover such change by using base address of > GPIO as that of drive-strength. While simply giving reg_ds = reg_pullen > make wrong value to reg_ds for Socs that do not support drive-strength like > AXG.To make things simple, add an extra dt parser function for a1 or later chip > and remain the old dt parser function for old Socs. > > Also note that there is no AO bank in A1. > > Signed-off-by: Qianggui Song > --- > drivers/pinctrl/meson/Kconfig | 6 + > drivers/pinctrl/meson/Makefile | 1 + > drivers/pinctrl/meson/pinctrl-meson-a1.c | 942 +++++++++++++++++++++++++++++++ > drivers/pinctrl/meson/pinctrl-meson.c | 16 +- > drivers/pinctrl/meson/pinctrl-meson.h | 5 + > 5 files changed, 969 insertions(+), 1 deletion(-) > create mode 100644 drivers/pinctrl/meson/pinctrl-meson-a1.c > [...] > --- a/drivers/pinctrl/meson/pinctrl-meson.c > +++ b/drivers/pinctrl/meson/pinctrl-meson.c > @@ -695,6 +695,17 @@ static int meson_pinctrl_parse_dt(struct meson_pinctrl *pc, > return 0; > } > > +int meson_pinctrl_parse_dt_extra(struct meson_pinctrl *pc, > + struct device_node *node) > +{ > + int ret; > + > + ret = meson_pinctrl_parse_dt(pc, node); > + pc->reg_ds = pc->reg_pullen; > + > + return ret; > +} > + > int meson_pinctrl_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > @@ -708,7 +719,10 @@ int meson_pinctrl_probe(struct platform_device *pdev) > pc->dev = dev; > pc->data = (struct meson_pinctrl_data *) of_device_get_match_data(dev); > > - ret = meson_pinctrl_parse_dt(pc, dev->of_node); > + if (pc->data->parse_dt) > + ret = pc->data->parse_dt(pc, dev->of_node); > + else > + ret = meson_pinctrl_parse_dt(pc, dev->of_node); > if (ret) > return ret; > > diff --git a/drivers/pinctrl/meson/pinctrl-meson.h b/drivers/pinctrl/meson/pinctrl-meson.h > index c696f3241a36..ca29efd90aac 100644 > --- a/drivers/pinctrl/meson/pinctrl-meson.h > +++ b/drivers/pinctrl/meson/pinctrl-meson.h > @@ -11,6 +11,7 @@ > #include > #include > > +struct meson_pinctrl; > /** > * struct meson_pmx_group - a pinmux group > * > @@ -114,6 +115,7 @@ struct meson_pinctrl_data { > unsigned int num_banks; > const struct pinmux_ops *pmx_ops; > void *pmx_data; > + int (*parse_dt) (struct meson_pinctrl *pc, struct device_node *node); > }; > > struct meson_pinctrl { > @@ -171,3 +173,6 @@ int meson_pmx_get_groups(struct pinctrl_dev *pcdev, > > /* Common probe function */ > int meson_pinctrl_probe(struct platform_device *pdev); > +/* Extra dt parser function for register layout grouped by bank */ > +int meson_pinctrl_parse_dt_extra(struct meson_pinctrl *pc, > + struct device_node *node); > I think you should add this parse_dt callback in a separate patch. Neil