Skip to content

morse-bundle: skip chip reset when reset GPIO is unavailable - #2

Open
jiahylan wants to merge 1 commit into
MorseMicro:3.1-devfrom
jiahylan:fix-chipreset-gpiod-v2
Open

morse-bundle: skip chip reset when reset GPIO is unavailable#2
jiahylan wants to merge 1 commit into
MorseMicro:3.1-devfrom
jiahylan:fix-chipreset-gpiod-v2

Conversation

@jiahylan

Copy link
Copy Markdown

Summary

Check that the MM_RESET GPIO line is available before unloading the Morse driver or unbinding an MMC/SDIO controller.

Some Raspberry Pi MM6108 device trees do not expose a GPIO line named MM_RESET. On these systems, the existing reset sequence can leave the SDIO controller unbound for the remainder of the boot, causing the Morse device to become unavailable.

Problem

This issue was observed with OpenMANET 1.8.0 on a Raspberry Pi 4B using a Heltec HT-HC01 / MM6108 module over SDIO.

During boot, the morsechipreset init service runs /morse/scripts/chipreset.sh. The current sequence is:

  1. Find the first MMC host under /sys/devices/platform.
  2. Remove the morse and dot11ah modules.
  3. Unbind the selected MMC/SDIO controller.
  4. Call reset_chip.
  5. Check whether the MM_RESET GPIO line exists.
  6. Rebind the MMC/SDIO controller.

The GPIO check currently occurs inside reset_chip, after the controller has already been unbound.

If MM_RESET is absent or not uniquely identifiable, gpioinfo fails and reset_chip exits the script. The matching bind operation is therefore never executed.

This leaves the SDIO controller unbound and can result in:

  • Morse SDIO probe failures;
  • the MM6108 device not being enumerated;
  • wlan0 not being created;
  • morse_cli being unable to communicate with the radio.

A later manual SDIO unbind/bind can recover the device, which confirms that the failure is caused by the boot-time reset sequence rather than the radio firmware, BCF, or hardware.

Root cause

The reset GPIO is treated as a prerequisite only after destructive changes have already been made to the driver and SDIO state.

On boards without an MM_RESET GPIO line, the reset operation is unavailable but optional. Failing to perform the reset should not leave the existing SDIO device unusable.

Change

Add an early gpioinfo check before discovering, unloading, or unbinding any MMC/SDIO device:

if ! gpioinfo -s --by-name MM_RESET > /dev/null 2>&1; then
    2>&1 echo 'morsechipreset: MM_RESET is unavailable; skipping reset
    without unbinding SDIO'
    exit 0
fi

When MM_RESET is unavailable, the script now:

  1. emits a clear diagnostic message;
  2. skips the optional chip reset;
  3. exits successfully;
  4. leaves the Morse driver and SDIO controller untouched.

When a valid and unique MM_RESET line is available, the existing reset, unbind, and bind sequence is unchanged.

Behavior comparison

Condition Previous behavior New behavior
MM_RESET is available Perform the existing reset sequence Unchanged
MM_RESET is absent without touching Unbind SDIO, exit before bind Skip reset SDIO
MM_RESET is duplicated without touching Unbind SDIO, exit before bind Skip reset SDIO

Validation

Static checks:

sh -n hardware/morse-bundle/files/morse/scripts/chipreset.sh
git diff --check

Both checks pass.

The same guard was also validated in a rebuilt OpenMANET 1.8.0 image on a Raspberry Pi 4B with a Heltec HT-HC01 / MM6108 SDIO module. With no MM_RESET GPIO line exposed by the device tree:

  • the reset script reports that the reset is being skipped;
  • the SDIO controller remains bound;
  • the MM6108 radio is enumerated;
  • the HaLow wlan0 interface remains available after boot.

Scope

This is a minimal change to the morse-bundle boot helper. It does not modify:

  • the Morse kernel driver;
  • firmware or BCF selection;
  • device-tree definitions;
  • behavior on boards that provide a valid MM_RESET line.

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