Skip to content

Commit

Permalink
ports/rp2: Remove flash timing control from PSRAM.
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Bell <[email protected]>
  • Loading branch information
MichaelBell authored and Gadgetoid committed Sep 26, 2024
1 parent 9fb4fe4 commit 4dc5626
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
23 changes: 0 additions & 23 deletions ports/rp2/rp2_psram.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,6 @@
#include "rp2_psram.h"


void __no_inline_not_in_flash_func(psram_set_qmi_timing)() {
// Make sure flash is deselected - QMI doesn't appear to have a busy flag(!)
while ((ioqspi_hw->io[1].status & IO_QSPI_GPIO_QSPI_SS_STATUS_OUTTOPAD_BITS) != IO_QSPI_GPIO_QSPI_SS_STATUS_OUTTOPAD_BITS) {
;
}

// Use the minimum divisor assuming a 133MHz flash.
// RX delay equal to the divisor means sampling at the same time as the next falling edge of SCK after the
// falling edge that generated the data. This is pretty tight at 133MHz but seems to work with the Winbond flash chips.
const int max_flash_freq = 133000000;
const int divisor = (clock_get_hz(clk_sys) + max_flash_freq - 1) / max_flash_freq;
const int rxdelay = divisor;
qmi_hw->m[0].timing = (1 << QMI_M0_TIMING_COOLDOWN_LSB) |
rxdelay << QMI_M1_TIMING_RXDELAY_LSB |
divisor << QMI_M1_TIMING_CLKDIV_LSB;

// Force a read through XIP to ensure the timing is applied
volatile uint32_t *ptr = (volatile uint32_t *)0x14000000;
(void)*ptr;
}

size_t __no_inline_not_in_flash_func(psram_detect)() {
int psram_size = 0;

Expand Down Expand Up @@ -110,8 +89,6 @@ size_t __no_inline_not_in_flash_func(psram_init)(uint cs_pin) {
return 0;
}

psram_set_qmi_timing();

// Enable direct mode, PSRAM CS, clkdiv of 10.
qmi_hw->direct_csr = 10 << QMI_DIRECT_CSR_CLKDIV_LSB | \
QMI_DIRECT_CSR_EN_BITS | \
Expand Down
1 change: 0 additions & 1 deletion ports/rp2/rp2_psram.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#define PSRAM_LOCATION _u(0x11000000)

extern void psram_set_qmi_timing();
extern size_t psram_init(uint cs_pin);

#endif

0 comments on commit 4dc5626

Please sign in to comment.