From patchwork Sun Apr 8 07:28:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 10328215 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 B214F6037F for ; Sun, 8 Apr 2018 07:36:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A03D028B13 for ; Sun, 8 Apr 2018 07:36:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94C2C29048; Sun, 8 Apr 2018 07:36:00 +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=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_SORBS_WEB autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EBBE628B13 for ; Sun, 8 Apr 2018 07:35:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=YoPMgDQXHKQ1RQbdbJT4BcHC957AeS73MSm7XaCpqgQ=; b=kMLNp06af77pg1jaNWWuZE1i6W B8I06fCZuMKzzmuVWiymlPj/l0KL1HphX0vgdJ9pEaOJbKl86oVU1bDAy+N9gi8rO1Skm2Ww9a98u 6Tvq6I8HSlNTFpegg0gFQBF/K13Kemb+jLxlKgcDYax6zBvbosKeWQYGheRqU3Rf909flJ0llFO3S D0DsrPOYEh2C3JFia85WMvFPWVKwyBNH9djHk3W+qgCHjvxzzYbecw4/V3KojPLP1okk3hhVS+bxO pirDyD4ptsJ5vl+gkhj6KuQ5ECv0yW5lZm3Dc4t6LRhmmjdsx6SiL1y1OuTEQA0eRgyMHrhp4bQhz dM9zoO1A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f54rm-0002a4-7B; Sun, 08 Apr 2018 07:35:58 +0000 Received: from lucky1.263xmail.com ([211.157.147.133]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f54ri-0002Wi-Qr for linux-rockchip@lists.infradead.org; Sun, 08 Apr 2018 07:35:57 +0000 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.229]) by lucky1.263xmail.com (Postfix) with ESMTP id 767A4952D9; Sun, 8 Apr 2018 15:35:38 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 968733BA; Sun, 8 Apr 2018 15:35:31 +0800 (CST) X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: mturquette@baylibre.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <33a2bbe6481f3ff403dceae68579c8f2> X-ATTACHMENT-NUM: 0 X-SENDER: lintao@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 12259TS20N3; Sun, 08 Apr 2018 15:35:36 +0800 (CST) From: Shawn Lin To: Michael Turquette , Stephen Boyd , Heiko Stuebner Subject: [PATCH v3 2/2] clk: rockchip: Add CLK_DIVIDER_EVEN for all mmc clock consumers Date: Sun, 8 Apr 2018 15:28:18 +0800 Message-Id: <1523172498-74798-2-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1523172498-74798-1-git-send-email-shawn.lin@rock-chips.com> References: <1523172498-74798-1-git-send-email-shawn.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180408_003555_452863_BABB7DD7 X-CRM114-Status: GOOD ( 16.02 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Elaine Zhang , Xiao Yao , Shawn Lin , Jeffy Chen , linux-rockchip@lists.infradead.org, Finley Xiao , Xing Zheng , Andy Yan , linux-clk@vger.kernel.org, Ziyuan Xu MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP For conventional Rockchip platforms, mmc hosts, except RK3399's eMMC controller, should ask their clock parents to provider the closest clock rate with a even div number. That wasn't done explicitly by the clock framework. but now we have CLK_DIVIDER_EVEN flag to help. Signed-off-by: Shawn Lin --- Changes in v3: None Changes in v2: None drivers/clk/rockchip/clk-rk3036.c | 7 ++++--- drivers/clk/rockchip/clk-rk3128.c | 9 ++++++--- drivers/clk/rockchip/clk-rk3188.c | 6 +++--- drivers/clk/rockchip/clk-rk3228.c | 7 ++++--- drivers/clk/rockchip/clk-rk3288.c | 12 ++++++++---- drivers/clk/rockchip/clk-rk3328.c | 9 ++++++--- drivers/clk/rockchip/clk-rk3368.c | 9 ++++++--- drivers/clk/rockchip/clk-rk3399.c | 6 ++++-- drivers/clk/rockchip/clk-rv1108.c | 7 ++++--- 9 files changed, 45 insertions(+), 27 deletions(-) diff --git a/drivers/clk/rockchip/clk-rk3036.c b/drivers/clk/rockchip/clk-rk3036.c index c300198..155fd4f 100644 --- a/drivers/clk/rockchip/clk-rk3036.c +++ b/drivers/clk/rockchip/clk-rk3036.c @@ -290,16 +290,17 @@ enum rk3036_plls { RK2928_CLKSEL_CON(12), 8, 2, MFLAGS, RK2928_CLKGATE_CON(2), 11, GFLAGS), DIV(SCLK_SDMMC, "sclk_sdmmc", "sclk_sdmmc_src", 0, - RK2928_CLKSEL_CON(11), 0, 7, DFLAGS), + RK2928_CLKSEL_CON(11), 0, 7, DFLAGS | CLK_DIVIDER_EVEN), COMPOSITE_NODIV(0, "sclk_sdio_src", mux_mmc_src_p, 0, RK2928_CLKSEL_CON(12), 10, 2, MFLAGS, RK2928_CLKGATE_CON(2), 13, GFLAGS), DIV(SCLK_SDIO, "sclk_sdio", "sclk_sdio_src", 0, - RK2928_CLKSEL_CON(11), 8, 7, DFLAGS), + RK2928_CLKSEL_CON(11), 8, 7, DFLAGS | CLK_DIVIDER_EVEN), COMPOSITE(SCLK_EMMC, "sclk_emmc", mux_mmc_src_p, 0, - RK2928_CLKSEL_CON(12), 12, 2, MFLAGS, 0, 7, DFLAGS, + RK2928_CLKSEL_CON(12), 12, 2, MFLAGS, 0, 7, + DFLAGS | CLK_DIVIDER_EVEN, RK2928_CLKGATE_CON(2), 14, GFLAGS), MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "sclk_sdmmc", RK3036_SDMMC_CON0, 1), diff --git a/drivers/clk/rockchip/clk-rk3128.c b/drivers/clk/rockchip/clk-rk3128.c index 5970a50..7c6e30a 100644 --- a/drivers/clk/rockchip/clk-rk3128.c +++ b/drivers/clk/rockchip/clk-rk3128.c @@ -324,15 +324,18 @@ enum rk3128_plls { RK2928_CLKGATE_CON(2), 15, GFLAGS), COMPOSITE(SCLK_SDMMC, "sclk_sdmmc0", mux_mmc_src_p, 0, - RK2928_CLKSEL_CON(11), 6, 2, MFLAGS, 0, 6, DFLAGS, + RK2928_CLKSEL_CON(11), 6, 2, MFLAGS, 0, 6, + DFLAGS | CLK_DIVIDER_EVEN, RK2928_CLKGATE_CON(2), 11, GFLAGS), COMPOSITE(SCLK_SDIO, "sclk_sdio", mux_mmc_src_p, 0, - RK2928_CLKSEL_CON(12), 6, 2, MFLAGS, 0, 6, DFLAGS, + RK2928_CLKSEL_CON(12), 6, 2, MFLAGS, 0, 6, + DFLAGS | CLK_DIVIDER_EVEN, RK2928_CLKGATE_CON(2), 13, GFLAGS), COMPOSITE(SCLK_EMMC, "sclk_emmc", mux_mmc_src_p, 0, - RK2928_CLKSEL_CON(12), 14, 2, MFLAGS, 8, 6, DFLAGS, + RK2928_CLKSEL_CON(12), 14, 2, MFLAGS, 8, 6, + DFLAGS | CLK_DIVIDER_EVEN, RK2928_CLKGATE_CON(2), 14, GFLAGS), DIV(SCLK_PVTM, "clk_pvtm", "clk_pvtm_func", 0, diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c index 67e73fd..32f199d 100644 --- a/drivers/clk/rockchip/clk-rk3188.c +++ b/drivers/clk/rockchip/clk-rk3188.c @@ -402,13 +402,13 @@ enum rk3188_plls { RK2928_CLKGATE_CON(2), 10, GFLAGS), COMPOSITE_NOMUX(SCLK_SDMMC, "sclk_sdmmc", "hclk_peri", 0, - RK2928_CLKSEL_CON(11), 0, 6, DFLAGS, + RK2928_CLKSEL_CON(11), 0, 6, DFLAGS | CLK_DIVIDER_EVEN, RK2928_CLKGATE_CON(2), 11, GFLAGS), COMPOSITE_NOMUX(SCLK_SDIO, "sclk_sdio", "hclk_peri", 0, - RK2928_CLKSEL_CON(12), 0, 6, DFLAGS, + RK2928_CLKSEL_CON(12), 0, 6, DFLAGS | CLK_DIVIDER_EVEN, RK2928_CLKGATE_CON(2), 13, GFLAGS), COMPOSITE_NOMUX(SCLK_EMMC, "sclk_emmc", "hclk_peri", 0, - RK2928_CLKSEL_CON(12), 8, 6, DFLAGS, + RK2928_CLKSEL_CON(12), 8, 6, DFLAGS | CLK_DIVIDER_EVEN, RK2928_CLKGATE_CON(2), 14, GFLAGS), MUX(0, "uart_src", mux_pll_src_gpll_cpll_p, 0, diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c index 7af4818..15da16a 100644 --- a/drivers/clk/rockchip/clk-rk3228.c +++ b/drivers/clk/rockchip/clk-rk3228.c @@ -388,20 +388,21 @@ enum rk3228_plls { RK2928_CLKGATE_CON(2), 15, GFLAGS), COMPOSITE(SCLK_SDMMC, "sclk_sdmmc", mux_mmc_src_p, 0, - RK2928_CLKSEL_CON(11), 8, 2, MFLAGS, 0, 8, DFLAGS, + RK2928_CLKSEL_CON(11), 8, 2, MFLAGS, 0, 8, + DFLAGS | CLK_DIVIDER_EVEN, RK2928_CLKGATE_CON(2), 11, GFLAGS), COMPOSITE_NODIV(SCLK_SDIO_SRC, "sclk_sdio_src", mux_mmc_src_p, 0, RK2928_CLKSEL_CON(11), 10, 2, MFLAGS, RK2928_CLKGATE_CON(2), 13, GFLAGS), DIV(SCLK_SDIO, "sclk_sdio", "sclk_sdio_src", 0, - RK2928_CLKSEL_CON(12), 0, 8, DFLAGS), + RK2928_CLKSEL_CON(12), 0, 8, DFLAGS | CLK_DIVIDER_EVEN), COMPOSITE_NODIV(0, "sclk_emmc_src", mux_mmc_src_p, 0, RK2928_CLKSEL_CON(11), 12, 2, MFLAGS, RK2928_CLKGATE_CON(2), 14, GFLAGS), DIV(SCLK_EMMC, "sclk_emmc", "sclk_emmc_src", 0, - RK2928_CLKSEL_CON(12), 8, 8, DFLAGS), + RK2928_CLKSEL_CON(12), 8, 8, DFLAGS | CLK_DIVIDER_EVEN), /* * Clock-Architecture Diagram 2 diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c index 450de24..2a6f231 100644 --- a/drivers/clk/rockchip/clk-rk3288.c +++ b/drivers/clk/rockchip/clk-rk3288.c @@ -508,16 +508,20 @@ enum rk3288_plls { RK3288_CLKGATE_CON(2), 11, GFLAGS), COMPOSITE(SCLK_SDMMC, "sclk_sdmmc", mux_mmc_src_p, 0, - RK3288_CLKSEL_CON(11), 6, 2, MFLAGS, 0, 6, DFLAGS, + RK3288_CLKSEL_CON(11), 6, 2, MFLAGS, 0, 6, + DFLAGS | CLK_DIVIDER_EVEN, RK3288_CLKGATE_CON(13), 0, GFLAGS), COMPOSITE(SCLK_SDIO0, "sclk_sdio0", mux_mmc_src_p, 0, - RK3288_CLKSEL_CON(12), 6, 2, MFLAGS, 0, 6, DFLAGS, + RK3288_CLKSEL_CON(12), 6, 2, MFLAGS, 0, 6, + DFLAGS | CLK_DIVIDER_EVEN, RK3288_CLKGATE_CON(13), 1, GFLAGS), COMPOSITE(SCLK_SDIO1, "sclk_sdio1", mux_mmc_src_p, 0, - RK3288_CLKSEL_CON(34), 14, 2, MFLAGS, 8, 6, DFLAGS, + RK3288_CLKSEL_CON(34), 14, 2, MFLAGS, 8, 6, + DFLAGS | CLK_DIVIDER_EVEN, RK3288_CLKGATE_CON(13), 2, GFLAGS), COMPOSITE(SCLK_EMMC, "sclk_emmc", mux_mmc_src_p, 0, - RK3288_CLKSEL_CON(12), 14, 2, MFLAGS, 8, 6, DFLAGS, + RK3288_CLKSEL_CON(12), 14, 2, MFLAGS, 8, 6, + DFLAGS | CLK_DIVIDER_EVEN, RK3288_CLKGATE_CON(13), 3, GFLAGS), MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "sclk_sdmmc", RK3288_SDMMC_CON0, 1), diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c index 252366a..f81acf8 100644 --- a/drivers/clk/rockchip/clk-rk3328.c +++ b/drivers/clk/rockchip/clk-rk3328.c @@ -632,15 +632,18 @@ enum rk3328_plls { RK3328_CLKGATE_CON(4), 3, GFLAGS), COMPOSITE(SCLK_SDIO, "clk_sdio", mux_2plls_24m_u480m_p, 0, - RK3328_CLKSEL_CON(31), 8, 2, MFLAGS, 0, 8, DFLAGS, + RK3328_CLKSEL_CON(31), 8, 2, MFLAGS, 0, 8, + DFLAGS | CLK_DIVIDER_EVEN, RK3328_CLKGATE_CON(4), 4, GFLAGS), COMPOSITE(SCLK_EMMC, "clk_emmc", mux_2plls_24m_u480m_p, 0, - RK3328_CLKSEL_CON(32), 8, 2, MFLAGS, 0, 8, DFLAGS, + RK3328_CLKSEL_CON(32), 8, 2, MFLAGS, 0, 8, + DFLAGS | CLK_DIVIDER_EVEN, RK3328_CLKGATE_CON(4), 5, GFLAGS), COMPOSITE(SCLK_SDMMC_EXT, "clk_sdmmc_ext", mux_2plls_24m_u480m_p, 0, - RK3328_CLKSEL_CON(43), 8, 2, MFLAGS, 0, 8, DFLAGS, + RK3328_CLKSEL_CON(43), 8, 2, MFLAGS, 0, 8, + DFLAGS | CLK_DIVIDER_EVEN, RK3328_CLKGATE_CON(4), 10, GFLAGS), COMPOSITE(SCLK_REF_USB3OTG_SRC, "clk_ref_usb3otg_src", mux_2plls_p, 0, diff --git a/drivers/clk/rockchip/clk-rk3368.c b/drivers/clk/rockchip/clk-rk3368.c index 7c4d242..17a6293 100644 --- a/drivers/clk/rockchip/clk-rk3368.c +++ b/drivers/clk/rockchip/clk-rk3368.c @@ -550,13 +550,16 @@ enum rk3368_plls { COMPOSITE(SCLK_SDMMC, "sclk_sdmmc", mux_mmc_src_p, 0, - RK3368_CLKSEL_CON(50), 8, 2, MFLAGS, 0, 7, DFLAGS, + RK3368_CLKSEL_CON(50), 8, 2, MFLAGS, 0, 7, + DFLAGS | CLK_DIVIDER_EVEN, RK3368_CLKGATE_CON(7), 12, GFLAGS), COMPOSITE(SCLK_SDIO0, "sclk_sdio0", mux_mmc_src_p, 0, - RK3368_CLKSEL_CON(48), 8, 2, MFLAGS, 0, 7, DFLAGS, + RK3368_CLKSEL_CON(48), 8, 2, MFLAGS, 0, 7, + DFLAGS | CLK_DIVIDER_EVEN, RK3368_CLKGATE_CON(7), 13, GFLAGS), COMPOSITE(SCLK_EMMC, "sclk_emmc", mux_mmc_src_p, 0, - RK3368_CLKSEL_CON(51), 8, 2, MFLAGS, 0, 7, DFLAGS, + RK3368_CLKSEL_CON(51), 8, 2, MFLAGS, 0, 7, + DFLAGS | CLK_DIVIDER_EVEN, RK3368_CLKGATE_CON(7), 15, GFLAGS), MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "sclk_sdmmc", RK3368_SDMMC_CON0, 1), diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c index 118759d..aedb3d0 100644 --- a/drivers/clk/rockchip/clk-rk3399.c +++ b/drivers/clk/rockchip/clk-rk3399.c @@ -896,11 +896,13 @@ enum rk3399_pmu_plls { RK3399_CLKGATE_CON(33), 9, GFLAGS), COMPOSITE(SCLK_SDIO, "clk_sdio", mux_pll_src_cpll_gpll_npll_ppll_upll_24m_p, 0, - RK3399_CLKSEL_CON(15), 8, 3, MFLAGS, 0, 7, DFLAGS, + RK3399_CLKSEL_CON(15), 8, 3, MFLAGS, 0, 7, + DFLAGS | CLK_DIVIDER_EVEN, RK3399_CLKGATE_CON(6), 0, GFLAGS), COMPOSITE(SCLK_SDMMC, "clk_sdmmc", mux_pll_src_cpll_gpll_npll_ppll_upll_24m_p, 0, - RK3399_CLKSEL_CON(16), 8, 3, MFLAGS, 0, 7, DFLAGS, + RK3399_CLKSEL_CON(16), 8, 3, MFLAGS, 0, 7, + DFLAGS | CLK_DIVIDER_EVEN, RK3399_CLKGATE_CON(6), 1, GFLAGS), MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "clk_sdmmc", RK3399_SDMMC_CON0, 1), diff --git a/drivers/clk/rockchip/clk-rv1108.c b/drivers/clk/rockchip/clk-rv1108.c index 089cb17..b63af26 100644 --- a/drivers/clk/rockchip/clk-rv1108.c +++ b/drivers/clk/rockchip/clk-rv1108.c @@ -721,20 +721,21 @@ enum rv1108_plls { RV1108_CLKGATE_CON(15), 11, GFLAGS), COMPOSITE(SCLK_SDMMC, "sclk_sdmmc", mux_mmc_src_p, 0, - RV1108_CLKSEL_CON(25), 8, 2, MFLAGS, 0, 8, DFLAGS, + RV1108_CLKSEL_CON(25), 8, 2, MFLAGS, 0, 8, + DFLAGS | CLK_DIVIDER_EVEN, RV1108_CLKGATE_CON(5), 0, GFLAGS), COMPOSITE_NODIV(0, "sclk_sdio_src", mux_mmc_src_p, 0, RV1108_CLKSEL_CON(25), 10, 2, MFLAGS, RV1108_CLKGATE_CON(5), 2, GFLAGS), DIV(SCLK_SDIO, "sclk_sdio", "sclk_sdio_src", 0, - RV1108_CLKSEL_CON(26), 0, 8, DFLAGS), + RV1108_CLKSEL_CON(26), 0, 8, DFLAGS | CLK_DIVIDER_EVEN), COMPOSITE_NODIV(0, "sclk_emmc_src", mux_mmc_src_p, 0, RV1108_CLKSEL_CON(25), 12, 2, MFLAGS, RV1108_CLKGATE_CON(5), 1, GFLAGS), DIV(SCLK_EMMC, "sclk_emmc", "sclk_emmc_src", 0, - RK2928_CLKSEL_CON(26), 8, 8, DFLAGS), + RK2928_CLKSEL_CON(26), 8, 8, DFLAGS | CLK_DIVIDER_EVEN), GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_periph", 0, RV1108_CLKGATE_CON(15), 0, GFLAGS), GATE(HCLK_SDIO, "hclk_sdio", "hclk_periph", 0, RV1108_CLKGATE_CON(15), 1, GFLAGS), GATE(HCLK_EMMC, "hclk_emmc", "hclk_periph", 0, RV1108_CLKGATE_CON(15), 2, GFLAGS),