From patchwork Sun Jul 14 11:32:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3294 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 1A407412C7 for ; Sun, 14 Jul 2024 13:33:21 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-58e847f01f7sf2946204a12.1 for ; Sun, 14 Jul 2024 04:33:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956801; cv=pass; d=google.com; s=arc-20160816; b=xNsR+Ua4tqiUFll5vhN9P5VZxSFIyfbdsnlDAwnSwW11FTpS8Vq354qNr6ed1qtzhQ BlInhJ7wZhRyIH9TYGuxKXQMlXi7qazLB+ggBuavOr6AK1EGHdVpv8OcD1Oqw5sY9LNM PftkzvLBHedmTsc9AwTuEei0/I0p2hSZ9WReKSrJoJldnJyKtRE8scGoBTjd7CvKXOhJ Nja5hcVwOCysx0y02W7N+n+11ezOADSV0l4NcQ9E7r/gM5MpS6l5qAlMh+9mqJ2K1aMC nW813B2qyqQ3Cagj5/DdsllHQp/DK+bfvid4bOQgaWTzAwRFLRpKsslD3hPNrWqFTLY9 /VIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=mNVLAZIjA25iiyrZJDvR87DiT9sYQPHDITbfFQfdUnI=; fh=W+wzgTLUIGMXIUNgDgJFNnnUJqL/GcoMUfaWXvphm8I=; b=PSg6ZMcC6OtZO31kL7VmUMd5XM5vIAFh9cNlyddWE2WuGX6/BbmsONBHJeAJ9/rCK8 kHBb+7W/LJtiLo8pEAmIPfPIW457sgM+vYIPHn1U10VQQVCSg4pdhlUiNdeQ6cQWBo7L d4KTqLJ720rEFNwoY4O/T4DCCK3IXR9U5Eq0POi7n/F+iBZT4tHJixGbQ7sbnrwiCfL4 QxfDpKHPqk4EjBdBlWK7bIprxrd3zyE7VC8dJxXQI1SdN8q2KY5r9dssFZDGwjyji3hC xBzZSkOrz838+S8JTSQ6xB1JOwjsyzQYZd7H6HwbBPXdQbzqD5elKL30h23hDgx78skD XOwQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=D4fR8hP6; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720956801; x=1721561601; 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:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=mNVLAZIjA25iiyrZJDvR87DiT9sYQPHDITbfFQfdUnI=; b=f9ynT/q2QwyrTTfO9JRN/YvkJ86QsOSvBRldVSzAVMMgjwSt7fns1vbCvmjypB03Ry QiV+cmb3em1/+gi4RmUYC33EvV1XpS2Vp1Ke0PbFBiykQHhvMrmO4qJoHVFPRcxKvnrv fRFCO9YF1GRmqFK7ahPgwLFrUTeIE+yEOmbYc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956801; x=1721561601; 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:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mNVLAZIjA25iiyrZJDvR87DiT9sYQPHDITbfFQfdUnI=; b=lGohc9e7tEbyA4vbv9h8CnixBLCbu5hOIveCHsahWSjSyUHrQqPkr0Mh8EQe4xJvtJ 2zKxFSVrLE9sIO2fsZgzgOUwGj/HHy0xdiEumc3TTwKKPbig4A+Os6rP4vpkdtsyBuO6 QilstSB2IJAPFFSjr4zocTMedgNuGleVI7k5zSpSMvj2zwe6vOf4Tv0OC4uWtSVsIoEA iqF3JpPTLByvR64qHe1IP3u+5R5bIf8uRL6tn+U4OZc4ZOnQb8yF5qEKKMTrzrGS3La+ LdN5cK823Q/qnMPUmA7N30ibvK6wKIgyoM4rhYxxreN7Du+y3KwVNNp8AeV4jHjglDla rKCw== X-Forwarded-Encrypted: i=2; AJvYcCWtQvHt4NiwU/JsErJJ7Ru2ugjM2Ic2Ak6/c2P42YcADFgoZSOfjyUtMXPBbjmBQCuH+4i7TigmPHjbjPUdbCqAr+6q9xxanOCzdeirV6GMLtAEPNqS19D0pGgszw== X-Gm-Message-State: AOJu0Ywc9sv8vLv52w9L+5e705l6//1rMicvfbUyLVeWCxj50IMS1AE9 3SoQsnLUayOfA3irLEK+r7o+Ydi0goxJRCgGaksgdB2f+uevjdVihXyxFZmXH+IKIA== X-Google-Smtp-Source: AGHT+IF3zwKNANOOSB/rnoOeTS8EUz9vjLU1QGd/XdWRjuod3WtTU34FEkUMB8kXX44eGzxws505qw== X-Received: by 2002:a05:6402:1ed6:b0:584:a6f8:c0c5 with SMTP id 4fb4d7f45d1cf-594b7d81a1emr13886751a12.0.1720956800775; Sun, 14 Jul 2024 04:33:20 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:4310:b0:599:9c73:c392 with SMTP id 4fb4d7f45d1cf-5999c73c484ls1286648a12.2.-pod-prod-04-eu; Sun, 14 Jul 2024 04:33:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUMq4TW68arAkiW2fWR9bFb1V7alciivPaOb6UQMTn8yyxgQcvWrZZSufzwxydsYXeE8RmFARLyyrnkuEkDu+iB9u1ON4kvn4KQnbe04XZm2flS X-Received: by 2002:a17:906:5292:b0:a6f:4a42:1976 with SMTP id a640c23a62f3a-a780b6fee55mr1112908966b.37.1720956799089; Sun, 14 Jul 2024 04:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956799; cv=none; d=google.com; s=arc-20160816; b=bjzP8jTiuOG7bWL+iBkQ+QSr7A+t6osGQCLLERP60YOxFAlpH3N0T7Wy/vaQoaOvkB AnG5nlkU717wCnUTWL/aMsN1j1hgtZBIox6cqSOaqiGM1PE7k/s6IBVkqkJ/TjI/BQwy XhewKfpIPi0nmKeltRYxxHoofAqaFA5N4Z4ZVnkUnECS1gs88BCjLeVoiQMhActsyNqq c4wQ03GPaboBiINv9Eekr1fnB20zVxOt8QRYi2XHKIXzOAPM2tzGUMkD2c/wJ8DB5wqs V4At16Vs2U3+4cbdJKS1mHWZlkEjWmgWnQycBa0gO/xWdRNCkCuggMCq9SWBybOvDujF S2yw== 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:cc:to:from:dkim-signature; bh=BOsftV1B156FqKPDCerCP9N5GFz4CWFhQ+t16qP3mVE=; fh=Dwur1eXSkR4WbXLgcqMRKeQZr/JVJNzQ6qQzEQQuZjA=; b=CECgrjgmeFQqaGlBpoC6+MD68wkd1bAQCcojm+ewAmDfZiFMqTaGi0VmCI9wop1MZh k9/gPYnPjiTGo9rIYLXZV3d3olLhXf3e9CTNEY1uXPeXCuVtzjJ+zpkLMwbylEHGpQlO NBtHZtOYKLw7fCSnfF7dhnq9+xJVPl8juWzk57B8TNAIMuDCK7mMWtw/QnPQ5Y3Z1OXt f+t7BiGSHpTPlBhsBMAvLJ1sJJtARS98MARZ5OnhNp+dylbH3SmSyadIu6JCRqI6x0a2 m+2KHulEujKT+pih14QM42V7Ka45vGOkCylGjqphrQsMGvSHrXd3CXsF4xE1HqPTrrFw mUYg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=D4fR8hP6; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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 a640c23a62f3a-a79bc58929dsor47902666b.1.2024.07.14.04.33.19 for (Google Transport Security); Sun, 14 Jul 2024 04:33:19 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCWQReknVtd0gZ2mM4qWm0dfshPICysuTq6WoMimSOpLdTFxDBSqFtx/Fz3ZvsM3JJ7OCTA2cy4RV+EZOoRaquQcbO0Qs1ugxt3plRdl0RV+trsl X-Received: by 2002:a05:6402:234f:b0:583:a39e:f469 with SMTP id 4fb4d7f45d1cf-594baf87a01mr13186621a12.17.1720956798706; Sun, 14 Jul 2024 04:33:18 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:18 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 12/25] clk: imx8mn: add video clocks support Date: Sun, 14 Jul 2024 13:32:49 +0200 Message-ID: <20240714113302.133399-12-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=D4fR8hP6; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 31d2faa97a..089f5169da 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));