All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: David Daney <david.daney@cavium.com>
Cc: Alexandre Courbot <gnurou@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 5/6] gpio: Add gpio driver support for ThunderX and OCTEON-TX
Date: Tue, 14 Mar 2017 16:02:34 +0100	[thread overview]
Message-ID: <CACRpkdY1yKCrjTshmGVcKO2gDjC6cNufG1+VC_31Of1iJxYyiA@mail.gmail.com> (raw)
In-Reply-To: <1488332932-2691-6-git-send-email-david.daney@cavium.com>

On Wed, Mar 1, 2017 at 2:48 AM, David Daney <david.daney@cavium.com> wrote:

> Cavium ThunderX and OCTEON-TX are arm64 based SoCs.  Add driver for
> the on-chip GPIO pins.
>
> Signed-off-by: David Daney <david.daney@cavium.com>

I guess this can't be merged until the corresponding IRQ changes
are merged. It can be applied in the irqchip tree or next merge
window or they can give me an immutable branch to pull to
the GPIO subsystem or whatever works.

Some pretty minor things remain.

> +#include <linux/gpio/driver.h>
> +#include <linux/interrupt.h>
> +#include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/pci.h>
> +#include <linux/spinlock.h>

I think you should explicitly include <linux/bitops.h>

Other than that it is all fine.

> +/*
> + * Interrupts are chained from underlying MSI-X vectors.  We have
> + * these irq_chip functions to be able to handle level triggering
> + * semantics and other acknowledgment tasks associated with the GPIO
> + * mechanism.
> + */
> +static struct irq_chip thunderx_gpio_irq_chip = {
> +       .name                   = "GPIO",
> +       .irq_enable             = thunderx_gpio_irq_enable,
> +       .irq_disable            = thunderx_gpio_irq_disable,
> +       .irq_ack                = thunderx_gpio_irq_ack,
> +       .irq_mask               = thunderx_gpio_irq_mask,
> +       .irq_mask_ack           = thunderx_gpio_irq_mask_ack,
> +       .irq_unmask             = thunderx_gpio_irq_unmask,
> +       .irq_eoi                = irq_chip_eoi_parent,
> +       .irq_set_affinity       = irq_chip_set_affinity_parent,
> +       .irq_set_type           = thunderx_gpio_irq_set_type,
> +
> +       .flags                  = IRQCHIP_SET_TYPE_MASKED
> +};

I think you should implement .irq_request_resources() and
.irq_release_resources() calling
gpiochip_lock_as_irq(chip, d->hwirq)
and gpiochip_unlock_as_irq(chip, d->hwirq) respectively,
much like gpiochip_irq_reqres() and gpiochip_irq_relres()
in the gpiolib.

This helps the kernel knowing that the lines are taken for
interrupts and must be inputs.

> +static int thunderx_gpio_irq_map(struct irq_domain *d, unsigned int irq,
> +                                irq_hw_number_t hwirq)
> +{
> +       irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);

I would prefer that you just write the right state into the hardware
if that is what you want to do. Normally the consumer specifies
trigger type.

But I'm uncertain, maybe this is allright with the IRQ maintainers.

Apart from these nitpicks it is a beautiful driver.

Yours,
Linus Walleij

  reply	other threads:[~2017-03-14 15:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01  1:48 [PATCH v5 0/6] genirq/gpio: Add driver for ThunderX and OCTEON-TX SoCs David Daney
2017-03-01  1:48 ` [PATCH v5 1/6] genirq: Export more irq_chip_*_parent() functions David Daney
2017-03-01  1:48 ` [PATCH v5 2/6] genirq: Add handle_fasteoi_{level,edge}_irq flow handlers David Daney
     [not found]   ` <1488332932-2691-3-git-send-email-david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2017-03-14 16:54     ` Marc Zyngier
2017-03-14 16:54       ` Marc Zyngier
     [not found]       ` <254c0505-6890-2e9f-cf04-3c8efbcfeb2d-5wv7dgnIgG8@public.gmane.org>
2017-03-31 23:57         ` David Daney
2017-03-31 23:57           ` David Daney
2017-03-01  1:48 ` [PATCH v5 3/6] irqdomain: Add irq_domain_{push,pop}_irq() functions David Daney
2017-03-14 16:11   ` Marc Zyngier
2017-04-01  0:21     ` David Daney
2017-03-01  1:48 ` [PATCH v5 4/6] dt-bindings: gpio: Add binding documentation for gpio-thunderx David Daney
2017-03-14 14:53   ` Linus Walleij
2017-03-14 16:45     ` David Daney
2017-03-14 21:21       ` Linus Walleij
     [not found] ` <1488332932-2691-1-git-send-email-david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2017-03-01  1:48   ` [PATCH v5 5/6] gpio: Add gpio driver support for ThunderX and OCTEON-TX David Daney
2017-03-01  1:48     ` David Daney
2017-03-14 15:02     ` Linus Walleij [this message]
2017-03-01  1:48 ` [PATCH v5 6/6] MAINTAINERS: Add entry for THUNDERX GPIO Driver David Daney

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=CACRpkdY1yKCrjTshmGVcKO2gDjC6cNufG1+VC_31Of1iJxYyiA@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=david.daney@cavium.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gnurou@gmail.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.