Mt7628an: Issues with GPIO after upgrade to OpenWrt v25.12

Context:

I have a mt7628an (MIPS) based LoRa gateway which has SX1302 concentrator module connected. Before the software controlling the SX1302 can be started, it needs to reset using a GPIO pin (11). This is done in software, e.g.

        let req = gpiocdev::Request::builder()
            .on_chip(sx130x_reset.0)
            .with_line(sx130x_reset.1)
            .as_output(gpiocdev::line::Value::Inactive)
            .request()?;
        sleep(Duration::from_millis(100));
        reg.set_lone_value(gpiocdev::line::Value::Active)?;
        sleep(Duration::from_millis(100));
        reg.set_lone_value(gpiocdev::line::Value::Inactive)?;
        sleep(Duration::from_millis(100));

Without, the following error is returned:

Opening SPI communication interface
Note: chip version is 0x10 (v1.0)
ERROR: Failed to set SX1250_0 in STANDBY_RC mode
ERROR: failed to setup radio 0

Problem:

Using OpenWrt 24.10.5, this worked perfect. However when upgrading to OpenWrt 25.12.0 (and also tried 25.12.1), this no longer works. Using gpioinfo I can see all gpiochipX chips and lines, but the reset does not work. I have been looking at the device-tree changes and kernel configuration between OpenWrt 24.10.5 and OpenWrt 25.12.0, but I do not see anything obvious.

It looks like the issue is related to MIPS build. When compiling the same software for Raspberry Pi / ARM it works without issue.

What I have tried:

  • I have looked at the mt7628an device-tree changes between v24 and v25, but I do not see anything obvious
  • The same for the kernel configuration
  • I found some suggestions to map the GPIO pin (11 in this case) in the device-tree, but this cause it to be claimed by the kernel / no longer be controllable in user-space

Maybe this is a bug, maybe I’m missing something or maybe something has changes that requires additional configuration for using the GPIO pins on mt7628an. If anybody has any feedback or suggestions, that would be very welcome.

Could it be that the pin/chip numbering has changed between the releases for whatever reason? Or maybe something is already assigned to it in DT? What does gpioinfo say?

I guess others suggested naming the pin in DT without assigning it any function, so it's easier to see where it comes up in user space.

@Dante

I guess others suggested naming the pin in DT without assigning it any function

Would that mean that the numbering in DT could be different from user space? E.g. pin 11 named as “sx130x-reset” in the DT could end up with a different number when listing it using gpioinfo?

Looking at the leds, these these seem to be at the numbers as they where previously, so I assume the chip no / offset is still the same as before. As well rak:green:lora1 is mapped in the device-tree to to 14, which is the same as in gpioinfo.

Current output by gpioinfo

gpiochip0 - 32 lines:
        line   0:       unnamed                 input
        line   1:       unnamed                 input
        line   2:       unnamed                 input
        line   3:       unnamed                 input
        line   4:       unnamed                 input
        line   5:       unnamed                 input
        line   6:       unnamed                 input
        line   7:       unnamed                 input
        line   8:       unnamed                 input
        line   9:       unnamed                 input
        line  10:       unnamed                 input
        line  11:       unnamed                 output
        line  12:       unnamed                 input
        line  13:       unnamed                 input
        line  14:       unnamed                 output active-low consumer=rak:green:lora1
        line  15:       unnamed                 output active-low consumer=rak:green:lora
        line  16:       unnamed                 input
        line  17:       unnamed                 input
        line  18:       unnamed                 input active-low consumer=dying-gasp
        line  19:       unnamed                 input
        line  20:       unnamed                 input
        line  21:       unnamed                 input
        line  22:       unnamed                 input
        line  23:       unnamed                 input
        line  24:       unnamed                 input
        line  25:       unnamed                 input
        line  26:       unnamed                 input
        line  27:       unnamed                 input
        line  28:       unnamed                 input
        line  29:       unnamed                 input
        line  30:       unnamed                 input
        line  31:       unnamed                 input
gpiochip1 - 32 lines:
        line   0:       unnamed                 input
        line   1:       unnamed                 input
        line   2:       unnamed                 input
        line   3:       unnamed                 input
        line   4:       unnamed                 input
        line   5:       unnamed                 input
        line   6:       unnamed                 input active-low consumer=reset
        line   7:       unnamed                 input
        line   8:       unnamed                 input
        line   9:       unnamed                 input
        line  10:       unnamed                 input
        line  11:       unnamed                 output active-low consumer=rak:green:eth
        line  12:       unnamed                 output active-low consumer=mediatek:orange:wifi
        line  13:       unnamed                 input
        line  14:       unnamed                 input
        line  15:       unnamed                 input
        line  16:       unnamed                 input
        line  17:       unnamed                 input
        line  18:       unnamed                 input
        line  19:       unnamed                 input
        line  20:       unnamed                 input
        line  21:       unnamed                 input
        line  22:       unnamed                 input
        line  23:       unnamed                 input
        line  24:       unnamed                 input
        line  25:       unnamed                 input
        line  26:       unnamed                 input
        line  27:       unnamed                 input
        line  28:       unnamed                 input
        line  29:       unnamed                 input
        line  30:       unnamed                 input
        line  31:       unnamed                 input
gpiochip2 - 32 lines:
        line   0:       unnamed                 input
        line   1:       unnamed                 input
        line   2:       unnamed                 input
        line   3:       unnamed                 input
        line   4:       unnamed                 input
        line   5:       unnamed                 input
        line   6:       unnamed                 input
        line   7:       unnamed                 input
        line   8:       unnamed                 input
        line   9:       unnamed                 input
        line  10:       unnamed                 input
        line  11:       unnamed                 input
        line  12:       unnamed                 input
        line  13:       unnamed                 input
        line  14:       unnamed                 input
        line  15:       unnamed                 input
        line  16:       unnamed                 input
        line  17:       unnamed                 input
        line  18:       unnamed                 input
        line  19:       unnamed                 input
        line  20:       unnamed                 input
        line  21:       unnamed                 input
        line  22:       unnamed                 input
        line  23:       unnamed                 input
        line  24:       unnamed                 input
        line  25:       unnamed                 input
        line  26:       unnamed                 input
        line  27:       unnamed                 input
        line  28:       unnamed                 input
        line  29:       unnamed                 input
        line  30:       unnamed                 input
        line  31:       unnamed                 input

(Sorry if I’m asking dumb questions, I’m not an expert in device-trees and I’m learning while doing)

Edit: Just to let you know. When I change the logic in my code, e.g. invert the output, thus instead of high, sleep, low - low, sleep, high. I do get a different response (then the communication fails completely as in Note: chip version is 0x10 (v1.0) changes to Note: chip version is 0x00 (v0.0).So I assume it does work, but somehow there is a difference between OpenWrt v24.10.5 and v25.12.0 (and .1).

Edit 2: I have also built for ath79 (Atheros AR9330) and here it works fine as well, like with the Raspberry Pi target.

@Dante I have tried with naming GPIO 11 like this in the device-tree:

&gpio {
    gpio-line-names = 
        /* 0-10 */ "", "", "", "", "", "", "", "", "", "", "",
        /* 11 */   "sx130x-reset",
        /* 12-... */ "", "", "";
};

$ gpioinfo -c gpiochip0 11
gpiochip0 11    "sx130x-reset"          output

This is indeed the pin used by my software to reset the SX1302.

I have also tried reverting these device-tree changes:

Still no luck.

This is correct !

please show the relevant dts entry for your ax1302, or the whole dts

Please find the patch file that adds the DT for the RAK gateway here:

A quick answer ...
I'm (currently) too lazy to look deeper ..

+	spidev@1 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "semtech,sx1301";
+		reg = <1>;
+		spi-max-frequency = <40000000>;
+	};
+};

there is no gpio reset controller
in .config
CONFIG_RESET_GPIO

your gpio11 pin is connected to "something" in the dts.

Documentation/devicetree/bindings/reset/
should help you,

grep for "reset-gpios"

also for the entry in your spi node

as a side note

you can add gpio11 as "led" and test via sysfs or gpioget/gpioset