All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
To: <linux-mips@linux-mips.org>
Cc: <devicetree@vger.kernel.org>, <linux-serial@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <Zubair.Kakakhel@imgtec.com>,
	<gregkh@linuxfoundation.org>, <mturquette@linaro.org>,
	<sboyd@codeaurora.org>, <ralf@linux-mips.org>, <jslaby@suse.cz>,
	<tglx@linutronix.de>, <jason@lakedaemon.net>, <lars@metafoo.de>,
	<paul.burton@imgtec.com>
Subject: [PATCH_V2 13/34] MIPS: jz4740: replace use of jz4740_clock_bdata
Date: Wed, 4 Feb 2015 15:21:42 +0000	[thread overview]
Message-ID: <1423063323-19419-14-git-send-email-Zubair.Kakakhel@imgtec.com> (raw)
In-Reply-To: <1423063323-19419-1-git-send-email-Zubair.Kakakhel@imgtec.com>

From: Paul Burton <paul.burton@imgtec.com>

Replace uses of the jz4740_clock_bdata struct with calls to clk_get_rate
for the appropriate clock. This is in preparation for migrating the
clocks towards common clock framework & devicetree.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
---
 arch/mips/jz4740/platform.c | 11 ++++++++++-
 arch/mips/jz4740/reset.c    | 13 +++++++++++--
 arch/mips/jz4740/time.c     |  9 ++++++++-
 3 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c
index 0b12f27..2a5c7c7 100644
--- a/arch/mips/jz4740/platform.c
+++ b/arch/mips/jz4740/platform.c
@@ -13,6 +13,7 @@
  *
  */
 
+#include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
@@ -308,9 +309,17 @@ static struct platform_device jz4740_uart_device = {
 void jz4740_serial_device_register(void)
 {
 	struct plat_serial8250_port *p;
+	struct clk *ext_clk;
+	unsigned long ext_rate;
+
+	ext_clk = clk_get(NULL, "ext");
+	if (IS_ERR(ext_clk))
+		panic("unable to get ext clock");
+	ext_rate = clk_get_rate(ext_clk);
+	clk_put(ext_clk);
 
 	for (p = jz4740_uart_data; p->flags != 0; ++p)
-		p->uartclk = jz4740_clock_bdata.ext_rate;
+		p->uartclk = ext_rate;
 
 	platform_device_register(&jz4740_uart_device);
 }
diff --git a/arch/mips/jz4740/reset.c b/arch/mips/jz4740/reset.c
index b6c6343..954e669 100644
--- a/arch/mips/jz4740/reset.c
+++ b/arch/mips/jz4740/reset.c
@@ -12,6 +12,7 @@
  *
  */
 
+#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/pm.h>
@@ -79,12 +80,20 @@ static void jz4740_power_off(void)
 	void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x38);
 	unsigned long wakeup_filter_ticks;
 	unsigned long reset_counter_ticks;
+	struct clk *rtc_clk;
+	unsigned long rtc_rate;
+
+	rtc_clk = clk_get(NULL, "rtc");
+	if (IS_ERR(rtc_clk))
+		panic("unable to get RTC clock");
+	rtc_rate = clk_get_rate(rtc_clk);
+	clk_put(rtc_clk);
 
 	/*
 	 * Set minimum wakeup pin assertion time: 100 ms.
 	 * Range is 0 to 2 sec if RTC is clocked at 32 kHz.
 	 */
-	wakeup_filter_ticks = (100 * jz4740_clock_bdata.rtc_rate) / 1000;
+	wakeup_filter_ticks = (100 * rtc_rate) / 1000;
 	if (wakeup_filter_ticks < JZ_RTC_WAKEUP_FILTER_MASK)
 		wakeup_filter_ticks &= JZ_RTC_WAKEUP_FILTER_MASK;
 	else
@@ -96,7 +105,7 @@ static void jz4740_power_off(void)
 	 * Set reset pin low-level assertion time after wakeup: 60 ms.
 	 * Range is 0 to 125 ms if RTC is clocked at 32 kHz.
 	 */
-	reset_counter_ticks = (60 * jz4740_clock_bdata.rtc_rate) / 1000;
+	reset_counter_ticks = (60 * rtc_rate) / 1000;
 	if (reset_counter_ticks < JZ_RTC_RESET_COUNTER_MASK)
 		reset_counter_ticks &= JZ_RTC_RESET_COUNTER_MASK;
 	else
diff --git a/arch/mips/jz4740/time.c b/arch/mips/jz4740/time.c
index 9424344..bff2ac9 100644
--- a/arch/mips/jz4740/time.c
+++ b/arch/mips/jz4740/time.c
@@ -13,6 +13,7 @@
  *
  */
 
+#include <linux/clk.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/time.h>
@@ -109,11 +110,17 @@ void __init plat_time_init(void)
 	int ret;
 	uint32_t clk_rate;
 	uint16_t ctrl;
+	struct clk *ext_clk;
 
 	jz4740_clock_init();
 	jz4740_timer_init();
 
-	clk_rate = jz4740_clock_bdata.ext_rate >> 4;
+	ext_clk = clk_get(NULL, "ext");
+	if (IS_ERR(ext_clk))
+		panic("unable to get ext clock");
+	clk_rate = clk_get_rate(ext_clk) >> 4;
+	clk_put(ext_clk);
+
 	jz4740_jiffies_per_tick = DIV_ROUND_CLOSEST(clk_rate, HZ);
 
 	clockevent_set_clock(&jz4740_clockevent, clk_rate);
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
To: linux-mips@linux-mips.org
Cc: devicetree@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, Zubair.Kakakhel@imgtec.com,
	gregkh@linuxfoundation.org, mturquette@linaro.org,
	sboyd@codeaurora.org, ralf@linux-mips.org, jslaby@suse.cz,
	tglx@linutronix.de, jason@lakedaemon.net, lars@metafoo.de,
	paul.burton@imgtec.com
Subject: [PATCH_V2 13/34] MIPS: jz4740: replace use of jz4740_clock_bdata
Date: Wed, 4 Feb 2015 15:21:42 +0000	[thread overview]
Message-ID: <1423063323-19419-14-git-send-email-Zubair.Kakakhel@imgtec.com> (raw)
In-Reply-To: <1423063323-19419-1-git-send-email-Zubair.Kakakhel@imgtec.com>

From: Paul Burton <paul.burton@imgtec.com>

Replace uses of the jz4740_clock_bdata struct with calls to clk_get_rate
for the appropriate clock. This is in preparation for migrating the
clocks towards common clock framework & devicetree.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
---
 arch/mips/jz4740/platform.c | 11 ++++++++++-
 arch/mips/jz4740/reset.c    | 13 +++++++++++--
 arch/mips/jz4740/time.c     |  9 ++++++++-
 3 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c
index 0b12f27..2a5c7c7 100644
--- a/arch/mips/jz4740/platform.c
+++ b/arch/mips/jz4740/platform.c
@@ -13,6 +13,7 @@
  *
  */
 
+#include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
@@ -308,9 +309,17 @@ static struct platform_device jz4740_uart_device = {
 void jz4740_serial_device_register(void)
 {
 	struct plat_serial8250_port *p;
+	struct clk *ext_clk;
+	unsigned long ext_rate;
+
+	ext_clk = clk_get(NULL, "ext");
+	if (IS_ERR(ext_clk))
+		panic("unable to get ext clock");
+	ext_rate = clk_get_rate(ext_clk);
+	clk_put(ext_clk);
 
 	for (p = jz4740_uart_data; p->flags != 0; ++p)
-		p->uartclk = jz4740_clock_bdata.ext_rate;
+		p->uartclk = ext_rate;
 
 	platform_device_register(&jz4740_uart_device);
 }
diff --git a/arch/mips/jz4740/reset.c b/arch/mips/jz4740/reset.c
index b6c6343..954e669 100644
--- a/arch/mips/jz4740/reset.c
+++ b/arch/mips/jz4740/reset.c
@@ -12,6 +12,7 @@
  *
  */
 
+#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/pm.h>
@@ -79,12 +80,20 @@ static void jz4740_power_off(void)
 	void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x38);
 	unsigned long wakeup_filter_ticks;
 	unsigned long reset_counter_ticks;
+	struct clk *rtc_clk;
+	unsigned long rtc_rate;
+
+	rtc_clk = clk_get(NULL, "rtc");
+	if (IS_ERR(rtc_clk))
+		panic("unable to get RTC clock");
+	rtc_rate = clk_get_rate(rtc_clk);
+	clk_put(rtc_clk);
 
 	/*
 	 * Set minimum wakeup pin assertion time: 100 ms.
 	 * Range is 0 to 2 sec if RTC is clocked at 32 kHz.
 	 */
-	wakeup_filter_ticks = (100 * jz4740_clock_bdata.rtc_rate) / 1000;
+	wakeup_filter_ticks = (100 * rtc_rate) / 1000;
 	if (wakeup_filter_ticks < JZ_RTC_WAKEUP_FILTER_MASK)
 		wakeup_filter_ticks &= JZ_RTC_WAKEUP_FILTER_MASK;
 	else
@@ -96,7 +105,7 @@ static void jz4740_power_off(void)
 	 * Set reset pin low-level assertion time after wakeup: 60 ms.
 	 * Range is 0 to 125 ms if RTC is clocked at 32 kHz.
 	 */
-	reset_counter_ticks = (60 * jz4740_clock_bdata.rtc_rate) / 1000;
+	reset_counter_ticks = (60 * rtc_rate) / 1000;
 	if (reset_counter_ticks < JZ_RTC_RESET_COUNTER_MASK)
 		reset_counter_ticks &= JZ_RTC_RESET_COUNTER_MASK;
 	else
diff --git a/arch/mips/jz4740/time.c b/arch/mips/jz4740/time.c
index 9424344..bff2ac9 100644
--- a/arch/mips/jz4740/time.c
+++ b/arch/mips/jz4740/time.c
@@ -13,6 +13,7 @@
  *
  */
 
+#include <linux/clk.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/time.h>
@@ -109,11 +110,17 @@ void __init plat_time_init(void)
 	int ret;
 	uint32_t clk_rate;
 	uint16_t ctrl;
+	struct clk *ext_clk;
 
 	jz4740_clock_init();
 	jz4740_timer_init();
 
-	clk_rate = jz4740_clock_bdata.ext_rate >> 4;
+	ext_clk = clk_get(NULL, "ext");
+	if (IS_ERR(ext_clk))
+		panic("unable to get ext clock");
+	clk_rate = clk_get_rate(ext_clk) >> 4;
+	clk_put(ext_clk);
+
 	jz4740_jiffies_per_tick = DIV_ROUND_CLOSEST(clk_rate, HZ);
 
 	clockevent_set_clock(&jz4740_clockevent, clk_rate);
-- 
1.9.1

  parent reply	other threads:[~2015-02-04 15:33 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04 15:21 [PATCH_V2 00/34] jz4780 & CI20 support Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 01/34] dt: Add Ingenic Semiconductor vendor prefix Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 02/34] MIPS: jz4740: require & include DT Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 03/34] MIPS: irq_cpu: declare irqchip table entry Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 04/34] MIPS: jz4740: probe CPU interrupt controller via DT Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 17:05   ` Sergei Shtylyov
2015-02-04 15:21 ` [PATCH_V2 05/34] MIPS: jz4740: use generic plat_irq_dispatch Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 06/34] MIPS: jz4740: move arch_init_irq out of arch/mips/jz4740/irq.c Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 07/34] dt: interrupt-controller: Add ingenic,jz4740-intc binding doc Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 17:07   ` Sergei Shtylyov
2015-02-04 15:21 ` [PATCH_V2 08/34] MIPS: jz4740: allow interrupt controller probe via DT Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 09/34] MIPS: jz4740: probe interrupt controller " Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 17:09   ` Sergei Shtylyov
2015-02-04 15:21 ` [PATCH_V2 10/34] MIPS: jz4740: remove non-DT interrupt controller init Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 11/34] MIPS: jz4740: register an irq_domain for the interrupt controller Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 16:19   ` Arnd Bergmann
2015-02-04 16:19     ` Arnd Bergmann
2015-02-04 15:21 ` [PATCH_V2 12/34] MIPS: jz4740: call jz4740_clock_init earlier Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` Zubair Lutfullah Kakakhel [this message]
2015-02-04 15:21   ` [PATCH_V2 13/34] MIPS: jz4740: replace use of jz4740_clock_bdata Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 14/34] clk: jz47xx-cgu: add driver for Ingenic jz47xx series CGU clocks Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 15/34] dt: clk: Add ingenic,jz4740-cgu binding documentation Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 16:27   ` Arnd Bergmann
2015-02-04 15:21 ` [PATCH_V2 16/34] MIPS: clk: migrate jz4740 to common clock framework Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 17/34] MIPS: clk: move jz4740_clock_set_wait_mode to jz4740-cgu Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 18/34] MIPS: clk: move jz4740 UDC auto suspend functions " Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 19/34] MIPS: clk: move jz4740 clock suspend, resume " Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 20/34] MIPS: jz4740: remove clock.h Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 21/34] MIPS: jz4740: only detect RAM size if not specified in DT Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 22/34] MIPS: jz4740: support >32 interrupts Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 23/34] MIPS: jz4740: define IRQ numbers based on number of intc IRQs Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 24/34] dt: serial: Add ingenic,jz4740-uart binding Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 25/34] serial: 8250_jz47xx: support for Ingenic jz47xx UARTs Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 21:02   ` Paul Bolle
2015-02-04 15:21 ` [PATCH_V2 26/34] MIPS: allow mach-provided serial.h Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 27/34] MIPS: jz4740: use jz47xx-uart & DT for UART output Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 16:32   ` Arnd Bergmann
2015-02-04 16:32     ` Arnd Bergmann
2015-02-04 15:21 ` [PATCH_V2 28/34] dt: clk: Add ingenic,jz4780-cgu binding documentation Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 29/34] clk: add Ingenic jz4780 CGU driver Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:21 ` [PATCH_V2 30/34] MIPS: jz4740: add jz4780 interrupt controller support Zubair Lutfullah Kakakhel
2015-02-04 15:21   ` Zubair Lutfullah Kakakhel
2015-02-04 15:22 ` [PATCH_V2 31/34] MIPS: add jz4780 Ingenic vendor ID Zubair Lutfullah Kakakhel
2015-02-04 15:22   ` Zubair Lutfullah Kakakhel
2015-02-04 15:22 ` [PATCH_V2 32/34] MIPS: initial Ingenic jz4780 support Zubair Lutfullah Kakakhel
2015-02-04 15:22   ` Zubair Lutfullah Kakakhel
2015-02-04 15:22 ` [PATCH_V2 33/34] MIPS: initial MIPS Creator CI20 board support Zubair Lutfullah Kakakhel
2015-02-04 15:22   ` Zubair Lutfullah Kakakhel
2015-02-04 20:56   ` Paul Bolle
2015-02-04 20:56     ` Paul Bolle
2015-02-04 15:22 ` [PATCH_V2 34/34] MIPS: allow jz4780 to be selected in Kconfig Zubair Lutfullah Kakakhel
2015-02-04 15:22   ` Zubair Lutfullah Kakakhel
2015-02-04 16:47 ` [PATCH_V2 00/34] jz4780 & CI20 support Paul Burton
2015-02-04 16:47   ` Paul Burton

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=1423063323-19419-14-git-send-email-Zubair.Kakakhel@imgtec.com \
    --to=zubair.kakakhel@imgtec.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jason@lakedaemon.net \
    --cc=jslaby@suse.cz \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=paul.burton@imgtec.com \
    --cc=ralf@linux-mips.org \
    --cc=sboyd@codeaurora.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.