From patchwork Tue Sep 3 15:30:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3399 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 816D33FA4F for ; Tue, 3 Sep 2024 17:31:29 +0200 (CEST) Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42bb68e16b0sf62008605e9.1 for ; Tue, 03 Sep 2024 08:31:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1725377489; cv=pass; d=google.com; s=arc-20240605; b=O/TOIRmSyKpwe1HwxFcnk/NpOp1dJF62kWs25YCBL0TCKzpdLtjT2aI0bXiWkYWGOC ufYkMWkXDP6d6SyJn9c3sWnemOe/OM591COYpj3bhcDQkAQ5jjxvCCpZPkxXEk9j4VV7 GMDUlR2hPFF4FYashSETDRSNi77/aI3LDsDOZWAhRX/AXLmb3XTG0GjOrSbQ2s3kX3j6 XbRz4X405bEO+pOByOMk00BUwLt9yhfKuYNAVtuF8gQnkcHnvbqAXFT3veJi9fOjI5nV U18Q+NXRt1vryPZRsR8n8yLscjYsbaos3Dh1xZbCEBBgIv4C4JOg8rvjMchwvmq6N9Pw nUSw== 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=Ev9v1OUgypu+KhgIU87J9C3IBI5s0S4aDmBtueMxlSY=; fh=iOoq9pnUJH9wpp+zCq55TTZM0ocIyec6Ssft7pJAsrY=; b=KeRWJ6YDvjO90lJc7sOsBHAZkLvIqCwD2z5HspLQsfqawsDyd6Sa8QvcMvKQKn1HQf fmwyjlKddGdDoVQA7DeBqBtde4QuJHHrsr4Kr8JiGZSLS9hH2e58pM4GOc0IcqshSnFj iF39joYI8xr9g0QI4TG+OT70q5JAiZO+LVJLCOzgfUNA44P5CXDEPrV5Cg91zXSj/xwa gCrReq2HRmG2/QissLEnfr9Ky9d1x+7XEGAR9WUiJQUm0SswYt+3KpVaw7tQq3n6BU64 Vxg4k1lmYsixsh9OQq6FKlvd64tiOUmJgRN7/sLJ4P4uNNcP2yBjncP+L2QQBg1NAiy6 R/Fw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=E8aPHX9q; 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=1725377489; x=1725982289; 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=Ev9v1OUgypu+KhgIU87J9C3IBI5s0S4aDmBtueMxlSY=; b=GKHtm/moMlUtGsvtgUnxFm8idrz5yXHWbo/hUksLbFA0H4DDf531ugOEcvxZ1NwZcY wkdklDfaRBUTanRjaHjaSipyKjsAHiZgk/pbrOEOKbl0x8OyUSkmQwOEQfFy3c46YP+x LKuhmdvJ87t46UgeCpjpqUTdaMLHwDNWpUaJY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725377489; x=1725982289; 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=Ev9v1OUgypu+KhgIU87J9C3IBI5s0S4aDmBtueMxlSY=; b=tMjhVe/nY8SzEnruGR9xhX6cdlHnw0lcY4g52k7brW6cBiugJma9P/g5pOA7J68t+e 04DhyI1jKriq4+RAZ1Kqan80y0z9UeynqSEhudF55lQnN4fb0A7qHX1g2AGePoZTeh+y nOyPIpTEjNiPkxcE2YSSfm5ZHPMZIpW9i1vW5ZhPhcLBIOxZbWFNWrRxtJRfj8O0LRyh yfcI8ryHFhoxw2FIOA2jCTRgP5VUU3glEpdH92aiNM2Ao5vKKs9T7JX2zw1fJQbFCHqW rrnp3T1ohpAJJh+enxhfvaVRCiN91qeeneAM7qEi5vCAhIWI/NnkaTzIbVhZfNpcEUyG 7+Xw== X-Forwarded-Encrypted: i=2; AJvYcCUBx2tB9fYZC/a8vF4FWQ8ZoY5mmKMG7P7Zx9OJPmPqnmKs3NsZ2k7Sy+L7Sn7pYItt+Y8/3hwWpkR89dQ7@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yz4p2+r18T1DBAeUIAgqwXkon9kO3FJBGZ6MxlSU98qID9JkRQg WkiUkTXL1efttJOExhDq+rKXnddfZDdDAGKdu/9yKE8keBMzEUy22CQfnoNVOa/NNQ== X-Google-Smtp-Source: AGHT+IEzppmEzXO2+4ovc98JXUagVIkfSAph6/qprArvILxHC/GeXUT100dADx38cTCZPhUb+hPmBQ== X-Received: by 2002:a05:600c:1c0a:b0:428:15b0:c8dd with SMTP id 5b1f17b1804b1-42bb01c1e95mr173653415e9.20.1725377489097; Tue, 03 Sep 2024 08:31:29 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:4506:b0:426:7318:c5a0 with SMTP id 5b1f17b1804b1-42bb2a0f33cls1327775e9.2.-pod-prod-05-eu; Tue, 03 Sep 2024 08:31:27 -0700 (PDT) X-Received: by 2002:a05:600c:5102:b0:426:690d:d5b7 with SMTP id 5b1f17b1804b1-42bb01ee5b3mr158931735e9.25.1725377486774; Tue, 03 Sep 2024 08:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725377486; cv=none; d=google.com; s=arc-20160816; b=SeXvBdmdKxY7P4xRiU9nPB2L9GnfmtgMabkrejxyUlCeWFY4VuySm8Xo82bmIHQtu5 2i4GGlRnJm/MaWTqAZ7n8PIdEkLxAmw8AD8eaR20A/Q2SRCBEGUP4h9dgTR77JXCsD7a MTdvN4AF6/tl2ue4S1E+rmxn9Myw114cwfzCnAlgsYjCT7rDdsDYYdGOYv8BDgwgBss+ CHoRKfN+/CJTKHLEknSX4WIV6RPo8YkAEBeWamtmvPzRUBwNkcyeaPcdWAEAU3Nv2Du/ EaUjgQg47e7ccn5kKq0hTYOXsUUphMBTFbgWasaNr8p9jGw5msGwlobTnyiZ1I3uOOUB b9Sw== 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=Ty/eOojOBL4vgA9lyzKZZ8YJqhIjNzllwra781C5YKs=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=fcI7bIYd35PptdvkqXQb99/YO0o2wOCDxUCYxKIbR/YD3nqmpj9wXTN0fCN9+8tbmB WqYl2YbCoektBO6a3sQcjt2Nrt17kMjXjAk8SeXVZk7pjZxPCD1eki1e7y3pXmdeXC4/ o7H4ZH7MV85N1yIZALqcvK0XKbqcUCSBjdjnBFfYA3jXAnb0EXqBWRhDV18d1/IskB3C AhoKFu3V1OQZ/izIPxPUS6wvgirJbyTmzCDhe+UJSbsKfYd4eJuoYcUF47jcx8VqoXS8 yjrhJS+WnPSXaEzqaW5+oOzg8XrAeYKFVbdgT4pmZU5t2/iqzniVZpRoo55DMhcwxyPd TUpA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=E8aPHX9q; 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-42c8e41b1f9sor3577575e9.7.2024.09.03.08.31.26 for (Google Transport Security); Tue, 03 Sep 2024 08:31:26 -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:1d8b:b0:42b:892a:3296 with SMTP id 5b1f17b1804b1-42bb020d4eemr146192715e9.37.1725377486177; Tue, 03 Sep 2024 08:31:26 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.42.65]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6e273e3sm174168685e9.30.2024.09.03.08.31.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 08:31:25 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH 27/29] bsh: imx8mn-smm-s2/pro: support simple frame-buffer Date: Tue, 3 Sep 2024 17:30:58 +0200 Message-ID: <20240903153100.918077-27-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903153100.918077-1-dario.binacchi@amarulasolutions.com> References: <20240903153100.918077-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=E8aPHX9q; 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: 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; +}