diff options
author | Marek Vasut <marex@denx.de> | 2021-01-19 02:58:33 +0300 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2021-01-23 15:40:29 +0300 |
commit | 38b92ca196adbc257c4e777a2e270df9537d8890 (patch) | |
tree | 83ccbbeec3ac3aed2d37783eccd200dd0f0bea53 /drivers/spi/mxc_spi.c | |
parent | 6cd4f48b64d4b9a4f737c2aa4e6550d2eb8c80a5 (diff) | |
download | u-boot-38b92ca196adbc257c4e777a2e270df9537d8890.tar.xz |
spi: imx: Use clock framework if enabled
In case the clock framework is enabled, enable the SPI controller clock
and obtain max frequency from the clock framework.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers/spi/mxc_spi.c')
-rw-r--r-- | drivers/spi/mxc_spi.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index c61ab74edc..553a0315df 100644 --- a/drivers/spi/mxc_spi.c +++ b/drivers/spi/mxc_spi.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <clk.h> #include <dm.h> #include <log.h> #include <malloc.h> @@ -617,8 +618,19 @@ static int mxc_spi_probe(struct udevice *bus) if (mxcs->base == FDT_ADDR_T_NONE) return -ENODEV; +#if CONFIG_IS_ENABLED(CLK) + struct clk clk; + ret = clk_get_by_index(bus, 0, &clk); + if (ret) + return ret; + + clk_enable(&clk); + + mxcs->max_hz = clk_get_rate(&clk); +#else mxcs->max_hz = fdtdec_get_int(blob, node, "spi-max-frequency", 20000000); +#endif return 0; } |