From: sashiko-bot@kernel.org
To: "Fil Dunsky" <filipp.dunsky@gmail.com>
Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 2/2] gpio: Add Cortina Systems CS75xx GPIO driver
Date: Mon, 16 Nov 2026 02:42:59 +0000 [thread overview]
Message-ID: <sashiko-outbox-216086@kernel.org> (raw)
In-Reply-To: <20261116-cs75xx-gpio-v4-2-ad80a944e966@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] gpio: cs75xx: spurious interrupt when enabling edge-triggered
IRQs
- [Low] gpio: cs75xx: Kconfig depends on undefined symbol
ARCH_CORTINA_ACCESS
--
commit 6e394706938fa0fbfbaaa8045989b5a4c049c014
Author: Fil Dunsky <filipp.dunsky@gmail.com>
gpio: Add Cortina Systems CS75xx GPIO driver
This commit adds a GPIO and interrupt controller driver for the Cortina
Systems CS75xx SoCs using gpio-mmio.
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 55e4280029d86..cc00cfe48d941 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -300,6 +300,18 @@ config GPIO_CLPS711X
> help
> Say yes here to support GPIO on CLPS711X SoCs.
>
> +config GPIO_CS75XX
> + tristate "Cortina Systems CS75xx GPIO support"
> + depends on ARCH_CORTINA_ACCESS || COMPILE_TEST
[Severity: Low]
Is ARCH_CORTINA_ACCESS defined anywhere in the tree? Without that Kconfig
symbol, GPIO_CS75XX can only be enabled when COMPILE_TEST is set, and
scripts/checkkconfigsymbols.py will report an undefined symbol.
[ ... ]
> diff --git a/drivers/gpio/gpio-cs75xx.c b/drivers/gpio/gpio-cs75xx.c
> new file mode 100644
> index 0000000000000..b4f2889103311
> --- /dev/null
> +++ b/drivers/gpio/gpio-cs75xx.c
[ ... ]
> +static void cs75xx_gpio_irq_unmask(struct irq_data *d)
> +{
> + struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
> + struct cs75xx_gpio *g = gpiochip_get_data(gc);
> + irq_hw_number_t hwirq = irqd_to_hwirq(d);
> + u32 ie;
> +
> + gpiochip_enable_irq(gc, hwirq);
> +
> + guard(gpio_generic_lock_irqsave)(&g->chip);
> + /*
> + * The status of a level interrupt is latched while the line is
> + * asserted, also after the ack, so it may be stale by now. Clear it,
> + * it is set again right away if the line is still asserted.
> + */
> + if (irqd_is_level_type(d))
> + writel(BIT(hwirq), g->base + CS75XX_GPIO_INT);
> + ie = readl(g->base + CS75XX_GPIO_IE);
> + writel(ie | BIT(hwirq), g->base + CS75XX_GPIO_IE);
> +}
> +
> +static int cs75xx_gpio_irq_set_type(struct irq_data *d, unsigned int type)
> +{
> + struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
> + struct cs75xx_gpio *g = gpiochip_get_data(gc);
> + u32 mask = BIT(irqd_to_hwirq(d));
> + u32 lvl, edge, both_edges;
> +
> + guard(gpio_generic_lock_irqsave)(&g->chip);
> +
> + lvl = readl(g->base + CS75XX_GPIO_LVL);
> + edge = readl(g->base + CS75XX_GPIO_EDGE);
> + both_edges = g->both_edges & ~mask;
> +
> + switch (type & IRQ_TYPE_SENSE_MASK) {
> + case IRQ_TYPE_LEVEL_LOW:
> + lvl &= ~mask;
> + edge &= ~mask;
> + break;
> + case IRQ_TYPE_LEVEL_HIGH:
> + lvl |= mask;
> + edge &= ~mask;
> + break;
> + case IRQ_TYPE_EDGE_FALLING:
> + lvl &= ~mask;
> + edge |= mask;
> + break;
> + case IRQ_TYPE_EDGE_RISING:
> + lvl |= mask;
> + edge |= mask;
> + break;
> + case IRQ_TYPE_EDGE_BOTH:
> + both_edges |= mask;
> + edge |= mask;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + g->both_edges = both_edges;
> + writel(lvl, g->base + CS75XX_GPIO_LVL);
> + writel(edge, g->base + CS75XX_GPIO_EDGE);
> + if (g->both_edges & mask)
> + cs75xx_gpio_set_polarity(g, mask);
[Severity: Medium]
Can configuring and unmasking an edge-triggered interrupt fire an immediate
spurious interrupt?
cs75xx_gpio_probe() leaves CS75XX_GPIO_EDGE and CS75XX_GPIO_LVL at their
reset or boot loader state, so any line initially in level mode will
re-latch its bit in CS75XX_GPIO_INT whenever the input matches
CS75XX_GPIO_LVL. In addition, cs75xx_gpio_irq_set_type() writes
CS75XX_GPIO_LVL before switching CS75XX_GPIO_EDGE to edge mode, which
latches CS75XX_GPIO_INT if the pin already matches the new lvl bit.
Because neither cs75xx_gpio_irq_set_type() nor cs75xx_gpio_irq_unmask()
clears CS75XX_GPIO_INT for edge interrupts, unmasking the line in
CS75XX_GPIO_IE immediately triggers a spurious interrupt.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116-cs75xx-gpio-v4-0-ad80a944e966@gmail.com?part=2
next prev parent reply other threads:[~2026-11-16 2:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 2:08 [PATCH v4 0/2] gpio: Add Cortina Systems CS75xx GPIO driver Fil Dunsky
2026-11-16 2:08 ` Fil Dunsky via B4 Relay
2026-11-16 2:08 ` [PATCH v4 1/2] dt-bindings: gpio: Add Cortina Systems CS7542 GPIO controller Fil Dunsky
2026-11-16 2:08 ` Fil Dunsky via B4 Relay
2026-11-16 11:36 ` Krzysztof Kozlowski
2026-11-16 2:08 ` [PATCH v4 2/2] gpio: Add Cortina Systems CS75xx GPIO driver Fil Dunsky
2026-11-16 2:08 ` Fil Dunsky via B4 Relay
2026-11-16 2:42 ` sashiko-bot [this message]
2026-11-16 14:33 ` 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=sashiko-outbox-216086@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=filipp.dunsky@gmail.com \
--cc=linux-gpio@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.