mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Juergen Beisert <jbe@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] Samsung/serial: make the clock source configureable
Date: Tue, 24 Jul 2012 11:24:51 +0200	[thread overview]
Message-ID: <1343121891-1643-4-git-send-email-jbe@pengutronix.de> (raw)
In-Reply-To: <1343121891-1643-1-git-send-email-jbe@pengutronix.de>

Instead of taking the value from somewhere, use the selected architecture to
select one. This ensures the selected clock source corresponds to the values
setup in the clocks-*.c from the mach directory.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 drivers/serial/serial_s3c.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/serial/serial_s3c.c b/drivers/serial/serial_s3c.c
index 96fe847..0a7b137 100644
--- a/drivers/serial/serial_s3c.c
+++ b/drivers/serial/serial_s3c.c
@@ -45,11 +45,6 @@
 #define UBRDIVSLOT 0x2c		/* baudrate slot generator */
 #define UINTM 0x38		/* interrupt mask register */
 
-#ifndef S3C_UART_CLKSEL
-/* Use pclk */
-# define S3C_UART_CLKSEL 0
-#endif
-
 struct s3c_uart {
 	void __iomem *regs;
 	struct console_device cdev;
@@ -57,6 +52,17 @@ struct s3c_uart {
 
 #define to_s3c_uart(c)	container_of(c, struct s3c_uart, cdev)
 
+/* each architecture has a preferred reference clock for its UARTs */
+static unsigned s3c_select_arch_input_clock(void)
+{
+	/* S3C24xx: 0=2=PCLK, 1=UEXTCLK, 3=FCLK/n */
+	if (IS_ENABLED(CONFIG_ARCH_S3C24xx))
+		return 0;	/* use the internal PCLK */
+	/* S5PCxx: 0=PCLK, 1=SCLK_UART */
+	if (IS_ENABLED(CONFIG_ARCH_S5PCxx))
+		return 0;	/* use the internal PCLK */
+}
+
 static unsigned s3c_get_arch_uart_input_clock(void __iomem *base)
 {
 	unsigned reg = readw(base + UCON);
@@ -108,7 +114,7 @@ static int s3c_serial_init_port(struct console_device *cdev)
 	 * all SoCs:
 	 *  - enable receive and transmit mode
 	 */
-	writew(0x0005 | UCON_SET_CLK_SRC(S3C_UART_CLKSEL),
+	writew(0x0005 | UCON_SET_CLK_SRC(s3c_select_arch_input_clock()),
 						base + UCON);
 
 	if (IS_ENABLED(CONFIG_DRIVER_SERIAL_S3C_IMPROVED))
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-07-24  9:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20 19:29 [PATCH] ARM/Samsung: more clean up Juergen Beisert
2012-07-20 19:29 ` [PATCH 1/9] ARM/Samsung: List only really supported S3C24xx SoCs Juergen Beisert
2012-07-20 19:29 ` [PATCH 2/9] ARM/Samsung: follow the name style of the other source files in this directory Juergen Beisert
2012-07-20 19:29 ` [PATCH 3/9] Samsung/serial: remove more ugly ifdef lines Juergen Beisert
2012-07-20 19:29 ` [PATCH 4/9] Samsung/serial: make the code more readable Juergen Beisert
2012-07-20 19:29 ` [PATCH 5/9] Samsung/serial: there is no need to ifdef these register defines Juergen Beisert
2012-07-20 19:29 ` [PATCH 6/9] Samsung/serial: there is no need to ifdef the slot table Juergen Beisert
2012-07-20 19:29 ` [PATCH 7/9] Samsung/serial: move the decision about an improved UART into Kconfig Juergen Beisert
2012-07-23  6:41   ` Sascha Hauer
2012-07-24  9:24     ` [PATCH] ARM/Samsung: remaining clean up Juergen Beisert
2012-07-24  9:24       ` [PATCH 1/3] Samsung/serial: move the decision about an improved UART into Kconfig Juergen Beisert
2012-07-24  9:24       ` [PATCH 2/3] Samsung/serial: unify UCON register settings Juergen Beisert
2012-07-24  9:24       ` Juergen Beisert [this message]
2012-07-25  6:31       ` [PATCH] ARM/Samsung: remaining clean up Sascha Hauer
2012-07-20 19:29 ` [PATCH 8/9] Samsung/serial: unify UCON register settings Juergen Beisert
2012-07-20 19:29 ` [PATCH 9/9] Samsung/serial: make the clock source configureable Juergen Beisert
2012-07-23 22:10 ` [PATCH] ARM/Samsung: more clean up Sascha Hauer

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=1343121891-1643-4-git-send-email-jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=barebox@lists.infradead.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