linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Janek Kotas <jank@cadence.com>
To: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Janek Kotas <jank@cadence.com>, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-gpio <linux-gpio@vger.kernel.org>,
	linux-devicetree <devicetree@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] gpio: Add Cadence GPIO driver
Date: Tue, 18 Dec 2018 13:54:25 +0000	[thread overview]
Message-ID: <220ECBA7-CD30-4221-8878-0DA93390DDCC@global.cadence.com> (raw)
In-Reply-To: <CAMpxmJUnfnHmopyOfHRZrN1KoqZx_Bsra1BTiGud6UVmzz1ryA@mail.gmail.com>


> On 18 Dec 2018, at 13:50, Bartosz Golaszewski <bgolaszewski@baylibre.com> wrote:
> 
> 
> pon., 17 gru 2018 o 23:22 Linus Walleij <linus.walleij@linaro.org> napisał(a):
>> 
>> On Mon, Dec 17, 2018 at 4:51 PM Bartosz Golaszewski
>> <bgolaszewski@baylibre.com> wrote:
>> 
>>> The driver looks good but is there any particular reason not to use
>>> regmap for register IO?
>> 
>> I thought we only use regmap for MMIO when the register range is
>> shared (as in a system controller) so that some registers are for this,
>> some register or even bits in a register for some other driver, so they
>> need the spinlock in the regmap to protect the register range.
>> 
> 
> This is what syscon is for. Regmap simply abstracts any register IO.
> For instance: there's no locking in this driver. Are we sure it's not
> needed? Regmap provides internal locking for you in the form of a
> mutex or spinlock.
> 
> Also: it looks like the interrupts here are quite simple with a single
> bit per interrupt in the status register and the same layout in the
> mask register - it could probably profit from using the
> regmap_irq_chip and not bother with reimplementing irq_chip callbacks.
> 
>> It is also nice for shadowing/caching of register contents I guess,
>> wat does this driver get from regmap MMIO?
>> 
> 
> Code shrinkage IMO.
> 
> Note that I'm not blocking this from being merged - I just think that
> using modern frameworks is always a good idea.

I can reimplement the driver using regmap, but It seems in such case
I won’t be able to use the Generic GPIO Infrastructure, would I?
So I would need to provide functions for setting direction, etc.
I think it would make the driver code bigger.

Regards,
Jan

> Best regards,
> Bartosz Golaszewski
> 
>> Yours,
>> Linus Walleij


  reply	other threads:[~2018-12-18 13:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-17 15:36 [PATCH v2 0/2] gpio: Add a driver for Cadence GPIO controller Jan Kotas
2018-12-17 15:36 ` [PATCH v2 1/2] dt-bindings: gpio: Add bindings for Cadence GPIO Jan Kotas
2018-12-18 17:33   ` Rob Herring
2018-12-17 15:36 ` [PATCH v2 2/2] gpio: Add Cadence GPIO driver Jan Kotas
2018-12-17 15:51   ` Bartosz Golaszewski
2018-12-17 22:21     ` Linus Walleij
2018-12-18 12:50       ` Bartosz Golaszewski
2018-12-18 13:54         ` Janek Kotas [this message]
2018-12-18 14:06           ` Bartosz Golaszewski
2018-12-21 10:37             ` Linus Walleij
2018-12-21 10:34   ` Linus Walleij

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=220ECBA7-CD30-4221-8878-0DA93390DDCC@global.cadence.com \
    --to=jank@cadence.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.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).