Skip to content

Commit 50f77b2

Browse files
authored
Merge pull request #418 from BlueSCSI/eric/msc-sysresetreq
msc: fix reboot into mass storage on Ultra Wide/SCA
2 parents b454dfb + d30d45e commit 50f77b2

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

lib/BlueSCSI_platform_RP2MCU/BlueSCSI_platform.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ extern "C" {
4646
#include <hardware/sync.h>
4747
#include <hardware/vreg.h>
4848
#include <hardware/watchdog.h>
49+
#include <hardware/structs/scb.h>
4950
#include <hardware/structs/watchdog.h>
5051
#include <pico/bootrom.h>
5152
#include "scsi_accel_target.h"
@@ -1502,9 +1503,19 @@ static void usb_input_poll()
15021503
break;
15031504
case 'Y':
15041505
case 'y':
1505-
if (basic_reboot_keyed || mass_storage_reboot_keyed)
1506+
if (mass_storage_reboot_keyed)
15061507
{
1507-
logmsg("Rebooting", mass_storage_reboot_keyed ? " into mass storage": "");
1508+
logmsg("Rebooting into mass storage");
1509+
// A watchdog reset drops the supply on some boards (Ultra Wide
1510+
// reports HAD_POR afterwards), wiping the scratch0 magic.
1511+
// SYSRESETREQ keeps the watchdog block powered so it survives.
1512+
platform_delay_ms_with_usb(200);
1513+
scb_hw->aircr = 0x05FA0004;
1514+
while (1);
1515+
}
1516+
else if (basic_reboot_keyed)
1517+
{
1518+
logmsg("Rebooting");
15081519
watchdog_reboot(0, 0, 2000);
15091520
} else if (uf2_reboot_keyed) {
15101521
rom_reset_usb_boot(0, 0);

0 commit comments

Comments
 (0)