From patchwork Fri May 23 07:51:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 4228631 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 85CD29F1F4 for ; Fri, 23 May 2014 08:00:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A872120035 for ; Fri, 23 May 2014 08:00:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BD7EF2034B for ; Fri, 23 May 2014 08:00:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WnkMj-0005Gg-Sf; Fri, 23 May 2014 07:58:09 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WnkHQ-0000Qb-La for linux-arm-kernel@bombadil.infradead.org; Fri, 23 May 2014 07:52:40 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WnkHM-0001QV-Mk for linux-arm-kernel@lists.infradead.org; Fri, 23 May 2014 07:52:38 +0000 Received: from wens by mirror2.csie.ntu.edu.tw with local (Exim 4.82) (envelope-from ) id 1WnkGU-0007Ru-Cb; Fri, 23 May 2014 15:51:42 +0800 From: Chen-Yu Tsai To: Greg Kroah-Hartman , Samuel Ortiz , Lee Jones , Maxime Ripard , Rob Herring , Mike Turquette , Emilio Lopez , Linus Walleij Subject: [PATCH 01/22] serial: 8250_dw: Add optional reset control support Date: Fri, 23 May 2014 15:51:04 +0800 Message-Id: <1400831485-28576-2-git-send-email-wens@csie.org> X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: <1400831485-28576-1-git-send-email-wens@csie.org> References: <1400831485-28576-1-git-send-email-wens@csie.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140523_085237_041436_5F4DFB31 X-CRM114-Status: GOOD ( 14.47 ) X-Spam-Score: -2.6 (--) Cc: devicetree@vger.kernel.org, Boris BREZILLON , Luc Verhaegen , linux-kernel@vger.kernel.org, Hans de Goede , Chen-Yu Tsai , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The Allwinner A31 and A23 SoCs have a reset controller maintaining the UART in reset by default. This patch adds optional reset support to the driver. Signed-off-by: Chen-Yu Tsai --- Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt | 1 + drivers/tty/serial/8250/8250_dw.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt index f13f1c5..cb9af84 100644 --- a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt +++ b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt @@ -7,6 +7,7 @@ Required properties: - clock-frequency : the input clock frequency for the UART. Optional properties: +- resets : phandle to the parent reset controller. - reg-shift : quantity to shift the register offsets by. If this property is not present then the register offsets are not shifted. - reg-io-width : the size (in bytes) of the IO accesses that should be diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index ed31135..d0c6d080 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -59,6 +60,7 @@ struct dw8250_data { int last_mcr; int line; struct clk *clk; + struct reset_control *rst; struct uart_8250_dma dma; }; @@ -259,6 +261,8 @@ static int dw8250_probe_of(struct uart_port *p, if (!of_property_read_u32(np, "reg-shift", &val)) p->regshift = val; + data->rst = devm_reset_control_get_optional(p->dev, NULL); + /* clock got configured through clk api, all done */ if (p->uartclk) return 0; @@ -362,6 +366,9 @@ static int dw8250_probe(struct platform_device *pdev) return -ENODEV; } + if (!IS_ERR_OR_NULL(data->rst)) + reset_control_deassert(data->rst); + data->line = serial8250_register_8250_port(&uart); if (data->line < 0) return data->line; @@ -382,6 +389,9 @@ static int dw8250_remove(struct platform_device *pdev) serial8250_unregister_port(data->line); + if (!IS_ERR_OR_NULL(data->rst)) + reset_control_assert(data->rst); + if (!IS_ERR(data->clk)) clk_disable_unprepare(data->clk);