From patchwork Wed Sep 11 15:10:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3455 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9159B42E8A for ; Wed, 11 Sep 2024 17:11:07 +0200 (CEST) Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42cb940cd67sf29964035e9.0 for ; Wed, 11 Sep 2024 08:11:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067467; cv=pass; d=google.com; s=arc-20240605; b=eWwWgml4vRwifVDonK2f9p8iFjaE0LyOjRqWkFrOUn46QMtc99/507IEDWNI5LDne6 yqvpBR7xvdu1c7qcCCs1bxsDy2L/wTgoXBjiZPcr8hzue6QH4IiHmdRXtuHTBTRgX9rE CNEgkks8eM2ASYtempYKKZKnHbafPuc1kz59DLWhyh7w8G2f5KVuh9eQjkmelVacEdFp pLdb8T2dlAYD9RhoZ+UkkpPZpSmBeazpMqKRYt3lLo3ELzkKK6kXxB60aYiKoWKNlqCw eKxg2LhgFkIkSzCIEfVsf6Nc5Y/H95Pps468C6JrFWRwa44LDVnpux42sHSpboSZ3YTy v/Sg== 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:to:from:dkim-signature; bh=jIytob1JLGwMBnloa0lPwbV4ant84b5RNc9QjHFAD4g=; fh=RcMz3lLJ+ydWayN9jVq2Oj9HFrvWj93lmAahPazGtqU=; b=Tke6goBgXKSKXI/SZCTvDoHQivXpvDZTR2uCLFjC/duRbKi8/iS8sQc7jSKzt7gojb IRJoR1mcffdoor3UxlSlCe3+Y/CwxzjbDGndwQ+pzPQlwo8WWILV/nO6J9bG8by1ei3g BeGrGb/EyZysokGeuWthE49uMynpv/o27iA6ssMx4VF+n64IXSIZwZX29KzEuTthFdL/ Sas3a3NvRdYqYi5dFK2HrkpNbrMVGYRBMZbaV6jbaVsnn/MC7Skea6tHB+Q5LH7r4VTU 8kd6hhubPaHFPRrrU+BkfheYt333cPSsngH4OwyB08bsCKtMqz8aHovLEzEckPUCRZAs Yw5w==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=p8krCr3B; 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=1726067467; x=1726672267; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=jIytob1JLGwMBnloa0lPwbV4ant84b5RNc9QjHFAD4g=; b=pyaLy/u7lTBPdSEKnSXYi+kbA6P9PkpJqMsqoZx8BoCfz9PLD41PmdHNhOXBPGRj6X lxoah4SF5OPf04MEWgS61NWGb2rEQS6eMLMSzxXRDZoilmBo2kVPDxY4uI7xWHBIYL3e 7MDSQd1cPTO2yIJKSabxUr+puqhVru9xchfh0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067467; x=1726672267; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jIytob1JLGwMBnloa0lPwbV4ant84b5RNc9QjHFAD4g=; b=vvtM4W4ydDkO0yKEdo3YnNO0E4eWQuw0qdLgAgFJrjc1zLTR08B286B+JblVdc7tnc T5TPLYXlSjwY7OTCp8AEBYcZa5qep+LrnGetPpCeHOqbmEYKMFABzKinjEPl1EB3pi4L WZ/ST0WN8akJb02+XfeSzgqesbo36UgHi0yCg9ahLQWpong3wEd0/1gtekAsfHyndTg5 lQ5rRHBoZqD3GOZNi1jC5A2vHEwWPPMRT0imOvtQtVQTKLFF03wwwtcEM3y/FzvDblCs MFwfV9lYSxvrkngSelOkKVQILjWau9AWIiPzjfyln9JI62S3iEAWjWi3lNZY8KzcB14l zvSA== X-Forwarded-Encrypted: i=2; AJvYcCWIuBwUKpysqYHS6Occxiuc25czgv/+E9qjR4gY28ZBz739S4h0dWJcuaKfhpW3vl9XeOCW4aXZBl7syZ7z@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yw9IyOJBSapyUFuLzAuQ+QqmTu93JKfUBnQqjRZbGbfh8aOyVjF UVN2AbmrltY1oSUnZoZxvIPxTqLHvEHNvqFiBs1i25pZgnkLMBT0GabAcE78cP1GZw== X-Google-Smtp-Source: AGHT+IF3fYktowLo/5XoMafu9zFTco7C/tSHH4kI+1lWVHStiXPkoiO1Z7JgDJ/RO7u1z0Mwt84a/Q== X-Received: by 2002:a05:600c:1c9f:b0:42c:bcc8:5882 with SMTP id 5b1f17b1804b1-42cbcc85cf9mr78104565e9.7.1726067467139; Wed, 11 Sep 2024 08:11:07 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:3b93:b0:42c:af5b:fac1 with SMTP id 5b1f17b1804b1-42cdb16c789ls111805e9.1.-pod-prod-05-eu; Wed, 11 Sep 2024 08:11:06 -0700 (PDT) X-Received: by 2002:a05:600c:1c9e:b0:42c:b508:750e with SMTP id 5b1f17b1804b1-42cb50877femr112595595e9.11.1726067465737; Wed, 11 Sep 2024 08:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067465; cv=none; d=google.com; s=arc-20160816; b=Oxmz0WN35KEK9C2/y9+3qZeZbZqke4Q5ePd7RbXWNCdOngWKmqpbZdwVZBr3NkO80b ltCNMo8YrgZk0ziXrr4ItUCwRJ2Tjz1o4s9sW13hGdHiBF/2uGUnua2oPY7xL4o9Qq/F mzRqB6yT6rhjvzDdLv9nW7J1BZn8WoGHTuMg1aUvMtDtopfEvSKcoTzpHdbUItlWMtSg b2G4CWdxWDhGUhxSCza4ZM7O10M7wFznNMDLvDKGGrhLF3YXh+1+ZPAVEYcDvieq04gY xOumyvOHVKTxJInC2aEM1OMEbR32+IeUdopDhokETh51JsLOO3GIDO4qOgMsTtZRpplq IxPg== 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:to:from:dkim-signature; bh=jgSUdG7rW0Jf1oZnwnMTlSi+xK7g1Ded7BTigAFFf0Y=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=kOVCmspGMhhMKRTABOnPxO3rYcIAW6S6UeG9ugw6sMRtoyZvIO6RAUBYca9vsHOOqU buQN+FuELirsaDTVjYGM/jDDLTr8eOXUBZL7wRIDyLqN5bwJdwPTmABQTUFigpkF8JCe dDnfmd05JfpvLq3XF5FNbkmZDq++cGkvXqtak6nMCr3IbIgQt3UUIkeTkvxPLVXSjDDT qd/cjvgRrGrK96/iG0aYTzO1j7jOpMTInm9wDi7RQIyZq58Rt4aMczvEMzBQbZSeX2aP e35eckyKpH78sKm4lm92tzMwyKtmceN9oJF31RHNe0BHoGAtn/FokmiHyNv4R5Noj66q LQYQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=p8krCr3B; 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 5b1f17b1804b1-42caf2e1e74sor47367835e9.9.2024.09.11.08.11.05 for (Google Transport Security); Wed, 11 Sep 2024 08:11:05 -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-Received: by 2002:a05:600c:1d24:b0:42c:bbd5:727b with SMTP id 5b1f17b1804b1-42cbbd57a08mr91888915e9.25.1726067465018; Wed, 11 Sep 2024 08:11:05 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.11.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:11:04 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 25/27] imx8mn_bsh_smm_s2/pro: support simple frame-buffer Date: Wed, 11 Sep 2024 17:10:37 +0200 Message-ID: <20240911151039.2914886-25-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-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=p8krCr3B; 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 | 98 +++++++++++++++++++++++++ 1 file changed, 98 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..fe2f91b82a2c 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,99 @@ 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; +}