imx8m: clock_imx8mq: Add the ecspi clocks
Subsystems (3)
PATCH v2 1/1 imx8m: clock_imx8mq: Add the ecspi clocks
Enable the clocks for spi buses 1 through 3
---
Changes since v1:
added MXC_CSPI_CLK to ECSPI1_CLK_ROOT mapping
arch/arm/include/asm/arch-imx8m/imx-regs.h | 9 +++++ arch/arm/mach-imx/imx8m/clock_imx8mq.c | 40 ++++++++++++++++++++++ 2 files changed, 49 insertions(+)
arch/arm/include/asm/arch-imx8m/imx-regs.h +9 -0
@@ -94,6 +94,15 @@#define SRC_DDR1_RCR_CORE_RESET_N_MASK BIT(1)#define SRC_DDR1_RCR_PRESET_N_MASK BIT(0) +#define IMX_CSPI1_BASE 0x30820000 +#define IMX_CSPI2_BASE 0x30830000 +#define IMX_CSPI3_BASE 0x30840000 + +#define MXC_SPI_BASE_ADDRESSES \ + IMX_CSPI1_BASE, \ + IMX_CSPI2_BASE, \ + IMX_CSPI3_BASE +struct iomuxc_gpr_base_regs {u32 gpr[47 ]; };
arch/arm/mach-imx/imx8m/clock_imx8mq.c +40 -0
@@ -359,6 +359,8 @@ unsigned int mxc_get_clock(enum mxc_clock clk)clock_get_target_val (IPG_CLK_ROOT , &val); val = val &0x3 ;return get_root_clk (AHB_CLK_ROOT ) / (val +1 ); +case MXC_CSPI_CLK : +return get_root_clk (ECSPI1_CLK_ROOT );case MXC_ESDHC_CLK :return get_root_clk (USDHC1_CLK_ROOT );case MXC_ESDHC2_CLK :
@@ -505,6 +507,31 @@ int set_clk_qspi(void)return 0 ; } +int set_clk_ecspi (int sel) +{ +int clk =ECSPI1_CLK_ROOT ; + +switch (sel) { +case 1 : + clk =ECSPI1_CLK_ROOT ; +break ; +case 2 : + clk =ECSPI2_CLK_ROOT ; +break ; +case 3 : + clk =ECSPI3_CLK_ROOT ; +break ; + } + +clock_enable (clk,0 ); +/* +* TODO: configure clock +*/ +clock_enable (clk,1 ); + +return 0 ; +} +#ifdef CONFIG_FEC_MXC int set_clk_enet (enum enet_freq type) {
@@ -772,6 +799,19 @@ int clock_init(void)clock_enable (CCGR_TSENSOR ,1 );clock_enable (CCGR_OCOTP ,1 ); +/* +* set ecspi roots +*/ +clock_enable (CCGR_ECSPI1 ,0 ); +clock_enable (CCGR_ECSPI2 ,0 ); +clock_enable (CCGR_ECSPI3 ,0 ); +clock_set_target_val (ECSPI1_CLK_ROOT ,CLK_ROOT_ON |CLK_ROOT_SOURCE_SEL (0 )); +clock_set_target_val (ECSPI2_CLK_ROOT ,CLK_ROOT_ON |CLK_ROOT_SOURCE_SEL (0 )); +clock_set_target_val (ECSPI3_CLK_ROOT ,CLK_ROOT_ON |CLK_ROOT_SOURCE_SEL (0 )); +clock_enable (CCGR_ECSPI1 ,1 ); +clock_enable (CCGR_ECSPI2 ,1 ); +clock_enable (CCGR_ECSPI3 ,1 ); +/* config GIC ROOT to sys_pll2_200m */ clock_enable (CCGR_GIC ,0 ); clock_set_target_val(GIC_CLK_ROOT,
Signature · 1 line
2.25.1
Quoted 5 lines · Angus Ainslie
Enable the clocks for spi buses 1 through 3
Signed-off-by Angus Ainslie <[email protected]>---
Quoted 7 lines
Changes since v1:
added
MXC_CSPI_CLKtoECSPI1_CLK_ROOTmappingarch/arm/include/asm/arch-imx8m/imx-regs.h | 9 +++++ arch/arm/mach-imx/imx8m/clock_imx8mq.c | 40 ++++++++++++++++++++++ 2 files changed, 49 insertions(+)
Shouldn't all this come from DT ?
Hi Marek,
Quoted 8 lines · Marek Vasut
Quoted 7 lines · Angus Ainslie
Enable the clocks for spi buses 1 through 3
Signed-off-by Angus Ainslie <[email protected]>---
Changes since v1:
Quoted 8 lines
Quoted 6 lines
added
MXC_CSPI_CLKtoECSPI1_CLK_ROOTmappingarch/arm/include/asm/arch-imx8m/imx-regs.h | 9 +++++ arch/arm/mach-imx/imx8m/clock_imx8mq.c | 40 ++++++++++++++++++++++ 2 files changed, 49 insertions(+)Shouldn't all this come from DT ?
This is used in the SPL.
The imx8mq also doesn't have a DM clock driver.
Thanks
Angus
Quoted 1 line · Angus Ainslie
Hi Marek,
Hi,
Quoted 15 lines · Marek Vasut
Quoted 14 lines · Angus Ainslie
Quoted 12 lines
Enable the clocks for spi buses 1 through 3
Signed-off-by Angus Ainslie <[email protected]>---
Changes since v1:
added
MXC_CSPI_CLKtoECSPI1_CLK_ROOTmapping
arch/arm/include/asm/arch-imx8m/imx-regs.h| 9 +++++ arch/arm/mach-imx/imx8m/clock_imx8mq.c | 40 ++++++++++++++++++++++2 files changed, 49 insertions(+)
Quoted 5 lines
Quoted 1 line
Shouldn't all this come from DT ?
This is used in the SPL.
The imx8mq also doesn't have a DM clock driver.
Hmm, would it be possible to take one of the other Ms clock drivers, fork it into MQ one, and fill in the tables from Linux, thus creating the missing MQ clock driver?
Quoted 19 lines · Marek Vasut
Quoted 18 lines · Angus Ainslie
Quoted 16 lines · Marek Vasut
Quoted 5 lines · Angus Ainslie
Enable the clocks for spi buses 1 through 3
Signed-off-by Angus Ainslie <[email protected]>---
Quoted 8 lines
Changes since v1:
added
MXC_CSPI_CLKtoECSPI1_CLK_ROOTmapping
arch/arm/include/asm/arch-imx8m/imx-regs.h| 9 +++++ arch/arm/mach-imx/imx8m/clock_imx8mq.c | 40
++++++++++++++++++++++2 files changed, 49 insertions(+)Shouldn't all this come from DT ?
Quoted 7 lines
Quoted 3 lines
This is used in the SPL.
The imx8mq also doesn't have a DM clock driver.
Hmm, would it be possible to take one of the other Ms clock drivers, fork it into MQ one, and fill in the tables from Linux, thus creating the missing MQ clock driver?
I've begun working on that as well. I'll send the patches once I get Linux to boot.
Quoted 22 lines · Angus Ainslie
Quoted 21 lines · Marek Vasut
Quoted 20 lines · Angus Ainslie
Quoted 8 lines · Marek Vasut
Quoted 7 lines · Angus Ainslie
Enable the clocks for spi buses 1 through 3
Signed-off-by Angus Ainslie <[email protected]>---
Changes since v1:
Quoted 8 lines
Quoted 6 lines
added
MXC_CSPI_CLKtoECSPI1_CLK_ROOTmapping
arch/arm/include/asm/arch-imx8m/imx-regs.h| 9 +++++ arch/arm/mach-imx/imx8m/clock_imx8mq.c | 40
++++++++++++++++++++++2 files changed, 49 insertions(+)Shouldn't all this come from DT ?
This is used in the SPL.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
The imx8mq also doesn't have a DM clock driver.
Hmm, would it be possible to take one of the other Ms clock drivers, fork it into MQ one, and fill in the tables from Linux, thus creating the missing MQ clock driver?
I've begun working on that as well. I'll send the patches once I get Linux to boot.
Thanks
Does it make sense to wait with this patch for after 2022.04 , when it might not be needed ?
I'll let Stefano decide ...
Quoted 29 lines · Marek Vasut
Quoted 28 lines · Angus Ainslie
Quoted 26 lines · Marek Vasut
Quoted 16 lines · Angus Ainslie
Quoted 15 lines · Marek Vasut
Quoted 13 lines · Angus Ainslie
Enable the clocks for spi buses 1 through 3
Signed-off-by Angus Ainslie <[email protected]>---
Changes since v1:
added
MXC_CSPI_CLKtoECSPI1_CLK_ROOTmapping
arch/arm/include/asm/arch-imx8m/imx-regs.h| 9 +++++ arch/arm/mach-imx/imx8m/clock_imx8mq.c | 40
++++++++++++++++++++++2 files changed, 49 insertions(+)Quoted 5 lines
Quoted 1 line
Shouldn't all this come from DT ?
This is used in the SPL.
The imx8mq also doesn't have a DM clock driver.
Hmm, would it be possible to take one of the other Ms clock drivers, fork it into MQ one, and fill in the tables from Linux, thus creating the missing MQ clock driver?
Quoted 8 lines
Quoted 1 line
I've begun working on that as well. I'll send the patches once I get Linux to boot.
Thanks
Does it make sense to wait with this patch for after 2022.04 , when it might not be needed ?
I'll let Stefano decide ...
Ok, I'm not sure why it should get held back as it fixes ECSPI initialization and use in the SPL.
Quoted 32 lines · Angus Ainslie
Quoted 31 lines · Marek Vasut
Quoted 29 lines · Angus Ainslie
Quoted 19 lines · Marek Vasut
Quoted 18 lines · Angus Ainslie
Quoted 16 lines · Marek Vasut
Quoted 5 lines · Angus Ainslie
Enable the clocks for spi buses 1 through 3
Signed-off-by Angus Ainslie <[email protected]>---
Quoted 8 lines
Changes since v1:
added
MXC_CSPI_CLKtoECSPI1_CLK_ROOTmapping
arch/arm/include/asm/arch-imx8m/imx-regs.h| 9 +++++ arch/arm/mach-imx/imx8m/clock_imx8mq.c | 40
++++++++++++++++++++++2 files changed, 49 insertions(+)Shouldn't all this come from DT ?
Quoted 7 lines
Quoted 3 lines
This is used in the SPL.
The imx8mq also doesn't have a DM clock driver.
Hmm, would it be possible to take one of the other Ms clock drivers, fork it into MQ one, and fill in the tables from Linux, thus creating the missing MQ clock driver?
I've begun working on that as well. I'll send the patches once I get Linux to boot.
Quoted 8 lines
Quoted 6 lines
Thanks
Does it make sense to wait with this patch for after 2022.04 , when it might not be needed ?
I'll let Stefano decide ...
Ok, I'm not sure why it should get held back as it fixes ECSPI initialization and use in the SPL.
It also enables extra clock unconditionally and there is this "TODO" right in the middle of the patch.
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Angus Ainslie
Quoted 33 lines · Marek Vasut
Quoted 22 lines · Angus Ainslie
Quoted 21 lines · Marek Vasut
Quoted 20 lines · Angus Ainslie
Quoted 8 lines · Marek Vasut
Quoted 7 lines · Angus Ainslie
Enable the clocks for spi buses 1 through 3
Signed-off-by Angus Ainslie <[email protected]>---
Changes since v1:
Quoted 8 lines
Quoted 6 lines
added
MXC_CSPI_CLKtoECSPI1_CLK_ROOTmapping
arch/arm/include/asm/arch-imx8m/imx-regs.h| 9 +++++ arch/arm/mach-imx/imx8m/clock_imx8mq.c | 40
++++++++++++++++++++++2 files changed, 49 insertions(+)Shouldn't all this come from DT ?
This is used in the SPL.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
The imx8mq also doesn't have a DM clock driver.
Hmm, would it be possible to take one of the other Ms clock drivers, fork it into MQ one, and fill in the tables from Linux, thus creating the missing MQ clock driver?
I've begun working on that as well. I'll send the patches once I get Linux to boot.
Thanks
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Does it make sense to wait with this patch for after 2022.04 , when it might not be needed ?
I'll let Stefano decide ...
Ok, I'm not sure why it should get held back as it fixes ECSPI initialization and use in the SPL.
It also enables extra clock unconditionally and there is this "TODO" right in the middle of the patch.
Right, I agree.
Regards,
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================