i.MX early debug UART clock fixes
Subsystems (3)
v2 cover i.MX early debug UART clock fixes
This series fixes a long standing interaction issue between the kernels early debug facilities and the i.MX clock drivers.
Both earlyprintk and earlycon rely on the bootloader setup clocks for the UARTs to be retained during kernel init. As those clocks are only enabled in hardware, but not referenced in software they (or even their parent clocks) may get disabled as a result of other clocks being en-/disabled during boot.
This results in missing messages from the early debug console until the regular system console takes over, or even worse system hangs in response to unclocked register accesses. This renders those debugging facilities a lot less useful.
The fix implemented here is to check if any of this early debugging is enabled and keep the UART clocks referenced and enabled in that case. The clocks will then only be disabled at the end of kernel init, at which point the real console should have taken over and the early outputs being disabled.
I've runtime tested this on i.MX6Q and i.MX53, other platforms are only compile tested. This is mostly a mechanical change, but still I would appreciate some testing.
Changes since v1:
- reworked logic to require significantly less code in the individual clock drivers
Regards,
Lucas
Lucas Stach (8):
clk: imx: add common logic to detect early UART usage
clk: imx25: retain early UART clocks during kernel init
clk: imx27: retain early UART clocks during kernel init
clk: imx31: retain early UART clocks during kernel init
clk: imx35: retain early UART clocks during kernel init
clk: imx5: retain early UART clocks during kernel init
clk: imx6: retain early UART clocks during kernel init
clk: imx7d: retain early UART clocks during kernel init
drivers/clk/imx/clk-imx25.c | 10 +++++++++ drivers/clk/imx/clk-imx27.c | 11 ++++++++++ drivers/clk/imx/clk-imx31.c | 10 +++++++++ drivers/clk/imx/clk-imx35.c | 8 +++++++ drivers/clk/imx/clk-imx51-imx53.c | 14 ++++++++++++ drivers/clk/imx/clk-imx6q.c | 6 +++++ drivers/clk/imx/clk-imx6sl.c | 6 +++++ drivers/clk/imx/clk-imx6sx.c | 6 +++++ drivers/clk/imx/clk-imx7d.c | 11 ++++++++++ drivers/clk/imx/clk.c | 46 +++++++++++++++++++++++++++++++++++++++ drivers/clk/imx/clk.h | 1 + 11 files changed, 129 insertions(+)
Signature · 1 line
2.5.0
PATCH v2 1/8 clk: imx: add common logic to detect early UART usage
Both earlycon and eralyprintk depend on the bootloader setup UART clocks being retained. This patch adds the common logic to detect such situations and make the information available to the clock drivers, as well as adding the facilities to disable those clocks at the end of the kernel init.
--- drivers/clk/imx/clk.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/clk/imx/clk.h | 1 + 2 files changed, 47 insertions(+)
drivers/clk/imx/clk.c +46 -0
@@ -73,3 +73,49 @@ void imx_cscmr1_fixup(u32 *val) *val ^=CSCMR1_FIXUP ;return ; } + +static int __initdata imx_keep_uart_clocks; +static struct clk __initdata ***imx_uart_clocks; + +static int __init imx_keep_uart_clocks_param (char *str) +{ + imx_keep_uart_clocks =1 ; + +return 0 ; +} +__setup_param ("earlycon" , imx_keep_uart_earlycon, + imx_keep_uart_clocks_param,0 ); +__setup_param ("earlyprintk" , imx_keep_uart_earlyprintk, + imx_keep_uart_clocks_param,0 ); + +void __init imx_register_uart_clocks (struct clk **clks[]) +{ +if (imx_keep_uart_clocks) { +int i; + + imx_uart_clocks = clks; +for (i =0 ;; i++) { +if (imx_uart_clocks[i]) +clk_prepare_enable (*imx_uart_clocks[i]); +else +break ; + } + } +} + +static int __init imx_clk_disable_uart (void ) +{ +if (imx_keep_uart_clocks) { +int i; + +for (i =0 ;; i++) { +if (imx_uart_clocks[i]) +clk_disable_unprepare (*imx_uart_clocks[i]); +else +break ; + } + } + +return 0 ; +} +late_initcall_sync (imx_clk_disable_uart);
drivers/clk/imx/clk.h +1 -0
@@ -7,6 +7,7 @@extern spinlock_t imx_ccm_lock;void imx_check_clocks (struct clk *clks[],unsigned int count); +void imx_register_uart_clocks (struct clk **clks[]);extern void imx_cscmr1_fixup (u32 *val);
Signature · 1 line
2.5.0
PATCH v2 1/8 clk: imx: add common logic to detect early UART usage
Quoted 17 lines · Lucas Stach
Both earlycon and eralyprintk depend on the bootloader setup UART clocks being retained. This patch adds the common logic to detect such situations and make the information available to the clock drivers, as well as adding the facilities to disable those clocks at the end of the kernel init.
Signed-off-by Lucas Stach <[email protected]>--- drivers/clk/imx/clk.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/clk/imx/clk.h | 1 + 2 files changed, 47 insertions(+)drivers/clk/imx/clk.c +0
-0
drivers/clk/imx/clk.c void imx_cscmr1_fixup(u32 *val) · line 77
Quoted 5 lines
drivers/clk/imx/clk.c +2
-0@@ -73,3 +73,49 @@ void imx_cscmr1_fixup(u32 *val) *val ^=CSCMR1_FIXUP ;return ; } + +static int __initdata imx_keep_uart_clocks;
This gives a checkpatch warning as below.
WARNING: __initdata should be placed after imx_keep_uart_clocks #27: FILE: drivers/clk/imx/clk.c:77:
+static int __initdata imx_keep_uart_clocks;
Shawn
Quoted 59 lines
drivers/clk/imx/clk.c +44
-0+static struct clk __initdata ***imx_uart_clocks; + +static int __init imx_keep_uart_clocks_param (char *str) +{ + imx_keep_uart_clocks =1 ; + +return 0 ; +} +__setup_param ("earlycon" , imx_keep_uart_earlycon, + imx_keep_uart_clocks_param,0 ); +__setup_param ("earlyprintk" , imx_keep_uart_earlyprintk, + imx_keep_uart_clocks_param,0 ); + +void __init imx_register_uart_clocks (struct clk **clks[]) +{ +if (imx_keep_uart_clocks) { +int i; + + imx_uart_clocks = clks; +for (i =0 ;; i++) { +if (imx_uart_clocks[i]) +clk_prepare_enable (*imx_uart_clocks[i]); +else +break ; + } + } +} + +static int __init imx_clk_disable_uart (void ) +{ +if (imx_keep_uart_clocks) { +int i; + +for (i =0 ;; i++) { +if (imx_uart_clocks[i]) +clk_disable_unprepare (*imx_uart_clocks[i]); +else +break ; + } + } + +return 0 ; +} +late_initcall_sync (imx_clk_disable_uart);drivers/clk/imx/clk.h +1
-0@@ -7,6 +7,7 @@extern spinlock_t imx_ccm_lock;void imx_check_clocks (struct clk *clks[],unsigned int count); +void imx_register_uart_clocks (struct clk **clks[]);extern void imx_cscmr1_fixup (u32 *val);Signature · 1 line
2.5.0
PATCH v2 1/8 clk: imx: add common logic to detect early UART usage
In reply to Lucas StachHello Lucas,
Quoted 26 lines · Lucas Stach
Both earlycon and eralyprintk depend on the bootloader setup UART clocks being retained. This patch adds the common logic to detect such situations and make the information available to the clock drivers, as well as adding the facilities to disable those clocks at the end of the kernel init.
Signed-off-by Lucas Stach <[email protected]>--- drivers/clk/imx/clk.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/clk/imx/clk.h | 1 + 2 files changed, 47 insertions(+)drivers/clk/imx/clk.c +6
-0@@ -73,3 +73,49 @@ void imx_cscmr1_fixup(u32 *val) *val ^=CSCMR1_FIXUP ;return ; } + +static int __initdata imx_keep_uart_clocks; +static struct clk __initdata ***imx_uart_clocks; + +static int __init imx_keep_uart_clocks_param (char *str) +{
drivers/clk/imx/clk.c void imx_cscmr1_fixup(u32 *val) · line 91
Quoted 10 lines
drivers/clk/imx/clk.c +10
-0+ imx_keep_uart_clocks =1 ; + +return 0 ; +} +__setup_param ("earlycon" , imx_keep_uart_earlycon, + imx_keep_uart_clocks_param,0 ); +__setup_param ("earlyprintk" , imx_keep_uart_earlyprintk, + imx_keep_uart_clocks_param,0 ); + +void __init imx_register_uart_clocks (struct clk **clks[])
const struct clk **clks[]?
I wonder why you need an array of pointers to pointers of clocks. Isn't one indirection less possible and more easy?
drivers/clk/imx/clk.c void imx_cscmr1_fixup(u32 *val) · line 102
Quoted 11 lines
drivers/clk/imx/clk.c +11
-0+{ +if (imx_keep_uart_clocks) { +int i; + + imx_uart_clocks = clks; +for (i =0 ;; i++) { +if (imx_uart_clocks[i]) +clk_prepare_enable (*imx_uart_clocks[i]); +else +break ; + }
I would have written this as:
for (i = 0; imx_uart_clocks[i]; ++i) clk_prepare_enable(*imx_uart_clocks[i]);
but I guess that's a matter of taste.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v2 1/8 clk: imx: add common logic to detect early UART usage
Am Montag, den 07.09.2015, 11:06 +0200 schrieb Uwe Kleine-K?nig:
Quoted 33 lines
Hello Lucas,
Quoted 30 lines · Lucas Stach
Both earlycon and eralyprintk depend on the bootloader setup UART clocks being retained. This patch adds the common logic to detect such situations and make the information available to the clock drivers, as well as adding the facilities to disable those clocks at the end of the kernel init.
Signed-off-by Lucas Stach <[email protected]>--- drivers/clk/imx/clk.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/clk/imx/clk.h | 1 + 2 files changed, 47 insertions(+)drivers/clk/imx/clk.c +10
-0@@ -73,3 +73,49 @@ void imx_cscmr1_fixup(u32 *val) *val ^=CSCMR1_FIXUP ;return ; } + +static int __initdata imx_keep_uart_clocks; +static struct clk __initdata ***imx_uart_clocks; + +static int __init imx_keep_uart_clocks_param (char *str) +{ + imx_keep_uart_clocks =1 ; + +return 0 ; +}
Quoted 9 lines
drivers/clk/imx/clk.c void imx_cscmr1_fixup(u32 *val) · line 91
Quoted 6 lines
drivers/clk/imx/clk.c +6
-0+__setup_param ("earlycon" , imx_keep_uart_earlycon, + imx_keep_uart_clocks_param,0 ); +__setup_param ("earlyprintk" , imx_keep_uart_earlyprintk, + imx_keep_uart_clocks_param,0 ); + +void __init imx_register_uart_clocks (struct clk **clks[])const struct clk **clks[]?
Yep, will do.
Quoted 3 lines
I wonder why you need an array of pointers to pointers of clocks. Isn't one indirection less possible and more easy?
No, this is not easily possible if we want to use the auto-discarding of the clocks array and a simple static initialization. The clock pointers are only set up after the clock drivers probe routine has run, so if I want to point to the actual clocks I would need to dynamically populate the array and either dynamically allocate it, or would need to pre-size the static array.
So this added indirection and slight complication of the the common code cuts out some lines of code and chances to get things wrong in the individual clock drivers. So I think the trade off I made here is justified.
Quoted 14 lines
drivers/clk/imx/clk.c void imx_cscmr1_fixup(u32 *val) · line 102
Quoted 11 lines
drivers/clk/imx/clk.c +11
-0+{ +if (imx_keep_uart_clocks) { +int i; + + imx_uart_clocks = clks; +for (i =0 ;; i++) { +if (imx_uart_clocks[i]) +clk_prepare_enable (*imx_uart_clocks[i]); +else +break ; + }I would have written this as:
Quoted 5 lines
for (i = 0; imx_uart_clocks[i]; ++i) clk_prepare_enable(*imx_uart_clocks[i]);but I guess that's a matter of taste.
Philipp agrees with you. ;) But I like the more explicit style a bit more.
Regards,
Lucas
Signature · 2 lines
Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v2 1/8 clk: imx: add common logic to detect early UART usage
Hallo Lucas,
Quoted 10 lines · Lucas Stach
Am Montag, den 07.09.2015, 11:06 +0200 schrieb Uwe Kleine-K?nig:
Quoted 3 lines
I wonder why you need an array of pointers to pointers of clocks. Isn't one indirection less possible and more easy?
No, this is not easily possible if we want to use the auto-discarding of the clocks array and a simple static initialization. The clock pointers are only set up after the clock drivers probe routine has run, so if I want to point to the actual clocks I would need to dynamically populate the array and either dynamically allocate it, or would need to pre-size the static array.
Ah right. An alternative would be to just store the indices, but I don't think this is nicer because then you additionally need a reference to the clk array. You don't happen to have this anyhow, do you?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v2 2/8 clk: imx25: retain early UART clocks during kernel init
In reply to Lucas StachMake sure to keep UART clocks enabled during kernel init if earlyprintk or earlycon are active.
--- drivers/clk/imx/clk-imx25.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/clk/imx/clk-imx25.c +10 -0
@@ -86,6 +86,14 @@ enum mx25_clks {static struct clk *clk[clk_max]; +static struct clk **uart_clks[]__initdata = { &clk[uart_ipg_per], + &clk[uart1_ipg], + &clk[uart2_ipg], + &clk[uart3_ipg], + &clk[uart4_ipg], + &clk[uart5_ipg], +NULL }; +static int __init __mx25_clocks_init (unsigned long osc_rate,void __iomem *ccm_base) {
@@ -233,6 +241,8 @@ static int __init __mx25_clocks_init(unsigned long osc_rate,*/ clk_set_parent (clk[cko_sel], clk[ipg]); +imx_register_uart_clocks (uart_clks); +return 0 ; }
Signature · 1 line
2.5.0
PATCH v2 2/8 clk: imx25: retain early UART clocks during kernel init
Quoted 14 lines · Lucas Stach
Make sure to keep UART clocks enabled during kernel init if earlyprintk or earlycon are active.
Signed-off-by Lucas Stach <[email protected]>--- drivers/clk/imx/clk-imx25.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/clk/imx/clk-imx25.c +0
-0@@ -86,6 +86,14 @@ enum mx25_clks {
drivers/clk/imx/clk-imx25.c enum mx25_clks { · line 96
Quoted 10 lines
drivers/clk/imx/clk-imx25.c +8
-0static struct clk *clk[clk_max]; +static struct clk **uart_clks[]__initdata = { &clk[uart_ipg_per], + &clk[uart1_ipg], + &clk[uart2_ipg], + &clk[uart3_ipg], + &clk[uart4_ipg], + &clk[uart5_ipg], +NULL }; +
I prefer to code it like:
static struct clk **uart_clks[] __initdata = {
&clk[uart_ipg_per],
&clk[uart1_ipg],
&clk[uart2_ipg],
&clk[uart3_ipg],
&clk[uart4_ipg],
&clk[uart5_ipg],
NULL
};Other than that, I'm fine with the series.
Shawn
Quoted 15 lines
drivers/clk/imx/clk-imx25.c +2
-0static int __init __mx25_clocks_init (unsigned long osc_rate,void __iomem *ccm_base) {@@ -233,6 +241,8 @@ static int __init __mx25_clocks_init(unsigned long osc_rate,*/ clk_set_parent (clk[cko_sel], clk[ipg]); +imx_register_uart_clocks (uart_clks); +return 0 ; }Signature · 1 line
2.5.0
PATCH v2 2/8 clk: imx25: retain early UART clocks during kernel init
Quoted 12 lines · Shawn Guo
I prefer to code it like:
static struct clk **uart_clks[] __initdata = { &clk[uart_ipg_per], &clk[uart1_ipg], &clk[uart2_ipg], &clk[uart3_ipg], &clk[uart4_ipg], &clk[uart5_ipg], NULL };
And maybe also use mx25_ as prefix to make the name unique.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v2 2/8 clk: imx25: retain early UART clocks during kernel init
Am Montag, den 07.09.2015, 11:10 +0200 schrieb Uwe Kleine-K?nig:
Quoted 14 lines · Shawn Guo
Quoted 12 lines
I prefer to code it like:
static struct clk **uart_clks[] __initdata = { &clk[uart_ipg_per], &clk[uart1_ipg], &clk[uart2_ipg], &clk[uart3_ipg], &clk[uart4_ipg], &clk[uart5_ipg], NULL };
Quoted 2 lines
And maybe also use
mx25_as prefix to make the name unique.
We already have a lot of non-unique names in those files. As this is a static variable it will not leak into other compilation units, so I prefer to keep the current style of the file.
Regards,
Lucas
Signature · 2 lines
Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v2 3/8 clk: imx27: retain early UART clocks during kernel init
In reply to Lucas StachMake sure to keep UART clocks enabled during kernel init if earlyprintk or earlycon are active.
--- drivers/clk/imx/clk-imx27.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/clk/imx/clk-imx27.c +11 -0
@@ -47,6 +47,15 @@ static const char *ssi_sel_clks[] = { "spll_gate", "mpll", };static struct clk *clk[IMX27_CLK_MAX ];static struct clk_onecell_data clk_data; +static struct clk **uart_clks[]__initdata = { &clk[IMX27_CLK_PER1_GATE ], + &clk[IMX27_CLK_UART1_IPG_GATE ], + &clk[IMX27_CLK_UART2_IPG_GATE ], + &clk[IMX27_CLK_UART3_IPG_GATE ], + &clk[IMX27_CLK_UART4_IPG_GATE ], + &clk[IMX27_CLK_UART5_IPG_GATE ], + &clk[IMX27_CLK_UART6_IPG_GATE ], +NULL }; +static void __init _mx27_clocks_init (unsigned long fref) {BUG_ON (!ccm);
@@ -163,6 +172,8 @@ static void __init _mx27_clocks_init(unsigned long fref)clk_prepare_enable (clk[IMX27_CLK_EMI_AHB_GATE ]); +imx_register_uart_clocks (uart_clks); +imx_print_silicon_rev ("i.MX27" ,mx27_revision ()); }
Signature · 1 line
2.5.0
PATCH v2 4/8 clk: imx31: retain early UART clocks during kernel init
In reply to Lucas StachMake sure to keep UART clocks enabled during kernel init if earlyprintk or earlycon are active.
--- drivers/clk/imx/clk-imx31.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/clk/imx/clk-imx31.c +10 -0
@@ -62,6 +62,14 @@ enum mx31_clks {static struct clk *clk[clk_max];static struct clk_onecell_data clk_data; +static struct clk **uart_clks[]__initdata = { &clk[ipg], + &clk[uart1_gate], + &clk[uart2_gate], + &clk[uart3_gate], + &clk[uart4_gate], + &clk[uart5_gate], +NULL }; +int __init mx31_clocks_init (unsigned long fref) {void __iomem *base;
@@ -199,6 +207,8 @@ int __init mx31_clocks_init(unsigned long fref)mx31_revision ();clk_disable_unprepare (clk[iim_gate]); +imx_register_uart_clocks (uart_clks); +mxc_timer_init (MX31_GPT1_BASE_ADDR ,MX31_INT_GPT ,GPT_TYPE_IMX31 );return 0 ;
Signature · 1 line
2.5.0
PATCH v2 5/8 clk: imx35: retain early UART clocks during kernel init
In reply to Lucas StachMake sure to keep UART clocks enabled during kernel init if earlyprintk or earlycon are active.
--- drivers/clk/imx/clk-imx35.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/clk/imx/clk-imx35.c +8 -0
@@ -84,6 +84,12 @@ enum mx35_clks {static struct clk *clk[clk_max]; +static struct clk **uart_clks[]__initdata = { &clk[ipg], + &clk[uart1_gate], + &clk[uart2_gate], + &clk[uart3_gate], +NULL }; +int __init mx35_clocks_init (void ) {void __iomem *base;
@@ -292,6 +298,8 @@ int __init mx35_clocks_init(void)*/ clk_prepare_enable (clk[scc_gate]); +imx_register_uart_clocks (uart_clks); +imx_print_silicon_rev ("i.MX35" ,mx35_revision ());mxc_timer_init (MX35_GPT1_BASE_ADDR ,MX35_INT_GPT ,GPT_TYPE_IMX31 );
Signature · 1 line
2.5.0
PATCH v2 6/8 clk: imx5: retain early UART clocks during kernel init
In reply to Lucas StachMake sure to keep UART clocks enabled during kernel init if earlyprintk or earlycon are active.
--- drivers/clk/imx/clk-imx51-imx53.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/clk/imx/clk-imx51-imx53.c +14 -0
@@ -130,6 +130,18 @@ static const char *cpu_podf_sels[] = { "pll1_sw", "step_sel" };static struct clk *clk[IMX5_CLK_END ];static struct clk_onecell_data clk_data; +static struct clk **uart_clks[]__initdata = { &clk[IMX5_CLK_UART1_IPG_GATE ], + &clk[IMX5_CLK_UART1_PER_GATE ], + &clk[IMX5_CLK_UART2_IPG_GATE ], + &clk[IMX5_CLK_UART2_PER_GATE ], + &clk[IMX5_CLK_UART3_IPG_GATE ], + &clk[IMX5_CLK_UART3_PER_GATE ], + &clk[IMX5_CLK_UART4_IPG_GATE ], + &clk[IMX5_CLK_UART4_PER_GATE ], + &clk[IMX5_CLK_UART5_IPG_GATE ], + &clk[IMX5_CLK_UART5_PER_GATE ], +NULL }; +static void __init mx5_clocks_common_init (void __iomem *ccm_base) { clk[IMX5_CLK_DUMMY ] =imx_clk_fixed ("dummy" ,0 );
@@ -310,6 +322,8 @@ static void __init mx5_clocks_common_init(void __iomem *ccm_base)clk_prepare_enable (clk[IMX5_CLK_TMAX1 ]);clk_prepare_enable (clk[IMX5_CLK_TMAX2 ]);/* esdhc2, fec */ clk_prepare_enable (clk[IMX5_CLK_TMAX3 ]);/* esdhc1, esdhc4 */ + +imx_register_uart_clocks (uart_clks); }static void __init mx50_clocks_init (struct device_node *np)
Signature · 1 line
2.5.0
PATCH v2 7/8 clk: imx6: retain early UART clocks during kernel init
In reply to Lucas StachMake sure to keep UART clocks enabled during kernel init if earlyprintk or earlycon are active.
--- drivers/clk/imx/clk-imx6q.c | 6 ++++++ drivers/clk/imx/clk-imx6sl.c | 6 ++++++ drivers/clk/imx/clk-imx6sx.c | 6 ++++++ 3 files changed, 18 insertions(+)
drivers/clk/imx/clk-imx6q.c +6 -0
@@ -130,6 +130,10 @@ static inline int clk_on_imx6dl(void)return of_machine_is_compatible ("fsl,imx6dl" ); } +static struct clk **uart_clks[]__initdata = { &clk[IMX6QDL_CLK_UART_IPG ], + &clk[IMX6QDL_CLK_UART_SERIAL ], +NULL }; +static void __init imx6q_clocks_init (struct device_node *ccm_node) {struct device_node *np;
@@ -534,5 +538,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)/* All existing boards with PCIe use LVDS1 */ if (IS_ENABLED (CONFIG_PCI_IMX6 ))clk_set_parent (clk[IMX6QDL_CLK_LVDS1_SEL ], clk[IMX6QDL_CLK_SATA_REF_100M ]); + +imx_register_uart_clocks (uart_clks); }CLK_OF_DECLARE (imx6q,"fsl,imx6q-ccm" , imx6q_clocks_init);
drivers/clk/imx/clk-imx6sl.c +6 -0
@@ -184,6 +184,10 @@ void imx6sl_set_wait_clk(bool enter)imx6sl_enable_pll_arm (false); } +static struct clk **uart_clks[]__initdata = { &clks[IMX6SL_CLK_UART ], + &clks[IMX6SL_CLK_UART_SERIAL ], +NULL }; +static void __init imx6sl_clocks_init (struct device_node *ccm_node) {struct device_node *np;
@@ -439,5 +443,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)clk_set_parent (clks[IMX6SL_CLK_LCDIF_AXI_SEL ], clks[IMX6SL_CLK_PLL2_PFD2 ]); + +imx_register_uart_clocks (uart_clks); }CLK_OF_DECLARE (imx6sl,"fsl,imx6sl-ccm" , imx6sl_clocks_init);
drivers/clk/imx/clk-imx6sx.c +6 -0
@@ -135,6 +135,10 @@ static u32 share_count_ssi1;static u32 share_count_ssi2;static u32 share_count_ssi3; +static struct clk **uart_clks[]__initdata = { &clks[IMX6SX_CLK_UART_IPG ], + &clks[IMX6SX_CLK_UART_SERIAL ], +NULL }; +static void __init imx6sx_clocks_init (struct device_node *ccm_node) {struct device_node *np;
@@ -557,5 +561,7 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)clk_set_parent (clks[IMX6SX_CLK_QSPI1_SEL ], clks[IMX6SX_CLK_PLL2_BUS ]);clk_set_parent (clks[IMX6SX_CLK_QSPI2_SEL ], clks[IMX6SX_CLK_PLL2_BUS ]); + +imx_register_uart_clocks (uart_clks); }CLK_OF_DECLARE (imx6sx,"fsl,imx6sx-ccm" , imx6sx_clocks_init);
Signature · 1 line
2.5.0
PATCH v2 8/8 clk: imx7d: retain early UART clocks during kernel init
In reply to Lucas StachMake sure to keep UART clocks enabled during kernel init if earlyprintk or earlycon are active.
--- drivers/clk/imx/clk-imx7d.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/clk/imx/clk-imx7d.c +11 -0
@@ -363,6 +363,15 @@ static const char *pll_video_bypass_sel[] = { "pll_video_main", "pll_video_main_static struct clk_onecell_data clk_data; +static struct clk **uart_clks[]__initdata = { &clks[IMX7D_UART1_ROOT_CLK ], + &clks[IMX7D_UART2_ROOT_CLK ], + &clks[IMX7D_UART3_ROOT_CLK ], + &clks[IMX7D_UART4_ROOT_CLK ], + &clks[IMX7D_UART5_ROOT_CLK ], + &clks[IMX7D_UART6_ROOT_CLK ], + &clks[IMX7D_UART7_ROOT_CLK ], +NULL }; +static void __init imx7d_clocks_init (struct device_node *ccm_node) {struct device_node *np;
@@ -856,5 +865,7 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node)/* set uart module clock's parent clock source that must be great then 80MHz */ clk_set_parent (clks[IMX7D_UART1_ROOT_SRC ], clks[IMX7D_OSC_24M_CLK ]); +imx_register_uart_clocks (uart_clks); + }CLK_OF_DECLARE (imx7d,"fsl,imx7d-ccm" , imx7d_clocks_init);
Signature · 1 line
2.5.0