All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Felix Fietkau <nbd@nbd.name>
Cc: linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>, john <john@phrozen.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH v5 12/13] gpio: Add support for Airoha EN7523 GPIO controller
Date: Sun, 12 Dec 2021 21:16:13 +0200	[thread overview]
Message-ID: <CAHp75VeUn-a=Ob2i1Sxph3C4xa07yHMj7sg9R81R3STjQgSLiw@mail.gmail.com> (raw)
In-Reply-To: <20211129153330.37719-13-nbd@nbd.name>

On Tue, Nov 30, 2021 at 1:08 AM Felix Fietkau <nbd@nbd.name> wrote:
>
> From: John Crispin <john@phrozen.org>
>
> Airoha's GPIO controller on their ARM EN7523 SoCs consists of two banks of 32
> GPIOs. Each instance in DT is for an single bank.

a single

...

> +/**
> + * airoha_gpio_ctrl - Airoha GPIO driver data

> + *

Unnecessary blank line.

> + * @gc: Associated gpio_chip instance.
> + * @data: The data register.
> + * @dir0: The direction register for the lower 16 pins.
> + * @dir1: The direction register for the higher 16 pins.
> + * @output: The output enable register.
> + */

...

> +static int airoha_dir_set(struct gpio_chip *gc, unsigned int gpio,
> +                         int val, int out)
> +{
> +       struct airoha_gpio_ctrl *ctrl = gc_to_ctrl(gc);
> +       u32 dir = ioread32(ctrl->dir[gpio / 16]);
> +       u32 output = ioread32(ctrl->output);
> +       u32 mask = BIT((gpio % 16) * 2);
> +
> +       if (out) {
> +               dir |= mask;
> +               output |= BIT(gpio);
> +       } else {
> +               dir &= ~mask;
> +               output &= ~BIT(gpio);
> +       }
> +
> +       iowrite32(dir, ctrl->dir[gpio / 16]);
> +       iowrite32(output, ctrl->output);

> +       if (out)
> +               gc->set(gc, gpio, val);

Needs a fix or a comment to explain why it's fine that there is a
glitch possible.

> +       return 0;
> +}

...

> +       err = bgpio_init(&ctrl->gc, dev, 4, ctrl->data, NULL,
> +                        NULL, NULL, NULL, 0);
> +       if (err) {

> +               dev_err(dev, "unable to init generic GPIO");
> +               return err;

return dev_err_probe(...);

> +       }

-- 
With Best Regards,
Andy Shevchenko

WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Felix Fietkau <nbd@nbd.name>
Cc: linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	 Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>, john <john@phrozen.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	 "open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH v5 12/13] gpio: Add support for Airoha EN7523 GPIO controller
Date: Sun, 12 Dec 2021 21:16:13 +0200	[thread overview]
Message-ID: <CAHp75VeUn-a=Ob2i1Sxph3C4xa07yHMj7sg9R81R3STjQgSLiw@mail.gmail.com> (raw)
In-Reply-To: <20211129153330.37719-13-nbd@nbd.name>

On Tue, Nov 30, 2021 at 1:08 AM Felix Fietkau <nbd@nbd.name> wrote:
>
> From: John Crispin <john@phrozen.org>
>
> Airoha's GPIO controller on their ARM EN7523 SoCs consists of two banks of 32
> GPIOs. Each instance in DT is for an single bank.

a single

...

> +/**
> + * airoha_gpio_ctrl - Airoha GPIO driver data

> + *

Unnecessary blank line.

> + * @gc: Associated gpio_chip instance.
> + * @data: The data register.
> + * @dir0: The direction register for the lower 16 pins.
> + * @dir1: The direction register for the higher 16 pins.
> + * @output: The output enable register.
> + */

...

> +static int airoha_dir_set(struct gpio_chip *gc, unsigned int gpio,
> +                         int val, int out)
> +{
> +       struct airoha_gpio_ctrl *ctrl = gc_to_ctrl(gc);
> +       u32 dir = ioread32(ctrl->dir[gpio / 16]);
> +       u32 output = ioread32(ctrl->output);
> +       u32 mask = BIT((gpio % 16) * 2);
> +
> +       if (out) {
> +               dir |= mask;
> +               output |= BIT(gpio);
> +       } else {
> +               dir &= ~mask;
> +               output &= ~BIT(gpio);
> +       }
> +
> +       iowrite32(dir, ctrl->dir[gpio / 16]);
> +       iowrite32(output, ctrl->output);

> +       if (out)
> +               gc->set(gc, gpio, val);

Needs a fix or a comment to explain why it's fine that there is a
glitch possible.

> +       return 0;
> +}

...

> +       err = bgpio_init(&ctrl->gc, dev, 4, ctrl->data, NULL,
> +                        NULL, NULL, NULL, 0);
> +       if (err) {

> +               dev_err(dev, "unable to init generic GPIO");
> +               return err;

return dev_err_probe(...);

> +       }

-- 
With Best Regards,
Andy Shevchenko

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-12-12 19:16 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 15:33 [PATCH v5 00/13] Add support for Airoha EN7523 SoC Felix Fietkau
2021-11-29 15:33 ` Felix Fietkau
2021-11-29 15:33 ` [PATCH v5 01/13] dt-bindings: Add vendor prefix for Airoha Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33 ` [PATCH v5 02/13] dt-bindings: arm: airoha: Add binding for EN7523 SoC and EVB Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33 ` [PATCH v5 03/13] ARM: dts: Add basic support for Airoha EN7523 Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33 ` [PATCH v5 04/13] ARM: Add basic support for Airoha EN7523 SoC Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33 ` [PATCH v5 05/13] ARM: multi_v7_defconfig: Add " Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33 ` [PATCH v5 06/13] dt-bindings: Add en7523-scu device tree binding documentation Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33 ` [PATCH v5 07/13] clk: en7523: Add clock driver for Airoha EN7523 SoC Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-12-02 17:34   ` kernel test robot
2021-12-02 17:34     ` kernel test robot
2021-12-02 17:34     ` kernel test robot
2021-12-03  8:03   ` Stephen Boyd
2021-12-03  8:03     ` Stephen Boyd
2021-11-29 15:33 ` [PATCH v5 08/13] dt-bindings: PCI: Add support for Airoha EN7532 Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33 ` [PATCH v5 09/13] PCI: mediatek: allow selecting controller driver for airoha arch Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 23:55   ` Bjorn Helgaas
2021-11-29 23:55     ` Bjorn Helgaas
2021-11-29 23:55     ` Bjorn Helgaas
2021-12-06 20:06     ` Bjorn Helgaas
2021-12-06 20:06       ` Bjorn Helgaas
2021-12-06 20:06       ` Bjorn Helgaas
2021-11-29 15:33 ` [PATCH v5 10/13] ARM: dts: Add PCIe support for Airoha EN7523 Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33 ` [PATCH v5 11/13] dt-bindings: arm: airoha: Add binding for Airoha GPIO controller Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-11-29 15:33 ` [PATCH v5 12/13] gpio: Add support for Airoha EN7523 " Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau
2021-12-02  1:47   ` Linus Walleij
2021-12-02  1:47     ` Linus Walleij
2021-12-02 17:59     ` Felix Fietkau
2021-12-02 17:59       ` Felix Fietkau
2021-12-02 19:02       ` John Crispin
2021-12-02 19:02         ` John Crispin
2021-12-04 23:55         ` Linus Walleij
2021-12-04 23:55           ` Linus Walleij
2021-12-04 23:57       ` Linus Walleij
2021-12-04 23:57         ` Linus Walleij
2021-12-12  6:59         ` Felix Fietkau
2021-12-12  6:59           ` Felix Fietkau
2021-12-12 19:16   ` Andy Shevchenko [this message]
2021-12-12 19:16     ` Andy Shevchenko
2021-11-29 15:33 ` [PATCH v5 13/13] ARM: dts: add GPIO support for Airoha EN7523 Felix Fietkau
2021-11-29 15:33   ` Felix Fietkau

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='CAHp75VeUn-a=Ob2i1Sxph3C4xa07yHMj7sg9R81R3STjQgSLiw@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=john@phrozen.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=nbd@nbd.name \
    /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.