From: Linus Walleij <linus.walleij@linaro.org>
To: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Cc: Rob Herring <robh+dt@kernel.org>,
Punit Agrawal <punit1.agrawal@toshiba.co.jp>,
yuji2.ishikawa@toshiba.co.jp,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/4] gpio: visoconti: Add Toshiba Visconti GPIO support
Date: Tue, 17 Nov 2020 21:59:06 +0100 [thread overview]
Message-ID: <CACRpkdbtkLjzMqRKzd3ppmwZ9hZESL4+zGOf7-uqjuF==Wm=3A@mail.gmail.com> (raw)
In-Reply-To: <20201112084057.1399983-3-nobuhiro1.iwamatsu@toshiba.co.jp>
Hi Nobuhiro,
On Thu, Nov 12, 2020 at 12:42 AM Nobuhiro Iwamatsu
<nobuhiro1.iwamatsu@toshiba.co.jp> wrote:
> Add the GPIO driver for Toshiba Visconti ARM SoCs.
>
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
I just noticed this:
> +config GPIO_VISCONTI
> + tristate "Toshiba Visconti GPIO support"
> + depends on ARCH_VISCONTI || COMPILE_TEST
> + depends on OF_GPIO
> + select GPIOLIB_IRQCHIP
> + help
> + Say yes here to support GPIO on Tohisba Visconti.
Add:
select GPIO_GENERIC
Then all of these:
> +static int visconti_gpio_get(struct gpio_chip *chip, unsigned int offset)
> +static void visconti_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
> +static int visconti_gpio_get_dir(struct gpio_chip *chip, unsigned int offset)
> +static int visconti_gpio_dir_in(struct gpio_chip *chip, unsigned int offset)
> +static int visconti_gpio_dir_out(struct gpio_chip *chip, unsigned int offset, int value)
Can be implemented by the genric MMIO GPIO library.
> + gpio_chip = &priv->gpio_chip;
> + gpio_chip->label = name;
> + gpio_chip->owner = THIS_MODULE;
> + gpio_chip->parent = dev;
> + gpio_chip->request = gpiochip_generic_request;
> + gpio_chip->free = gpiochip_generic_free;
> + gpio_chip->get = visconti_gpio_get;
> + gpio_chip->set = visconti_gpio_set;
> + gpio_chip->get_direction = visconti_gpio_get_dir;
> + gpio_chip->direction_input = visconti_gpio_dir_in;
> + gpio_chip->direction_output = visconti_gpio_dir_out;
> + gpio_chip->base = 0;
> + gpio_chip->ngpio = VISCONTI_GPIO_NR;
> + gpio_chip->irq.init_valid_mask = visconti_init_irq_valid_mask;
Initialized the generic helpers using the addresses of the
GPIO registers here by a call to bgpio_init().
Check this driver for an example:
drivers/gpio/gpio-ftgpio010.c
If you get uncertain about the arguments to bgpio_init()
check drivers/gpio/gpio-mmio.c, there is kerneldoc for the
function.
By doing this you get implementations of gpio_[get|set]_multiple()
for free.
Yours,
Linus Walleij
next prev parent reply other threads:[~2020-11-17 21:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 8:40 [PATCH v2 0/4] gpio: visoconti: Add Toshiba Visconti GPIO support Nobuhiro Iwamatsu
2020-11-12 8:40 ` [PATCH v2 1/4] dt-bindings: gpio: Add bindings for Toshiba Visconti GPIO Controller Nobuhiro Iwamatsu
2020-11-12 14:52 ` Rob Herring
2020-11-12 8:40 ` [PATCH v2 2/4] gpio: visoconti: Add Toshiba Visconti GPIO support Nobuhiro Iwamatsu
2020-11-17 20:59 ` Linus Walleij [this message]
2020-12-01 5:02 ` Nobuhiro Iwamatsu
2020-11-12 8:40 ` [PATCH v2 3/4] MAINTAINERS: Add entries for Toshiba Visconti GPIO controller Nobuhiro Iwamatsu
2020-11-12 8:40 ` [PATCH v2 4/4] arm: dts: visconti: Add DT support for Toshiba Visconti5 GPIO driver Nobuhiro Iwamatsu
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='CACRpkdbtkLjzMqRKzd3ppmwZ9hZESL4+zGOf7-uqjuF==Wm=3A@mail.gmail.com' \
--to=linus.walleij@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nobuhiro1.iwamatsu@toshiba.co.jp \
--cc=punit1.agrawal@toshiba.co.jp \
--cc=robh+dt@kernel.org \
--cc=yuji2.ishikawa@toshiba.co.jp \
/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).