From 28cb8f5b0ba6a8edb1f9224ae5db8967e09d7151 Mon Sep 17 00:00:00 2001 From: Mikey Sklar Date: Fri, 20 Nov 2026 12:51:59 -0800 Subject: [PATCH 1/2] Revert "Merge pull request #11890 from mikeysklar/rp2-boot-out-mac" This reverts commit 173d22c92be1a5e37f6c5631be20b8823edcb627, reversing changes made to 0dcb267495d80123b35b0e3130a231088e5aa198. Powering up the CYW43 just to read its MAC added ~560 ms of boot time and left the chip powered on boards whose status LED is not on CYW0. Co-Authored-By: Claude Opus 5.5 --- ports/raspberrypi/common-hal/microcontroller/Pin.c | 4 ++-- ports/raspberrypi/common-hal/microcontroller/Pin.h | 4 +--- ports/raspberrypi/supervisor/port.c | 6 +----- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.c b/ports/raspberrypi/common-hal/microcontroller/Pin.c index 60245ff6b5f..257e1ee08ff 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Pin.c +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.c @@ -17,7 +17,7 @@ static uint64_t gpio_bank0_pin_claimed; #include "bindings/cyw43/__init__.h" #include "pico/cyw43_arch.h" -bool cyw_driver_ready; +bool cyw_ever_init; static uint32_t cyw_pin_claimed; void reset_pin_number_cyw(uint8_t pin_no) { @@ -25,7 +25,7 @@ void reset_pin_number_cyw(uint8_t pin_no) { // Drive the LED (GPIO 0) and SMPS_MODE (GPIO 1) low. Don't touch // VBUS_SENSE (GPIO 2): writing it would switch it to an output for good. - if (cyw_driver_ready && pin_no <= 1) { + if (cyw_ever_init && pin_no <= 1) { cyw43_arch_gpio_put(pin_no, false); } } diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.h b/ports/raspberrypi/common-hal/microcontroller/Pin.h index fd6f77c6ced..fe2191e8f25 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Pin.h +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.h @@ -29,8 +29,6 @@ bool pin_number_is_free(uint8_t pin_number); uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t *pin); #if CIRCUITPY_CYW43 -// True once cyw43_arch_init() succeeded in port_init(). The driver is ready, -// but the chip may still be powered down until something accesses it. -extern bool cyw_driver_ready; +extern bool cyw_ever_init; void reset_pin_number_cyw(uint8_t pin_number); #endif diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index 7e6a58f9ac2..5cceeafc736 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -475,7 +475,7 @@ safe_mode_t port_init(void) { if (cyw43_arch_init_with_country(PICO_CYW43_ARCH_DEFAULT_COUNTRY_CODE)) { serial_write("WiFi init failed\n"); } else { - cyw_driver_ready = true; + cyw_ever_init = true; } #endif if (board_requests_safe_mode()) { @@ -698,10 +698,6 @@ void port_task_yield(void) { void port_boot_info(void) { #if CIRCUITPY_CYW43 - // Access CYW43 GPIO to power it up before reading the MAC - if (cyw_driver_ready) { - cyw43_arch_gpio_get(pin_CYW2.number); - } mp_printf(&mp_plat_print, "MAC"); for (int i = 0; i < 6; i++) { mp_printf(&mp_plat_print, ":%02X", cyw43_state.mac[i]); From fd7fc83555fd0b6e09a146f565897906b0a70ae9 Mon Sep 17 00:00:00 2001 From: Mikey Sklar Date: Fri, 20 Nov 2026 12:52:12 -0800 Subject: [PATCH 2/2] raspberrypi: don't print MAC in boot_out.txt The CYW43 may not be powered up yet when boot_out.txt is written, so the MAC can read as all zeros. Drop the line instead of powering the chip up early. Fixes #10777. Co-Authored-By: Claude Opus 5.5 --- ports/raspberrypi/supervisor/port.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index 5cceeafc736..d76029d53d7 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -696,16 +696,6 @@ void port_task_yield(void) { #endif } -void port_boot_info(void) { - #if CIRCUITPY_CYW43 - mp_printf(&mp_plat_print, "MAC"); - for (int i = 0; i < 6; i++) { - mp_printf(&mp_plat_print, ":%02X", cyw43_state.mac[i]); - } - mp_printf(&mp_plat_print, "\n"); - #endif -} - #if CIRCUITPY_BOOT_BUTTON_NO_GPIO bool __no_inline_not_in_flash_func(port_boot_button_pressed)(void) { // Sense the state of the boot button. Because this function