summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mauderer <christian.mauderer@embedded-brains.de>2020-03-30 16:38:22 +0200
committerChristian Mauderer <christian.mauderer@embedded-brains.de>2020-04-15 16:13:07 +0200
commit01219541289e8081054d4a57924ee169339f1eaf (patch)
tree98642528db4df219f5e3c29794c2a20730db8b32
parentd007cc2ceef48ce47c157512370c1bf2c45596f3 (diff)
downloadrtems-01219541289e8081054d4a57924ee169339f1eaf.tar.bz2
bsp/imx: Add an extra ecspi clock.
Some imx chips or boards don't use the same frequency for ECSPI and IPG. Update #3869
-rw-r--r--bsps/arm/imx/include/arm/freescale/imx/imx_ccmvar.h3
-rw-r--r--bsps/arm/imx/spi/imx-ecspi.c2
-rw-r--r--bsps/arm/imx/start/ccm.c5
-rw-r--r--c/src/lib/libbsp/arm/imx/configure.ac3
4 files changed, 12 insertions, 1 deletions
diff --git a/bsps/arm/imx/include/arm/freescale/imx/imx_ccmvar.h b/bsps/arm/imx/include/arm/freescale/imx/imx_ccmvar.h
index 5633de6f50..0f19d80813 100644
--- a/bsps/arm/imx/include/arm/freescale/imx/imx_ccmvar.h
+++ b/bsps/arm/imx/include/arm/freescale/imx/imx_ccmvar.h
@@ -48,6 +48,9 @@ uint32_t imx_ccm_perclk_hz(void);
uint32_t imx_ccm_sdhci_hz(void);
uint32_t imx_ccm_uart_hz(void);
uint32_t imx_ccm_ahb_hz(void);
+#ifdef __rtems__
+uint32_t imx_ccm_ecspi_hz(void);
+#endif /* __rtems__ */
#ifndef __rtems__
void imx_ccm_usb_enable(device_t _usbdev);
diff --git a/bsps/arm/imx/spi/imx-ecspi.c b/bsps/arm/imx/spi/imx-ecspi.c
index 4c4978cdac..a18047f2e0 100644
--- a/bsps/arm/imx/spi/imx-ecspi.c
+++ b/bsps/arm/imx/spi/imx-ecspi.c
@@ -435,7 +435,7 @@ int spi_bus_register_imx(const char *bus_path, const char *alias_or_path)
return -1;
}
- bus->base.max_speed_hz = imx_ccm_ipg_hz();
+ bus->base.max_speed_hz = imx_ccm_ecspi_hz();
bus->base.delay_usecs = 1;
bus->regs = imx_get_reg_of_node(fdt, node);
bus->irq = imx_get_irq_of_node(fdt, node, 0);
diff --git a/bsps/arm/imx/start/ccm.c b/bsps/arm/imx/start/ccm.c
index cc93dcbd5d..3487470357 100644
--- a/bsps/arm/imx/start/ccm.c
+++ b/bsps/arm/imx/start/ccm.c
@@ -27,6 +27,11 @@ uint32_t imx_ccm_uart_hz(void)
return IMX_CCM_UART_HZ;
}
+uint32_t imx_ccm_ecspi_hz(void)
+{
+ return IMX_CCM_ECSPI_HZ;
+}
+
uint32_t imx_ccm_ahb_hz(void)
{
return IMX_CCM_AHB_HZ;
diff --git a/c/src/lib/libbsp/arm/imx/configure.ac b/c/src/lib/libbsp/arm/imx/configure.ac
index aa119b9236..fbb9d9278a 100644
--- a/c/src/lib/libbsp/arm/imx/configure.ac
+++ b/c/src/lib/libbsp/arm/imx/configure.ac
@@ -43,6 +43,9 @@ RTEMS_BSPOPTS_HELP([IMX_CCM_IPG_HZ],[IPG clock frequency in Hz])
RTEMS_BSPOPTS_SET([IMX_CCM_UART_HZ],[*],[24000000])
RTEMS_BSPOPTS_HELP([IMX_CCM_UART_HZ],[UART clock frequency in Hz])
+RTEMS_BSPOPTS_SET([IMX_CCM_ECSPI_HZ],[*],[67500000])
+RTEMS_BSPOPTS_HELP([IMX_CCM_ECSPI_HZ],[ECSPI clock frequency in Hz])
+
RTEMS_BSPOPTS_SET([IMX_CCM_AHB_HZ],[*],[135000000])
RTEMS_BSPOPTS_HELP([IMX_CCM_AHB_HZ],[AHB clock frequency in Hz])