From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750913AbdE2Jn3 (ORCPT ); Mon, 29 May 2017 05:43:29 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:56829 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750837AbdE2Jn2 (ORCPT ); Mon, 29 May 2017 05:43:28 -0400 Message-ID: <1496051002.17695.34.camel@pengutronix.de> Subject: Re: [PATCH v2] serial: 8250_of: Add reset support From: Philipp Zabel To: Joel Stanley Cc: Greg Kroah-Hartman , Rob Herring , Mark Rutland , linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 29 May 2017 11:43:22 +0200 In-Reply-To: <20170526015519.11865-1-joel@jms.id.au> References: <20170526015519.11865-1-joel@jms.id.au> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joel, On Fri, 2017-05-26 at 11:55 +1000, Joel Stanley wrote: > This adds the hooks for an optional reset controller in the 8250 device > tree node. > > Signed-off-by: Joel Stanley > > --- > v2: > Address Philipp's comments. Thanks for the review! > - use _shared variant > - remove unnecessary error handling > > Documentation/devicetree/bindings/serial/8250.txt | 1 + > drivers/tty/serial/8250/8250_of.c | 10 ++++++++++ > 2 files changed, 11 insertions(+) > > diff --git a/Documentation/devicetree/bindings/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt > index 10276a46ecef..63e32393f82b 100644 > --- a/Documentation/devicetree/bindings/serial/8250.txt > +++ b/Documentation/devicetree/bindings/serial/8250.txt > @@ -45,6 +45,7 @@ Optional properties: > property. > - tx-threshold: Specify the TX FIFO low water indication for parts with > programmable TX FIFO thresholds. > +- resets : phandle + reset specifier pairs > > Note: > * fsl,ns16550: > diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c > index 1cbadafc6889..e95cc9698c32 100644 > --- a/drivers/tty/serial/8250/8250_of.c > +++ b/drivers/tty/serial/8250/8250_of.c > @@ -19,11 +19,13 @@ > #include > #include > #include > +#include > > #include "8250.h" > > struct of_serial_info { > struct clk *clk; > + struct reset_control *rst; > int type; > int line; > }; > @@ -132,6 +134,13 @@ static int of_platform_serial_setup(struct platform_device *ofdev, > } > } > > + info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL); > + if (IS_ERR(info->rst)) > + goto out; > + ret = reset_control_deassert(info->rst); > + if (ret) > + goto out; > + > port->type = type; > port->uartclk = clk; > port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP > @@ -231,6 +240,7 @@ static int of_platform_serial_remove(struct platform_device *ofdev) > > if (info->clk) > clk_disable_unprepare(info->clk); > + reset_control_assert(info->rst); The clock is enabled before the reset is deasserted in of_platform_serial_setup, I'd disable it after asserting the reset in of_platform_serial_remove. Other than that, Reviewed-by: Philipp Zabel regards Philipp