From patchwork Sun Jul 14 10:53:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3269 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9E6EF412C7 for ; Sun, 14 Jul 2024 12:53:49 +0200 (CEST) Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-52e97e5e3a8sf3437904e87.3 for ; Sun, 14 Jul 2024 03:53:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720954429; cv=pass; d=google.com; s=arc-20160816; b=rneY+r+Q0Fd0PI5ca68yHSnuzCG1Iuh6/hAIDOQ6puhPehGQTIAXJoUK1Gv/LVAcL7 /AfpF5TqTV0IvHerY+rjiK0ch1NU5BsDRR0O6Pcaqxjswbhp9cZNy6cQt7XEmwOgVw5G on9E3TUF+dm98nkDZMher3MpPvfczh2CY5avQn+lEBR3/UvDUN22rxv/SJ897apfApbq EUqiIOGiEWl8xiiGTqHtZ8Wmr2l+tZq8+UtM3szji6GGc6O/7S36rWIO60hjvOjMBp2a 0O5dFAClIPUvk8b/SWUcBPHCqDlXdrmfu7MQgRfv04ehRzFQj4kjuHbzynCjBg/98vj5 HUUQ== 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=zLPiBr+EjZU6HWU63BM7fz66EhXCHUd/glW5BaJ7HhM=; b=QtqyF7feaLvcKIi+y61fsKhkil2g8esY+fiNYxpFyFlJyUzVtxsHHOun8P6e/uBclw DI73VE+TBWNZAcq8PgtIEyo0U/tW0n4txDDJB6/THBm1cNw0Sysk2XReWWZhaKYgAEA2 B7+KkBkm+bvdsZ/9SSNqMejDm77emwiICrLVcogLgGDnL+tfWo9Z2INNwtsniOANMwe9 CcL0ta935xhc2LlkyJSMZTyuFfr+B1Ab5fc82vv3IGDG+8bfaOVNEey3zJKhake2bx72 3Io8dQUQ+8WfX9ldJCsoc9DORvoZ/1ULst0Ltmzr2tDnXh1KpOKzZny8V62H5ZiqEqlJ vFsA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZtVwtpSK; 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=1720954429; x=1721559229; 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=P+eDnrMYMUZ9PZN+YDY3xqooQ6eW07A2+NfCOvl4SXG757a3qsy4myUXpzYTtJG7Xa MOV3cCIDE4QvI3a9ylPCId7oJ/DfWt700h78dYnPolWFgm+VDDB/Q2nPuZCO3e2O7pMi jZ2Fq8txAvIJT8COSudiriRqhNpBJ46hC9XXQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720954429; x=1721559229; 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=nbJFQ2Oncurw4Bt06N9P9aJgurnMzPuffQxYFhR+o+D25h35K7lEEH36ZgsVCiD501 vTGzObyho2qgpgBmFUAW0lbHr5BYs/VCCYnCoKPcAJknAmzZm4fnzPvwrM7aq2gLJ80g 2YI+9bDtZ4AZ9DjkzK98cx6SbqzkMLbk0Lp5jq3cXFf7xqOLPVXK4U22jAWncGt4ha4j Fct8/lHoWfKFfUV1cROl3d3O2NMkqYaGGKOMQZUBbdCa8P9HzkIOG3co+EFoYBqO/17+ 7KgYcX472dn+qlXcw8XrG+VzzEyHt9v7436PQK7u93X7qY6T65YEUcP8ouFt0QIS7MBW Xn+g== X-Forwarded-Encrypted: i=2; AJvYcCW0P+wXxtdg5diQZ6oHx2Uw+ghkxiZ6rHfpRHwBs36w6bPUzsDIaWPAnQBOMucYIQzO+zhYn0x+TygC+MG8u9QLLJ51LPetCqcIPvZUd12JJzXdlPFEoLy+mfl+ow== X-Gm-Message-State: AOJu0YzK0XEh+hKbssnWrdJnwXtY0zQdXHW9q+ckcDs0y8h/nR4iFDfx MQ1zIwrVHWM09+1SsgGDOlWdGKXCrModAJ+1r631mzlTn6TkLI1D9vJDBn9/BRfm8w== X-Google-Smtp-Source: AGHT+IHEOOxgW4D3pdU3vGOg4fjF4iUA9QINZAX/WoNx6/TE0UQe3aFP/TgsRP3G4w7z54KuPAWSgA== X-Received: by 2002:a05:6512:3b91:b0:52c:d76a:867f with SMTP id 2adb3069b0e04-52eb97641b9mr14150481e87.0.1720954429093; Sun, 14 Jul 2024 03:53:49 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:3b02:b0:427:ad0:2dd8 with SMTP id 5b1f17b1804b1-42798473fdfls16896195e9.0.-pod-prod-04-eu; Sun, 14 Jul 2024 03:53:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXs81A47RFM5URNoMnw1a9TnCzZjCO0PqlKmgKPlZBBogRFUhmLojNVsvXL6J6CevWlI5cXDWqYhI6AiqplgrkX0WLlUgoE5hnqUD4E2A/h5jfT X-Received: by 2002:a17:906:514:b0:a77:a58f:7f6a with SMTP id a640c23a62f3a-a780b6fe37amr981199566b.38.1720954427374; Sun, 14 Jul 2024 03:53:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720954427; cv=none; d=google.com; s=arc-20160816; b=JkIQSTDJRiAgo+uMwiT9QabjwXJyoO2m4C2fFzLyt88Nw8XOWWQFHhjhMxo3mOH7W6 oBJjqNQLzR3W8U2qQFFOCHsnGJTesklQH6oavuk7/m3PuaVWISAwbxHQb8WsX9dU741r oXcKfKCHUpP1UzwPh+eSkjAV05EpDz1jxH48nOGIs9D+wJdKC1CPl07YgVyIPa15akZn UnkjA24koR6xLmE23xi+3FK57tLuIYUNnylprcx6ft0AdL5VuU+GaTJepHgsZtxiE53o hh1E9EmkGTVeoQD9uUtIEdXbo8EAJjrNUC8DfhTncPPhVHeRAnadwZkovA0mohwJ2fOC askQ== 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=q7T1dwSbBEWXpxTM5RBnHKCQhfSNebdU85Jk0CG8SeY=; b=nK5/UJy2xsrASJTzAxBkCDNNfhTVD8qDEjB1WOPV0BY2MVqwwlNPHqlcrRmEsAv2lD 8IjQAeQnRzqI/4AG4P0y9vMp4njJXbidTTV+CV8VSdyul+2uKeMTDaltclsX//Slc16p y+d3qcw3VucHNKLKFJkNhhWK2Vho/NwJ9k7D1a59XR028C/knTwFBoMerweCD/KnD9/g 9IacnGbYQBCrKivvra1X4PgDpl23+DsOW3OfhLBkurjSKPYEGrl6J2BwtCyvfe9g7Z3K +VFnWz/s7a7A72BKVPNoMkK/rhQT7VPBXeqmWwo6I9uRyNjgfwFswbbPvYyQyhkm/LPU obFA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZtVwtpSK; 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-a79bc7cf0dcsor35428966b.18.2024.07.14.03.53.47 for (Google Transport Security); Sun, 14 Jul 2024 03:53:47 -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; AJvYcCXvgwk+9sRP1TaU2i9oNoCkpr1bEm6IBjxicNOgUacBeP5tpxJa7ZJu8imBqTVzrIFnOija82rA1ehM2dewidGU4+FrjSk2nEbws6TsZT0dTHrh X-Received: by 2002:a17:906:ccc3:b0:a72:633d:5fd6 with SMTP id a640c23a62f3a-a780b6b1c4amr1075529966b.32.1720954427027; Sun, 14 Jul 2024 03:53:47 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc5a36c7sm119966166b.7.2024.07.14.03.53.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 03:53:46 -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 12:53:15 +0200 Message-ID: <20240714105328.35825-12-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714105328.35825-1-michael@amarulasolutions.com> References: <20240714105328.35825-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=ZtVwtpSK; 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));