From patchwork Fri Sep 13 09:56:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3492 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 74C2E411AB for ; Fri, 13 Sep 2024 11:57:31 +0200 (CEST) Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-5365b801741sf876538e87.2 for ; Fri, 13 Sep 2024 02:57:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221451; cv=pass; d=google.com; s=arc-20240605; b=Jz2jqEAmPmwm59hJgNwwnTF6nsGWAk2n2xYvcgFNi1a6mdQM0ssJs4rOVO3mYDjW9H US15tObrmvP8ozhnZ9AJSDAL0b5KSTFDd6JrkXb2bOZ9e4DIKCS/kilJ94G9Ht+xdrsn hGRhlc9x1U/WdIE8IkZAxsIHuNpdV+xgK0Um9HOBcO/XiigJFpECB3kX6TGWZ3PTZ/rr q5Qsh5Vg89G6HKzadcU2hHZ5iQEH5Cc5DLKKsZK1IlARRCT8zB9yX9YMuau+2f7Tt+nP CuxmUotK0KZOlfsvTyH9X6K6BQZ4BDjmHP7z1ZzMfkzIXk4tT6597u7BlI4aUnGVaibF DoHg== 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:cc:to:from:dkim-signature; bh=zQ0CxJAmVMgUkXfBrLBApMilg93hGIa9QMfzZzfiRDs=; fh=mUyxw6ZpMV9AQB4Il1EIZ3/M2riPXCBHjkaLFQvE6eM=; b=eQRKn7GCcZafR2Z6l/YvxK2uK0mEPE3hzyNCOlY6DHFb00l26oGW/p58cOP2wiXvu0 L8OPTwaYcBEOKyGH38c3ChLB6kCTcaY+61VTi6Pc49fvqkBXL47MuRmCT9vjTghqUaT4 8ptnHpmwRYdGsm2JrRMGmaOFja4iwJ/isAB/nbnzXu2+cK0UVBK/jm7zGsPeYguHja2h 4U3UeSWQPTygUrbVqoANfMLoXhg5bSdETqPjYMhR3RMoXhKilldDu5/CHT4DUXl4yqtN rfTLs5pRU8fVsYZfTnZPFumdA2qBd51Y9XzXDmVqfZTZJN/u52ktj/cLc3LQ48pLlbk1 GF4A==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ei8NY9o9; 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=1726221451; x=1726826251; 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=zQ0CxJAmVMgUkXfBrLBApMilg93hGIa9QMfzZzfiRDs=; b=HJQoCVv+Psrs7LjPEGpVNtwH2VjlnNWFBrKI9lPdpbHAZsNqEigWsY0dkZwFAxy2Xw 68YItr+O9oTv2t+2u/YWApN4gDfAPvx4eYwyjKXBBpv8em0W3KcAvrj3yb7NEMipemcj bCbjvRuA0xIxkFrx9EJIDITPDXc5FhiopltIc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221451; x=1726826251; 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=zQ0CxJAmVMgUkXfBrLBApMilg93hGIa9QMfzZzfiRDs=; b=H+RbjuDVtLR3F9Kf6K66FW7w6382q07N+XE+rSGeX8NS7hCoY3lZ4KJPT75JwrpmFD wsDpcfOCjcSe5XC1eH5MCxy7EBDfvoPzN8BBMV+VqTYz6HcnCah/7gXl4u9YyifEhzmx +AajdDSwj68ddUZHFOJUnWxUMZEHwD+XiowV5/wZ0OpVcXC8ouvyc7wJn2GlFdP2LSpI jOLlAGlZjdNUEysENY38g9uwUX4vjPPPoTH5NXnRQyAFVrcnqmcij2XUUd9x5awncD4B OwR8FoOAXeD2SlSIjQAnQVBAJu9vubfUC1t3ZZNKR91Q9w+SFYERieGVn/0wbSthv1JT BrXg== X-Forwarded-Encrypted: i=2; AJvYcCVVC+Ixz5wio6l8x3ww2LfZaSBCdbtfPRZtUMRvLbLu0d2AmYQMfv5AvBKUXzkNFa6ihUosZ+oogFb4S47/@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YyfIXp4fp88AIstOJrv6l/0sL25KoH4iCnYF4ka4flwRCJ+5+Rq cICutYsEGlFTKLXnY3kX8wCitlJ467+GzobSlnaikKAbdPjUVGb0v3AIG3PgSRaM8A== X-Google-Smtp-Source: AGHT+IFQrw3Jn/AJ75/rnfCJ5CfK69q+lBG7U1V5agolYBxBANcxjqOJqE0zsbbGE+vauGauW5NfVg== X-Received: by 2002:a05:6512:114c:b0:52e:9921:6dff with SMTP id 2adb3069b0e04-5367fee53f2mr1932560e87.26.1726221450733; Fri, 13 Sep 2024 02:57:30 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:4019:b0:533:482f:afc3 with SMTP id 2adb3069b0e04-53678e094ecls69618e87.0.-pod-prod-05-eu; Fri, 13 Sep 2024 02:57:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWP1ZBip3C+Hg805XY4jl+FdgfAx38rHv84FW/5KxMkUu1eBW8ju469dcsCPZcWIubbQ/6Ga662SuBJdV38@amarulasolutions.com X-Received: by 2002:a05:6512:238b:b0:52e:932d:88ab with SMTP id 2adb3069b0e04-5367fee25a8mr2092643e87.23.1726221448853; Fri, 13 Sep 2024 02:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221448; cv=none; d=google.com; s=arc-20160816; b=HjcxE/21fGpEg7yYeOK8pdm0bsnlLyGwwIh8HiNEvmg6gTlkElUxBiahHgLE6SJcf6 CvNeaTQsbhOPw1x6a4tmU50UtXHM4NXr9kC/JfDN3u/iNaz4B+vopLW8GXf0NdXTgUSZ rKkRrCSo/GOSkFiZBQmchJ7ny3BY6bgLy7DJBxUUhgKYqJOWhQe3qDOP2+MhTKYUwwWE OaldHyquzVqO4GnOixMj/bXHfCo/E1mlbAiEdV/5hl7Jg6Fxy+wc9gm0RpKTtPhBfdPu z943zaDJhcW1RgwidVxZcTgmKW4//Ayja07s4sKfdAQMmo3SVQhEs9Iw7NoHq3w8WeZj q5Zg== 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=KxLcrsk7KRUbBJ1NKSDZt5CMW8u++VHiwt7yzGRE7kA=; fh=Eyyy8FmQ9GXk8FoArf6Eh17UmFeiQdQ2vnjfPRkjMmw=; b=XE1/ar+X2WmD49R7NpHomckPMPsjEFSAq3zrNmUsuVjIYuvrHYXP6x8mbQR8nfYSAa IIjnRaJ8pXLQlOhbhVBPOSwDtPqi20MyKaLl7ac/ZibMm+DaR6HnitEqchP98TLvjZ7A wQJQWDJsDPFvO8cgT+cVETzb1LIAzws6VB+w7Tdj7xgraTgk9OTGELfGkIf34g1t4nl5 ocnvGNCfKstc9oPINkUM1ZtfzGSPhJ0G0YdfSs6YlElbqa4Xby82cCp3icBNXTWwKfp6 CzsQMqC9cG59CsPMhTYn5mt82y+7DIJfCHq3A/3FT7eB9lcY+b+10T5cid0WX3R1r8FB R74g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ei8NY9o9; 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 2adb3069b0e04-5365f884df3sor4822430e87.14.2024.09.13.02.57.28 for (Google Transport Security); Fri, 13 Sep 2024 02:57:28 -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-Forwarded-Encrypted: i=1; AJvYcCXsHNdA/tXLSQ9mIr6jjfL1nFxjdJhGo1REOM7fXEAed34v/BO2rB/l85DVdZq6Ym4XucyW5ghBrVi1b6Sd@amarulasolutions.com X-Received: by 2002:ac2:4c4a:0:b0:52c:76ac:329b with SMTP id 2adb3069b0e04-5367fef1b91mr1744190e87.35.1726221448156; Fri, 13 Sep 2024 02:57:28 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:27 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Tom Rini Subject: [PATCH 24/26] imx8mn_bsh_smm_s2/pro: support simple frame-buffer Date: Fri, 13 Sep 2024 11:56:06 +0200 Message-ID: <20240913095622.72377-25-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-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=ei8NY9o9; 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: , If you want to pass the frame-buffer to the kernel, the video output is initialized by U-Boot, and kept by the kernel. The commit modifies the device tree to be passed to the kernel just before launching it, to prevent the kernel from reinitializing hardware that has already been configured by the bootloader. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c | 99 +++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c b/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c index c99896873991..87eb4e7ed63e 100644 --- a/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c +++ b/board/bsh/imx8mn_smm_s2/imx8mn_smm_s2.c @@ -5,6 +5,8 @@ #include #include +#include +#include int board_init(void) { @@ -20,3 +22,100 @@ int board_late_init(void) return 0; } + +#if (IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_FDT_SIMPLEFB) && \ + IS_ENABLED(CONFIG_VIDEO)) +static void smm_s2_setup_simplefb(void *blob) +{ +#define DT_BLK_CTRL_NODE_PATH "/soc@0/bus@32c00000/blk-ctrl@32e28000" +#define DT_GPC_NODE_PATH "/soc@0/bus@30000000/gpc@303a0000" +#define DT_MIPI_DSI_NODE_PATH "/soc@0/bus@32c00000/dsi@32e10000" +#define DT_LCDIF_NODE_PATH "/soc@0/bus@32c00000/lcdif@32e00000" + + const char *dt_addnode[][2] = { + { DT_BLK_CTRL_NODE_PATH, "lcdif" }, + { DT_BLK_CTRL_NODE_PATH, "mipi-dsi" }, + }; + + const char *dt_addprop[][2] = { + { "/regulator-3v3-O2", "regulator-boot-on" }, + { "/regulator-3v3-O3", "regulator-boot-on" }, + { DT_GPC_NODE_PATH "/pgc/power-domain@3", "fsl,boot-on" }, + { DT_GPC_NODE_PATH "/pgc/power-domain@4", "fsl,boot-on" }, + { DT_BLK_CTRL_NODE_PATH "/lcdif", "fsl,boot-on" }, + { DT_BLK_CTRL_NODE_PATH "/mipi-dsi", "fsl,boot-on" }, + { DT_MIPI_DSI_NODE_PATH, "samsung,boot-on" }, + { DT_MIPI_DSI_NODE_PATH "/panel@0", "syna,boot-on" }, + { DT_LCDIF_NODE_PATH, "fsl,boot-on" }, + }; + const char *dt_delprop[][2] = { + { DT_BLK_CTRL_NODE_PATH, "assigned-clock-rates" }, + { DT_GPC_NODE_PATH "/pgc/power-domain@3", "assigned-clock-rates" }, // pgc_dispmix + { DT_LCDIF_NODE_PATH, "assigned-clock-rates" }, + }; + int i, ret, offset; + + ret = fdt_simplefb_enable_and_mem_rsv(blob); + if (ret) { + printf("Failed to enable framebuffer DTS node\n"); + return; + } + + for (i = 0; i < ARRAY_SIZE(dt_addnode); i++) { + const char *path = dt_addnode[i][0]; + const char *node = dt_addnode[i][1]; + + offset = fdt_path_offset(blob, path); + if (offset < 0) { + printf("Missing node %s, err=%s\n", path, + fdt_strerror(offset)); + continue; + } + + offset = fdt_find_or_add_subnode(blob, offset, node); + if (offset < 0) + printf("Failed to create node %s, err=%s\n", path, + fdt_strerror(offset)); + else + debug("Add node %s:%s\n", path, node); + } + + for (i = 0; i < ARRAY_SIZE(dt_addprop); i++) { + const char *path = dt_addprop[i][0]; + const char *prop = dt_addprop[i][1]; + + ret = fdt_find_and_setprop(blob, path, prop, NULL, 0, 1); + if (ret < 0) + printf("Failed to add property %s:%s, err=%s\n", path, prop, + fdt_strerror(ret)); + else + debug("Add property %s:%s\n", path, prop); + } + + for (i = 0; i < ARRAY_SIZE(dt_delprop); i++) { + const char *path = dt_delprop[i][0]; + const char *prop = dt_delprop[i][1]; + + offset = fdt_path_offset(blob, path); + if (offset < 0) { + printf("Missing node %s\n", path); + continue; + } + + ret = fdt_delprop(blob, offset, prop); + if (ret < 0) + printf("Failed to delete property %s:%s\n", path, prop); + else + debug("Delete property %s:%s\n", path, prop); + } +} +#endif + +int ft_board_setup(void *blob, struct bd_info *bd) +{ + if (IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_FDT_SIMPLEFB) && + IS_ENABLED(CONFIG_VIDEO)) + smm_s2_setup_simplefb(blob); + + return 0; +}