Skip to content

Commit 273fdf5

Browse files
committed
machine/rp2350: fix the ROM CS control for RP2350 ROM code
Remove support for A0 & A1 versions of RP2350
1 parent d9d19e8 commit 273fdf5

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

src/machine/machine_rp2350_rom.go

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,7 @@ static bool pico_processor_state_is_nonsecure(void) {
155155
156156
#define BOOTROM_FUNC_TABLE_OFFSET 0x14
157157
158-
// todo remove this (or #ifdef it for A1/A2)
159-
#define BOOTROM_IS_A2() ((*(volatile uint8_t *)0x13) == 2)
160-
#define BOOTROM_WELL_KNOWN_PTR_SIZE (BOOTROM_IS_A2() ? 2 : 4)
158+
#define BOOTROM_WELL_KNOWN_PTR_SIZE 2
161159
162160
#define BOOTROM_VTABLE_OFFSET 0x00
163161
#define BOOTROM_TABLE_LOOKUP_OFFSET (BOOTROM_FUNC_TABLE_OFFSET + BOOTROM_WELL_KNOWN_PTR_SIZE)
@@ -229,11 +227,12 @@ void reset_usb_boot(uint32_t usb_activity_gpio_pin_mask, uint32_t disable_interf
229227
// https://github.com/raspberrypi/pico-sdk
230228
// src/rp2350/hardware_regs/include/hardware/regs/qmi.h
231229
232-
#define QMI_DIRECT_CSR_EN_BITS 0x00000001
233-
#define QMI_DIRECT_CSR_RXEMPTY_BITS 0x00010000
234-
#define QMI_DIRECT_CSR_TXFULL_BITS 0x00000400
235-
#define QMI_M1_WFMT_RESET 0x00001000
236-
#define QMI_M1_WCMD_RESET 0x0000a002
230+
#define QMI_DIRECT_CSR_EN_BITS 0x00000001
231+
#define QMI_DIRECT_CSR_ASSERT_CS0N_BITS 0x00000004
232+
#define QMI_DIRECT_CSR_RXEMPTY_BITS 0x00010000
233+
#define QMI_DIRECT_CSR_TXFULL_BITS 0x00000400
234+
#define QMI_M1_WFMT_RESET 0x00001000
235+
#define QMI_M1_WCMD_RESET 0x0000a002
237236
238237
239238
// https://github.com/raspberrypi/pico-sdk
@@ -406,13 +405,11 @@ static ram_func void flash_rp2350_restore_qmi_cs1(const flash_rp2350_qmi_save_st
406405
}
407406
408407
void ram_func flash_cs_force(bool high) {
409-
uint32_t field_val = high ?
410-
IO_QSPI_GPIO_QSPI_SS_CTRL_OUTOVER_VALUE_HIGH :
411-
IO_QSPI_GPIO_QSPI_SS_CTRL_OUTOVER_VALUE_LOW;
412-
hw_write_masked(&io_qspi_hw->io[1].ctrl,
413-
field_val << IO_QSPI_GPIO_QSPI_SS_CTRL_OUTOVER_LSB,
414-
IO_QSPI_GPIO_QSPI_SS_CTRL_OUTOVER_BITS
415-
);
408+
if (high) {
409+
hw_clear_bits(&qmi_hw->direct_csr, QMI_DIRECT_CSR_ASSERT_CS0N_BITS);
410+
} else {
411+
hw_set_bits(&qmi_hw->direct_csr, QMI_DIRECT_CSR_ASSERT_CS0N_BITS);
412+
}
416413
}
417414
418415
// Adapted from flash_range_program()

0 commit comments

Comments
 (0)