From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C901C4360F for ; Tue, 2 Apr 2019 21:06:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65D8520856 for ; Tue, 2 Apr 2019 21:06:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbfDBVGk (ORCPT ); Tue, 2 Apr 2019 17:06:40 -0400 Received: from mailoutvs58.siol.net ([185.57.226.249]:37305 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726584AbfDBVGi (ORCPT ); Tue, 2 Apr 2019 17:06:38 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTP id 1D8B3521AA0; Tue, 2 Apr 2019 23:06:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta12.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta12.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 7aHKU8lrfJUg; Tue, 2 Apr 2019 23:06:34 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTPS id BF215521A6C; Tue, 2 Apr 2019 23:06:34 +0200 (CEST) Received: from localhost.localdomain (cpe-86-58-52-202.static.triera.net [86.58.52.202]) (Authenticated sender: 031275009) by mail.siol.net (Zimbra) with ESMTPSA id 7BB10521AA0; Tue, 2 Apr 2019 23:06:32 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org Cc: mturquette@baylibre.com, sboyd@kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, jernej.skrabec@siol.net Subject: [PATCH 2/3] clk: sunxi-ng: h6: Preset hdmi-cec clock parent Date: Tue, 2 Apr 2019 23:06:22 +0200 Message-Id: <20190402210623.14988-3-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190402210623.14988-1-jernej.skrabec@siol.net> References: <20190402210623.14988-1-jernej.skrabec@siol.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org H6 manual and BSP clock driver both states that hdmi-cec clock has two possible parents, osc32k and pll-periph0-2x with 36621 predivider. Because pll-periph0-2x is always 1.2 GHz, both parents give same hdmi-cec rate - 32768 Hz, which is exactly the rate needed for HDMI CEC controller to operate correctly. However, for some reason, HDMI CEC controller doesn't work if default parent (osc32k) is used. BSP HDMI driver also always use pll-periph0-2x as hdmi-cec clock parent. In order to solve the issue, preset hdmi-cec clock parent to pll-periph0-2x. Signed-off-by: Jernej Skrabec --- drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/= ccu-sun50i-h6.c index daf78966555e..33980067b06e 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c @@ -656,6 +656,8 @@ static const char * const hdmi_cec_parents[] =3D { "o= sc32k", "pll-periph0-2x" }; static const struct ccu_mux_fixed_prediv hdmi_cec_predivs[] =3D { { .index =3D 1, .div =3D 36621 }, }; + +#define SUN50I_H6_HDMI_CEC_CLK_REG 0xb10 static struct ccu_mux hdmi_cec_clk =3D { .enable =3D BIT(31), =20 @@ -1200,6 +1202,15 @@ static int sun50i_h6_ccu_probe(struct platform_dev= ice *pdev) val &=3D ~(GENMASK(21, 16) | BIT(0)); writel(val | (7 << 16), reg + SUN50I_H6_PLL_AUDIO_REG); =20 + /* + * First clock parent (osc32K) is unusable for CEC. But since there + * is no good way to force parent switch (both run with same frequency)= , + * just set second clock parent here. + */ + val =3D readl(reg + SUN50I_H6_HDMI_CEC_CLK_REG); + val |=3D BIT(24); + writel(val, reg + SUN50I_H6_HDMI_CEC_CLK_REG); + return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_h6_ccu_desc); } =20 --=20 2.21.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A101C4360F for ; Tue, 2 Apr 2019 21:06:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB7D72084B for ; Tue, 2 Apr 2019 21:06:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QX7iK7Nd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB7D72084B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=siol.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=d6M/uDkMDp3upmgGTqrLtUCpobOY/m7F22j2OBKBzEc=; b=QX7iK7Nd50ruv4 lXqU3cCn/nB9V6n2b8t7sFr+YMQzyiNnT1YI0NTqedVmGEkO5PTLG/SJJG7T67tOfjKZ/4wRpCJe6 HZP99tM/Ivj8DZEcpdwvw/BzrQqeS7ReFT/nTbewbJ7i0lrFaeG/6F773xhP3jJmJm6QIe05Ep3Z3 +Zvw5Mi11yhQRB7Rw7A8fWbzrYK/b7TNz2fa88WrCiHE4W+um/1OCk7GYuibaBOvPTKgIi1e2o5YQ aygNlnO7HgHRgVBShifmfRVe4f4LOw7UNoJZn6DDRZmGO4fm9yarS7LcCKo/5FPY35dGq/qDigTWU Fq7ZwSOUfy510RwoVqRg==; 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 1hBQcM-00009n-1o; Tue, 02 Apr 2019 21:06:50 +0000 Received: from mailoutvs2.siol.net ([185.57.226.193] helo=mail.siol.net) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBQcC-0008Rj-UQ for linux-arm-kernel@lists.infradead.org; Tue, 02 Apr 2019 21:06:43 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTP id 1D8B3521AA0; Tue, 2 Apr 2019 23:06:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta12.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta12.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 7aHKU8lrfJUg; Tue, 2 Apr 2019 23:06:34 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTPS id BF215521A6C; Tue, 2 Apr 2019 23:06:34 +0200 (CEST) Received: from localhost.localdomain (cpe-86-58-52-202.static.triera.net [86.58.52.202]) (Authenticated sender: 031275009) by mail.siol.net (Zimbra) with ESMTPSA id 7BB10521AA0; Tue, 2 Apr 2019 23:06:32 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org Subject: [PATCH 2/3] clk: sunxi-ng: h6: Preset hdmi-cec clock parent Date: Tue, 2 Apr 2019 23:06:22 +0200 Message-Id: <20190402210623.14988-3-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190402210623.14988-1-jernej.skrabec@siol.net> References: <20190402210623.14988-1-jernej.skrabec@siol.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190402_140641_141413_A36F6C72 X-CRM114-Status: UNSURE ( 9.29 ) X-CRM114-Notice: Please train this message. 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: jernej.skrabec@siol.net, sboyd@kernel.org, mturquette@baylibre.com, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org H6 manual and BSP clock driver both states that hdmi-cec clock has two possible parents, osc32k and pll-periph0-2x with 36621 predivider. Because pll-periph0-2x is always 1.2 GHz, both parents give same hdmi-cec rate - 32768 Hz, which is exactly the rate needed for HDMI CEC controller to operate correctly. However, for some reason, HDMI CEC controller doesn't work if default parent (osc32k) is used. BSP HDMI driver also always use pll-periph0-2x as hdmi-cec clock parent. In order to solve the issue, preset hdmi-cec clock parent to pll-periph0-2x. Signed-off-by: Jernej Skrabec --- drivers/clk/sunxi-ng/ccu-sun50i-h6.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c index daf78966555e..33980067b06e 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c @@ -656,6 +656,8 @@ static const char * const hdmi_cec_parents[] = { "osc32k", "pll-periph0-2x" }; static const struct ccu_mux_fixed_prediv hdmi_cec_predivs[] = { { .index = 1, .div = 36621 }, }; + +#define SUN50I_H6_HDMI_CEC_CLK_REG 0xb10 static struct ccu_mux hdmi_cec_clk = { .enable = BIT(31), @@ -1200,6 +1202,15 @@ static int sun50i_h6_ccu_probe(struct platform_device *pdev) val &= ~(GENMASK(21, 16) | BIT(0)); writel(val | (7 << 16), reg + SUN50I_H6_PLL_AUDIO_REG); + /* + * First clock parent (osc32K) is unusable for CEC. But since there + * is no good way to force parent switch (both run with same frequency), + * just set second clock parent here. + */ + val = readl(reg + SUN50I_H6_HDMI_CEC_CLK_REG); + val |= BIT(24); + writel(val, reg + SUN50I_H6_HDMI_CEC_CLK_REG); + return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_h6_ccu_desc); } -- 2.21.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel