From patchwork Wed Oct 18 11:00:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiancheng Xue X-Patchwork-Id: 116172 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp5582650qgn; Tue, 17 Oct 2017 19:57:37 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDGKfImQX5cSGFdnbmCjUcgeMnU1KAOguZuSh1e4M5bPznbO0fb6udq9Cys5Q8ESyYFcE1S X-Received: by 10.84.130.108 with SMTP id 99mr13898528plc.343.1508295457475; Tue, 17 Oct 2017 19:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508295457; cv=none; d=google.com; s=arc-20160816; b=aFHdc89xVpc772aBgEKEhomA8Zz8RjDYEy2IOV+DbbIW1j7XTluoznpR75x5qZ9mR/ KDiN0j98oaiHvsXyyWv2h7kR7mQOpDFzMRKN+PilZZML1eGiQIUFVY1ArthK9U9y+cVJ oV3h++2s1IzFY7JgiAGUXiCIvM+1OT6+ZzlZw/oLe51viNv3PMqHNjIvs28PWvRIjt8q bZ6Gr7T3rh/J6oMrUORD6vdThs9NISP17i9QgW0pM3prA7tYP3iI1MhyBCdIJYJphVj7 0L2KGspt5N0nR5WO1DGzOIWPJJ9IrWsLu8JJfhFvw+usXoehuLflrZYBH10Qzyi28en/ o5ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=8ZruUUvyj6i/O3o6xq2iINGlTJ1loyJyfFsjqqJbtCk=; b=s5F8Pr73NZoR9MWHoPhUFKfZQnjUWGqyYeYu4mtiQXU+rkWu8ENjhX+qwqF82mq0/E hEIs+UPH5IB0czgADxK0BwtTP4d6vtpWoPOk7UZALUSKXtA+mkIc+g7eqhKvxOhXp5oX TN+X3QeSmELmpbv3CstgMVKnk2sg9C0kMMwGtaFWIuWOHcWmZTVpJGqNeJPUhSBgA6/j OeZEkUrfeAaVRM9TZWlMBi2ZWax1X6bzRnHgGlFrpvJhS05Y4cgKhs1kw0fGxXlITPl2 C0iknQ8+ijNYHBrCYFlBJOD+2n1umbtnM8kNG4lRsWgbNbv7DUrK29Uvvw2sSrUPvHkb gSvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e73si6715852pfb.421.2017.10.17.19.57.37; Tue, 17 Oct 2017 19:57:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933314AbdJRC5f (ORCPT + 27 others); Tue, 17 Oct 2017 22:57:35 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8494 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752607AbdJRC5d (ORCPT ); Tue, 17 Oct 2017 22:57:33 -0400 Received: from 172.30.72.60 (EHLO DGGEMS413-HUB.china.huawei.com) ([172.30.72.60]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DJG66693; Wed, 18 Oct 2017 10:57:24 +0800 (CST) Received: from arch-ubuntu.huawei.com (10.69.192.66) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.301.0; Wed, 18 Oct 2017 10:56:03 +0800 From: Jiancheng Xue To: , CC: , , , , , tianshuliang , Jiancheng Xue Subject: [PATCH 2/3] clk: hisilicon: add emmc sample and drive clock for hi3798cv200 SoC Date: Wed, 18 Oct 2017 07:00:28 -0400 Message-ID: <1508324429-6012-3-git-send-email-xuejiancheng@hisilicon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508324429-6012-1-git-send-email-xuejiancheng@hisilicon.com> References: <1508324429-6012-1-git-send-email-xuejiancheng@hisilicon.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.66] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.59E6C315.006D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3d4d91a454f65dda5af82117e416fc17 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: tianshuliang Add emmc sample and emmc drive clock for Hi3798cv200 SoC Signed-off-by: tianshuliang Signed-off-by: Jiancheng Xue --- drivers/clk/hisilicon/crg-hi3798cv200.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/clk/hisilicon/crg-hi3798cv200.c b/drivers/clk/hisilicon/crg-hi3798cv200.c index ed8bb5f..25d750c 100644 --- a/drivers/clk/hisilicon/crg-hi3798cv200.c +++ b/drivers/clk/hisilicon/crg-hi3798cv200.c @@ -83,6 +83,18 @@ static struct hisi_mux_clock hi3798cv200_mux_clks[] = { CLK_SET_RATE_PARENT, 0x188, 10, 2, 0, comphy1_mux_table, }, }; +static u32 mmc_phase_reg[] = {0, 1, 2, 3, 4, 5, 6, 7}; +static u32 mmc_phase_val[] = {0, 45, 90, 135, 180, 225, 270, 315}; + +static struct hisi_phase_clock hi3798cv200_phase_clks[] = { + { HISTB_MMC_SAMPLE_CLK, "mmc_sample", "clk_mmc_ciu", + CLK_SET_RATE_PARENT, 0xa0, 12, 3, mmc_phase_val, + mmc_phase_reg, ARRAY_SIZE(mmc_phase_reg)}, + { HISTB_MMC_DRV_CLK, "mmc_drive", "clk_mmc_ciu", + CLK_SET_RATE_PARENT, 0xa0, 16, 3, mmc_phase_val, + mmc_phase_reg, ARRAY_SIZE(mmc_phase_reg)}, +}; + static const struct hisi_gate_clock hi3798cv200_gate_clks[] = { /* UART */ { HISTB_UART2_CLK, "clk_uart2", "75m", @@ -179,11 +191,18 @@ static struct hisi_clock_data *hi3798cv200_clk_register( if (ret) goto unregister_fixed_rate; + ret = hisi_clk_register_phase(&pdev->dev, + hi3798cv200_phase_clks, + ARRAY_SIZE(hi3798cv200_phase_clks), + clk_data); + if (ret) + goto unregister_mux; + ret = hisi_clk_register_gate(hi3798cv200_gate_clks, ARRAY_SIZE(hi3798cv200_gate_clks), clk_data); if (ret) - goto unregister_mux; + goto unregister_phase; ret = of_clk_add_provider(pdev->dev.of_node, of_clk_src_onecell_get, &clk_data->clk_data); @@ -201,6 +220,10 @@ static struct hisi_clock_data *hi3798cv200_clk_register( hisi_clk_unregister_mux(hi3798cv200_mux_clks, ARRAY_SIZE(hi3798cv200_mux_clks), clk_data); +unregister_phase: + hisi_clk_unregister_phase(hi3798cv200_phase_clks, + ARRAY_SIZE(hi3798cv200_phase_clks), + clk_data); unregister_gate: hisi_clk_unregister_gate(hi3798cv200_gate_clks, ARRAY_SIZE(hi3798cv200_gate_clks),