From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SsItc-00068x-OC for barebox@lists.infradead.org; Fri, 20 Jul 2012 19:29:58 +0000 Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:21e:67ff:fe11:9c5c]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1SsItY-0005c1-Bq for barebox@lists.infradead.org; Fri, 20 Jul 2012 21:29:48 +0200 Received: from jbe by dude.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1SsItX-0007gW-Dv for barebox@lists.infradead.org; Fri, 20 Jul 2012 21:29:47 +0200 From: Juergen Beisert Date: Fri, 20 Jul 2012 21:29:40 +0200 Message-Id: <1342812585-22017-5-git-send-email-jbe@pengutronix.de> In-Reply-To: <1342812585-22017-1-git-send-email-jbe@pengutronix.de> References: <1342812585-22017-1-git-send-email-jbe@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 4/9] Samsung/serial: make the code more readable To: barebox@lists.infradead.org This bit magic is just setting and reading the UART's selected clock source. Signed-off-by: Juergen Beisert --- drivers/serial/serial_s3c.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/serial/serial_s3c.c b/drivers/serial/serial_s3c.c index ff3792b..c537bc0 100644 --- a/drivers/serial/serial_s3c.c +++ b/drivers/serial/serial_s3c.c @@ -31,6 +31,8 @@ /* Note: Offsets are for little endian access */ #define ULCON 0x00 /* line control */ #define UCON 0x04 /* UART control */ +# define UCON_SET_CLK_SRC(x) (((x) & 0x03) << 10) +# define UCON_GET_CLK_SRC(x) (((x) >> 10) & 0x03) #define UFCON 0x08 /* FIFO control */ #define UMCON 0x0c /* modem control */ #define UTRSTAT 0x10 /* Rx/Tx status */ @@ -62,8 +64,7 @@ struct s3c_uart { static unsigned s3c_get_arch_uart_input_clock(void __iomem *base) { unsigned reg = readw(base + UCON); - reg = (reg >> 10) & 0x3; - return s3c_get_uart_clk(reg); + return s3c_get_uart_clk(UCON_GET_CLK_SRC(reg)); } #ifdef S3C_UART_HAS_UBRDIVSLOT @@ -108,7 +109,8 @@ static int s3c_serial_init_port(struct console_device *cdev) /* tx=level,rx=edge,disable timeout int.,enable rx error int., * normal, interrupt or polling, no pre-divider */ - writew(0x0245 | ((S3C_UART_CLKSEL) << 10), base + UCON); + writew(0x0245 | UCON_SET_CLK_SRC(S3C_UART_CLKSEL), + base + UCON); #ifdef S3C_UART_HAS_UINTM /* 'interrupt or polling mode' for both directions */ -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox