When should gpio-restart be used/avoided?

Bjørn Mork bjorn at mork.no
Sun Aug 14 09:40:48 PDT 2022


Lech Perczak <lech.perczak at gmail.com> writes:

> I'll try your settings, on MF286D and on older MF286 as well.
> My setup is a bit more convoluted, since my build has patches to use
> split APN for IPv4v6 dual stack and I use DHCP.

Are patches still required for dual-stack with uqmi? 

FWIW, this just works with ModemManager.  Tested this interface config
now: 

config interface 'wan'
        option device '/sys/devices/platform/soc/8af8800.usb3/8a00000.dwc3/xhci-hcd.0.auto/usb2/2-1'
        option proto 'modemmanager'
        option apn 'telenor.smart'
        option iptype 'ipv4v6'

and got:

root at mf286d:/# ifconfig wwan0
wwan0     Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.201.240.26  P-t-P:10.201.240.26  Mask:255.255.255.252
          inet6 addr: 2a02:2121:285:6c98:ed02:dc3b:8d92:ba9b/128 Scope:Global
          inet6 addr: fe80::6481:c58c:9848:2b5/64 Scope:Link
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1540  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1415 (1.3 KiB)  TX bytes:1669 (1.6 KiB)

root at mf286d:/# mmcli -b 1
  ------------------------------------
  General            |           path: /org/freedesktop/ModemManager1/Bearer/1
                     |           type: default
  ------------------------------------
  Status             |      connected: yes
                     |      suspended: no
                     |    multiplexed: no
                     |      interface: wwan0
                     |     ip timeout: 20
  ------------------------------------
  Properties         |            apn: telenor.smart
                     |        roaming: allowed
                     |        ip type: ipv4v6
  ------------------------------------
  IPv4 configuration |         method: static
                     |        address: 10.201.240.26
                     |         prefix: 30
                     |        gateway: 10.201.240.25
                     |            dns: 193.213.112.4, 130.67.15.198
                     |            mtu: 1500
  ------------------------------------
  IPv6 configuration |         method: static
                     |        address: 2a02:2121:285:6c98:ed02:dc3b:8d92:ba9b
                     |         prefix: 64
                     |        gateway: 2a02:2121:285:6c98:f4b2:80d1:eba3:9279
                     |            dns: 2001:4600:4:fff::52, 2001:4600:4:1fff::52
                     |            mtu: 1540
  ------------------------------------
  Statistics         |       duration: 30
                     |       bytes rx: 1204
                     |       bytes tx: 722
                     |       attempts: 1
                     | total-duration: 30
                     | total-bytes rx: 1204
                     | total-bytes tx: 722

root at mf286d:/# ip route
default via 10.201.240.25 dev wwan0  src 10.201.240.26 
10.201.240.24/30 dev wwan0 scope link  src 10.201.240.26 
192.168.99.0/24 dev lan4.203 scope link  src 192.168.99.56 

root at mf286d:/# ip -6 route
default from 2a02:2121:285:6c98::/64 via 2a02:2121:285:6c98:f4b2:80d1:eba3:9279 dev wwan0  metric 1024 
2a02:2121:285:6c98:ed02:dc3b:8d92:ba9b dev wwan0  metric 256 
2a02:2121:285:6c98:f4b2:80d1:eba3:9279 dev wwan0  metric 1024 
2a02:2121:285:6c98::/64 dev lan4.203  metric 1024 
unreachable 2a02:2121:285:6c98::/64 dev lo  metric 2147483647 
fd63:fcae:6f0::/64 dev lan4.203  metric 1024 
unreachable fd63:fcae:6f0::/48 dev lo  metric 2147483647 
fe80::/64 dev eth0  metric 256 
fe80::/64 dev lan4  metric 256 
fe80::/64 dev lan4.203  metric 256 
fe80::/64 dev br-lan  metric 256 
fe80::/64 dev br-iot  metric 256 
fe80::/64 dev wwan0  metric 256 
anycast 2a02:2121:285:6c98:: dev lan4.203  metric 0 
anycast fd63:fcae:6f0:: dev lan4.203  metric 0 
anycast fe80:: dev eth0  metric 0 
anycast fe80:: dev br-lan  metric 0 
anycast fe80:: dev br-iot  metric 0 
anycast fe80:: dev lan4  metric 0 
anycast fe80:: dev lan4.203  metric 0 
anycast fe80:: dev wwan0  metric 0 
multicast ff00::/8 dev eth0  metric 256 
multicast ff00::/8 dev lan4.203  metric 256 
multicast ff00::/8 dev lan4  metric 256 
multicast ff00::/8 dev br-lan  metric 256 
multicast ff00::/8 dev br-iot  metric 256 
multicast ff00::/8 dev wwan0  metric 256 

>> But AFAICS the gpio-restart is not required for proper modem reset.  The
>> modem works just fine without it.
> Please check what happens if you set the "power button blocker" GPIO
> switch high instead of default low. It will block the rear power
> switch,
> and should allow modem restart without forcing power-down of whole
> board during reboot, IIRC.

Yes, that sort of "works".

But that's because the gpio-restart driver fails.  Looks like this GPIO
not only disables the power button, but also the gpio used by the
gpio-restart device (this would happen to be the GPIO connected to that
button, would it?)

The board isn't powered down simply because the driver fails and we
fall back to the next reboot method.

With "power button blocker" GPIO enabled I get this:

root at mf286d:/# reboot
root at mf286d:/# [  143.729180] br-iot: port 1(lan4.15) entered disabled state
[  143.731624] device lan4.15 left promiscuous mode
[  143.734007] br-iot: port 1(lan4.15) entered disabled state
[  144.013431] br-lan: port 1(lan4.10) entered disabled state
[  144.014460] device lan2 left promiscuous mode
[  144.018001] br-lan: port 3(lan2) entered disabled state
[  144.069983] device lan3 left promiscuous mode
[  144.070286] br-lan: port 4(lan3) entered disabled state
[  144.123858] device lan4.10 left promiscuous mode
[  144.123943] device lan4 left promiscuous mode
[  144.128225] br-lan: port 1(lan4.10) entered disabled state
[  144.309385] device wan left promiscuous mode
[  144.309781] br-lan: port 2(wan) entered disabled state
[  144.360491] device eth0 left promiscuous mode
[  144.670087] ipqess-edma c080000.ethernet eth0: Link is Down
[  144.672057] qca8k-ipq4019 c000000.switch lan4: Link is Down
[1707]: <info>  [modem0] state changed (connected -> disconnecting)
[1707]: <info>  [modem0] state changed (disconnecting -> registered)
[1707]: <info>  [modem0/bearer1] connection #1 finished: duration 90s, tx: 120 bytes, rx: 132 bytes
[1707]: <info>  [modem0] state changed (registered -> disabling)
[1707]: <info>  caught signal, shutting down...
[1707]: <warn>  could not acquire the 'org.freedesktop.ModemManager1' service name
[  148.863741] reboot: Restarting system
[  152.069897] ------------[ cut here ]------------
[  152.070259] WARNING: CPU: 0 PID: 3305 at drivers/power/reset/gpio-restart.c:46 gpio_restart_notify+0xec/0xf4
[  152.073770] Modules linked in: pppoe ppp_async option nft_fib_inet nf_flow_table_ipv6 nf_flow_table_ipv4 nf_flow_table_inet ath10k_pci ath10k_core ath usb_wwan qmi_wwan pppox ppp_generic nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_redir nft_quota nft_objref nft_numgen nft_nat nft_masq nft_log nft_limit nft_hash nft_flow_offload nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_ct nft_counter nft_chain_nat nf_tables nf_nat nf_flow_table nf_conntrack mac80211 cfg80211 usbserial usbnet slhc nfnetlink nf_reject_ipv6 nf_reject_ipv4 nf_log_ipv6 nf_log_ipv4 nf_log_common nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c hwmon crc_ccitt compat cdc_wdm ghash_arm_ce cmac leds_gpio xhci_plat_hcd xhci_pci xhci_hcd dwc3 dwc3_qcom gpio_button_hotplug mii crc32c_generic
[  152.127776] CPU: 0 PID: 3305 Comm: procd Not tainted 5.10.120 #0
[  152.149974] Hardware name: Generic DT based system
[  152.156293] [<c030cd14>] (unwind_backtrace) from [<c0309998>] (show_stack+0x10/0x14)
[  152.160868] [<c0309998>] (show_stack) from [<c05fb7f4>] (dump_stack+0x94/0xa8)
[  152.168789] [<c05fb7f4>] (dump_stack) from [<c0320d08>] (__warn+0xc0/0x11c)
[  152.175829] [<c0320d08>] (__warn) from [<c0320dcc>] (warn_slowpath_fmt+0x68/0x78)
[  152.182701] [<c0320dcc>] (warn_slowpath_fmt) from [<c0734178>] (gpio_restart_notify+0xec/0xf4)
[  152.190357] [<c0734178>] (gpio_restart_notify) from [<c03417c0>] (atomic_notifier_call_chain+0x58/0x78)
[  152.198863] [<c03417c0>] (atomic_notifier_call_chain) from [<c0308334>] (machine_restart+0x78/0x7c)
[  152.208115] [<c0308334>] (machine_restart) from [<c03432e4>] (__do_sys_reboot+0x204/0x258)
[  152.217108] [<c03432e4>] (__do_sys_reboot) from [<c0300040>] (ret_fast_syscall+0x0/0x54)
[  152.225354] Exception stack(0xc230bfa8 to 0xc230bff0)
[  152.233658] bfa0:                   00000000 bed77e50 fee1dead 28121969 01234567 0001f514
[  152.238643] bfc0: 00000000 bed77e50 b6ec4020 00000058 00000000 00000000 b6ec4010 00000001
[  152.246748] bfe0: 004d2e14 bed77d7c 004b429c �
Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.BF.3.1.1-00126
S - IMAGE_VARIANT_STRING=DAABANAZA
S - OEM_IMAGE_VERSION_STRING=CRM
S - Boot Config, 0x00000021

etc.

That warning isn't there when the "power button blocker" is disabled.



Bjørn



More information about the openwrt-devel mailing list