From patchwork Mon Jul 23 21:54:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10541189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE685112E for ; Mon, 23 Jul 2018 21:54:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE4EE28538 for ; Mon, 23 Jul 2018 21:54:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C217E2856A; Mon, 23 Jul 2018 21:54: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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 AB09628538 for ; Mon, 23 Jul 2018 21:54:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388203AbeGWW5s (ORCPT ); Mon, 23 Jul 2018 18:57:48 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46783 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388233AbeGWW5r (ORCPT ); Mon, 23 Jul 2018 18:57:47 -0400 Received: by mail-pf1-f194.google.com with SMTP id u24-v6so350068pfn.13 for ; Mon, 23 Jul 2018 14:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OcJAee3cdd0GwYh1ij0y6A/aT86+kBdXYoDfzCL9WVo=; b=oJANRBgw9vJSxuKGlspyJp+Ana1l3doAmQSBe17A7y8egWZrBy04BHG8hc4kmzjujb BFDt7NMiNggrmdPQpargJccT5xgNoI4QhQeJ3ufDcqYR0+LMQwC6vPw9AGSa+LvE/yo+ X0/4r4pSl8fGjUyDjcryT/JTpBsv8+eLhjFSI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OcJAee3cdd0GwYh1ij0y6A/aT86+kBdXYoDfzCL9WVo=; b=tEah2Wg+pCayDD+TAz/Uu+G8XbAFNX0dri3knSuuBUD45Ux5LeycjWPdTiu0rQqnhs iMU+w2My+BwBh//Admy57a4Kh1nJi40Tv4Z0oR1B9wZaffDHR3nNaPxf0PQFE98I0JxF fSa2YT9qT+f8lnMsGReZlIEV59bEEMC3Z5MEhvkyeMFKVr9a0pXULLMQusKw2F19h/CK WnYZcgB8Af/6N84I5EIgEpEd8MPF7136ZqGawm6bL9E9/nAnNvWVO2WhYu3fXHy+d8iW kMEjRI9+aZtD5sgNrdvOtvDkZ8Ln20zf1XdL3wFaz1HLi9gDezY4JCJ5YMh26apk/b+4 E+9A== X-Gm-Message-State: AOUpUlF8ErYx1lJxBeIjCF9k05Yp3bjW46L8qYnl6y/yeys0JlcBOdi2 WAQNKiQ8q9ho28k9Q9nJRsq9XQ== X-Google-Smtp-Source: AAOMgpd61OtegwI3b8TJ83kjKn86OmKlrEtLn39BYbywv/DzcywfWBww2aW30Y7x8+vt7DJPyi01Sw== X-Received: by 2002:a63:b705:: with SMTP id t5-v6mr13916488pgf.45.1532382874415; Mon, 23 Jul 2018 14:54:34 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:0:1000:1501:38e4:86fe:ec0c:4007]) by smtp.gmail.com with ESMTPSA id n26-v6sm5927629pgv.78.2018.07.23.14.54.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 14:54:33 -0700 (PDT) From: Douglas Anderson To: sboyd@kernel.org, andy.gross@linaro.org Cc: tdas@codeaurora.org, grahamr@codeaurora.org, girishm@codeaurora.org, anischal@codeaurora.org, bjorn.andersson@linaro.org, Douglas Anderson , Michael Turquette , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, David Brown , linux-soc@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH v2 2/2] clk: qcom: Add qspi (Quad SPI) clocks for sdm845 Date: Mon, 23 Jul 2018 14:54:04 -0700 Message-Id: <20180723215404.74296-3-dianders@chromium.org> X-Mailer: git-send-email 2.18.0.233.g985f88cf7e-goog In-Reply-To: <20180723215404.74296-1-dianders@chromium.org> References: <20180723215404.74296-1-dianders@chromium.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 Add both the interface and core clock. Signed-off-by: Douglas Anderson --- Changes in v2: - Only 19.2, 100, 150, and 300 MHz now. - All clocks come from MAIN rather than EVEN. - Use parent map 0 instead of new parent map 9. drivers/clk/qcom/gcc-sdm845.c | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c index 0f694ed4238a..5bca634e277a 100644 --- a/drivers/clk/qcom/gcc-sdm845.c +++ b/drivers/clk/qcom/gcc-sdm845.c @@ -162,6 +162,13 @@ static const char * const gcc_parent_names_10[] = { "core_bi_pll_test_se", }; +static const char * const gcc_parent_names_9[] = { + "bi_tcxo", + "gpll0", + "gpll0_out_even", + "core_pi_sleep_clk", +}; + static struct clk_alpha_pll gpll0 = { .offset = 0x0, .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA], @@ -358,6 +365,28 @@ static struct clk_rcg2 gcc_pcie_phy_refgen_clk_src = { }, }; +static const struct freq_tbl ftbl_gcc_qspi_core_clk_src[] = { + F(19200000, P_BI_TCXO, 1, 0, 0), + F(100000000, P_GPLL0_OUT_MAIN, 6, 0, 0), + F(150000000, P_GPLL0_OUT_MAIN, 4, 0, 0), + F(300000000, P_GPLL0_OUT_MAIN, 2, 0, 0), + { } +}; + +static struct clk_rcg2 gcc_qspi_core_clk_src = { + .cmd_rcgr = 0x4b008, + .mnd_width = 0, + .hid_width = 5, + .parent_map = gcc_parent_map_0, + .freq_tbl = ftbl_gcc_qspi_core_clk_src, + .clkr.hw.init = &(struct clk_init_data){ + .name = "gcc_qspi_core_clk_src", + .parent_names = gcc_parent_names_9, + .num_parents = 4, + .ops = &clk_rcg2_floor_ops, + }, +}; + static const struct freq_tbl ftbl_gcc_pdm2_clk_src[] = { F(9600000, P_BI_TCXO, 2, 0, 0), F(19200000, P_BI_TCXO, 1, 0, 0), @@ -1935,6 +1964,37 @@ static struct clk_branch gcc_qmip_video_ahb_clk = { }, }; +static struct clk_branch gcc_qspi_cnoc_periph_ahb_clk = { + .halt_reg = 0x4b000, + .halt_check = BRANCH_HALT, + .clkr = { + .enable_reg = 0x4b000, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "gcc_qspi_cnoc_periph_ahb_clk", + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch gcc_qspi_core_clk = { + .halt_reg = 0x4b004, + .halt_check = BRANCH_HALT, + .clkr = { + .enable_reg = 0x4b004, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "gcc_qspi_core_clk", + .parent_names = (const char *[]){ + "gcc_qspi_core_clk_src", + }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, + .ops = &clk_branch2_ops, + }, + }, +}; + static struct clk_branch gcc_qupv3_wrap0_s0_clk = { .halt_reg = 0x17030, .halt_check = BRANCH_HALT_VOTED, @@ -3383,6 +3443,9 @@ static struct clk_regmap *gcc_sdm845_clocks[] = { [GPLL4] = &gpll4.clkr, [GCC_CPUSS_DVM_BUS_CLK] = &gcc_cpuss_dvm_bus_clk.clkr, [GCC_CPUSS_GNOC_CLK] = &gcc_cpuss_gnoc_clk.clkr, + [GCC_QSPI_CORE_CLK_SRC] = &gcc_qspi_core_clk_src.clkr, + [GCC_QSPI_CORE_CLK] = &gcc_qspi_core_clk.clkr, + [GCC_QSPI_CNOC_PERIPH_AHB_CLK] = &gcc_qspi_cnoc_periph_ahb_clk.clkr, }; static const struct qcom_reset_map gcc_sdm845_resets[] = {