From patchwork Sat Jul 13 08:45:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3218 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3612C40F45 for ; Sat, 13 Jul 2024 10:45:52 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-57a524f1f7esf1914404a12.2 for ; Sat, 13 Jul 2024 01:45:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860352; cv=pass; d=google.com; s=arc-20160816; b=LJfCjU0soFfEFQEqutr0SkldTqgKYzxp2WdcEDSvjIJPCtoar/19kZtMyqWsbsjEtV H86W1Evj5rlVh2N+XNvrQ2bLRz9IE8c7nW8bL63h2cPFKD95OH+120U5kx1rbqO6Q7oS Pd1zm0P0QA7dVKbV5H+vmeYstMeRXZWu0rb/t+ttnVuSEx8HypIM4OgmoN5HlsbDZT5+ lTBQazs1jrvrNO6t8oFKllvkvq5XRuHCbiAzqqxuXIY3GMS4BP6JeW0QsEczwgOp4PHZ tcHKuzg0yQuWOiuEpssjEwyO6HInpqKt35G+XkKcEZFqhk7rAWnEwRG/xSyCEqxrETLI 1Veg== 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=bVI0u7EwAIYmok6piIKVibwwsrYlav0bmyeoiMfLrcQ=; b=YqRd84GIETQP3RM7v1b73ggAr1ctabgSL4n5FkN2J8fy2vTYCKc/2bffMLtMC/+/VQ xmxeJptmj4myI5FBN5KB0Uki8Pkl/3gT9PUjP60TYTRk9+MfTtyyGroBtKn7yDNfNoqp xDQfoe+FKB8r2+8Q20y+dQwCPxwxzpDdYtrlU0AVDTBLT72yHUM10YL7G3YDEQsfh1Gx tqRi5e835CF7Ij5CPIhjufjEnGsUyPxLUUlqdO9k4MoARdws2Sp+oezzzInc5OxFp6qb dPRX2XzKCBRr4mFCSXNnnHXGNRPzgpCHEDzP3/PrBy622x56g/xquegqKqKF9XuvJmPh sh+g==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kGLrvIkt; 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=1720860352; x=1721465152; 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=GjUtd49X2CAnI5m1QE3FJgMs+m92ZVWS6Xk6NKXCOdaybWR94TIQFwMiTtequo+VOB 06kQkOUiuJEbBHaCjyFOO/xTEX2G9A2j9XVD+upknLQRtVQwdF4uhAn4E8qutITFbTlY rzCQztQ8q81/mKmkPa53jrqBpQoUEUNf7KpfA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860352; x=1721465152; 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=aNOQ32YppQ18oQEL04SSGBwp6ilT0qrG/ZKmKviNcBazfQupiygEaxfwRe3/6h0OAI AW+nKV4fuooRpzq0k+3zN7s0aVEViFeh3m/ybd8lZpYZS73ax6RT/OUPUh6nvucFlQu1 Roasx3L+p8JM9AdiqGkYJZv9fCHurLrt1c2KtAz3u+jyYX85/wdXtj24Mf+Mv1wSFiPT eFRk6chOm0dQrNr+PiJ1TeP0JdO/+P53JjzD9zL3DPq6IvUJZxHTizziRIO+OpdIN5Ai TiNx6TgI1GIo2YGXtuQr7/PSqVMOZn3peT3gR28tjfHbetFkRKcqWm2/c5W4yf3Kwz2T A44g== X-Forwarded-Encrypted: i=2; AJvYcCV7EP0vMV2J4Yt3u2uh33kveoPTZHRj0TXN3cKAYY6+30UNK2sRHFUc8w1ZQtIo7JIMHr6E3hcrDvuHdHtQ8QnIIJePe9NM8hW680RdGqv9TR4RuqmUwhKzlRJ1Pw== X-Gm-Message-State: AOJu0YzZ9Z7mrQcwv0Tf63OuNKLaxnda1olgShwcKS/3JlqAcNpP2Abj +DVaSL6UuTTxQOReqwIROHEFXxTGowUfsE7/jTw6zJH3f63dpDDCzjpSJpa2mfr5ZQ== X-Google-Smtp-Source: AGHT+IFx15T5fVghcwB1in0YGwothhoPL4E7HqzhMKd8ehmVCw7OsccPTHOvTkPYjRRVN9Nrc14iPA== X-Received: by 2002:a05:6402:1c87:b0:58b:7413:db00 with SMTP id 4fb4d7f45d1cf-594bbe2b9e5mr9014112a12.37.1720860351909; Sat, 13 Jul 2024 01:45:51 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:48f:b0:57d:2188:f507 with SMTP id 4fb4d7f45d1cf-598267117b9ls1569802a12.2.-pod-prod-07-eu; Sat, 13 Jul 2024 01:45:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVOXpqNwxU0cWEiwrLUQoUOI8zFiaWhqZ/Sk+FqoV0d2/KAyq68yffruSIlSL4vzOxOHxYrp+gnJrtiZeZtWnYcJcvQq3jJlJHISsIrb2368tOX X-Received: by 2002:a17:906:4c55:b0:a77:c080:11fc with SMTP id a640c23a62f3a-a780b7009eemr731452266b.36.1720860349951; Sat, 13 Jul 2024 01:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860349; cv=none; d=google.com; s=arc-20160816; b=ryWzqW0BXcqWXe0wCQV3i4Yio5cpK68Fudav1pRknGpJhhAYitc+9gwnNFQ8/lA9Z/ sdBgmIK3ETrpYxHf0g9N2TeHBv1e9lss8AZE8Wk4S07iMDtjO6kc5OIw8o2kv1lwVOMJ h0OYB6tc6tcrYgiD/mRDRCam/Grteiuf4m405d8p4hETs0fOQl67peCx1z6HLzBYuJQ9 +XlvAdMWACE0txo0e9gg8MGbUEmcFIEbQvu5+2stbs3kXbUM+q60mqkEXcXB0TAfTz3w Kstf4QY6NFupCIn5aHv361EQlkiL+5O/UPH7xV2tG6adPh4qzvBrpVDc/iuiK9EPT+cp 0BcA== 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=+nOU8GO/Hrsw4vm5rWGxMSsdCuMsn6lnzU7eLJH933Y=; b=biDQYD9aHzQMRigKHGUxuOgwPvEvWy3dnW+at44+nLRItGcXo5QnwsvdgcdrDDcMPu BHAHDR9ZsIpKxPDxPQ7w3O64+5pEtUGCTLulxf+yPHgZ6cmRP6wUuvlHgVdYm0d39HjO q2Ntm8JiiXJATF9zgIsD5nXOrkaI6d1u8AkO0hRQr3VuMeQisIgUKtb5C8BRdi7fvis3 GYefR33h7unyh1JusCr+RXe5gMRRdrKEcx4dA+25uy8YcrGN4H5ojdn7ezmgqf4DcXYg WDaSPMXIzooHOe3hgIoqYQEs1vdVwn8G3paE2dgG6NUnjxg7MG4QZTFCsbLsUd/ar6DA lOrg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kGLrvIkt; 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-a79bc7d0048sor15897666b.17.2024.07.13.01.45.49 for (Google Transport Security); Sat, 13 Jul 2024 01:45:49 -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; AJvYcCWh2ydxBw5oZkmfAbjWiWD5pbg0b+Lyv8/tZ6JJOCUSQCDkILyTVHAdH6UaEPk30UYvlO4Bv2Oz7iAFtSg/2VBK0lWxSfqT73/xO5mguE6QSod+ X-Received: by 2002:a17:906:260d:b0:a72:b287:1e04 with SMTP id a640c23a62f3a-a780b70106fmr762602466b.34.1720860349507; Sat, 13 Jul 2024 01:45:49 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:49 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 12/21] clk: imx8mn: add video clocks support Date: Sat, 13 Jul 2024 10:45:17 +0200 Message-ID: <20240713084526.922537-12-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-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=kGLrvIkt; 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));