linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Purna Chandra Mandal <purna.mandal@microchip.com>
To: <linux-kernel@vger.kernel.org>
Cc: <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>,
	Purna Chandra Mandal <purna.mandal@microchip.com>,
	Joshua Henderson <digitalpeer@digitalpeer.com>,
	Joshua Henderson <joshua.henderson@microchip.com>
Subject: [PATCH 03/11] MIPS: pic32mzda: fix getting timer clock rate.
Date: Tue, 17 May 2016 10:35:52 +0530	[thread overview]
Message-ID: <1463461560-9629-3-git-send-email-purna.mandal@microchip.com> (raw)
In-Reply-To: <1463461560-9629-1-git-send-email-purna.mandal@microchip.com>

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 <purna.mandal@microchip.com>

---
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 <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/clocksource.h>
 #include <linux/init.h>
+#include <linux/irqdomain.h>
 #include <linux/of.h>
 #include <linux/of_irq.h>
-#include <linux/irqdomain.h>
 
 #include <asm/time.h>
 
@@ -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) / 1000000);
-	mips_hpt_frequency = clk_get_rate(clk) / 2;
+	pr_info("CPU Clock: %ldMHz\n", rate / 1000000);
+	mips_hpt_frequency = rate / 2;
 
 	clocksource_probe();
 }
-- 
1.8.3.1

  parent reply	other threads:[~2016-05-17  5:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17  5:05 [PATCH 01/11] clk: microchip: use readl_poll_timeout() in pbclk_set_rate() Purna Chandra Mandal
2016-05-17  5:05 ` [PATCH 02/11] clk: microchip: Initialize SOSC clock rate for PIC32MZDA Purna Chandra Mandal
2016-08-24 23:05   ` Stephen Boyd
2016-05-17  5:05 ` Purna Chandra Mandal [this message]
2016-05-17 12:30   ` [PATCH 03/11] MIPS: pic32mzda: fix getting timer clock rate Ralf Baechle
2016-05-25 16:02   ` Harvey Hunt
2016-06-02  5:05     ` Purna Chandra Mandal
2016-05-17  5:05 ` [PATCH 04/11] irqchip: irq-pic32-evic: Fix bug with external interrupts Purna Chandra Mandal
2016-05-17  8:09   ` Marc Zyngier
2016-05-17  5:05 ` [PATCH 05/11] serial: pic32_uart: Fix double free of 'sport->irq_fault_name' Purna Chandra Mandal
2016-05-17  5:05 ` [PATCH 06/11] dt/bindings: Correct clk binding example for PIC32 SDHCI Purna Chandra Mandal
2016-05-18 16:50   ` Rob Herring
2016-05-17  5:05 ` [PATCH 07/11] dt/bindings: Correct clk binding example for PIC32 pinctrl Purna Chandra Mandal
2016-05-18 16:50   ` Rob Herring
2016-05-26  8:37   ` Linus Walleij
2016-05-17  5:05 ` [PATCH 08/11] dt/bindings: Correct clk binding example for PIC32 serial Purna Chandra Mandal
2016-05-18 16:51   ` Rob Herring
2016-05-17  5:05 ` [PATCH 09/11] dt/bindings: Correct clk binding example for PIC32 DMT Purna Chandra Mandal
2016-05-18 16:51   ` Rob Herring
2016-05-17  5:05 ` [PATCH 10/11] dt/bindings: Correct clk binding example for PIC32 WDT Purna Chandra Mandal
2016-05-18 16:52   ` Rob Herring
2016-05-17  5:06 ` [PATCH 11/11] dt/bindings: Correct clk binding example for PIC32 gpio Purna Chandra Mandal
2016-05-18 16:52   ` Rob Herring
2016-05-26  8:38   ` Linus Walleij
2016-08-24 23:05 ` [PATCH 01/11] clk: microchip: use readl_poll_timeout() in pbclk_set_rate() Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1463461560-9629-3-git-send-email-purna.mandal@microchip.com \
    --to=purna.mandal@microchip.com \
    --cc=digitalpeer@digitalpeer.com \
    --cc=joshua.henderson@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).