ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vinicius Pedrosa" <vinicius.eduardo.pedrosa@gmail.com>,
	linux-gpio@vger.kernel.org
Cc: linux-sunxi@lists.linux.dev
Subject: Re: [PATCH] pinctrl: sunxi: a733: do not switch the mux to read IRQ lines
Date: Tue, 10 Nov 2026 13:21:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-207115@kernel.org> (raw)
In-Reply-To: <20261110130157.112155-1-vinicius.eduardo.pedrosa@gmail.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] pinctrl: sunxi: wrong A733 IRQ bank offset calculation in
  sunxi_irq_base_reg() [1]
--

commit e0da3dde27e4a3b5c2c95273c0b30e65e89fd5f3
Author: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>

pinctrl: sunxi: a733: do not switch the mux to read IRQ lines

This commit removes irq_read_needs_mux from a733_pinctrl_data so that reading
an interrupt line does not switch the pin mux to function 6 instead of keeping
A733's interrupt function 14.

> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c b/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
> index ca82f08a3a65b..456d9170c2a27 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun60i-a733.c
> @@ -23,7 +23,6 @@ static const u8 a733_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS] =
>  
>  static struct sunxi_pinctrl_desc a733_pinctrl_data = {
>  	.irq_banks = 10,
> -	.irq_read_needs_mux = true,
>  	.io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL,
>  };

[Severity: High]
This problem wasn't introduced by this patch, but does sunxi_irq_base_reg()
calculate the wrong IRQ bank MMIO offset for a733_pinctrl_data [1]?

drivers/pinctrl/sunxi/pinctrl-sunxi.h:sunxi_irq_base_reg() {
	if (pctl->flags & SUNXI_PINCTRL_NCAT3_REG_LAYOUT)
		return pctl->bank_offset + bank * pctl->bank_mem_size +
		       A733_IRQ_REGS_OFFSET;

	return IRQ_REGS_OFFSET +
	       sunxi_irq_hw_bank_num(pctl->desc, bank) * IRQ_MEM_SIZE;
}

Because A733 implements no PA pins (a733_nr_bank_pins[0] == 0),
sunxi_pinctrl_dt_table_init() assigns logical IRQ banks 0..9 to ports PB..PK,
whose hardware banks are 1..10.  However, a733_pinctrl_data omits
irq_bank_map, and the SUNXI_PINCTRL_NCAT3_REG_LAYOUT branch in
sunxi_irq_base_reg() multiplies the logical bank index directly by
pctl->bank_mem_size without calling sunxi_irq_hw_bank_num().

As a result, IRQ register accesses target hardware banks 0..9 (PA..PJ)
instead of 1..10 (PB..PK), shifting every port's interrupt registers by one
bank and leaving port PK interrupts unmasked and uncleared at probe.

[1] https://sashiko.dev/#/bug/linux-213c0bba-8e71-4432-952e-9f5e320fd4b7

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110130157.112155-1-vinicius.eduardo.pedrosa@gmail.com?part=1

      reply	other threads:[~2026-11-10 13:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 13:01 [PATCH] pinctrl: sunxi: a733: do not switch the mux to read IRQ lines Vinicius Pedrosa
2026-11-10 13:21 ` sashiko-bot [this message]

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-207115@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vinicius.eduardo.pedrosa@gmail.com \
    /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