Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6379681rwl; Wed, 22 Mar 2023 09:50:18 -0700 (PDT) X-Google-Smtp-Source: AK7set+i97AnaAZsEt4mcL4LxHB0VJo/dNd7t3jM/aO1/iCS0mLI3G2fQYnHHkgxYY21EBPHCJp1 X-Received: by 2002:a17:906:1501:b0:932:853c:c958 with SMTP id b1-20020a170906150100b00932853cc958mr6467864ejd.25.1679503818676; Wed, 22 Mar 2023 09:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679503818; cv=none; d=google.com; s=arc-20160816; b=y7H4j46Fb4G827qPqG6Bbmv0TspVkV0H0JfnOwjog68QBJf4VW0TYHFBIypg458yvu 41nYawF/f6vGpeg28UAKfHZ9Q7Gml9BOqZBUuFDAQI8IiGo4sx0hb+OxpIh+1ymAIVM3 U5HPaMiZ9aAqbz9sshwKq8hSn6F4Wd7r4Rv5vAis8RTLJCltvdUAgCK8ra/3zVW3aevV C6+asRi6ZdZTNRP8rQwTL7343NxHNqjW9obB+FeTbGfAoheq2NuBF9mecCqjd0HFgT6u WeCbSiNQ6AGYjN8TGncwpjIKhNIvkdjhqaOd2/HubZ8htQsxKEn7eB541mVP8dLpxDfy nv8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=2w0LAtw9cPfSNM4qX5A/16NLh+XxymxwSqd/uu1gfQU=; b=DW5cJ5SUPh1Qy47n0ehFmpiIkPNErtMIvnrbsAJFGIA32uQ5Uw7FvBFhILubVOX63A Q9yLMRO5+q0gnUUlNI0ztENGUBbp94Fsc7i9sd3g4AdVNQxp6peBUFK2VmxEvdA3b5gm V8XzuaPEczYp/4FCtWOAOOqWOXKDpIYy+zfLiDe2qEaDb8w5GlMzEmUmfvhsRzPazBjl nUDPLNSEV2ZRFLcsxQTFcDktaZCG8tGB8sQBz1CsE3pL6n9WqVYV2DnOQNZ/2FOe0SlA mwmLZDRwIp5UTtjqwX9TZZJj1TMDL49/ZQBF4BU+2NLhdF9/oqW3ng3qOVQ7Ca2tPbbp XSdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=RyjBxDPR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id st6-20020a170907c08600b0093299b7ce62si14089974ejc.560.2023.03.22.09.49.53; Wed, 22 Mar 2023 09:50:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=RyjBxDPR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229673AbjCVQsw (ORCPT + 99 others); Wed, 22 Mar 2023 12:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230086AbjCVQss (ORCPT ); Wed, 22 Mar 2023 12:48:48 -0400 Received: from mail-ua1-x929.google.com (mail-ua1-x929.google.com [IPv6:2607:f8b0:4864:20::929]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14E9B57D39 for ; Wed, 22 Mar 2023 09:48:42 -0700 (PDT) Received: by mail-ua1-x929.google.com with SMTP id m5so13073714uae.11 for ; Wed, 22 Mar 2023 09:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; t=1679503721; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2w0LAtw9cPfSNM4qX5A/16NLh+XxymxwSqd/uu1gfQU=; b=RyjBxDPR9Gaa2RWhPtZwOgt/F7XlwPMCS9VUiT2DPq+iirNmsZnpWZUIFrFJo7YSid OTI4uancfUSnhPkwaehBVH+XRm32vttS69BLXU/wY/gWONf+Wxr1HdQoJmRmBLepuIMG c3B9YgQTrYX9KGhqMlwANDi8yY5dJVd4cf6zFbtg91qD8/0tTA87NAAbaXBQOjwHeFaS i1ZlwAWQ40NjAlIDGmBcKdym3nD79WlUE8ZRSvfu6N7l1numhTv/q8SxQow1kmRetpm1 pkk4gx35heDUY/1HkanuMYR3dqdBfSzdIiWVBJvVNDrJ3fApnCjTNSqxxefzkZZQlrlE z1HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679503721; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2w0LAtw9cPfSNM4qX5A/16NLh+XxymxwSqd/uu1gfQU=; b=xLXjytaQlF/AeuXYvEWTH8dzEpP4zROKkzLAvkCBYGlvnx5UJgmJokUGbjfy16xrVI Z6GauacMAXBpue2ScErbZWnvF4r/F1Sepq5BhL3KBkO2ON568Dan/bxzf1oCYHGdxREx hvbm1SdN9ktpLnpli9/n3nD1PvykXnKnoBZLH+iwFMP14Q4EI7vWyxMsJVuG1Qq/lft3 +4bSrqTDA1vI4q6pp6dc9PISF4IwDepAA3IUmLDxzwsGeBUTufYhlS1Mm90gDIw7f3gz Z7ujkt79Hx95w0vZd9yvfg/Acevpe2YDgG/ORx+Nv98B5AOCZoRHJ8dhayD1eQ9wfCjg RYDA== X-Gm-Message-State: AAQBX9fICOMk9HY3eXpc6TYqcUe1tbFATEpgJy7MaEqmWbIS6q3NaMLa NQC0oioldyXSASq/hz6Z/4dL4mTWO0QHYxLub7nMVA== X-Received: by 2002:a05:6130:290:b0:688:d612:2024 with SMTP id q16-20020a056130029000b00688d6122024mr3518649uac.2.1679503721140; Wed, 22 Mar 2023 09:48:41 -0700 (PDT) MIME-Version: 1.0 References: <20230315110650.142577-1-keguang.zhang@gmail.com> <20230315110650.142577-4-keguang.zhang@gmail.com> In-Reply-To: <20230315110650.142577-4-keguang.zhang@gmail.com> From: Bartosz Golaszewski Date: Wed, 22 Mar 2023 17:48:30 +0100 Message-ID: Subject: Re: [PATCH v3 3/4] gpio: loongson1: Add DT support To: Keguang Zhang Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij , Rob Herring , Krzysztof Kozlowski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 15, 2023 at 12:07=E2=80=AFPM Keguang Zhang wrote: > > This patch adds DT support for Loongson-1 GPIO driver. > > Signed-off-by: Keguang Zhang > --- > V2 -> V3: None > V1 -> V2: Let gpiolib parse ngpios property > Remove unnecessary alias id parsing > Remove superfluous initialization done by bgpio_init() > Add MODULE_DEVICE_TABLE() > Other minor fixes > --- > drivers/gpio/gpio-loongson1.c | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpio/gpio-loongson1.c b/drivers/gpio/gpio-loongson1.= c > index dddfc71f0e10..6ca3b969db4d 100644 > --- a/drivers/gpio/gpio-loongson1.c > +++ b/drivers/gpio/gpio-loongson1.c > @@ -68,25 +68,38 @@ static int ls1x_gpio_probe(struct platform_device *pd= ev) > ls1x_gc->gc.owner =3D THIS_MODULE; > ls1x_gc->gc.request =3D ls1x_gpio_request; > ls1x_gc->gc.free =3D ls1x_gpio_free; > - ls1x_gc->gc.base =3D pdev->id * 32; > + /* > + * Clear ngpio to let gpiolib get the correct number > + * by reading ngpios property > + */ > + ls1x_gc->gc.ngpio =3D 0; > > ret =3D devm_gpiochip_add_data(dev, &ls1x_gc->gc, ls1x_gc); > if (ret) > goto err; > > platform_set_drvdata(pdev, ls1x_gc); > - dev_info(dev, "Loongson1 GPIO driver registered\n"); > + > + dev_info(dev, "GPIO controller registered with %d pins\n", > + ls1x_gc->gc.ngpio); > > return 0; > err: > - dev_err(dev, "failed to register GPIO device\n"); > + dev_err(dev, "failed to register GPIO controller\n"); > return ret; > } > > +static const struct of_device_id ls1x_gpio_dt_ids[] =3D { > + { .compatible =3D "loongson,ls1x-gpio" }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, ls1x_gpio_dt_ids); > + > static struct platform_driver ls1x_gpio_driver =3D { > .probe =3D ls1x_gpio_probe, > .driver =3D { > .name =3D "ls1x-gpio", > + .of_match_table =3D ls1x_gpio_dt_ids, > }, > }; > > -- > 2.34.1 > I applied this and the last one but switched patches 3 and 4 as it's customary to have bindings in the tree before DT support. Bart