From: Andy Shevchenko <andy@kernel.org>
To: nikita.shubin@maquefel.me
Cc: Hartley Sweeten <hsweeten@visionengravers.com>,
Alexander Sverdlin <alexander.sverdlin@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Lukasz Majewski <lukma@denx.de>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
Arnd Bergmann <arnd@arndb.de>,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH v4 01/42] gpio: ep93xx: split device in multiple
Date: Mon, 18 Sep 2023 10:37:55 +0300 [thread overview]
Message-ID: <ZQf+U2ZQWiJbJGGp@smile.fi.intel.com> (raw)
In-Reply-To: <20230915-ep93xx-v4-1-a1d779dcec10@maquefel.me>
On Fri, Sep 15, 2023 at 11:10:43AM +0300, Nikita Shubin via B4 Relay wrote:
> From: Nikita Shubin <nikita.shubin@maquefel.me>
>
> Prepare ep93xx SOC gpio to convert into device tree driver:
> - dropped banks and legacy defines
> - split AB IRQ and make it shared
>
> We are relying on IRQ number information A, B ports have single shared
> IRQ, while F port have dedicated IRQ for each line.
>
> Also we had to split single ep93xx platform_device into multiple, one
> for each port, without this we can't do a full working transition from
> legacy platform code into device tree capable. All GPIO_LOOKUP were
> change to match new chip namings.
...
> #include <linux/reboot.h>
> #include <linux/usb/ohci_pdriver.h>
> #include <linux/random.h>
> +#include <linux/ioport.h>
Can it be squeezed to the most ordered part?
...
> +static struct resource ep93xx_a_gpio_resources[] = {
> + DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE, 0x04, "data"),
You can also use " + 0x00", but it's up to you.
> + DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x10, 0x04, "dir"),
> + DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x90, 0x1c, "intr"),
> DEFINE_RES_IRQ(IRQ_EP93XX_GPIO_AB),
> +};
...
> .dev_id = "i2c-gpio.0",
> .table = {
> /* Use local offsets on gpiochip/port "G" */
> - GPIO_LOOKUP_IDX("G", 1, NULL, 0,
> + GPIO_LOOKUP_IDX("gpio-ep93xx.6", 1, NULL, 0,
> GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
> - GPIO_LOOKUP_IDX("G", 0, NULL, 1,
> + GPIO_LOOKUP_IDX("gpio-ep93xx.6", 0, NULL, 1,
> GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
Here the terminator is missing, I believe you need to have a separate fix patch
done first to prepend this one.
> },
...
> #include <linux/seq_file.h>
> +#include <linux/interrupt.h>
Please, squeeze this to the most sorted part.
...
> static void ep93xx_gpio_irq_mask_ack(struct irq_data *d)
> {
> struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
> struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc);
> - struct ep93xx_gpio *epg = gpiochip_get_data(gc);
> - int port_mask = BIT(d->irq & 7);
irq_hw_number_t hwirq = irqd_to_hwirq(d);
> + int port_mask = BIT(hwirq);
>
> if (irqd_get_trigger_type(d) == IRQ_TYPE_EDGE_BOTH)
> eic->int_type2 ^= port_mask; /* switch edge direction */
>
> eic->int_unmasked &= ~port_mask;
> - ep93xx_gpio_update_int_params(epg, eic);
> + ep93xx_gpio_update_int_params(eic);
>
> - writeb(port_mask, epg->base + eic->irq_offset + EP93XX_INT_EOI_OFFSET);
> + writeb(port_mask, eic->base + EP93XX_INT_EOI_OFFSET);
> gpiochip_disable_irq(gc, irqd_to_hwirq(d));
gpiochip_disable_irq(gc, hwirq);
> }
...
> {
> struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
> struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc);
> - struct ep93xx_gpio *epg = gpiochip_get_data(gc);
>
> - eic->int_unmasked &= ~BIT(d->irq & 7);
> - ep93xx_gpio_update_int_params(epg, eic);
> + eic->int_unmasked &= ~BIT(irqd_to_hwirq(d));
> + ep93xx_gpio_update_int_params(eic);
> gpiochip_disable_irq(gc, irqd_to_hwirq(d));
> }
As per above.
...
> @@ -203,11 +164,10 @@ static void ep93xx_gpio_irq_unmask(struct irq_data *d)
> {
> struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
> struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc);
> - struct ep93xx_gpio *epg = gpiochip_get_data(gc);
>
> gpiochip_enable_irq(gc, irqd_to_hwirq(d));
> - eic->int_unmasked |= BIT(d->irq & 7);
> - ep93xx_gpio_update_int_params(epg, eic);
> + eic->int_unmasked |= BIT(irqd_to_hwirq(d));
> + ep93xx_gpio_update_int_params(eic);
> }
As per above.
...
> + irq_hw_number_t offset = irqd_to_hwirq(d);
(or use hwirq name to be consistent in the code).
...
> + girq->parents = devm_kcalloc(dev, girq->num_parents,
> + sizeof(*girq->parents),
I would put this one to the previous line.
> + GFP_KERNEL);
> + if (!girq->parents)
> + return -ENOMEM;
...
> + irq = platform_get_irq(pdev, i);
This will issue a warning or error message if IRQ is not found...
> + if (irq < 0)
> + continue;
...but this suggests that that is optional. Hence
irq = platform_get_irq_optional(pdev, i);
?
...
> + if (platform_irq_count(pdev) > 0) {
> + dev_dbg(&pdev->dev, "setting up irqs for %s\n", dev_name(&pdev->dev));
> + ret = ep93xx_setup_irqs(pdev, egc);
> + if (ret)
> + dev_err_probe(&pdev->dev, ret, "setup irqs failed");
Hmm... Missing return?
> }
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-09-18 7:42 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 8:10 [PATCH v4 00/42] ep93xx device tree conversion Nikita Shubin via B4 Relay
2023-09-15 8:10 ` [PATCH v4 01/42] gpio: ep93xx: split device in multiple Nikita Shubin via B4 Relay
2023-09-18 7:37 ` Andy Shevchenko [this message]
2023-09-15 8:10 ` [PATCH v4 02/42] ARM: ep93xx: add swlocked prototypes Nikita Shubin via B4 Relay
2023-09-16 15:38 ` Alexander Sverdlin
2023-09-18 13:04 ` Alexander Sverdlin
2023-09-15 8:10 ` [PATCH v4 03/42] dt-bindings: clock: Add Cirrus EP93xx Nikita Shubin via B4 Relay
2023-09-15 10:36 ` Krzysztof Kozlowski
2023-09-15 8:10 ` [PATCH v4 04/42] clk: ep93xx: add DT support for " Nikita Shubin via B4 Relay
2023-10-24 2:50 ` Stephen Boyd
2023-09-15 8:10 ` [PATCH v4 05/42] dt-bindings: pinctrl: Add " Nikita Shubin via B4 Relay
2023-09-15 10:37 ` Krzysztof Kozlowski
2023-09-15 8:10 ` [PATCH v4 06/42] pinctrl: add a Cirrus ep93xx SoC pin controller Nikita Shubin via B4 Relay
2023-09-15 8:10 ` [PATCH v4 07/42] dt-bindings: power: reset: Add ep93xx reset Nikita Shubin via B4 Relay
2023-09-15 10:39 ` Krzysztof Kozlowski
2023-09-15 8:10 ` [PATCH v4 08/42] power: reset: Add a driver for the " Nikita Shubin via B4 Relay
2023-09-15 8:10 ` [PATCH v4 09/42] dt-bindings: soc: Add Cirrus EP93xx Nikita Shubin via B4 Relay
2023-09-15 10:42 ` Krzysztof Kozlowski
2023-09-15 8:10 ` [PATCH v4 10/42] soc: Add SoC driver for Cirrus ep93xx Nikita Shubin via B4 Relay
2023-09-15 8:10 ` [PATCH v4 11/42] dt-bindings: timers: Add Cirrus EP93xx Nikita Shubin via B4 Relay
2023-10-15 21:40 ` Daniel Lezcano
2023-10-27 18:23 ` [tip: timers/core] " tip-bot2 for Nikita Shubin
2023-09-15 8:10 ` [PATCH v4 12/42] clocksource: ep93xx: Add driver for Cirrus Logic EP93xx Nikita Shubin via B4 Relay
2023-10-11 13:30 ` Daniel Lezcano
2023-10-15 21:40 ` Daniel Lezcano
2023-10-27 18:23 ` [tip: timers/core] " tip-bot2 for Nikita Shubin
2023-09-15 8:10 ` [PATCH v4 13/42] dt-bindings: rtc: Add Cirrus EP93xx Nikita Shubin via B4 Relay
2023-09-15 10:43 ` Krzysztof Kozlowski
2023-09-15 8:10 ` [PATCH v4 14/42] rtc: ep93xx: add DT support for " Nikita Shubin via B4 Relay
2023-09-15 8:10 ` [PATCH v4 15/42] dt-bindings: watchdog: Add Cirrus EP93x Nikita Shubin via B4 Relay
2023-09-15 10:43 ` Krzysztof Kozlowski
2023-09-15 8:10 ` [PATCH v4 16/42] watchdog: ep93xx: add DT support for Cirrus EP93xx Nikita Shubin via B4 Relay
2023-09-15 8:10 ` [PATCH v4 17/42] dt-bindings: pwm: Add " Nikita Shubin via B4 Relay
2023-09-15 10:45 ` Krzysztof Kozlowski
2023-09-15 8:11 ` [PATCH v4 18/42] pwm: ep93xx: add DT support for " Nikita Shubin via B4 Relay
2023-09-15 10:43 ` Uwe Kleine-König
2023-09-15 8:11 ` [PATCH v4 19/42] dt-bindings: spi: Add " Nikita Shubin via B4 Relay
2023-09-15 10:47 ` Krzysztof Kozlowski
2023-09-15 8:11 ` [PATCH v4 20/42] spi: ep93xx: add DT support for " Nikita Shubin via B4 Relay
2023-09-15 12:38 ` Mark Brown
2023-09-15 8:11 ` [PATCH v4 21/42] dt-bindings: net: Add " Nikita Shubin via B4 Relay
2023-09-15 10:49 ` Krzysztof Kozlowski
2023-09-15 8:11 ` [PATCH v4 22/42] net: cirrus: add DT support for " Nikita Shubin via B4 Relay
2023-09-15 8:11 ` [PATCH v4 23/42] dt-bindings: dma: Add " Nikita Shubin via B4 Relay
2023-09-15 10:58 ` Krzysztof Kozlowski
2023-09-15 8:11 ` [PATCH v4 24/42] dma: cirrus: add DT support for " Nikita Shubin via B4 Relay
2023-09-15 8:11 ` [PATCH v4 25/42] dt-bindings: mtd: Add ts7200 nand-controller Nikita Shubin via B4 Relay
2023-09-15 11:00 ` Krzysztof Kozlowski
2023-09-15 8:11 ` [PATCH v4 26/42] mtd: nand: add support for ts72xx Nikita Shubin via B4 Relay
2023-09-18 12:58 ` Miquel Raynal
2023-09-15 8:11 ` [PATCH v4 27/42] dt-bindings: ata: Add Cirrus EP93xx Nikita Shubin via B4 Relay
2023-09-15 11:00 ` Krzysztof Kozlowski
2023-09-15 8:11 ` [PATCH v4 28/42] ata: pata_ep93xx: add device tree support Nikita Shubin via B4 Relay
2023-09-15 8:17 ` Damien Le Moal
2023-09-15 8:53 ` Sergey Shtylyov
2023-09-15 8:11 ` [PATCH v4 29/42] dt-bindings: input: Add Cirrus EP93xx keypad Nikita Shubin via B4 Relay
2023-09-15 11:05 ` Krzysztof Kozlowski
2023-09-15 8:11 ` [PATCH v4 30/42] input: keypad: ep93xx: add DT support for Cirrus EP93xx Nikita Shubin via B4 Relay
2023-09-18 7:27 ` Andy Shevchenko
2023-09-15 8:11 ` [PATCH v4 31/42] dt-bindings: wdt: Add ts72xx Nikita Shubin via B4 Relay
2023-09-15 11:18 ` Krzysztof Kozlowski
2023-09-15 8:11 ` [PATCH v4 32/42] wdt: ts72xx: add DT support for ts72xx Nikita Shubin via B4 Relay
2023-09-15 8:11 ` [PATCH v4 33/42] gpio: ep93xx: add DT support for gpio-ep93xx Nikita Shubin via B4 Relay
2023-09-15 8:11 ` [PATCH v4 34/42] ARM: dts: add Cirrus EP93XX SoC .dtsi Nikita Shubin via B4 Relay
2023-09-15 11:24 ` Krzysztof Kozlowski
2023-09-15 8:11 ` [PATCH v4 35/42] ARM: dts: ep93xx: add ts7250 board Nikita Shubin via B4 Relay
2023-09-15 8:11 ` [PATCH v4 36/42] ARM: ep93xx: DT for the Cirrus ep93xx SoC platforms Nikita Shubin via B4 Relay
2023-09-15 8:11 ` [PATCH v4 37/42] pwm: ep93xx: drop legacy pinctrl Nikita Shubin via B4 Relay
2023-09-15 8:46 ` Linus Walleij
2023-09-15 8:11 ` [PATCH v4 38/42] ata: pata_ep93xx: remove legacy pinctrl use Nikita Shubin via B4 Relay
2023-09-15 8:47 ` Linus Walleij
2023-09-15 8:11 ` [PATCH v4 39/42] ARM: ep93xx: delete all boardfiles Nikita Shubin via B4 Relay
2023-09-15 8:11 ` [PATCH v4 40/42] ARM: ep93xx: soc: drop defines Nikita Shubin via B4 Relay
2023-09-15 8:11 ` [PATCH v4 41/42] ARM: dts: ep93xx: Add EDB9302 DT Nikita Shubin via B4 Relay
2023-09-15 8:11 ` [PATCH v4 42/42] ASoC: cirrus: edb93xx: Delete driver Nikita Shubin via B4 Relay
2023-09-15 12:26 ` Mark Brown
2023-09-18 7:39 ` [PATCH v4 00/42] ep93xx device tree conversion Andy Shevchenko
2023-10-15 21:17 ` (subset) " Alexandre Belloni
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=ZQf+U2ZQWiJbJGGp@smile.fi.intel.com \
--to=andy@kernel.org \
--cc=alexander.sverdlin@gmail.com \
--cc=arnd@arndb.de \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=hsweeten@visionengravers.com \
--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=linux@armlinux.org.uk \
--cc=lukma@denx.de \
--cc=nikita.shubin@maquefel.me \
/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