From patchwork Tue Sep 3 15:30:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3380 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 167503FA4F for ; Tue, 3 Sep 2024 17:31:11 +0200 (CEST) Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-374beb23f35sf2323415f8f.0 for ; Tue, 03 Sep 2024 08:31:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1725377470; cv=pass; d=google.com; s=arc-20240605; b=HriW9Xz2NTWorq+5C96d4GaqMEZtdAALRxnZZAPNBOQOcdd4LZo/ppEyZXdKGP50hW PCFLHtb9oUjzdujTIKWi5Zmnm9xufACa3MUCOg05HCEJ30piyRisFDuOPbhEcY0HYy0D 8tf6ei56kY8k+9ANwLL/u6Hz6tKZTXMPg80XrqEmLAUpp9nqVi0g04dRoEn1ZR2AN/4v bXm4PauD5gpL2o+MRImNXdMAiVfwuZ+8Hq/AfO/PqHFpjJ48UkJmIBOYTItziZ/rx+aD 2vt/6pocZTgQNOK7GPdKzRLEeRlbKWQLeDn01+0KOkpPfUF6mytxFnXLiG0aLs1N4fZg i4Sg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=mWDufPksGEYToewnG+IsiEC6GijPyIJfwVUHg9uQVd4=; fh=2e/FmA1qhoKljMtdpE1Jw+4gx94J0lN5nojLVMRpB6U=; b=cA15LcsIxOrPbpPj+AnpLtT7mRo5H2JsRA9OXBqXZ+IxhuaWm2AoDq8PQlJG/Qwvqx Lwio3h2RzOwmB6KCPR/j60gQI4IqeD4ykwA2gtQya5YsdyAnW9kYojvbWIJU8Y9I0hbK 2bl68fNGjYvmPHMIenkaVChKwOnACWR6XkebKPnsHvtZsxa+seQVTUWfHitdzs0XjiPU IbKkLAs6AwEKFu812PCjDR0vI9Xw/SwQZW4Ek02nsrtsdMbElkvrRo08LLzsbkj5qAcc juS8eJ7AQG8Wb9McL016AnlxmWQvL7gZ1WzhEDZRy5JyXngRyq/NLj3hyUzeZZRHcwj6 iE+A==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AT+itxFx; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1725377470; x=1725982270; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=mWDufPksGEYToewnG+IsiEC6GijPyIJfwVUHg9uQVd4=; b=BV8dXAKeTZWJ+qtm3vG10J/xDt5kxZaHeyOJK/hq/EkNlm1kCLDHJ8BPeJNnv/0x5G A8d26QwPxYseArW89oGLa3PUvDFbYDrR01qZQB6cXEtha8WLuqhhz8U8GTsYR6LzYYPO NoREqadXCfgXIxwxlt3xepd0lzUaV9m1mY7Rw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725377470; x=1725982270; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mWDufPksGEYToewnG+IsiEC6GijPyIJfwVUHg9uQVd4=; b=HGappa8Vw5GRZTqs2TuU8R3E5ysUYy5yO7mWfG+y4poKUVHV/IBAWwGtci4/k2vfvy 0oy6mGOfoNNEiBY8sMk9ywQTPpGQXe0zhbemhrYPVxD5RMAuFYHAPLjoTiQJ7iVokrJK nnaKyAFS9mYfyg35tFU0v85rhUh4+r4K0/QLOrT5weFoPmjk+jtmARp33i1qNBN891cy 9R10AxdSk4q/fIoKr5HO3AkP1uT4OBm90LcA7cQh9yu7TFmSXKqpxCITVY1CX7Hc1/UU QB2KA9MrQWmYC3RytpqX9lHW/I6SAEeErqxqAJrnrDTMqHBg6o+KcX34xHRww3nimvvj CTNQ== X-Forwarded-Encrypted: i=2; AJvYcCUgcH0born5XYIJ9Or54kaRV1n6nHYLwUNrA+FV7a3oeqEUihjl9PxXDc6d5wBlpV5/rVjhK0mrPmoE9K1F@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxmKEGM7cmlkHaUmaO+0krBx7hAIJH0bluprUP/e8hkLX6tLIgv Hn8otvzG+FKNJPQxGp6U5MfNl5PhobaoTk9XnlsKuENRa7Z5ZnInN/61LRvOjq7fgw== X-Google-Smtp-Source: AGHT+IFyflJGCmVAkNP+XMbjHvHVAwd4K1EDNJNk/q5Vf5LjDqEHNU8DjCSFIsIevUctKUTC53YaJw== X-Received: by 2002:adf:fb4f:0:b0:368:7f4f:9ead with SMTP id ffacd0b85a97d-3749b531648mr11883963f8f.7.1725377470602; Tue, 03 Sep 2024 08:31:10 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:adf:ffca:0:b0:374:d333:a5d9 with SMTP id ffacd0b85a97d-374d333a676ls453232f8f.0.-pod-prod-08-eu; Tue, 03 Sep 2024 08:31:09 -0700 (PDT) X-Received: by 2002:adf:9d87:0:b0:368:5bb4:169b with SMTP id ffacd0b85a97d-374bed94fe5mr7298576f8f.4.1725377468919; Tue, 03 Sep 2024 08:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725377468; cv=none; d=google.com; s=arc-20160816; b=a3qckYdn0Qas8iWyyy24DTaPT6gJztZpc+zVNJg1tnGvDHzgHUdvzWyXliZB0Mo3Zy onS90QriyUk0ZSy4N9gp37Q0sDGP0mu93KxZo0NBvdVPxrEPzdxFGgQMwCgsri2p9PnP 8I7xq983LXxh1Q33/Ixz/D+ld2qRZJ0tTJWCevWdHpJX9HnYHytNggvSbG4us4L5SCwK d2ccU2wGmn274kFUmOuHF3ulXASAFgVkndHjL7tghnTCa3R/1FF83+gOVTwjhBZFIisR Xsd8dX5HGly+HSuI7a8RS2lPhy0x0bxPagpY7zKznTSAiLfBTMnOpXIxUsizbbkUJknY ysyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=oaGGzg1ZcW8MunpfHTSkfDsZrsx9ImjK3JuQuUVolOE=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=o0QMfy2DA6ceYMOPd6uKqfydJEXtDNHwL3BQMgIXU8s67rujfnDPQ/QBPqSHt19joO gT+CePv8by540QVwYtFHqd6nkO3+GhMunHyUff2FDBMGtTl4uwo4GagIXeNcA2NDVcjS G7pepM1MUk6hTZsOFlOOKKzr7UcdQHjjL5IJF2ychZl+gGYjrAqxPRax2E21NSkWxlIp lgpn1TuEb30TSH6+EVKF3Ry16PuoXe32rNVuE2nlG4rDTfqoxxxMQX9ya+Cs+lYL0efF 8mWNoMelFp5NP66coqmt17iaKb7DG9dPftd2NFkMA1YjJgctx2wiBt0WMVdbzDEXIbZJ WSCw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AT+itxFx; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-42bb7052accsor46233935e9.3.2024.09.03.08.31.08 for (Google Transport Security); Tue, 03 Sep 2024 08:31:08 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:3b10:b0:426:50e1:ea6e with SMTP id 5b1f17b1804b1-42bb0306838mr144717935e9.18.1725377468217; Tue, 03 Sep 2024 08:31:08 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.42.65]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6e273e3sm174168685e9.30.2024.09.03.08.31.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 08:31:07 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH 08/29] clk: imx8mn: add video clocks support Date: Tue, 3 Sep 2024 17:30:39 +0200 Message-ID: <20240903153100.918077-8-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903153100.918077-1-dario.binacchi@amarulasolutions.com> References: <20240903153100.918077-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AT+itxFx; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Add clocks support for the video subsystem. Signed-off-by: Michael Trimarchi --- drivers/clk/imx/clk-imx8mn.c | 72 ++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index 31d2faa97a3e..089f5169da1a 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -17,6 +17,7 @@ static u32 share_count_nand; static const char * const pll_ref_sels[] = { "clock-osc-24m", "dummy", "dummy", "dummy", }; +static const char * const video_pll_bypass_sels[] = {"video_pll", "video_pll_ref_sel", }; static const char * const dram_pll_bypass_sels[] = {"dram_pll", "dram_pll_ref_sel", }; static const char * const arm_pll_bypass_sels[] = {"arm_pll", "arm_pll_ref_sel", }; static const char * const sys_pll1_bypass_sels[] = {"sys_pll1", "sys_pll1_ref_sel", }; @@ -44,6 +45,34 @@ static const char * const imx8mn_enet_axi_sels[] = {"clock-osc-24m", "sys_pll1_2 "video_pll_out", "sys_pll3_out", }; #ifndef CONFIG_SPL_BUILD +static const char * const imx8mn_disp_axi_sels[] = {"clock-osc-24m", "sys_pll2_1000m", "sys_pll1_800m", + "sys_pll3_out", "sys_pll1_40m", "audio_pll2_out", + "clk_ext1", "clk_ext4", }; + +static const char * const imx8mn_disp_apb_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll1_800m", + "sys_pll3_out", "sys_pll1_40m", "audio_pll2_out", + "clk_ext1", "clk_ext3", }; + +static const char * const imx8mn_disp_pixel_sels[] = {"clock-osc-24m", "video_pll_out", "audio_pll2_out", + "audio_pll1_out", "sys_pll1_800m", "sys_pll2_1000m", + "sys_pll3_out", "clk_ext4", }; + +static const char * const imx8mn_dsi_core_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll2_250m", + "sys_pll1_800m", "sys_pll2_1000m", "sys_pll3_out", + "audio_pll2_out", "video_pll_out", }; + +static const char * const imx8mn_dsi_phy_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_100m", + "sys_pll1_800m", "sys_pll2_1000m", "clk_ext2", + "audio_pll2_out", "video_pll_out", }; + +static const char * const imx8mn_dsi_dbi_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll2_100m", + "sys_pll1_800m", "sys_pll2_1000m", "sys_pll3_out", + "audio_pll2_out", "video_pll_out", }; + +static const char * const imx8mn_camera_pixel_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll2_250m", + "sys_pll1_800m", "sys_pll2_1000m", "sys_pll3_out", + "audio_pll2_out", "video_pll_out", }; + static const char * const imx8mn_enet_ref_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_50m", "sys_pll2_100m", "sys_pll1_160m", "audio_pll1_out", "video_pll_out", "clk_ext4", }; @@ -148,6 +177,10 @@ static const char * const imx8mn_usb_phy_sels[] = {"clock-osc-24m", "sys_pll1_10 "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", "clk_ext3", "audio_pll2_out", }; +#ifndef CONFIG_SPL_BUILD +static unsigned int share_count_disp; +#endif + static int imx8mn_clk_probe(struct udevice *dev) { struct clk osc_24m_clk; @@ -188,8 +221,19 @@ static int imx8mn_clk_probe(struct udevice *dev) clk_dm(IMX8MN_SYS_PLL3, imx_clk_pll14xx("sys_pll3", "sys_pll3_ref_sel", base + 0x114, &imx_1416x_pll)); + clk_dm(IMX8MN_VIDEO_PLL_REF_SEL, + imx_clk_mux("video_pll_ref_sel", base + 0x28, 0, 2, + pll_ref_sels, ARRAY_SIZE(pll_ref_sels))); + clk_dm(IMX8MN_VIDEO_PLL1, + imx_clk_pll14xx("video_pll", "video_pll_ref_sel", + base + 0x28, &imx_1443x_pll)); /* PLL bypass out */ + clk_dm(IMX8MN_VIDEO_PLL_BYPASS, + imx_clk_mux_flags("video_pll_bypass", base + 0x28, 16, 1, + video_pll_bypass_sels, + ARRAY_SIZE(video_pll_bypass_sels), + CLK_SET_RATE_PARENT)); clk_dm(IMX8MN_DRAM_PLL_BYPASS, imx_clk_mux_flags("dram_pll_bypass", base + 0x50, 4, 1, dram_pll_bypass_sels, @@ -217,6 +261,9 @@ static int imx8mn_clk_probe(struct udevice *dev) CLK_SET_RATE_PARENT)); /* PLL out gate */ + clk_dm(IMX8MN_VIDEO_PLL_OUT, + imx_clk_gate("video_pll_out", "video_pll_bypass", + base + 0x28, 13)); clk_dm(IMX8MN_DRAM_PLL_OUT, imx_clk_gate("dram_pll_out", "dram_pll_bypass", base + 0x50, 13)); @@ -373,6 +420,31 @@ static int imx8mn_clk_probe(struct udevice *dev) /* clks not needed in SPL stage */ #ifndef CONFIG_SPL_BUILD + clk_dm(IMX8MN_CLK_DISP_AXI, + imx8m_clk_composite("disp_axi", imx8mn_disp_axi_sels, base + 0x8a00)); + clk_dm(IMX8MN_CLK_DISP_APB, + imx8m_clk_composite("disp_apb", imx8mn_disp_apb_sels, base + 0x8a80)); + clk_dm(IMX8MN_CLK_DISP_PIXEL, + __imx8m_clk_composite("disp_pixel", imx8mn_disp_pixel_sels, base + 0xa500, + CLK_SET_RATE_PARENT)); + clk_dm(IMX8MN_CLK_DSI_CORE, + imx8m_clk_composite("dsi_core", imx8mn_dsi_core_sels, base + 0xbb00)); + clk_dm(IMX8MN_CLK_DSI_PHY_REF, + imx8m_clk_composite("dsi_phy_ref", imx8mn_dsi_phy_sels, base + 0xbb80)); + clk_dm(IMX8MN_CLK_DSI_DBI, + imx8m_clk_composite("dsi_dbi", imx8mn_dsi_dbi_sels, base + 0xbc00)); + clk_dm(IMX8MN_CLK_CAMERA_PIXEL, + imx8m_clk_composite("camera_pixel", imx8mn_camera_pixel_sels, base + 0xbd00)); + + clk_dm(IMX8MN_CLK_DISP_AXI_ROOT, + imx_clk_gate2_shared2("disp_axi_root_clk", "disp_axi", base + 0x45d0, 0, &share_count_disp)); + clk_dm(IMX8MN_CLK_DISP_APB_ROOT, + imx_clk_gate2_shared2("disp_apb_root_clk", "disp_apb", base + 0x45d0, 0, &share_count_disp)); + clk_dm(IMX8MN_CLK_CAMERA_PIXEL_ROOT, + imx_clk_gate2_shared2("camera_pixel_clk", "camera_pixel", base + 0x45d0, 0, &share_count_disp)); + clk_dm(IMX8MN_CLK_DISP_PIXEL_ROOT, + imx_clk_gate2_shared2("disp_pixel_clk", "disp_pixel", base + 0x45d0, 0, &share_count_disp)); + clk_dm(IMX8MN_CLK_ENET_REF, imx8m_clk_composite("enet_ref", imx8mn_enet_ref_sels, base + 0xa980));