From: Manuel Lauss <manuel.lauss@gmail.com>
To: Linux-MIPS <linux-mips@linux-mips.org>,
Mike Turquette <mturquette@linaro.org>
Cc: linux-kernel@vger.kernel.org, Manuel Lauss <manuel.lauss@gmail.com>
Subject: [RFC PATCH v2 03/11] MIPS: Alchemy: platform: use clk framework for uarts
Date: Thu, 3 Jul 2014 15:22:34 +0200 [thread overview]
Message-ID: <1404393762-858019-4-git-send-email-manuel.lauss@gmail.com> (raw)
In-Reply-To: <1404393762-858019-1-git-send-email-manuel.lauss@gmail.com>
Use the clock framework to get the rate of the peripheral clock.
Remove the now obsolete get_uart_baud_base function.
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
---
v2: initial version, taken from original patch #2
arch/mips/alchemy/common/clocks.c | 19 -------------------
arch/mips/alchemy/common/platform.c | 13 ++++++++++++-
arch/mips/include/asm/mach-au1x00/au1000.h | 2 --
3 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/arch/mips/alchemy/common/clocks.c b/arch/mips/alchemy/common/clocks.c
index 35db35b..e77fa9b 100644
--- a/arch/mips/alchemy/common/clocks.c
+++ b/arch/mips/alchemy/common/clocks.c
@@ -38,7 +38,6 @@
#define AU1000_SRC_CLK 12000000
static unsigned int au1x00_clock; /* Hz */
-static unsigned long uart_baud_base;
/*
* Set the au1000_clock
@@ -55,21 +54,6 @@ unsigned int get_au1x00_speed(void)
EXPORT_SYMBOL(get_au1x00_speed);
/*
- * The UART baud base is not known at compile time ... if
- * we want to be able to use the same code on different
- * speed CPUs.
- */
-unsigned long get_au1x00_uart_baud_base(void)
-{
- return uart_baud_base;
-}
-
-void set_au1x00_uart_baud_base(unsigned long new_baud_base)
-{
- uart_baud_base = new_baud_base;
-}
-
-/*
* We read the real processor speed from the PLL. This is important
* because it is more accurate than computing it from the 32 KHz
* counter, if it exists. If we don't have an accurate processor
@@ -96,9 +80,6 @@ unsigned long au1xxx_calc_clock(void)
/* On Alchemy CPU:counter ratio is 1:1 */
mips_hpt_frequency = cpu_speed;
- /* Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16) */
- set_au1x00_uart_baud_base(cpu_speed /
- (2 * ((AU1X_RDSYS(AU1000_SYS_POWERCTRL) & 0x03) + 2) * 16));
set_au1x00_speed(cpu_speed);
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index 4cdc8fd..e70d5c1 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -11,6 +11,7 @@
* warranty of any kind, whether express or implied.
*/
+#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/etherdevice.h>
#include <linux/init.h>
@@ -99,10 +100,20 @@ static struct platform_device au1xx0_uart_device = {
static void __init alchemy_setup_uarts(int ctype)
{
- unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
+ long uartclk;
int s = sizeof(struct plat_serial8250_port);
int c = alchemy_get_uarts(ctype);
struct plat_serial8250_port *ports;
+ struct clk *clk = clk_get(NULL, ALCHEMY_PERIPH_CLK);
+
+ if (IS_ERR(clk))
+ return;
+ if (clk_prepare_enable(clk)) {
+ clk_put(clk);
+ return;
+ }
+ uartclk = clk_get_rate(clk);
+ clk_put(clk);
ports = kzalloc(s * (c + 1), GFP_KERNEL);
if (!ports) {
diff --git a/arch/mips/include/asm/mach-au1x00/au1000.h b/arch/mips/include/asm/mach-au1x00/au1000.h
index 734b4ac..46ce1fe 100644
--- a/arch/mips/include/asm/mach-au1x00/au1000.h
+++ b/arch/mips/include/asm/mach-au1x00/au1000.h
@@ -829,8 +829,6 @@ static inline int alchemy_get_macs(int type)
/* arch/mips/au1000/common/clocks.c */
extern void set_au1x00_speed(unsigned int new_freq);
extern unsigned int get_au1x00_speed(void);
-extern void set_au1x00_uart_baud_base(unsigned long new_baud_base);
-extern unsigned long get_au1x00_uart_baud_base(void);
extern unsigned long au1xxx_calc_clock(void);
/* PM: arch/mips/alchemy/common/sleeper.S, power.c, irq.c */
--
2.0.0
next prev parent reply other threads:[~2014-07-03 13:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-03 13:22 [RFC PATCH v2 00/11] MIPS: Alchemy: clock framework support Manuel Lauss
2014-07-03 13:22 ` [RFC PATCH v2 01/11] MIPS: Alchemy: au1000 header file cleanup Manuel Lauss
2014-07-03 13:22 ` [RFC PATCH v2 02/11] MIPS: Alchemy: clock framework integration of onchip clocks Manuel Lauss
2014-07-03 13:22 ` Manuel Lauss [this message]
2014-07-03 13:22 ` [RFC PATCH v2 04/11] MIPS: Alchemy: usb: use clk framework Manuel Lauss
2014-07-03 13:22 ` [RFC PATCH v2 05/11] MIPS: Alchemy: pci: use clk framework to enable PCI clock Manuel Lauss
2014-07-03 13:50 ` Sergei Shtylyov
2014-07-03 17:19 ` Manuel Lauss
2014-07-03 13:22 ` [RFC PATCH v2 06/11] MIPS: Alchemy: db1200: use clk framework Manuel Lauss
2014-07-03 13:22 ` [RFC PATCH v2 07/11] MIPS: Alchemy: irda: " Manuel Lauss
2014-07-03 13:22 ` [RFC PATCH v2 08/11] MIPS: Alchemy: au1100fb: " Manuel Lauss
2014-07-03 13:22 ` [RFC PATCH v2 09/11] MIPS: Alchemy: au1200fb: " Manuel Lauss
2014-07-03 13:22 ` [RFC PATCH v2 10/11] MIPS: Alchemy: au1xmmc: " Manuel Lauss
2014-07-03 13:22 ` [RFC PATCH v2 11/11] MIPS: Alchemy: remove old clock support Manuel Lauss
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=1404393762-858019-4-git-send-email-manuel.lauss@gmail.com \
--to=manuel.lauss@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mturquette@linaro.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
all inboxes | Powered by JetHome®