Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp581081pxu; Thu, 26 Nov 2020 06:19:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqDftWnWyqwMDdOTuo+4RcOnL9QL/+56ycWg/L7OmdRSNlPGqVZCBrNnL/wGlvRMzxPVSy X-Received: by 2002:a17:906:2850:: with SMTP id s16mr2873500ejc.276.1606400367966; Thu, 26 Nov 2020 06:19:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606400367; cv=none; d=google.com; s=arc-20160816; b=T55zTqk1UsxH64Nv5sDQLLBG76Bl4RIj9OrjymtRU5t6zUZ6IW06jf3H1Wsdh3HL0Y HpIqmPk9ADnGp+gRJKavbW5Su9PS7sQlOpKFFCe8KEbcUlebaX0Kf5+aF1qjWfmc603x G/LFmCbygQlB43tw2baHAKimhEJmeY01qr07NUHV9ro6UhY8i7P8B1jrmoyDybaFvbAk Fx/tBDFFCm86RXncBei1a17V4IKKT2ZJT5X+qeBGe+uvmu0u5Z+dBIcpR7O8zBt6bopK MOV1WZh0UOnnMS5+NbuOaN9SBkExjG6pptrEutIOkh4f0FXr5n8QrHJM0Zhb6byYqYl5 j/Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tMVgTeO03AHhfaOSmS4teYNEJZSWM7hPB1HU15pX36k=; b=Q9eGFPJwc9bNRn7ay5RvSMY9m2i3lM+BWfy+t96uQD5qgtFkmcqBHW55HKC8GHvFDL 4z6hR1gQXcANDXj3ChMMSDs62N0Jp1GHt+Z6qqBgSrqdwDbhihSBEZ9+dJtHuDLORslv lHOfLW1owrPefbMIYvPkjB9ZH1WkZ86dhLeWkrcEVelH6FzWoqQJ+PZan4UOU5zL2RKy zsDJXjT2SeRcnuHU/lZeH6a0VLfMXlx9lgikgJgpRRsIaoY5eNzA/S3QEFr5NSBc9DIz f+7/tRJNUzjeycG2IXeYZDwIrNSwPPxhpsXQM/rXdGnnqtloK256jwa6r3le5S6TBeBP ggsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=gVtPSCQa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si3784973ejm.675.2020.11.26.06.19.05; Thu, 26 Nov 2020 06:19:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=gVtPSCQa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391087AbgKZOQL (ORCPT + 99 others); Thu, 26 Nov 2020 09:16:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390350AbgKZOQK (ORCPT ); Thu, 26 Nov 2020 09:16:10 -0500 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2166BC0617A7 for ; Thu, 26 Nov 2020 06:16:10 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id x22so2273041wmc.5 for ; Thu, 26 Nov 2020 06:16:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tMVgTeO03AHhfaOSmS4teYNEJZSWM7hPB1HU15pX36k=; b=gVtPSCQalNvDgr33ts7W1WaWeEMcrGJRwq51W7OCAC9uj3VCBekCCfcLbzwb/8S0zm NUD1DrOfqHWkkbKBLKyftCMjuEyeP8yU8ATXGOOjFRoUyWZL6wZ/6dn/inrI834Mx9i3 SuPNcVzNtodBIqclscIz8iPdzdIAukRemLN1OQN4J7/sW4VMRg91TBHtENsC+pRfsoa3 4wVd9b4D7BE9eQgMaXglhfjd6YNh16MgNJ+lZXfs+qbQaGKzP1yEkX1BJvEoVE2kdORk Ahr45Mh5BFRvrDn0Ek6KeV+eKzEL2fL4KEF4LY/sturMGkDNCBv/zKQhBsVjJOCBiCYR bcYA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=tMVgTeO03AHhfaOSmS4teYNEJZSWM7hPB1HU15pX36k=; b=egukhaJCZbzADRjz3KMoLlEI+15QG13kr9i4hJ968eG8L6PnbQJeEkvMa0Zo8q3j6m EGthe8PMUQQ3azsRvONMcBjccZhVEJZijkv8twYsAdme4RIGmedZ0TXbTV4Ew5iKGusr wSF91R1IiTWK6xjAyWKFWFrfH86pHI+n4595a8B9KVUxNYUC7zgfzPwPIcZ1OtyjYSfg 9VRVYTQdOj44t/L8fmMard+Xu4bLWNFBfLU6uK7L5ROYyJQsRcMeMAYSceZrq7nEe70O 1rfIFV4cpi893f6EWwTJPuwLOAs9TuRvEYVdKWfcLpkYi+HEI3iDRNJJ1z4P0y6N+W0I fqOA== X-Gm-Message-State: AOAM5307gMIOPHWZpWjsDqZ8xLfr08aWT+0mqPzQvf1/Fa21e9j8Qt7l lNqeC2qPVeXqsAgS7rJi2saAEQ== X-Received: by 2002:a1c:61c5:: with SMTP id v188mr3597306wmb.141.1606400168632; Thu, 26 Nov 2020 06:16:08 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:2ec0:82b0:193b:ad82:52ad:936c]) by smtp.gmail.com with ESMTPSA id q16sm9286079wrn.13.2020.11.26.06.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 06:16:07 -0800 (PST) From: Neil Armstrong To: jbrunet@baylibre.com Cc: linux-clk@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Neil Armstrong Subject: [PATCH v2 2/2] clk: meson: g12a: add MIPI DSI Host Pixel Clock Date: Thu, 26 Nov 2020 15:16:00 +0100 Message-Id: <20201126141600.2084586-3-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201126141600.2084586-1-narmstrong@baylibre.com> References: <20201126141600.2084586-1-narmstrong@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds the MIPI DSI Host Pixel Clock, unlike AXG, the pixel clock can be different from the VPU ENCL output clock to feed the DSI Host controller with a different clock rate. Signed-off-by: Neil Armstrong --- drivers/clk/meson/g12a.c | 74 ++++++++++++++++++++++++++++++++++++++++ drivers/clk/meson/g12a.h | 3 +- 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c index 3cb8196c8e29..b080359b4645 100644 --- a/drivers/clk/meson/g12a.c +++ b/drivers/clk/meson/g12a.c @@ -3658,6 +3658,68 @@ static struct clk_regmap g12a_hdmi_tx = { }, }; +/* MIPI DSI Host Clocks */ + +static const struct clk_hw *g12a_mipi_dsi_pxclk_parent_hws[] = { + &g12a_vid_pll.hw, + &g12a_gp0_pll.hw, + &g12a_hifi_pll.hw, + &g12a_mpll1.hw, + &g12a_fclk_div2.hw, + &g12a_fclk_div2p5.hw, + &g12a_fclk_div3.hw, + &g12a_fclk_div7.hw, +}; + +static struct clk_regmap g12a_mipi_dsi_pxclk_sel = { + .data = &(struct clk_regmap_mux_data){ + .offset = HHI_MIPIDSI_PHY_CLK_CNTL, + .mask = 0x7, + .shift = 12, + .flags = CLK_MUX_ROUND_CLOSEST, + }, + .hw.init = &(struct clk_init_data){ + .name = "mipi_dsi_pxclk_sel", + .ops = &clk_regmap_mux_ops, + .parent_hws = g12a_mipi_dsi_pxclk_parent_hws, + .num_parents = ARRAY_SIZE(g12a_mipi_dsi_pxclk_parent_hws), + .flags = CLK_SET_RATE_NO_REPARENT, + }, +}; + +static struct clk_regmap g12a_mipi_dsi_pxclk_div = { + .data = &(struct clk_regmap_div_data){ + .offset = HHI_MIPIDSI_PHY_CLK_CNTL, + .shift = 0, + .width = 7, + }, + .hw.init = &(struct clk_init_data){ + .name = "mipi_dsi_pxclk_div", + .ops = &clk_regmap_divider_ops, + .parent_hws = (const struct clk_hw *[]) { + &g12a_mipi_dsi_pxclk_sel.hw + }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, + }, +}; + +static struct clk_regmap g12a_mipi_dsi_pxclk = { + .data = &(struct clk_regmap_gate_data){ + .offset = HHI_MIPIDSI_PHY_CLK_CNTL, + .bit_idx = 8, + }, + .hw.init = &(struct clk_init_data) { + .name = "mipi_dsi_pxclk", + .ops = &clk_regmap_gate_ops, + .parent_hws = (const struct clk_hw *[]) { + &g12a_mipi_dsi_pxclk_div.hw + }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, + }, +}; + /* HDMI Clocks */ static const struct clk_parent_data g12a_hdmi_parent_data[] = { @@ -4403,6 +4465,9 @@ static struct clk_hw_onecell_data g12a_hw_onecell_data = { [CLKID_SPICC1_SCLK_SEL] = &g12a_spicc1_sclk_sel.hw, [CLKID_SPICC1_SCLK_DIV] = &g12a_spicc1_sclk_div.hw, [CLKID_SPICC1_SCLK] = &g12a_spicc1_sclk.hw, + [CLKID_MIPI_DSI_PXCLK_SEL] = &g12a_mipi_dsi_pxclk_sel.hw, + [CLKID_MIPI_DSI_PXCLK_DIV] = &g12a_mipi_dsi_pxclk_div.hw, + [CLKID_MIPI_DSI_PXCLK] = &g12a_mipi_dsi_pxclk.hw, [NR_CLKS] = NULL, }, .num = NR_CLKS, @@ -4658,6 +4723,9 @@ static struct clk_hw_onecell_data g12b_hw_onecell_data = { [CLKID_SPICC1_SCLK_SEL] = &g12a_spicc1_sclk_sel.hw, [CLKID_SPICC1_SCLK_DIV] = &g12a_spicc1_sclk_div.hw, [CLKID_SPICC1_SCLK] = &g12a_spicc1_sclk.hw, + [CLKID_MIPI_DSI_PXCLK_SEL] = &g12a_mipi_dsi_pxclk_sel.hw, + [CLKID_MIPI_DSI_PXCLK_DIV] = &g12a_mipi_dsi_pxclk_div.hw, + [CLKID_MIPI_DSI_PXCLK] = &g12a_mipi_dsi_pxclk.hw, [NR_CLKS] = NULL, }, .num = NR_CLKS, @@ -4904,6 +4972,9 @@ static struct clk_hw_onecell_data sm1_hw_onecell_data = { [CLKID_NNA_CORE_CLK_SEL] = &sm1_nna_core_clk_sel.hw, [CLKID_NNA_CORE_CLK_DIV] = &sm1_nna_core_clk_div.hw, [CLKID_NNA_CORE_CLK] = &sm1_nna_core_clk.hw, + [CLKID_MIPI_DSI_PXCLK_SEL] = &g12a_mipi_dsi_pxclk_sel.hw, + [CLKID_MIPI_DSI_PXCLK_DIV] = &g12a_mipi_dsi_pxclk_div.hw, + [CLKID_MIPI_DSI_PXCLK] = &g12a_mipi_dsi_pxclk.hw, [NR_CLKS] = NULL, }, .num = NR_CLKS, @@ -5151,6 +5222,9 @@ static struct clk_regmap *const g12a_clk_regmaps[] = { &sm1_nna_core_clk_sel, &sm1_nna_core_clk_div, &sm1_nna_core_clk, + &g12a_mipi_dsi_pxclk_sel, + &g12a_mipi_dsi_pxclk_div, + &g12a_mipi_dsi_pxclk, }; static const struct reg_sequence g12a_init_regs[] = { diff --git a/drivers/clk/meson/g12a.h b/drivers/clk/meson/g12a.h index 69b6a69549c7..a97613df38b3 100644 --- a/drivers/clk/meson/g12a.h +++ b/drivers/clk/meson/g12a.h @@ -264,8 +264,9 @@ #define CLKID_NNA_AXI_CLK_DIV 263 #define CLKID_NNA_CORE_CLK_SEL 265 #define CLKID_NNA_CORE_CLK_DIV 266 +#define CLKID_MIPI_DSI_PXCLK_DIV 268 -#define NR_CLKS 268 +#define NR_CLKS 271 /* include the CLKIDs that have been made part of the DT binding */ #include -- 2.25.1