Skip to content

Commit f10906d

Browse files
MichaelBellGadgetoid
authored andcommitted
ports/rp2: Remove flash timing control from PSRAM.
Signed-off-by: Mike Bell <[email protected]>
1 parent 4c8f769 commit f10906d

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

ports/rp2/rp2_psram.c

-23
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,6 @@
66
#include "rp2_psram.h"
77

88

9-
void __no_inline_not_in_flash_func(psram_set_qmi_timing)() {
10-
// Make sure flash is deselected - QMI doesn't appear to have a busy flag(!)
11-
while ((ioqspi_hw->io[1].status & IO_QSPI_GPIO_QSPI_SS_STATUS_OUTTOPAD_BITS) != IO_QSPI_GPIO_QSPI_SS_STATUS_OUTTOPAD_BITS) {
12-
;
13-
}
14-
15-
// Use the minimum divisor assuming a 133MHz flash.
16-
// RX delay equal to the divisor means sampling at the same time as the next falling edge of SCK after the
17-
// falling edge that generated the data. This is pretty tight at 133MHz but seems to work with the Winbond flash chips.
18-
const int max_flash_freq = 133000000;
19-
const int divisor = (clock_get_hz(clk_sys) + max_flash_freq - 1) / max_flash_freq;
20-
const int rxdelay = divisor;
21-
qmi_hw->m[0].timing = (1 << QMI_M0_TIMING_COOLDOWN_LSB) |
22-
rxdelay << QMI_M1_TIMING_RXDELAY_LSB |
23-
divisor << QMI_M1_TIMING_CLKDIV_LSB;
24-
25-
// Force a read through XIP to ensure the timing is applied
26-
volatile uint32_t *ptr = (volatile uint32_t *)0x14000000;
27-
(void)*ptr;
28-
}
29-
309
size_t __no_inline_not_in_flash_func(psram_detect)() {
3110
int psram_size = 0;
3211

@@ -110,8 +89,6 @@ size_t __no_inline_not_in_flash_func(psram_init)(uint cs_pin) {
11089
return 0;
11190
}
11291

113-
psram_set_qmi_timing();
114-
11592
// Enable direct mode, PSRAM CS, clkdiv of 10.
11693
qmi_hw->direct_csr = 10 << QMI_DIRECT_CSR_CLKDIV_LSB | \
11794
QMI_DIRECT_CSR_EN_BITS | \

ports/rp2/rp2_psram.h

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#define PSRAM_LOCATION _u(0x11000000)
77

8-
extern void psram_set_qmi_timing();
98
extern size_t psram_init(uint cs_pin);
109

1110
#endif

0 commit comments

Comments
 (0)