From patchwork Sat Aug 12 14:23:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergej Sawazki X-Patchwork-Id: 9897261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3E74260236 for ; Sat, 12 Aug 2017 14:23:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3075328683 for ; Sat, 12 Aug 2017 14:23:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 256DC28BC2; Sat, 12 Aug 2017 14:23:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 546A728BC3 for ; Sat, 12 Aug 2017 14:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750968AbdHLOXk (ORCPT ); Sat, 12 Aug 2017 10:23:40 -0400 Received: from s62.goserver.host ([37.17.224.62]:40556 "EHLO s62.goserver.host" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750972AbdHLOXk (ORCPT ); Sat, 12 Aug 2017 10:23:40 -0400 Received: from duke.fritz.box (p5B23AD9C.dip0.t-ipconnect.de [91.35.173.156]) by s62.goserver.host (Postfix) with ESMTPSA id 96EB2BD016C7; Sat, 12 Aug 2017 16:23:38 +0200 (CEST) From: Sergej Sawazki To: sboyd@codeaurora.org, mturquette@baylibre.com Cc: sebastian.hesselbarth@gmail.com, rabeeh@solid-run.com, linux@armlinux.org.uk, linux-clk@vger.kernel.org, Sergej Sawazki Subject: [PATCH 2/3] clk: si5351: Add DT property to enable PLL reset Date: Sat, 12 Aug 2017 16:23:02 +0200 Message-Id: <1502547783-24685-3-git-send-email-sergej@taudac.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502547783-24685-1-git-send-email-sergej@taudac.com> References: <1502547783-24685-1-git-send-email-sergej@taudac.com> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add optional output clock DT property to enable PLL reset when a clock output is enabled or the clock rate is changed. Cc: Sebastian Hesselbarth Cc: Rabeeh Khoury Signed-off-by: Sergej Sawazki --- Documentation/devicetree/bindings/clock/silabs,si5351.txt | 1 + drivers/clk/clk-si5351.c | 11 ++++++++++- include/linux/platform_data/si5351.h | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/clock/silabs,si5351.txt b/Documentation/devicetree/bindings/clock/silabs,si5351.txt index 28b2830..157ee02 100644 --- a/Documentation/devicetree/bindings/clock/silabs,si5351.txt +++ b/Documentation/devicetree/bindings/clock/silabs,si5351.txt @@ -45,6 +45,7 @@ Optional child node properties: - silabs,multisynth-source: source pll A(0) or B(1) of corresponding multisynth divider. - silabs,pll-master: boolean, multisynth can change pll frequency. +- silabs,pll-reset: boolean, clock output can reset its pll. - silabs,disable-state : clock output disable state, shall be 0 = clock output is driven LOW when disabled 1 = clock output is driven HIGH when disabled diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c index 46bbc95..aa8d8d9 100644 --- a/drivers/clk/clk-si5351.c +++ b/drivers/clk/clk-si5351.c @@ -900,7 +900,13 @@ static int _si5351_clkout_set_disable_state( void _si5351_clkout_reset_pll(struct si5351_driver_data *drvdata, int num) { - u8 val = si5351_reg_read(drvdata, SI5351_CLK0_CTRL + num); + struct si5351_platform_data *pdata = drvdata->client->dev.platform_data; + u8 val; + + if (!pdata->clkout[num].pll_reset) + return; /* Resetting PLL disabled */ + + val = si5351_reg_read(drvdata, SI5351_CLK0_CTRL + num); switch (val & SI5351_CLK_INPUT_MASK) { case SI5351_CLK_INPUT_XTAL: @@ -1321,6 +1327,9 @@ static int si5351_dt_parse(struct i2c_client *client, pdata->clkout[num].pll_master = of_property_read_bool(child, "silabs,pll-master"); + + pdata->clkout[num].pll_reset = + of_property_read_bool(child, "silabs,pll-reset"); } client->dev.platform_data = pdata; diff --git a/include/linux/platform_data/si5351.h b/include/linux/platform_data/si5351.h index 533d980..da346f22 100644 --- a/include/linux/platform_data/si5351.h +++ b/include/linux/platform_data/si5351.h @@ -85,6 +85,7 @@ enum si5351_disable_state { * @multisynth_src: multisynth source clock * @clkout_src: clkout source clock * @pll_master: if true, clkout can also change pll rate + * @pll_reset: if true, clkout can reset its pll * @drive: output drive strength * @rate: initial clkout rate, or default if 0 */ @@ -94,6 +95,7 @@ struct si5351_clkout_config { enum si5351_drive_strength drive; enum si5351_disable_state disable_state; bool pll_master; + bool pll_reset; unsigned long rate; };