From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760268AbbEEQL0 (ORCPT ); Tue, 5 May 2015 12:11:26 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:44343 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2993468AbbEEPu5 (ORCPT ); Tue, 5 May 2015 11:50:57 -0400 Date: Tue, 5 May 2015 17:50:30 +0200 From: Sascha Hauer To: Matthias Brugger Cc: "linux-kernel@vger.kernel.org" , Greg KH , linux-mediatek@lists.infradead.org, "linux-arm-kernel@lists.infradead.org" , linux-serial@vger.kernel.org, Alan Cox Subject: Re: [PATCH 4/4] tty: serial: 8250_mtk: Add support for bus clock Message-ID: <20150505155030.GA6325@pengutronix.de> References: <1430117397-13517-1-git-send-email-s.hauer@pengutronix.de> <1430117397-13517-5-git-send-email-s.hauer@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 17:48:34 up 50 days, 3:40, 83 users, load average: 0.01, 0.16, 0.18 User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@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 On Tue, May 05, 2015 at 05:41:16PM +0200, Matthias Brugger wrote: > 2015-04-27 8:49 GMT+02:00 Sascha Hauer : > > The mtk 8250 needs two clocks, one for providing the baudrate and > > one that needs to be enabled for register accesses. The latter has > > not been supported, this patch adds support for it. It is optional > > for now since not all SoCs provide a bus clock. > > > > Signed-off-by: Sascha Hauer > > --- > > .../devicetree/bindings/serial/mtk-uart.txt | 12 ++++++++-- > > drivers/tty/serial/8250/8250_mtk.c | 28 ++++++++++++++++++---- > > 2 files changed, 34 insertions(+), 6 deletions(-) > > > > diff --git a/Documentation/devicetree/bindings/serial/mtk-uart.txt b/Documentation/devicetree/bindings/serial/mtk-uart.txt > > index 4415226..8d63f1d 100644 > > --- a/Documentation/devicetree/bindings/serial/mtk-uart.txt > > +++ b/Documentation/devicetree/bindings/serial/mtk-uart.txt > > @@ -14,7 +14,14 @@ Required properties: > > > > - interrupts: A single interrupt specifier. > > > > -- clocks: Clock driving the hardware. > > +- clocks : Must contain an entry for each entry in clock-names. > > + See ../clocks/clock-bindings.txt for details. > > +- clock-names: > > + - "baud": The clock the baudrate is derived from > > + - "bus": The bus clock for register accesses (optional) > > + > > +For compatibility with older device trees an unnamed clock is used for the > > +baud clock if the baudclk does not exist. Do not use this for new designs. > > > > Example: > > > > @@ -22,5 +29,6 @@ Example: > > compatible = "mediatek,mt6589-uart", "mediatek,mt6577-uart"; > > reg = <0x11006000 0x400>; > > interrupts = ; > > - clocks = <&uart_clk>; > > + clocks = <&uart_clk>, <&bus_clk>; > > + clock-names = "baud", "bus"; > > }; > > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c > > index 2f28bd0..8eb3876 100644 > > --- a/drivers/tty/serial/8250/8250_mtk.c > > +++ b/drivers/tty/serial/8250/8250_mtk.c > > @@ -34,6 +34,7 @@ > > struct mtk8250_data { > > int line; > > struct clk *uart_clk; > > + struct clk *bus_clk; > > }; > > Not sure if it would be better to rename the uart_clk to baud_clk > which reflects the new naming scheme. Can do. > > > > > static void > > @@ -120,6 +121,7 @@ static int mtk8250_runtime_suspend(struct device *dev) > > struct mtk8250_data *data = dev_get_drvdata(dev); > > > > clk_disable_unprepare(data->uart_clk); > > + clk_disable_unprepare(data->bus_clk); > > bus_clk can be NULL. The clk core handles NULL clks just fine. They are considered dummy clks. You can prepare/enable them, clk_get_rate of course returns nothing useful. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sascha Hauer Subject: Re: [PATCH 4/4] tty: serial: 8250_mtk: Add support for bus clock Date: Tue, 5 May 2015 17:50:30 +0200 Message-ID: <20150505155030.GA6325@pengutronix.de> References: <1430117397-13517-1-git-send-email-s.hauer@pengutronix.de> <1430117397-13517-5-git-send-email-s.hauer@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+glpam-linux-mediatek=m.gmane.org-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org To: Matthias Brugger Cc: Greg KH , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , Alan Cox List-Id: linux-serial@vger.kernel.org On Tue, May 05, 2015 at 05:41:16PM +0200, Matthias Brugger wrote: > 2015-04-27 8:49 GMT+02:00 Sascha Hauer : > > The mtk 8250 needs two clocks, one for providing the baudrate and > > one that needs to be enabled for register accesses. The latter has > > not been supported, this patch adds support for it. It is optional > > for now since not all SoCs provide a bus clock. > > > > Signed-off-by: Sascha Hauer > > --- > > .../devicetree/bindings/serial/mtk-uart.txt | 12 ++++++++-- > > drivers/tty/serial/8250/8250_mtk.c | 28 ++++++++++++++++++---- > > 2 files changed, 34 insertions(+), 6 deletions(-) > > > > diff --git a/Documentation/devicetree/bindings/serial/mtk-uart.txt b/Documentation/devicetree/bindings/serial/mtk-uart.txt > > index 4415226..8d63f1d 100644 > > --- a/Documentation/devicetree/bindings/serial/mtk-uart.txt > > +++ b/Documentation/devicetree/bindings/serial/mtk-uart.txt > > @@ -14,7 +14,14 @@ Required properties: > > > > - interrupts: A single interrupt specifier. > > > > -- clocks: Clock driving the hardware. > > +- clocks : Must contain an entry for each entry in clock-names. > > + See ../clocks/clock-bindings.txt for details. > > +- clock-names: > > + - "baud": The clock the baudrate is derived from > > + - "bus": The bus clock for register accesses (optional) > > + > > +For compatibility with older device trees an unnamed clock is used for the > > +baud clock if the baudclk does not exist. Do not use this for new designs. > > > > Example: > > > > @@ -22,5 +29,6 @@ Example: > > compatible = "mediatek,mt6589-uart", "mediatek,mt6577-uart"; > > reg = <0x11006000 0x400>; > > interrupts = ; > > - clocks = <&uart_clk>; > > + clocks = <&uart_clk>, <&bus_clk>; > > + clock-names = "baud", "bus"; > > }; > > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c > > index 2f28bd0..8eb3876 100644 > > --- a/drivers/tty/serial/8250/8250_mtk.c > > +++ b/drivers/tty/serial/8250/8250_mtk.c > > @@ -34,6 +34,7 @@ > > struct mtk8250_data { > > int line; > > struct clk *uart_clk; > > + struct clk *bus_clk; > > }; > > Not sure if it would be better to rename the uart_clk to baud_clk > which reflects the new naming scheme. Can do. > > > > > static void > > @@ -120,6 +121,7 @@ static int mtk8250_runtime_suspend(struct device *dev) > > struct mtk8250_data *data = dev_get_drvdata(dev); > > > > clk_disable_unprepare(data->uart_clk); > > + clk_disable_unprepare(data->bus_clk); > > bus_clk can be NULL. The clk core handles NULL clks just fine. They are considered dummy clks. You can prepare/enable them, clk_get_rate of course returns nothing useful. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | From mboxrd@z Thu Jan 1 00:00:00 1970 From: s.hauer@pengutronix.de (Sascha Hauer) Date: Tue, 5 May 2015 17:50:30 +0200 Subject: [PATCH 4/4] tty: serial: 8250_mtk: Add support for bus clock In-Reply-To: References: <1430117397-13517-1-git-send-email-s.hauer@pengutronix.de> <1430117397-13517-5-git-send-email-s.hauer@pengutronix.de> Message-ID: <20150505155030.GA6325@pengutronix.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tue, May 05, 2015 at 05:41:16PM +0200, Matthias Brugger wrote: > 2015-04-27 8:49 GMT+02:00 Sascha Hauer : > > The mtk 8250 needs two clocks, one for providing the baudrate and > > one that needs to be enabled for register accesses. The latter has > > not been supported, this patch adds support for it. It is optional > > for now since not all SoCs provide a bus clock. > > > > Signed-off-by: Sascha Hauer > > --- > > .../devicetree/bindings/serial/mtk-uart.txt | 12 ++++++++-- > > drivers/tty/serial/8250/8250_mtk.c | 28 ++++++++++++++++++---- > > 2 files changed, 34 insertions(+), 6 deletions(-) > > > > diff --git a/Documentation/devicetree/bindings/serial/mtk-uart.txt b/Documentation/devicetree/bindings/serial/mtk-uart.txt > > index 4415226..8d63f1d 100644 > > --- a/Documentation/devicetree/bindings/serial/mtk-uart.txt > > +++ b/Documentation/devicetree/bindings/serial/mtk-uart.txt > > @@ -14,7 +14,14 @@ Required properties: > > > > - interrupts: A single interrupt specifier. > > > > -- clocks: Clock driving the hardware. > > +- clocks : Must contain an entry for each entry in clock-names. > > + See ../clocks/clock-bindings.txt for details. > > +- clock-names: > > + - "baud": The clock the baudrate is derived from > > + - "bus": The bus clock for register accesses (optional) > > + > > +For compatibility with older device trees an unnamed clock is used for the > > +baud clock if the baudclk does not exist. Do not use this for new designs. > > > > Example: > > > > @@ -22,5 +29,6 @@ Example: > > compatible = "mediatek,mt6589-uart", "mediatek,mt6577-uart"; > > reg = <0x11006000 0x400>; > > interrupts = ; > > - clocks = <&uart_clk>; > > + clocks = <&uart_clk>, <&bus_clk>; > > + clock-names = "baud", "bus"; > > }; > > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c > > index 2f28bd0..8eb3876 100644 > > --- a/drivers/tty/serial/8250/8250_mtk.c > > +++ b/drivers/tty/serial/8250/8250_mtk.c > > @@ -34,6 +34,7 @@ > > struct mtk8250_data { > > int line; > > struct clk *uart_clk; > > + struct clk *bus_clk; > > }; > > Not sure if it would be better to rename the uart_clk to baud_clk > which reflects the new naming scheme. Can do. > > > > > static void > > @@ -120,6 +121,7 @@ static int mtk8250_runtime_suspend(struct device *dev) > > struct mtk8250_data *data = dev_get_drvdata(dev); > > > > clk_disable_unprepare(data->uart_clk); > > + clk_disable_unprepare(data->bus_clk); > > bus_clk can be NULL. The clk core handles NULL clks just fine. They are considered dummy clks. You can prepare/enable them, clk_get_rate of course returns nothing useful. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |