Re: FDT access from a driver during attach
Vincent DEFERT <[email protected]> Mon, 28 Jul 2025 17:59:00 +0000
| Newsgroups | gmane.os.netbsd.ports.arm |
|---|---|
| Message-ID | <[email protected]> |
Thank you, Robert. I've had a quick look at the C2's Ethernet. Does that mean I need an overlay to add interrupt-parent = <&gpio_intc> to the gpio? Also, I feel I miss too many fundamentals on NetBSD's internal structure and organisation. Are there any resources I can use to improve on this? On 28/07/2025 17:53, Robert Swindells wrote: > Vincent DEFERT <[email protected]> wrote: >> I want to add interrupt handling to the Meson pinctrl driver. >> I have seen that this is handled by attaching gpioirq to the desired pin >> with gpioctl(8) and there's an example of how to implement the >> underlying capability in sunxi_gpio.c. >> I also have the S905 documentation and the source code of the vendor >> Linux driver as reference. So far, so good. > You could also look at rk_gpio.c and sys/dev/i2c/fusbtc.c, combined > with a dump of the dtb for the Pinebook Pro. > >> The only thing I don't know is how to retrieve the GPIO interrupt >> controller configuration. >> It is stored in a gpio_intc node with the "amlogic,meson-gpio-intc" >> compatible string, but none of the 2 gpio instances reference it. >> How can I search the full FDT to find this node? > I don't think you should need to search the device tree for this. > > I would expect you to write a driver that matches on that compat > string, it would map the registers of the interrupt controller > and hook up this interrupt controller to the main one. > > Then your device tree overlay to go with a driver for whatever you are > planning to connect to the gpio would specify an interrupt-parent that > points to the meson-gpio-intc node. > > The Ethernet PHY seems to be the only place in the Odroid-C2 device tree > that uses this kind of thing but our driver isn't using GPIO interrupts > to make it work.