From patchwork Sun Jul 14 07:10:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3244 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 44DF941497 for ; Sun, 14 Jul 2024 09:10:44 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-58b3fcf235dsf2642676a12.2 for ; Sun, 14 Jul 2024 00:10:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941044; cv=pass; d=google.com; s=arc-20160816; b=TOdhUAA86knZi32aAfX2cILacPBsgVwbr6tl1WQW+rQ13rvOSKJR5SNURqdNT3BbfJ 8HW3ikCZWFExkr34yKChENW94AsAYOEmZIeP74dIPu2VCS+D+k/p5lhzH8vFT8Br6KCv up8lvIXPV7NitJB8C2xgFAcQMpzQYwrPEbI9phSIojAKObnGT6gFcs5FGyuR+G+2EbXk 13qn8WJlJD4V+7dQR5Ti137sWwphmYuAjdhUWT7VDZa/Ak5K0zmIuHd6cOJI4QSg3Daf Ds0KmH+pH8d+8mODx/BaVkh7XGLMV6qLj17zhUjjt0dNOrV1uRW0QAUJGXhSeTjACP0N Bfaw== 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=CiKzGiPu3X2IkJpBJDXoC8WzJe9XNmOXuj6rBYJ208g=; b=WU8tA8ZXfwxsTpHBcO87olRDHGhn4KyOWtKK4K1rRxslqDPn9tXDQrMMc4ovLeXjHo cFpj/i+8Zj67Puo+TYWPT7jJrW1+uM1Tz2JLCVbQitoKl0CKvShHALnywP7nA5nkiOk2 6ecHBS13KhxPJMN1SD9/b4IdCYzBPw5LuxIpHJqJ++TwgWcShxT1YPLGS8pbIySD338K Hpq2kONngfM0DZYHzudKNA0HXqWfT+aQCfgJOgQgezQil+n9n+PlxkK2iwIijLB9s20H AVGU4vH9Or3IQqzUmsS+eq7ZMOkOjdNoA7iSDjYVkqLC9R8MMnkJpb/MmrO7EWptP2WA W6hw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YgbA6eNQ; 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=1720941044; x=1721545844; 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=oZQJysRnDocUfcgDChHskPDGEakh5aG7sOlYXe0151uhzN09VsUl2ZNapi3iUA5pF8 LFfXgh51+nQdb4OOYpKdd1b8wELEyqiQF+eCJfKCbiCWLLXtB5V3ZVLW1gxvjU5hWKeP pDwdXR09WkKo/Tte7JVcMlGojYFheM5yLByVU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941044; x=1721545844; 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=TMR95vssJpQszRquNKeL9weeQzghuSe875OFzvsoNh5eNEFWHp/B54g+bOigs7QXqm skUNgB+uUQyComSw5he8paTgKLmH9TxbWr5WH7Ee+ZHotQ4WcUh+7vk7Nc4quMVfaTth YzcHXui6Ve0eOM85jKWh04dZVgKAOqFvcFfcTcUpW14UV7Ec15vD+RstdxPbteznRm9X lObgj7wk2ZIWTsk/eMiC5pMO7ud9zQ1ES2evGqDVBdwRWXUEj+0kzG/FI3/8UD3yZIMP 69SrMlShmACNS85VWBTHAxzUarQhoMCCj2uLFw7Doxr9lqCq3GI68iSsvR2rIQctqXDe kxJA== X-Forwarded-Encrypted: i=2; AJvYcCXIxziyvt6Ih3PnbIAWOF6K4TYlWut+DHvcH8WJGveNyODty4SqOeZvNtqlEo2XOgM6cWG32ltyKKf6J3aiesiFqAuCJ6N8g65MUlhz+LK4i1GmiUBDUxcrd5xmKQ== X-Gm-Message-State: AOJu0YziflAm6W0fMsJN8p7L+AMZeisWGn4D6Di4wBTlD12Ua1QxYQCt QTxmafhaXomY7ZeQH6zT5FkZ4c5DcTgfWJvdg/tr9+VxswNSrduRN+5nlzqw536Njg== X-Google-Smtp-Source: AGHT+IHjILuRvJfYtRLyuaxGbprli2MbBRwAksKOncZ9r/SsFFowSUGsBn0lnamma+sL2dZbNd3yPQ== X-Received: by 2002:a05:6402:4301:b0:57a:4c22:bd with SMTP id 4fb4d7f45d1cf-594baa8bb40mr12014761a12.7.1720941044022; Sun, 14 Jul 2024 00:10:44 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:cc94:0:b0:57d:555d:8ddd with SMTP id 4fb4d7f45d1cf-59821cb87f6ls1686845a12.0.-pod-prod-02-eu; Sun, 14 Jul 2024 00:10:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUXkJAxyYDVxGERdnvRBADs11etCeM4ozAWVdPqDjVQaNaFQ4odrvbZTV8XpyJ734x0obE8Tayr3K1hECvBdG+tN6eglRk54hbKBuZRe/pcNcF5 X-Received: by 2002:a17:906:2ed4:b0:a72:6849:cb0f with SMTP id a640c23a62f3a-a780b881dbbmr1017999266b.62.1720941042293; Sun, 14 Jul 2024 00:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941042; cv=none; d=google.com; s=arc-20160816; b=UO6nfjBb2rqmhWlVWve6gEUz9PdxxDe+qOwlCoGqwthuM1t8NNeT2CtCmR/rk4xDRy IxhrhoKXh64OMvBPUEM3Zu5uHq3x2r/sZ6OkidXYeUxEuxJFFXrxLjHcZut9dQEQKoJR Lv8ZduHMWTQvaXnB382QCy5mLYlY5qzdEDwciYtB1jY5TTaw651cU+3duI1fDgYWMnvu jOyiurWdIqnZ30a0vqn2yzQOyjZKjhEwCPQNUAaZztXTRXTTEc1QXArVVXQOFowexAqB IFMiy7NMPkTeJ5dIG+zcyCs5l3J22DMB7lwiBTyyBMApoSNIHy8qBAopjhPPMXjbNSBH aViQ== 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=alU8NCszoLKs55UZWh+B9/hGGfEx4hP0uUmjH0WrIVI=; b=lruGtVgBJU7fNC7/Dlgnxb60iYqHUmXSqUuSobT7P6ikNojvlyzLuoMz3QqW3jb2e0 7KQxCYSweTkp6xosABvYRZDgcAxpRkgfjUcbNG7wAz20xL4KuSziFZNGNPjYN9lM2njS 8Cmjg1iTPD7vs3X2XyxFnE6vb36iADiwk+4CUWIpdav/w8fmSljktZOyewMFNA37kKQt kP26I7V6geM85J0o9heMidJqX7k5zRj5/bvw3yvshN82LLZRI/hNvSChQzEj6cE9d83F cCizmhLqV+WFeA7DPG9tzSSeX7Lsz+F3wEHZOmsrLH5W6YvVMJHwrGHX5w9jr1sY4i5F gpQA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YgbA6eNQ; 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-a79bc86319fsor50244766b.1.2024.07.14.00.10.42 for (Google Transport Security); Sun, 14 Jul 2024 00:10:42 -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; AJvYcCWvbsWg/U8n6W+EDcGXmXEDCKC56NjgJ2bV99ObwfqUvTz2Fah898CNwdFFMUY2VHt7grGnswPaWYyNv60D6o/8xCHVSkqajlidULSKsR98xUVF X-Received: by 2002:a17:906:57ce:b0:a77:dd1c:6274 with SMTP id a640c23a62f3a-a780b89ca67mr968712466b.69.1720941041924; Sun, 14 Jul 2024 00:10:41 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:41 -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 09:10:10 +0200 Message-ID: <20240714071023.10417-12-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=YgbA6eNQ; 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));