Re: [PATCH 03/11] MIPS: pic32mzda: fix getting timer clock rate.
On 05/25/2016 09:32 PM, Harvey Hunt wrote: > Hi Purna, > > On 17/05/16 06:05, Purna Chandra Mandal wrote: >> PIC32 clock driver is now implemented as platform driver instead of >> as part of of_clk_init(). It meants all the clock modules are available >> quite late in the boot sequence. So request for CPU clock by clk_get_sys() >> and clk_get_rate() to find c0_timer rate fails. >> >> To fix this use PIC32 specific early clock functions implemented for early >> console support. >> >> Signed-off-by: Purna Chandra Mandal>> >> --- >> Note: Please pull this complete series through the MIPS tree. >> >> --- >> >> arch/mips/pic32/pic32mzda/time.c | 13 - >> 1 file changed, 4 insertions(+), 9 deletions(-) >> >> diff --git a/arch/mips/pic32/pic32mzda/time.c >> b/arch/mips/pic32/pic32mzda/time.c >> index ca6a62b..62a0a78 100644 >> --- a/arch/mips/pic32/pic32mzda/time.c >> +++ b/arch/mips/pic32/pic32mzda/time.c >> @@ -11,13 +11,12 @@ >> * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >> * for more details. >> */ >> -#include >> #include >> #include >> #include >> +#include >> #include >> #include >> -#include >> >> #include >> >> @@ -58,16 +57,12 @@ unsigned int get_c0_compare_int(void) >> >> void __init plat_time_init(void) >> { >> -struct clk *clk; >> +unsigned long rate = pic32_get_pbclk(7); > > pic32_get_pbclk() is defined in arch/mips/pic32/pic32mzda/early_clk.c. When > CONFIG_EARLY_PRINTK isn't set, early_clk.c isn't compiled and so a linker > error occurs. > > Maybe it's best to always build the early_clk.c file, or perhaps there is a > better place to put pic32_get_pbclk()? > Thanks Harvey. Will fix in separate patch. > Thanks, > > Harvey >
Re: [PATCH 03/11] MIPS: pic32mzda: fix getting timer clock rate.
On 05/25/2016 09:32 PM, Harvey Hunt wrote: > Hi Purna, > > On 17/05/16 06:05, Purna Chandra Mandal wrote: >> PIC32 clock driver is now implemented as platform driver instead of >> as part of of_clk_init(). It meants all the clock modules are available >> quite late in the boot sequence. So request for CPU clock by clk_get_sys() >> and clk_get_rate() to find c0_timer rate fails. >> >> To fix this use PIC32 specific early clock functions implemented for early >> console support. >> >> Signed-off-by: Purna Chandra Mandal >> >> --- >> Note: Please pull this complete series through the MIPS tree. >> >> --- >> >> arch/mips/pic32/pic32mzda/time.c | 13 - >> 1 file changed, 4 insertions(+), 9 deletions(-) >> >> diff --git a/arch/mips/pic32/pic32mzda/time.c >> b/arch/mips/pic32/pic32mzda/time.c >> index ca6a62b..62a0a78 100644 >> --- a/arch/mips/pic32/pic32mzda/time.c >> +++ b/arch/mips/pic32/pic32mzda/time.c >> @@ -11,13 +11,12 @@ >> * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >> * for more details. >> */ >> -#include >> #include >> #include >> #include >> +#include >> #include >> #include >> -#include >> >> #include >> >> @@ -58,16 +57,12 @@ unsigned int get_c0_compare_int(void) >> >> void __init plat_time_init(void) >> { >> -struct clk *clk; >> +unsigned long rate = pic32_get_pbclk(7); > > pic32_get_pbclk() is defined in arch/mips/pic32/pic32mzda/early_clk.c. When > CONFIG_EARLY_PRINTK isn't set, early_clk.c isn't compiled and so a linker > error occurs. > > Maybe it's best to always build the early_clk.c file, or perhaps there is a > better place to put pic32_get_pbclk()? > Thanks Harvey. Will fix in separate patch. > Thanks, > > Harvey >
Re: [PATCH 03/11] MIPS: pic32mzda: fix getting timer clock rate.
Hi Purna, On 17/05/16 06:05, Purna Chandra Mandal wrote: PIC32 clock driver is now implemented as platform driver instead of as part of of_clk_init(). It meants all the clock modules are available quite late in the boot sequence. So request for CPU clock by clk_get_sys() and clk_get_rate() to find c0_timer rate fails. To fix this use PIC32 specific early clock functions implemented for early console support. Signed-off-by: Purna Chandra Mandal--- Note: Please pull this complete series through the MIPS tree. --- arch/mips/pic32/pic32mzda/time.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/mips/pic32/pic32mzda/time.c b/arch/mips/pic32/pic32mzda/time.c index ca6a62b..62a0a78 100644 --- a/arch/mips/pic32/pic32mzda/time.c +++ b/arch/mips/pic32/pic32mzda/time.c @@ -11,13 +11,12 @@ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ -#include #include #include #include +#include #include #include -#include #include @@ -58,16 +57,12 @@ unsigned int get_c0_compare_int(void) void __init plat_time_init(void) { - struct clk *clk; + unsigned long rate = pic32_get_pbclk(7); pic32_get_pbclk() is defined in arch/mips/pic32/pic32mzda/early_clk.c. When CONFIG_EARLY_PRINTK isn't set, early_clk.c isn't compiled and so a linker error occurs. Maybe it's best to always build the early_clk.c file, or perhaps there is a better place to put pic32_get_pbclk()? Thanks, Harvey
Re: [PATCH 03/11] MIPS: pic32mzda: fix getting timer clock rate.
Hi Purna, On 17/05/16 06:05, Purna Chandra Mandal wrote: PIC32 clock driver is now implemented as platform driver instead of as part of of_clk_init(). It meants all the clock modules are available quite late in the boot sequence. So request for CPU clock by clk_get_sys() and clk_get_rate() to find c0_timer rate fails. To fix this use PIC32 specific early clock functions implemented for early console support. Signed-off-by: Purna Chandra Mandal --- Note: Please pull this complete series through the MIPS tree. --- arch/mips/pic32/pic32mzda/time.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/mips/pic32/pic32mzda/time.c b/arch/mips/pic32/pic32mzda/time.c index ca6a62b..62a0a78 100644 --- a/arch/mips/pic32/pic32mzda/time.c +++ b/arch/mips/pic32/pic32mzda/time.c @@ -11,13 +11,12 @@ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ -#include #include #include #include +#include #include #include -#include #include @@ -58,16 +57,12 @@ unsigned int get_c0_compare_int(void) void __init plat_time_init(void) { - struct clk *clk; + unsigned long rate = pic32_get_pbclk(7); pic32_get_pbclk() is defined in arch/mips/pic32/pic32mzda/early_clk.c. When CONFIG_EARLY_PRINTK isn't set, early_clk.c isn't compiled and so a linker error occurs. Maybe it's best to always build the early_clk.c file, or perhaps there is a better place to put pic32_get_pbclk()? Thanks, Harvey
Re: [PATCH 03/11] MIPS: pic32mzda: fix getting timer clock rate.
On Tue, May 17, 2016 at 10:35:52AM +0530, Purna Chandra Mandal wrote: > PIC32 clock driver is now implemented as platform driver instead of > as part of of_clk_init(). It meants all the clock modules are available > quite late in the boot sequence. So request for CPU clock by clk_get_sys() > and clk_get_rate() to find c0_timer rate fails. > > To fix this use PIC32 specific early clock functions implemented for early > console support. > > Signed-off-by: Purna Chandra Mandal> > --- > Note: Please pull this complete series through the MIPS tree. > > --- > > arch/mips/pic32/pic32mzda/time.c | 13 - For now I applied only this patch as it seems independent of the remainder of the series which still will need to be reviewed and acked by the respective maintainers. Ralf
Re: [PATCH 03/11] MIPS: pic32mzda: fix getting timer clock rate.
On Tue, May 17, 2016 at 10:35:52AM +0530, Purna Chandra Mandal wrote: > PIC32 clock driver is now implemented as platform driver instead of > as part of of_clk_init(). It meants all the clock modules are available > quite late in the boot sequence. So request for CPU clock by clk_get_sys() > and clk_get_rate() to find c0_timer rate fails. > > To fix this use PIC32 specific early clock functions implemented for early > console support. > > Signed-off-by: Purna Chandra Mandal > > --- > Note: Please pull this complete series through the MIPS tree. > > --- > > arch/mips/pic32/pic32mzda/time.c | 13 - For now I applied only this patch as it seems independent of the remainder of the series which still will need to be reviewed and acked by the respective maintainers. Ralf
[PATCH 03/11] MIPS: pic32mzda: fix getting timer clock rate.
PIC32 clock driver is now implemented as platform driver instead of as part of of_clk_init(). It meants all the clock modules are available quite late in the boot sequence. So request for CPU clock by clk_get_sys() and clk_get_rate() to find c0_timer rate fails. To fix this use PIC32 specific early clock functions implemented for early console support. Signed-off-by: Purna Chandra Mandal--- Note: Please pull this complete series through the MIPS tree. --- arch/mips/pic32/pic32mzda/time.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/mips/pic32/pic32mzda/time.c b/arch/mips/pic32/pic32mzda/time.c index ca6a62b..62a0a78 100644 --- a/arch/mips/pic32/pic32mzda/time.c +++ b/arch/mips/pic32/pic32mzda/time.c @@ -11,13 +11,12 @@ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ -#include #include #include #include +#include #include #include -#include #include @@ -58,16 +57,12 @@ unsigned int get_c0_compare_int(void) void __init plat_time_init(void) { - struct clk *clk; + unsigned long rate = pic32_get_pbclk(7); of_clk_init(NULL); - clk = clk_get_sys("cpu_clk", NULL); - if (IS_ERR(clk)) - panic("unable to get CPU clock, err=%ld", PTR_ERR(clk)); - clk_prepare_enable(clk); - pr_info("CPU Clock: %ldMHz\n", clk_get_rate(clk) / 100); - mips_hpt_frequency = clk_get_rate(clk) / 2; + pr_info("CPU Clock: %ldMHz\n", rate / 100); + mips_hpt_frequency = rate / 2; clocksource_probe(); } -- 1.8.3.1
[PATCH 03/11] MIPS: pic32mzda: fix getting timer clock rate.
PIC32 clock driver is now implemented as platform driver instead of as part of of_clk_init(). It meants all the clock modules are available quite late in the boot sequence. So request for CPU clock by clk_get_sys() and clk_get_rate() to find c0_timer rate fails. To fix this use PIC32 specific early clock functions implemented for early console support. Signed-off-by: Purna Chandra Mandal --- Note: Please pull this complete series through the MIPS tree. --- arch/mips/pic32/pic32mzda/time.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/mips/pic32/pic32mzda/time.c b/arch/mips/pic32/pic32mzda/time.c index ca6a62b..62a0a78 100644 --- a/arch/mips/pic32/pic32mzda/time.c +++ b/arch/mips/pic32/pic32mzda/time.c @@ -11,13 +11,12 @@ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ -#include #include #include #include +#include #include #include -#include #include @@ -58,16 +57,12 @@ unsigned int get_c0_compare_int(void) void __init plat_time_init(void) { - struct clk *clk; + unsigned long rate = pic32_get_pbclk(7); of_clk_init(NULL); - clk = clk_get_sys("cpu_clk", NULL); - if (IS_ERR(clk)) - panic("unable to get CPU clock, err=%ld", PTR_ERR(clk)); - clk_prepare_enable(clk); - pr_info("CPU Clock: %ldMHz\n", clk_get_rate(clk) / 100); - mips_hpt_frequency = clk_get_rate(clk) / 2; + pr_info("CPU Clock: %ldMHz\n", rate / 100); + mips_hpt_frequency = rate / 2; clocksource_probe(); } -- 1.8.3.1