]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Fix wrong QSPI clock calculation for AM4372
authorStefan Mätje <stefan.maetje@esd.eu>
Tue, 30 Nov 2021 00:06:56 +0000 (01:06 +0100)
committerTom Rini <trini@konsulko.com>
Sun, 16 Jan 2022 13:31:03 +0000 (08:31 -0500)
On AM4372 the SPI_GCLK input gets its clock from the PRCM module which
divides the PER_CLKOUTM2 frequency (192MHz) by a fixed factor of 4.
See AM437x Reference Manual in section 27 QSPI >> 27.2 Integration.

The QSPI_FCLK therefore needs to take this factor into account and
becomes (192000000 / 4).

Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
drivers/spi/ti_qspi.c

index c542f40c7df674ee8318431e5b6920ae94f18b17..99acb108823edb222d1954790f11b15d6f19f27a 100644 (file)
@@ -30,7 +30,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 /* ti qpsi register bit masks */
 #define QSPI_TIMEOUT                    2000000
-#define QSPI_FCLK                      192000000
+/* AM4372: QSPI gets SPI_GCLK from PRCM unit as PER_CLKOUTM2 divided by 4. */
+#define QSPI_FCLK                       (192000000 / 4)
 #define QSPI_DRA7XX_FCLK                76800000
 #define QSPI_WLEN_MAX_BITS             128
 #define QSPI_WLEN_MAX_BYTES            (QSPI_WLEN_MAX_BITS >> 3)