From patchwork Fri Mar 24 11:31:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kochetkov X-Patchwork-Id: 9642733 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 DD8A96020B for ; Fri, 24 Mar 2017 11:31:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8F6628423 for ; Fri, 24 Mar 2017 11:31:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE0D528429; Fri, 24 Mar 2017 11:31:44 +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.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 2A4D628427 for ; Fri, 24 Mar 2017 11:31:44 +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: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:In-Reply-To: References:List-Owner; bh=07dXpyvtJvt/zdsEz7KGadkXltFOvT2qY0sdeu9Ky9Q=; b=RN4 TdNqa0zFa47Ap6eEEBy0q/cJ15gXewjMh02GeZKL7Sm0RbkrGOpnpnc41R3VbCOzzhzN0Ml9v/ytM XMymWWoKVylwdEdtAauNSQmEPyphQbrzHNDj0zrAe/KGSXv4IrJxWFyg+WzzWxY0gjdgEi4UPtDLY e/ooRhH0qx1Ajguil2zD8xz7RBAbV8JnxjDZkXuaJ3KF5T6CpdfdHQ+ebjn69QT+zHrFVp/RDvAJ1 rvXcktAz2U9VspNn3/eflAqXk3XxjMXKIiWHk/fNN2Hqb+XZxs0hRJXFSZ8R9E7NgkZsArxG+h7e2 ZjuRVjD8X52NHOxEPnO9+0z1h3EE7vA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1crNRT-0005GD-2N; Fri, 24 Mar 2017 11:31:39 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1crNRP-000505-Eq; Fri, 24 Mar 2017 11:31:37 +0000 Received: by mail-lf0-x244.google.com with SMTP id r36so1251064lfi.0; Fri, 24 Mar 2017 04:31:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=lhzFdN5zdpsAZyesJFGp9uWHUz8WuNT++psOCb2gVy0=; b=FZFeCZXR+qomylo0MK1bj8hnu5wTC+emca7c75LanVvfmKMKLXVn6wf36mtonhHZRS 8DsaV2f0LrwBxvwqqvBqy1y0it+wScT2cu+NPTS1/tat3X/6suK1JrAaiylj4iugc2TZ GC4awSPQta5Vtg6S8PYM1L5tC8PONmqaz+2Aeie3SeZyCCQvSqO8Hko8XVUt2DLGPxv4 VYF+9pbLptG7ACfvERaF92Uza3bzDnPdaquoafcbQ2i3GxnqrqD4bnTZl3S9BjklXP6o u3BpJYzTkpZ60P5tCXTRTd5V3IFfUsJLRTGElCN9JLU7tRbfrcPjy3ib7REk5OYqY1IQ pxDw== 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; bh=lhzFdN5zdpsAZyesJFGp9uWHUz8WuNT++psOCb2gVy0=; b=czMzDQ3uzimQURFNfUSTThna4ib0r3PiuiW4KfAhNAyHs/NFzDmdHW9juU1CY2wCHz 2zDPOE9kVfkoVWgtwilPIFsBJjlA8XWbWwF2wunh/Z/ss/zis0GpH1FoKBCJ18Pfjtkf iWOwtUTbvCKRKR1KqGvf/FziFiH7dbTt/nJLIQBmXlvX8ixwzyVSHh1fngC4p7T58zUp Ppf4pdc5HgJTlEgWKvidLP8U909R+smOTsBKn4WEOXQBPyHR+MasskB58mEdx20M+a1e upC7R5ZGEsrdUVNS2wrkMHagWkrWaqV3h8e+u3sRsSCuTFnA/hZEm/7aanxzwzSEFHdg JkDw== X-Gm-Message-State: AFeK/H0xpnRLDZ3QQ1vR5prQsTFdAL5rIgBOgKx9PFPbCefzOkrS/C5FdYHdG8mL5RlayQ== X-Received: by 10.25.19.194 with SMTP id 63mr4256233lft.144.1490355073368; Fri, 24 Mar 2017 04:31:13 -0700 (PDT) Received: from ubuntu.lintech.local ([185.35.119.87]) by smtp.gmail.com with ESMTPSA id q98sm330937lfi.11.2017.03.24.04.31.12 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Mar 2017 04:31:12 -0700 (PDT) From: Alexander Kochetkov To: Michael Turquette , Stephen Boyd , Heiko Stuebner , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] clk: rockchip: limit i2s0_pre max rate on rk3188 Date: Fri, 24 Mar 2017 14:31:10 +0300 Message-Id: <1490355070-21818-1-git-send-email-al.kochet@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170324_043135_767131_D20C0393 X-CRM114-Status: GOOD ( 11.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Kochetkov MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Change i2s0_pre from 768MHz to 192MHz and limit it's rate to 192MHz in order to fix issues described below. If right after the boot change i2s0_clk to 16.384MHz, real rate on i2s0_clk pin may differ from 16.384MHz. The issue is random. Sometimes rate on i2s0_clk pin equal to 16.384MHz, sometimes not. There is another 100% reproducable issue. First we have to boot and see the correct frequency on i2s0_clk pin (16.384MHz). Then we change its rate to 8.192MHz (and it changes), then we change its rate again to 16.384MHz. Rate leaves unchanged and equal to 8.192MHz. 'clk_summary' shows following clock connection in all the cases, where rate was set to 16.384MHz (even then real rate differs). clock rate ----- ---- xin24m 24000000 pll_gpll 768000000 gpll 768000000 i2s_src 768000000 i2s0_pre 768000000 i2s0_frac 16384000 sclk_i2s0 16384000 Also I found, that if I change i2s0_pre to 192MHz all the issues described above gone. I supposed that the issues is due to high i2s0_pre rate. Probably rk3188 has some sort of frequency restrictions imposed. Haven't found anything in the RK3188 TRM, so this is my assumption. Anyway, with the patch, all the issues gone. Signed-off-by: Alexander Kochetkov --- drivers/clk/rockchip/clk-rk3188.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c index d0e722a..e883f48 100644 --- a/drivers/clk/rockchip/clk-rk3188.c +++ b/drivers/clk/rockchip/clk-rk3188.c @@ -849,6 +849,15 @@ static void __init rk3188a_clk_init(struct device_node *np) __func__); } + /* limit i2s0_pre max rate */ + clk1 = __clk_lookup("aclk_cpu_pre"); + clk2 = __clk_lookup("i2s0_pre"); + if (clk1 && clk2) { + rate = clk_get_rate(clk1); + clk_set_max_rate(clk2, rate); + clk_set_rate(clk2, rate); + } + rockchip_clk_protect_critical(rk3188_critical_clocks, ARRAY_SIZE(rk3188_critical_clocks)); rockchip_clk_of_add_provider(np, ctx);