boards/rp2040: support reboot bootloader via reset_usb_boot()

Add reset_usb_boot ROM function typedef and wire it into
board_reset() so that 'nsh> reboot bootloader'
(BOARDIOC_SOFTRESETCAUSE_ENTER_BOOTLOADER) on RP2040 boards enters
BOOTSEL USB mass-storage mode directly, matching the behavior
already available on rp23xx boards.  All other status values keep
the existing up_systemreset() behavior.

This affects all boards under boards/arm/rp2040/common (pico,
pico-w, feather-rp2040, xiao-rp2040, w5500-evb-pico, etc.) since
the change is in the shared board_reset() implementation.

Assisted-by: GitHubCopilot:claude-4.6-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
wangjianyu3 2026-09-04 22:09:18 +08:00 committed by Xiang Xiao
parent 6b5673a433
commit 71499bd66e
2 changed files with 18 additions and 1 deletions

View file

@ -63,3 +63,5 @@
****************************************************************************/
typedef void *(*rom_table_lookup_fn)(uint16_t *table, uint32_t code);
typedef void (*rom_reset_usb_boot_fn)(uint32_t usb_activity_gpio_pin_mask,
uint32_t disable_interface_mask);

View file

@ -28,6 +28,10 @@
#include <nuttx/board.h>
#include <nuttx/arch.h>
#include <sys/boardctl.h>
#include "rp2040_rom.h"
#ifdef CONFIG_BOARDCTL_RESET
/****************************************************************************
@ -56,7 +60,18 @@
int board_reset(int status)
{
up_systemreset();
if (status == BOARDIOC_SOFTRESETCAUSE_ENTER_BOOTLOADER)
{
rom_reset_usb_boot_fn reset_usb_boot;
reset_usb_boot = (rom_reset_usb_boot_fn)ROM_LOOKUP(ROM_RESET_USB_BOOT);
reset_usb_boot(0, 0);
}
else
{
up_systemreset();
}
return 0;
}