From patchwork Mon Jul 11 10:50:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 9223265 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 3881F60760 for ; Mon, 11 Jul 2016 10:52:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28B00277D9 for ; Mon, 11 Jul 2016 10:52:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D2D827C38; Mon, 11 Jul 2016 10:52:27 +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 8FCF0277D9 for ; Mon, 11 Jul 2016 10:52:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758630AbcGKKwE (ORCPT ); Mon, 11 Jul 2016 06:52:04 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:40698 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758559AbcGKKvE (ORCPT ); Mon, 11 Jul 2016 06:51:04 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 56492611E1; Mon, 11 Jul 2016 10:51:03 +0000 (UTC) Received: from blr-ubuntu-34.ap.qualcomm.com (unknown [202.46.23.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: rnayak@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 40BC3611DD; Mon, 11 Jul 2016 10:50:59 +0000 (UTC) From: Rajendra Nayak To: sboyd@codeaurora.org, stephen.boyd@linaro.org, mturquette@baylibre.com Cc: linux-clk@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Rajendra Nayak Subject: [PATCH 4/6] clk: qcom: Add support for PLLs with alpha mode Date: Mon, 11 Jul 2016 16:20:37 +0530 Message-Id: <1468234239-28693-5-git-send-email-rnayak@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1468234239-28693-1-git-send-email-rnayak@codeaurora.org> References: <1468234239-28693-1-git-send-email-rnayak@codeaurora.org> 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 Some PLLs can support an alpha mode, and a single alpha register (instead of registers to program the M/N values), the contents of which depend on the alpha mode selected. (They are either treated as two's complement or M/N value) Add support for this in the clk PLL driver. Signed-off-by: Rajendra Nayak --- drivers/clk/qcom/clk-pll.c | 8 ++++++-- drivers/clk/qcom/clk-pll.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/clk/qcom/clk-pll.c b/drivers/clk/qcom/clk-pll.c index 5b940d6..08d2fa2 100644 --- a/drivers/clk/qcom/clk-pll.c +++ b/drivers/clk/qcom/clk-pll.c @@ -255,8 +255,12 @@ static void clk_pll_configure(struct clk_pll *pll, struct regmap *regmap, u32 mask; regmap_write(regmap, pll->l_reg, config->l); - regmap_write(regmap, pll->m_reg, config->m); - regmap_write(regmap, pll->n_reg, config->n); + if (pll->alpha_reg) { + regmap_write(regmap, pll->alpha_reg, config->alpha); + } else { + regmap_write(regmap, pll->m_reg, config->m); + regmap_write(regmap, pll->n_reg, config->n); + } val = config->vco_val; val |= config->pre_div_val; diff --git a/drivers/clk/qcom/clk-pll.h b/drivers/clk/qcom/clk-pll.h index ffd0c63..083727e 100644 --- a/drivers/clk/qcom/clk-pll.h +++ b/drivers/clk/qcom/clk-pll.h @@ -48,6 +48,7 @@ struct clk_pll { u32 l_reg; u32 m_reg; u32 n_reg; + u32 alpha_reg; u32 config_reg; u32 mode_reg; u32 status_reg; @@ -70,6 +71,7 @@ struct pll_config { u16 l; u32 m; u32 n; + u32 alpha; u32 vco_val; u32 vco_mask; u32 pre_div_val;