]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: cadence_qspi: Migrate CONFIG_CQSPI_REF_CLK to Kconfig
authorTom Rini <trini@konsulko.com>
Wed, 30 Mar 2022 22:07:23 +0000 (18:07 -0400)
committerTom Rini <trini@konsulko.com>
Fri, 8 Apr 2022 14:46:22 +0000 (10:46 -0400)
This is a little tricky since SoCFPGA has code to determine this as
runtime.  Introduce a guard variable for platforms to select if they
have a static value to use.  Then for ARCH_SOCFPGA, call
cm_get_qspi_controller_clk_hz() and otherwise continue the previous
behavior.

Cc: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
21 files changed:
arch/arm/mach-socfpga/misc_soc64.c
configs/j7200_evm_a72_defconfig
configs/j7200_evm_r5_defconfig
configs/j721e_evm_a72_defconfig
configs/j721e_evm_r5_defconfig
configs/j721e_hs_evm_a72_defconfig
configs/j721e_hs_evm_r5_defconfig
configs/j721s2_evm_a72_defconfig
configs/j721s2_evm_r5_defconfig
configs/k2g_evm_defconfig
configs/k2g_hs_evm_defconfig
configs/stv0991_defconfig
drivers/spi/Kconfig
drivers/spi/cadence_qspi.c
drivers/spi/cadence_qspi.h
include/configs/j721e_evm.h
include/configs/j721s2_evm.h
include/configs/k2g_evm.h
include/configs/socfpga_common.h
include/configs/socfpga_soc64_common.h
include/configs/stv0991.h

index 7b973a79e807f7e5574e996893cf44fed9453987..2acdfad07b35be6d583869b2e0587558596e04c5 100644 (file)
@@ -16,6 +16,7 @@
 #include <errno.h>
 #include <init.h>
 #include <log.h>
+#include <mach/clock_manager.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index eb1d7d46b82a8487a0c298f7c39202cd7c975958..3d0d1977ff99fb43bc68e4f271afde903349adf1 100644 (file)
@@ -173,6 +173,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=133333333
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
index e500a27bb692e8779b2208a2bc8a757544784a6b..0f4b006b80b5dfd6e8ef1c8e3434429d604dfee1 100644 (file)
@@ -134,6 +134,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=133333333
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
index 447967add2f27d620e38c3d203ead3b3ab475c9f..792a9021d773e6524a79385415405892fb49e922 100644 (file)
@@ -173,6 +173,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=133333333
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
index e6a5f99505615dec6c6415db6b60b91d5e96b460..6553212de85b03c5bd46a746b5b0f5038b065a39 100644 (file)
@@ -127,6 +127,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=133333333
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
index b468a4438eb53fa5fa8c6a102cadab942df25c74..8146af9732d48aa8833cceaf8e8f173b9a8a8387 100644 (file)
@@ -145,6 +145,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=133333333
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
index 1e4a93ff53fea26034b13abda6a36babd7e871ad..aaf3c2b5b0b4fb793830647c5c8f704392a0a36f 100644 (file)
@@ -114,6 +114,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=133333333
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
index 7e2bbc482d1d99e8a8adef9da7172ab5ad33ebfb..e0d124575c4b3ec34ecf1d3c0a08ad64b272b350 100644 (file)
@@ -181,6 +181,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=133333333
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
index 996efd4db2690bdb54b5c52ee8c6ea18ff9ed996..4147b4e26c7b0eed11de11e1c88c6f167d627ca8 100644 (file)
@@ -138,6 +138,8 @@ CONFIG_SOC_TI=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=133333333
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
index 440a76f443cca6ac67cad434ef7778c09bcab438..251a9824927c4df16119799a61dc91831fae9d2f 100644 (file)
@@ -89,6 +89,8 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=384000000
 CONFIG_DAVINCI_SPI=y
 CONFIG_USB=y
 CONFIG_DM_USB_GADGET=y
index 4137733c0fef379daa16c45da6f08bc77c915f4c..d89eb41b6b4fc164e7bb2f67f6a85109226274f9 100644 (file)
@@ -73,6 +73,8 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=384000000
 CONFIG_DAVINCI_SPI=y
 CONFIG_USB=y
 CONFIG_DM_USB_GADGET=y
index e8d8509608de6f309e98ae5983e05e8a269ad82a..d58d6c3c9c08164c3050a8942d2d1d9aca2b9c87 100644 (file)
@@ -39,3 +39,5 @@ CONFIG_PHY_RESET_DELAY=10000
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_MII=y
 CONFIG_CADENCE_QSPI=y
+CONFIG_HAS_CQSPI_REF_CLK=y
+CONFIG_CQSPI_REF_CLK=3000000
index 423a757141127ef03730f62c1b574ad1b417a65e..8dba95ae4ea6367c5f851d2f60935c66d0f9e0d8 100644 (file)
@@ -128,6 +128,14 @@ config CADENCE_QSPI
          used to access the SPI NOR flash on platforms embedding this
          Cadence IP core.
 
+config HAS_CQSPI_REF_CLK
+       bool "Cadence QSPI static reference clock"
+       depends on CADENCE_QSPI
+
+config CQSPI_REF_CLK
+       int "Cadence QSPI reference clock value in Hz"
+       depends on HAS_CQSPI_REF_CLK
+
 config CF_SPI
         bool "ColdFire SPI driver"
         help
index db680618ee9bb0f54f0857efa240463fd77e6b99..7209bb43a776c7d274cce270915973c85b146f38 100644 (file)
@@ -188,8 +188,10 @@ static int cadence_spi_probe(struct udevice *bus)
        if (plat->ref_clk_hz == 0) {
                ret = clk_get_by_index(bus, 0, &clk);
                if (ret) {
-#ifdef CONFIG_CQSPI_REF_CLK
+#ifdef CONFIG_HAS_CQSPI_REF_CLK
                        plat->ref_clk_hz = CONFIG_CQSPI_REF_CLK;
+#elif defined(CONFIG_ARCH_SOCFPGA)
+                       plat->ref_clk_hz = cm_get_qspi_controller_clk_hz();
 #else
                        return ret;
 #endif
index 19345cac5a04f698c01b5337cdbff9f52e0622ec..a2b620a5fe297592d48952fd59e0aee0619bbf63 100644 (file)
@@ -95,5 +95,6 @@ void cadence_qspi_apb_delay(void *reg_base,
 void cadence_qspi_apb_enter_xip(void *reg_base, char xip_dummy);
 void cadence_qspi_apb_readdata_capture(void *reg_base,
        unsigned int bypass, unsigned int delay);
+unsigned int cm_get_qspi_controller_clk_hz(void);
 
 #endif /* __CADENCE_QSPI_H__ */
index 5aaa31eaa152f3fb336bbaf99ea5ef2256c9403d..df3c16540ba3463e46cb4fed29ef1b617ed61846 100644 (file)
@@ -57,7 +57,6 @@
 #define CONFIG_SPL_MAX_SIZE            CONFIG_SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE
 
 #define CONFIG_SYS_BOOTM_LEN           SZ_64M
-#define CONFIG_CQSPI_REF_CLK           133333333
 
 /* HyperFlash related configuration */
 
index 87884649236afb169a116e4ac9536d88e5b16212..f0d56b8778eee02480f9017834f8398ccf8399a0 100644 (file)
@@ -58,7 +58,6 @@
 #define CONFIG_SPL_MAX_SIZE            CONFIG_SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE
 
 #define CONFIG_SYS_BOOTM_LEN           SZ_64M
-#define CONFIG_CQSPI_REF_CLK           133333333
 
 /* U-Boot general configuration */
 #define EXTRA_ENV_J721S2_BOARD_SETTINGS                                        \
index 294ce4662e2f0e0f01a6ebd3becbe9e59a012163..887fda90d6a0afa09a91ce2106d2e80b3c75e314 100644 (file)
 #define CONFIG_KSNET_MDIO_PHY_CONFIG_ENABLE
 #define PHY_ANEG_TIMEOUT       10000 /* PHY needs longer aneg time */
 
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_CQSPI_REF_CLK 384000000
-#endif
-
 #define SPI_MTD_PARTS  KEYSTONE_SPI1_MTD_PARTS
 
 #include <configs/ti_armv7_keystone2.h>
index e094bef3b50839588299bd619212b947331320f8..5ecd1e6399b4fe60969b15fc85fa0a4c33ca164f 100644 (file)
 #define CONFIG_SYS_NAND_DATA_BASE      SOCFPGA_NANDDATA_ADDRESS
 #endif
 
-/*
- * QSPI support
- */
-/* QSPI reference clock */
-#ifndef __ASSEMBLY__
-unsigned int cm_get_qspi_controller_clk_hz(void);
-#define CONFIG_CQSPI_REF_CLK           cm_get_qspi_controller_clk_hz()
-#endif
-
 /*
  * USB
  */
index b810567a03a11a3e48b64d37ade765c2bc0585c6..c288d548f5b4affa36c77085ebdb90c83eba6209 100644 (file)
 #define MTDIDS_DEFAULT                 "nor0=ff705000.spi.0"
 #endif /* CONFIG_SPL_BUILD */
 
-#ifndef __ASSEMBLY__
-unsigned int cm_get_qspi_controller_clk_hz(void);
-#define CONFIG_CQSPI_REF_CLK           cm_get_qspi_controller_clk_hz()
-#endif
-
 #endif /* CONFIG_CADENCE_QSPI */
 
 /*
index feec8695f2ee817371cd4bc5266cff5cf7ce7ebd..137672909bebd6474e6ed136fc3fa37d7e3be284 100644 (file)
 
 /* Misc configuration */
 
-/*
-+ * QSPI support
-+ */
-#ifdef CONFIG_OF_CONTROL               /* QSPI is controlled via DT */
-#define CONFIG_CQSPI_REF_CLK           ((30/4)/2)*1000*1000
-
-#endif
-
 #endif /* __CONFIG_H */