devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: devicetree <devicetree@vger.kernel.org>,
	"Daniel Thompson" <daniel.thompson@linaro.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	刘炜 <liuwei@actions-semi.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	amit.kucheria@linaro.org,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	mp-cs@actions-semi.com, 96boards@ucrobotics.com,
	"Andreas Färber" <afaerber@suse.de>,
	"linux-arm Mailing List" <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 08/10] gpio: Add gpio driver for Actions OWL S900 SoC
Date: Mon, 19 Feb 2018 22:50:10 +0530	[thread overview]
Message-ID: <20180219172010.ph34dvpdhhkmemdg@linaro.org> (raw)
In-Reply-To: <CAHp75Vcmtq_mpkqx4+Yr24nRQEHJZmcypbOJLukZpdXVYzizNQ@mail.gmail.com>

Hi Andy,
On Sun, Feb 18, 2018 at 04:45:09PM +0200, Andy Shevchenko wrote:
> On Sat, Feb 17, 2018 at 10:44 PM, Manivannan Sadhasivam
> <manivannan.sadhasivam@linaro.org> wrote:
> > Add gpio driver for Actions Semi OWL family S900 SoC. Set of registers
> > controlling the gpio shares the same register range with pinctrl block.
> >
> > GPIO registers are organized as 6 banks and each bank controls the
> > maximum of 32 gpios.
> 
> > +#include <linux/init.h>
> 
> > +#include <linux/module.h>
> 
> Choose one of them.
> 
Will drop <linux/init.h>
> > +       val = readl(gpio_base + GPIO_OUTEN);
> > +       val |= BIT(offset);
> > +       writel(val, gpio_base + GPIO_OUTEN);
> 
> out_en()
> 
> > +       val = readl(gpio_base + GPIO_OUTEN);
> > +       val &= ~BIT(offset);
> > +       writel(val, gpio_base + GPIO_OUTEN);
> 
> out_dis()
> 
> > +       val = readl(gpio_base + GPIO_INEN);
> > +       val &= ~BIT(offset);
> > +       writel(val, gpio_base + GPIO_INEN);
> 
> in_dis()
> 
> > +       val = readl(gpio_base + GPIO_OUTEN);
> > +       val &= ~BIT(offset);
> > +       writel(val, gpio_base + GPIO_OUTEN);
> 
> out_dis()
> 
> > +       val = readl(gpio_base + GPIO_INEN);
> > +       val |= BIT(offset);
> > +       writel(val, gpio_base + GPIO_INEN);
> 
> in_en()
> 
> 
> > +       val = readl(gpio_base + GPIO_INEN);
> > +       val &= ~BIT(pin);
> > +       writel(val, gpio_base + GPIO_INEN);
> 
> in_dis()
> 
> > +       val = readl(gpio_base + GPIO_OUTEN);
> > +       val |= BIT(pin);
> > +       writel(val, gpio_base + GPIO_OUTEN);
> 
> out_en()
> 
> Find above code duplication.
> 
Sure. Will add a common function like owl_gpio_set_reg for setting register
values.
> > +static int owl_gpio_probe(struct platform_device *pdev)
> > +{
> 
> > +       gpio->base = of_iomap(pdev->dev.of_node, 0);
> > +       if (IS_ERR(gpio->base))
> > +               return PTR_ERR(gpio->base);
> 
> 
> > +       gpio->gpio.of_node = pdev->dev.of_node;
> 
> Isn't this done by GPIO library?
> 
Yes. Will drop this.
> > +static int owl_gpio_remove(struct platform_device *pdev)
> > +{
> > +       return 0;
> > +}
> 
> Useless stub.
> 
Okay.

Also, in the next revision of the driver I will be making all the banks
as its own gpio-controller as opposed to the single controller since all
have their own interrupt domain.

For this case, MMIO can't be used because the banks have irregular number
of gpios.

Thanks,
Mani
> -- 
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2018-02-19 17:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-17 20:44 [PATCH 00/10] Add Actions Semi S900 pinctrl and gpio support Manivannan Sadhasivam
2018-02-17 20:44 ` [PATCH 01/10] dt-bindings: pinctrl: Add bindings for Actions S900 SoC Manivannan Sadhasivam
2018-02-17 21:03   ` Andreas Färber
2018-02-19 17:13     ` Manivannan Sadhasivam
2018-02-19 20:34   ` Rob Herring
2018-02-17 20:44 ` [PATCH 02/10] arm64: dts: actions: Add pinctrl node for S900 Manivannan Sadhasivam
2018-02-17 20:44 ` [PATCH 03/10] arm64: actions: Enable PINCTRL in platforms Kconfig Manivannan Sadhasivam
2018-02-17 20:44 ` [PATCH 04/10] pinctrl: actions: Add Actions S900 pinctrl driver Manivannan Sadhasivam
2018-02-17 21:41   ` Andreas Färber
2018-02-19 17:29     ` Manivannan Sadhasivam
2018-02-20  7:53   ` Philippe Ombredanne
2018-02-21 14:56     ` Manivannan Sadhasivam
2018-02-17 20:44 ` [PATCH 05/10] dt-bindings: gpio: Add gpio nodes for Actions S900 SoC Manivannan Sadhasivam
2018-02-19 20:35   ` Rob Herring
2018-02-21 14:58     ` Manivannan Sadhasivam
2018-02-21 18:05       ` Andreas Färber
2018-02-21 23:52       ` Rob Herring
2018-02-17 20:44 ` [PATCH 07/10] arm64: dts: actions: Add gpio line names to Bubblegum-96 board Manivannan Sadhasivam
2018-02-17 20:44 ` [PATCH 08/10] gpio: Add gpio driver for Actions OWL S900 SoC Manivannan Sadhasivam
2018-02-18 14:45   ` Andy Shevchenko
2018-02-19 17:20     ` Manivannan Sadhasivam [this message]
2018-02-20  7:55   ` Philippe Ombredanne
2018-02-21 14:55     ` Manivannan Sadhasivam
     [not found] ` <20180217204433.3095-1-manivannan.sadhasivam-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-02-17 20:44   ` [PATCH 06/10] arm64: dts: actions: Add S900 gpio nodes Manivannan Sadhasivam
     [not found]     ` <20180217204433.3095-7-manivannan.sadhasivam-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-02-17 21:08       ` Andreas Färber
2018-02-19 17:43         ` Manivannan Sadhasivam
2018-02-17 20:44   ` [PATCH 09/10] MAINTAINERS: Add reviewer for ACTIONS platforms Manivannan Sadhasivam
2018-02-17 20:44 ` [PATCH 10/10] MAINTAINERS: Add Actions Semi S900 pinctrl and gpio entries Manivannan Sadhasivam
2018-02-17 21:21   ` Andreas Färber
2018-02-19 17:30     ` Manivannan Sadhasivam
2018-02-17 21:19 ` [PATCH 00/10] Add Actions Semi S900 pinctrl and gpio support Andreas Färber
2018-02-19 17:40   ` Manivannan Sadhasivam
  -- strict thread matches above, loose matches on Subject: below --
2018-02-28 17:48 Manivannan Sadhasivam
2018-02-28 17:49 ` [PATCH 08/10] gpio: Add gpio driver for Actions OWL S900 SoC Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180219172010.ph34dvpdhhkmemdg@linaro.org \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=96boards@ucrobotics.com \
    --cc=afaerber@suse.de \
    --cc=amit.kucheria@linaro.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=daniel.thompson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuwei@actions-semi.com \
    --cc=mp-cs@actions-semi.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).