Skip to content

ts71xxweim: extend IRQ functionality for interrupt controller and gpio controller#275

Open
anakin-childerhose-sfl wants to merge 18 commits intoembeddedTS:linux-6.6.yfrom
anakin-childerhose-sfl:linux-6.6.y
Open

ts71xxweim: extend IRQ functionality for interrupt controller and gpio controller#275
anakin-childerhose-sfl wants to merge 18 commits intoembeddedTS:linux-6.6.yfrom
anakin-childerhose-sfl:linux-6.6.y

Conversation

@anakin-childerhose-sfl
Copy link

@anakin-childerhose-sfl anakin-childerhose-sfl commented Feb 13, 2026

irq-ts71xxweim changes

Changes made:

  • add ack and mask_ack functions
  • add spinlocks for read-modify-write transactions
  • add initialisation of priv->mask to value of mask register
  • simplified irq handler
  • minor fixes

These commits have been tested on a ts7250 v3 with FPGA firmware rev70 by jumping the RX and TX pins together for the three RS-232 UARTS and running them all at 115200 baud for a period of time:

  • ttyS8 on the DB9 connector
  • ttyS9 on COM2 header
  • ttyS10 on COM3 header

The output of linux-serial-test for each tty:

/dev/ttyS10: count for this session: rx=3919758, tx=3919814, rx err=0
/dev/ttyS10: TIOCGICOUNT: ret=0, rx=3997939, tx=3997939, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0
/dev/ttyS8: count for this session: rx=3923653, tx=3923653, rx err=0
/dev/ttyS8: TIOCGICOUNT: ret=0, rx=4009904, tx=4009904, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0
/dev/ttyS9: count for this session: rx=3929020, tx=3932100, rx err=0
/dev/ttyS9: TIOCGICOUNT: ret=0, rx=4018415, tx=4018415, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0

gpio-ts71xxweim changes

Changes made:

  • add optional IRQ support
  • add get_direction function
  • minor misc fixes

These commits have been tested on a ts7250 v3 with FPGA firmware rev70 by jumping two gpios together then using gpiomon on one to listen for interrupts and gpioset on the other to trigger interrupts.

@anakin-childerhose-sfl anakin-childerhose-sfl changed the title irq-ts71xxweim: add IRQ ack and ack_mask functions ts71xxweim: extend IRQ functionality for interrupt controller and gpio controller Mar 5, 2026
Support both rev56 and rev65 of FPGA firmware by checking
TSWEIM_IRQ_ACK_MODE_EN in TSWEIM_IRQ_ACK_MODE.
priv->mask by default will be initialized with 0. This may not
accurately reflect the value in TSWEIM_IRQ_MASK. Initialize priv->mask
with TSWEIM_IRQ_MASK to ensure the variable is synced with the register.
Since tsweim_intc_probe() uses platform_set_drvdata(),
tsweim_intc_remove() should use platform_get_drvdata() instead of
dev_get_platdata().
The driver was assigning the address of the local `priv` pointer to
`pdev->dev.platform_data`. This is incorrect for two reasons:

1. It assigns the address of a stack variable ("&priv") rather than the
   allocated struct itself, leading to invalid memory access if used later.
2. The driver uses devm_gpiochip_add_data(), which handles private data
   association internally. There is no need to manually set platform_data
   or driver data in the probe function for this driver's usage patterns.
Follow the convention of allocating kernel memory first on driver probe.
Now that the private data is allocated before calling devm_ioremap(),
the local variable membase is no longer needed.
The priv->syscon __iomem attribute gets populated with
devm_ioremap(index = 0) which will return the cell at the 0th index of
the reg property from the devicetree. This is the
base register address of the fpga_gpio controller and not the register
of the parent syscon device.

Rename syscon to base to avoid this confusion.
…o devices

The ts71xxweim-gpio driver will support interrupts via interrupt
registers starting 0x4080 and incrementing by 0x10 per bank.
Add interrupt support to the WEIM FPGA GPIO driver. When an IRQ
resource is present in the device tree, a second memory-mapped
register range is used to configure and manage interrupts. The
driver supports level-high, level-low, rising-edge, falling-edge,
and both-edge trigger types.

IRQ support is optional; if no IRQ is specified in the device tree
the driver falls back to GPIO-only operation.

Note: the optional irq_chip.mask_ack is intentionally omitted.
Providing it triggers a WARN_ON in gpiochip_disable_irq.
Get a reference to the syscon node to check FPGA revision and
ack_mode_en status to retain backwards compatiblity for boards with
older FPGA revisions.
In newer revisions of the FPGA firmware the MASK register applies the
mask to the status register in hardware. This removes the need to do so
in software. Looping on the status register is also not required and
could cause interrupt storms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant