From patchwork Mon Sep 26 19:07:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 4346 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CEA8B23F57 for ; Mon, 26 Sep 2011 19:07:45 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id C36B0A18626 for ; Mon, 26 Sep 2011 19:07:45 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 23so8789249fxe.11 for ; Mon, 26 Sep 2011 12:07:45 -0700 (PDT) Received: by 10.223.57.17 with SMTP id a17mr6092741fah.65.1317064065594; Mon, 26 Sep 2011 12:07:45 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.3.234 with SMTP id f10cs48425laf; Mon, 26 Sep 2011 12:07:45 -0700 (PDT) Received: by 10.236.191.101 with SMTP id f65mr42747913yhn.61.1317064064398; Mon, 26 Sep 2011 12:07:44 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id d68si17484062yhe.149.2011.09.26.12.07.43; Mon, 26 Sep 2011 12:07:44 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.24 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.24 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm2.samsung.com (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LS500DWP94FYQ70@mailout1.samsung.com> for patches@linaro.org; Tue, 27 Sep 2011 04:07:42 +0900 (KST) X-AuditID: cbfee61b-b7b7fae000005864-05-4e80cd7e3a58 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id 65.8A.22628.E7DC08E4; Tue, 27 Sep 2011 04:07:42 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTPA id <0LS5008Q69489390@mmp2.samsung.com> for patches@linaro.org; Tue, 27 Sep 2011 04:07:42 +0900 (KST) From: Thomas Abraham To: linux-serial@vger.kernel.org, devicetree-discuss@lists.ozlabs.org Cc: linux-arm-kernel@lists.infradead.org, alan@linux.intel.com, grant.likely@secretlab.ca, linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, ben-linux@fluff.org, patches@linaro.org Subject: [PATCH 7/9] serial: samsung: merge all SoC specific port reset functions Date: Tue, 27 Sep 2011 00:37:16 +0530 Message-id: <1317064038-32428-8-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1317064038-32428-1-git-send-email-thomas.abraham@linaro.org> References: <1317064038-32428-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: AAAAAA== The SoC specific port reset functions is removed from SoC extensions of the Samsung serial driver and merged into a single port reset function. Cc: Ben Dooks Signed-off-by: Thomas Abraham --- drivers/tty/serial/s3c2410.c | 18 ------------------ drivers/tty/serial/s3c2412.c | 24 ------------------------ drivers/tty/serial/s3c2440.c | 24 ------------------------ drivers/tty/serial/s3c6400.c | 24 ------------------------ drivers/tty/serial/s5pv210.c | 22 +--------------------- drivers/tty/serial/samsung.c | 25 +++++++++++++++++++------ 6 files changed, 20 insertions(+), 117 deletions(-) diff --git a/drivers/tty/serial/s3c2410.c b/drivers/tty/serial/s3c2410.c index e668a9d..1491c32 100644 --- a/drivers/tty/serial/s3c2410.c +++ b/drivers/tty/serial/s3c2410.c @@ -25,23 +25,6 @@ #include "samsung.h" -static int s3c2410_serial_resetport(struct uart_port *port, - struct s3c2410_uartcfg *cfg) -{ - dbg("s3c2410_serial_resetport: port=%p (%08lx), cfg=%p\n", - port, port->mapbase, cfg); - - wr_regl(port, S3C2410_UCON, cfg->ucon); - wr_regl(port, S3C2410_ULCON, cfg->ulcon); - - /* reset both fifos */ - - wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); - wr_regl(port, S3C2410_UFCON, cfg->ufcon); - - return 0; -} - static struct s3c24xx_uart_info s3c2410_uart_inf = { .name = "Samsung S3C2410 UART", .type = PORT_S3C2410, @@ -56,7 +39,6 @@ static struct s3c24xx_uart_info s3c2410_uart_inf = { .num_clks = 2, .clksel_mask = S3C2410_UCON_CLKMASK, .clksel_shift = S3C2410_UCON_CLKSHIFT, - .reset_port = s3c2410_serial_resetport, }; static int s3c2410_serial_probe(struct platform_device *dev) diff --git a/drivers/tty/serial/s3c2412.c b/drivers/tty/serial/s3c2412.c index 5b85c19..38ae730 100644 --- a/drivers/tty/serial/s3c2412.c +++ b/drivers/tty/serial/s3c2412.c @@ -25,29 +25,6 @@ #include "samsung.h" -static int s3c2412_serial_resetport(struct uart_port *port, - struct s3c2410_uartcfg *cfg) -{ - unsigned long ucon = rd_regl(port, S3C2410_UCON); - - dbg("%s: port=%p (%08lx), cfg=%p\n", - __func__, port, port->mapbase, cfg); - - /* ensure we don't change the clock settings... */ - - ucon &= S3C2412_UCON_CLKMASK; - - wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); - wr_regl(port, S3C2410_ULCON, cfg->ulcon); - - /* reset both fifos */ - - wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); - wr_regl(port, S3C2410_UFCON, cfg->ufcon); - - return 0; -} - static struct s3c24xx_uart_info s3c2412_uart_inf = { .name = "Samsung S3C2412 UART", .type = PORT_S3C2412, @@ -63,7 +40,6 @@ static struct s3c24xx_uart_info s3c2412_uart_inf = { .num_clks = 4, .clksel_mask = S3C2412_UCON_CLKMASK, .clksel_shift = S3C2412_UCON_CLKSHIFT, - .reset_port = s3c2412_serial_resetport, }; /* device management */ diff --git a/drivers/tty/serial/s3c2440.c b/drivers/tty/serial/s3c2440.c index 39930f8..70652f5 100644 --- a/drivers/tty/serial/s3c2440.c +++ b/drivers/tty/serial/s3c2440.c @@ -25,29 +25,6 @@ #include "samsung.h" -static int s3c2440_serial_resetport(struct uart_port *port, - struct s3c2410_uartcfg *cfg) -{ - unsigned long ucon = rd_regl(port, S3C2410_UCON); - - dbg("s3c2440_serial_resetport: port=%p (%08lx), cfg=%p\n", - port, port->mapbase, cfg); - - /* ensure we don't change the clock settings... */ - - ucon &= (S3C2440_UCON0_DIVMASK | (3<<10)); - - wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); - wr_regl(port, S3C2410_ULCON, cfg->ulcon); - - /* reset both fifos */ - - wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); - wr_regl(port, S3C2410_UFCON, cfg->ufcon); - - return 0; -} - static struct s3c24xx_uart_info s3c2440_uart_inf = { .name = "Samsung S3C2440 UART", .type = PORT_S3C2440, @@ -62,7 +39,6 @@ static struct s3c24xx_uart_info s3c2440_uart_inf = { .num_clks = 4, .clksel_mask = S3C2440_UCON_CLKMASK, .clksel_shift = S3C2440_UCON_CLKSHIFT, - .reset_port = s3c2440_serial_resetport, }; /* device management */ diff --git a/drivers/tty/serial/s3c6400.c b/drivers/tty/serial/s3c6400.c index c5a6d46..30a69f1 100644 --- a/drivers/tty/serial/s3c6400.c +++ b/drivers/tty/serial/s3c6400.c @@ -26,29 +26,6 @@ #include "samsung.h" -static int s3c6400_serial_resetport(struct uart_port *port, - struct s3c2410_uartcfg *cfg) -{ - unsigned long ucon = rd_regl(port, S3C2410_UCON); - - dbg("s3c6400_serial_resetport: port=%p (%08lx), cfg=%p\n", - port, port->mapbase, cfg); - - /* ensure we don't change the clock settings... */ - - ucon &= S3C6400_UCON_CLKMASK; - - wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); - wr_regl(port, S3C2410_ULCON, cfg->ulcon); - - /* reset both fifos */ - - wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); - wr_regl(port, S3C2410_UFCON, cfg->ufcon); - - return 0; -} - static struct s3c24xx_uart_info s3c6400_uart_inf = { .name = "Samsung S3C6400 UART", .type = PORT_S3C6400, @@ -64,7 +41,6 @@ static struct s3c24xx_uart_info s3c6400_uart_inf = { .num_clks = 4, .clksel_mask = S3C6400_UCON_CLKMASK, .clksel_shift = S3C6400_UCON_CLKSHIFT, - .reset_port = s3c6400_serial_resetport, }; /* device management */ diff --git a/drivers/tty/serial/s5pv210.c b/drivers/tty/serial/s5pv210.c index 173df5a..d232094 100644 --- a/drivers/tty/serial/s5pv210.c +++ b/drivers/tty/serial/s5pv210.c @@ -25,25 +25,6 @@ #include #include "samsung.h" -static int s5pv210_serial_resetport(struct uart_port *port, - struct s3c2410_uartcfg *cfg) -{ - unsigned long ucon = rd_regl(port, S3C2410_UCON); - - ucon &= S5PV210_UCON_CLKMASK; - wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); - wr_regl(port, S3C2410_ULCON, cfg->ulcon); - - /* reset both fifos */ - wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); - wr_regl(port, S3C2410_UFCON, cfg->ufcon); - - /* It is need to delay When reset FIFO register */ - udelay(1); - - return 0; -} - #define S5PV210_UART_DEFAULT_INFO(fifo_size) \ .name = "Samsung S5PV210 UART0", \ .type = PORT_S3C6400, \ @@ -58,8 +39,7 @@ static int s5pv210_serial_resetport(struct uart_port *port, .def_clk_sel = S3C2410_UCON_CLKSEL0, \ .num_clks = 2, \ .clksel_mask = S5PV210_UCON_CLKMASK, \ - .clksel_shift = S5PV210_UCON_CLKSHIFT, \ - .reset_port = s5pv210_serial_resetport + .clksel_shift = S5PV210_UCON_CLKSHIFT static struct s3c24xx_uart_info s5p_port_fifo256 = { S5PV210_UART_DEFAULT_INFO(256), diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index dc5a4ed..7cd78b3 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -965,16 +965,29 @@ static struct s3c24xx_uart_port s3c24xx_serial_ports[CONFIG_SERIAL_SAMSUNG_UARTS /* s3c24xx_serial_resetport * - * wrapper to call the specific reset for this port (reset the fifos - * and the settings) + * reset the fifos and other the settings. */ -static inline int s3c24xx_serial_resetport(struct uart_port *port, - struct s3c2410_uartcfg *cfg) +static void s3c24xx_serial_resetport(struct uart_port *port, + struct s3c2410_uartcfg *cfg) { struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); + unsigned long ucon = rd_regl(port, S3C2410_UCON); + unsigned int ucon_mask; - return (info->reset_port)(port, cfg); + ucon_mask = info->clksel_mask; + if (info->type == PORT_S3C2440) + ucon_mask |= S3C2440_UCON0_DIVMASK; + + ucon &= ucon_mask; + wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); + + /* reset both fifos */ + wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); + wr_regl(port, S3C2410_UFCON, cfg->ufcon); + + /* some delay is required after fifo reset */ + udelay(1); }