Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp242994ybi; Wed, 29 May 2019 20:30:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+4+VmgodStKTyljZOwljSkj68iHi/8sLVRks5ZzSFZD8s3b9ea2VTIOSJ8U2D3OGU4K3I X-Received: by 2002:a17:90a:de08:: with SMTP id m8mr1418139pjv.18.1559187012325; Wed, 29 May 2019 20:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187012; cv=none; d=google.com; s=arc-20160816; b=irMbp8hx/cBdBLHUbhm0TCLPLgTHPETrHDgfH7kpUlEoQ8UWoEunQxhkze6fPFYYVS XcPOiLfYFoIScsN+4AdI3VAYlwpT/AzGnGHHyn4vD76qFS828Qduto15h6onqn1i0uWU 3spFsIMauK8qzlKJ5DZ6iI2dlsBtAWXw2s3lkSXC9dYyvp5k4M5r7ua+TXfe6qLJp1dR QJsbn021sJEpU7P05WgW3Nv7f/zXGNkmdDSfCGi33QSQvAtqZwyJbZJGqvzXZyfHwLyK xisp55mkS+Ujv4HGnEADCDO0cCGCTDbf7M1zVdKMDLBHhXRF3+lscchkiIPSSl1+MePI Sgcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E1zSHer4piEOYywl13fa0G4PxEFJjQ2hjIXQABFJDoQ=; b=USkLNoUaQf9LGY/PDWKCPDZ8YSBtChRwOp8N+1a0oSd0+/clLv3szjnsO0I1OEg4ZM iza8G4XlZTKFwVVmQJte8wg/cRZ/qQ1wfVGiphrbRtOU9FRZHzhy8YUzOmbiAJLO1CY/ cQvGcAZfA0r+Qh9vRrCmnZsPwEUhxakwr8WZuO+qrwY9lfsW5X+iRvAru4+BE1+Akc8o 9ncPhic87x2LEbPbgAJ2lsGg+i0G87KMl1viDTJOkzH3gQBLBPU9PvRMXoOxKvTPgOoW tJCtc1+1PsctlPvpKmojY41hqttza7iGV4POaIxTj9T0cCNNDEv5HCxMpNalsgiJDPnT 6MIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="0yJK/LEu"; 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 l1si2031213pgi.278.2019.05.29.20.29.54; Wed, 29 May 2019 20:30:12 -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; dkim=pass header.i=@kernel.org header.s=default header.b="0yJK/LEu"; 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 S2387469AbfE3D2Y (ORCPT + 99 others); Wed, 29 May 2019 23:28:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:57160 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732071AbfE3DTz (ORCPT ); Wed, 29 May 2019 23:19:55 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8484A248DE; Thu, 30 May 2019 03:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186394; bh=TLQ6wRuSyYf00wfdWZw3VLwozrQHQv4iyOZqob7MM3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0yJK/LEuoKb0IvPng75YYtKUtduD2bpBQs09b4ToKEARlfeTo539pbMjmDBVj7xf0 nqrXB9UnbT3v9LyW4NZKm1DVUqdeKHbb0fYr97rF0JIKiH+EicUdMe0TgypZ1i9tzx i2S6TXR2/lnE7otdH1Quvg15Vlvx9RG/xvCmakXg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonas Karlman , Randy Li , Douglas Anderson , Heiko Stuebner , Sasha Levin Subject: [PATCH 4.14 124/193] clk: rockchip: Fix video codec clocks on rk3288 Date: Wed, 29 May 2019 20:06:18 -0700 Message-Id: <20190530030505.787225686@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030446.953835040@linuxfoundation.org> References: <20190530030446.953835040@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 00c0cd9e59d265b393553e9afa54fee8b10e8158 ] It appears that there is a typo in the rk3288 TRM. For GRF_SOC_CON0[7] it says that 0 means "vepu" and 1 means "vdpu". It's the other way around. How do I know? Here's my evidence: 1. Prior to commit 4d3e84f99628 ("clk: rockchip: describe aclk_vcodec using the new muxgrf type on rk3288") we always pretended that we were using "aclk_vdpu" and the comment in the code said that this matched the default setting in the system. In fact the default setting is 0 according to the TRM and according to reading memory at bootup. In addition rk3288-based Chromebooks ran like this and the video codecs worked. 2. With the existing clock code if you boot up and try to enable the new VIDEO_ROCKCHIP_VPU as a module (and without "clk_ignore_unused" on the command line), you get errors like "failed to get ack on domain 'pd_video', val=0x80208". After flipping vepu/vdpu things init OK. 3. If I export and add both the vepu and vdpu to the list of clocks for RK3288_PD_VIDEO I can get past the power domain errors, but now I freeze when the vpu_mmu gets initted. 4. If I just mark the "vdpu" as IGNORE_UNUSED then everything boots up and probes OK showing that somehow the "vdpu" was important to keep enabled. This is because we were actually using it as a parent. 5. After this change I can hack "aclk_vcodec_pre" to parent from "aclk_vepu" using assigned-clocks and the video codec still probes OK. 6. Rockchip has said so on the mailing list [1]. ...so let's fix it. Let's also add CLK_SET_RATE_PARENT to "aclk_vcodec_pre" as suggested by Jonas Karlman. Prior to the same commit you could do clk_set_rate() on "aclk_vcodec" and it would change "aclk_vdpu". That's because "aclk_vcodec" was a simple gate clock (always gets CLK_SET_RATE_PARENT) and its direct parent was "aclk_vdpu". After that commit "aclk_vcodec_pre" gets in the way so we need to add CLK_SET_RATE_PARENT to it too. [1] https://lkml.kernel.org/r/1d17b015-9e17-34b9-baf8-c285dc1957aa@rock-chips.com Fixes: 4d3e84f99628 ("clk: rockchip: describe aclk_vcodec using the new muxgrf type on rk3288") Suggested-by: Jonas Karlman Suggested-by: Randy Li Signed-off-by: Douglas Anderson Signed-off-by: Heiko Stuebner Signed-off-by: Sasha Levin --- drivers/clk/rockchip/clk-rk3288.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c index 45cd2897e586b..c6cd6d28af56f 100644 --- a/drivers/clk/rockchip/clk-rk3288.c +++ b/drivers/clk/rockchip/clk-rk3288.c @@ -198,7 +198,7 @@ PNAME(mux_hsadcout_p) = { "hsadc_src", "ext_hsadc" }; PNAME(mux_edp_24m_p) = { "ext_edp_24m", "xin24m" }; PNAME(mux_tspout_p) = { "cpll", "gpll", "npll", "xin27m" }; -PNAME(mux_aclk_vcodec_pre_p) = { "aclk_vepu", "aclk_vdpu" }; +PNAME(mux_aclk_vcodec_pre_p) = { "aclk_vdpu", "aclk_vepu" }; PNAME(mux_usbphy480m_p) = { "sclk_otgphy1_480m", "sclk_otgphy2_480m", "sclk_otgphy0_480m" }; PNAME(mux_hsicphy480m_p) = { "cpll", "gpll", "usbphy480m_src" }; @@ -399,7 +399,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { COMPOSITE(0, "aclk_vdpu", mux_pll_src_cpll_gpll_usb480m_p, 0, RK3288_CLKSEL_CON(32), 14, 2, MFLAGS, 8, 5, DFLAGS, RK3288_CLKGATE_CON(3), 11, GFLAGS), - MUXGRF(0, "aclk_vcodec_pre", mux_aclk_vcodec_pre_p, 0, + MUXGRF(0, "aclk_vcodec_pre", mux_aclk_vcodec_pre_p, CLK_SET_RATE_PARENT, RK3288_GRF_SOC_CON(0), 7, 1, MFLAGS), GATE(ACLK_VCODEC, "aclk_vcodec", "aclk_vcodec_pre", 0, RK3288_CLKGATE_CON(9), 0, GFLAGS), -- 2.20.1