{"id":1940979,"url":"http://patchwork.ozlabs.org/api/patches/1940979/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/d294851372d1003573439d81fb3ed22ace103304.1716965617.git.ysato@users.sourceforge.jp/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<d294851372d1003573439d81fb3ed22ace103304.1716965617.git.ysato@users.sourceforge.jp>","list_archive_url":null,"date":"2024-05-29T08:00:52","name":"[DO,NOT,MERGE,v8,06/36] sh: kernel/setup Update DT support.","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"13f8cd10f6df606eedae2f1c2ea10fbc13117a73","submitter":{"id":7114,"url":"http://patchwork.ozlabs.org/api/people/7114/?format=json","name":"Yoshinori Sato","email":"ysato@users.sourceforge.jp"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/d294851372d1003573439d81fb3ed22ace103304.1716965617.git.ysato@users.sourceforge.jp/mbox/","series":[{"id":408652,"url":"http://patchwork.ozlabs.org/api/series/408652/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=408652","date":"2024-05-29T08:00:51","name":"Device Tree support for SH7751 based board","version":8,"mbox":"http://patchwork.ozlabs.org/series/408652/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/1940979/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/1940979/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-pci+bounces-7960-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org;\n envelope-from=linux-pci+bounces-7960-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=153.127.30.23","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=users.sourceforge.jp","smtp.subspace.kernel.org;\n spf=fail smtp.mailfrom=users.sourceforge.jp"],"Received":["from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4Vq20z63v0z20Pc\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 May 2024 18:02:27 +1000 (AEST)","from smtp.subspace.kernel.org (wormhole.subspace.kernel.org\n [52.25.139.140])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby sy.mirrors.kernel.org (Postfix) with ESMTPS id 947A6B24650\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 May 2024 08:02:27 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 25320169ACA;\n\tWed, 29 May 2024 08:01:43 +0000 (UTC)","from sakura.ysato.name (ik1-413-38519.vs.sakura.ne.jp\n [153.127.30.23])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5C6562F37;\n\tWed, 29 May 2024 08:01:41 +0000 (UTC)","from SIOS1075.ysato.name (al128006.dynamic.ppp.asahi-net.or.jp\n [111.234.128.6])\n\tby sakura.ysato.name (Postfix) with ESMTPSA id B1C6F1C05A7;\n\tWed, 29 May 2024 17:01:38 +0900 (JST)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1716969703; cv=none;\n b=g87uWSnns+reruLL2xkPnoz/mvVqOBEfXvSWE/M0l8hjQcmN1D4dbwte7uDwDZ41nS8KtlPbYl+Fc9Xb9X6ot7fmaK5Rn7X5bqjn+62F+R1iq0OE4ggnL3iE0bysDp+dSZu3ttyGkXcrSFXvGDyVBFmUH3V98asjM6oY74oYZ4Q=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1716969703; c=relaxed/simple;\n\tbh=LQRqo2R5KpFisxDuNYQDVzcbcyFMytNT9GqRgFmxwEg=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=SORMFTgm3eLi5COPV7efIJx1GZcjc7teO3o9thmgG/sGRiRwGmysA+ho6VBNW8Q+mpQuHA0K2HKMkH8k1olcg6o5kK+7cmG97Hglurfwh2Zdf/UO5b9yxI5gXdStoix7cXSXP/kW1Fvb/eEVsbGWPIH5uCxertTBSfwxylx0hF4=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=users.sourceforge.jp;\n spf=fail smtp.mailfrom=users.sourceforge.jp;\n arc=none smtp.client-ip=153.127.30.23","From":"Yoshinori Sato <ysato@users.sourceforge.jp>","To":"linux-sh@vger.kernel.org","Cc":"Yoshinori Sato <ysato@users.sourceforge.jp>,\n Damien Le Moal <dlemoal@kernel.org>, Niklas Cassel <cassel@kernel.org>,\n Rob Herring <robh@kernel.org>, Krzysztof Kozlowski <krzk+dt@kernel.org>,\n Conor Dooley <conor+dt@kernel.org>,\n Geert Uytterhoeven <geert+renesas@glider.be>,\n Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>,\n David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,\n Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,\n Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>,\n Thomas Gleixner <tglx@linutronix.de>, Bjorn Helgaas <bhelgaas@google.com>,\n Lorenzo Pieralisi <lpieralisi@kernel.org>, =?utf-8?q?Krzysztof_Wilczy=C5=84?=\n\t=?utf-8?q?ski?= <kw@linux.com>,\n Greg Kroah-Hartman <gregkh@linuxfoundation.org>,\n Jiri Slaby <jirislaby@kernel.org>, Magnus Damm <magnus.damm@gmail.com>,\n Daniel Lezcano <daniel.lezcano@linaro.org>, Rich Felker <dalias@libc.org>,\n John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,\n Lee Jones <lee@kernel.org>, Helge Deller <deller@gmx.de>,\n Heiko Stuebner <heiko.stuebner@cherry.de>,\n Neil Armstrong <neil.armstrong@linaro.org>,\n Chris Morgan <macromorgan@hotmail.com>, Sebastian Reichel <sre@kernel.org>,\n Linus Walleij <linus.walleij@linaro.org>, Arnd Bergmann <arnd@arndb.de>,\n Masahiro Yamada <masahiroy@kernel.org>, Baoquan He <bhe@redhat.com>,\n Andrew Morton <akpm@linux-foundation.org>,\n Guenter Roeck <linux@roeck-us.net>, Kefeng Wang <wangkefeng.wang@huawei.com>,\n Stephen Rothwell <sfr@canb.auug.org.au>,\n Azeem Shaikh <azeemshaikh38@gmail.com>, Guo Ren <guoren@kernel.org>,\n Max Filippov <jcmvbkbc@gmail.com>, Jernej Skrabec <jernej.skrabec@gmail.com>,\n Herve Codina <herve.codina@bootlin.com>,\n Andy Shevchenko <andriy.shevchenko@linux.intel.com>,\n Anup Patel <apatel@ventanamicro.com>, Jacky Huang <ychuang3@nuvoton.com>,\n Hugo Villeneuve <hvilleneuve@dimonoff.com>, Jonathan Corbet <corbet@lwn.net>,\n Wolfram Sang <wsa+renesas@sang-engineering.com>, =?utf-8?q?Uwe_Kleine-K?=\n\t=?utf-8?q?=C3=B6nig?= <u.kleine-koenig@pengutronix.de>,\n Christophe JAILLET <christophe.jaillet@wanadoo.fr>,\n Sam Ravnborg <sam@ravnborg.org>,\n Javier Martinez Canillas <javierm@redhat.com>,\n Sergey Shtylyov <s.shtylyov@omp.ru>,\n Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,\n linux-ide@vger.kernel.org, devicetree@vger.kernel.org,\n linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,\n linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org,\n linux-pci@vger.kernel.org, linux-serial@vger.kernel.org,\n linux-fbdev@vger.kernel.org","Subject":"[DO NOT MERGE v8 06/36] sh: kernel/setup Update DT support.","Date":"Wed, 29 May 2024 17:00:52 +0900","Message-Id":"\n <d294851372d1003573439d81fb3ed22ace103304.1716965617.git.ysato@users.sourceforge.jp>","X-Mailer":"git-send-email 2.39.2","In-Reply-To":"<cover.1716965617.git.ysato@users.sourceforge.jp>","References":"<cover.1716965617.git.ysato@users.sourceforge.jp>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"Fix extrnal fdt initialize and bootargs.\n\nSigned-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>\n---\n arch/sh/Kconfig        |  1 -\n arch/sh/kernel/setup.c | 31 ++++++++++++++++++++-----------\n 2 files changed, 20 insertions(+), 12 deletions(-)","diff":"diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig\nindex 91c7c72bc0db..5c9b50884995 100644\n--- a/arch/sh/Kconfig\n+++ b/arch/sh/Kconfig\n@@ -712,7 +712,6 @@ config ROMIMAGE_MMCIF\n choice\n \tprompt \"Kernel command line\"\n \tdefault CMDLINE_OVERWRITE\n-\tdepends on !OF || USE_BUILTIN_DTB\n \thelp\n \t  Setting this option allows the kernel command line arguments\n \t  to be set.\ndiff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c\nindex 620e5cf8ae1e..03ec6f7a1153 100644\n--- a/arch/sh/kernel/setup.c\n+++ b/arch/sh/kernel/setup.c\n@@ -30,6 +30,7 @@\n #include <linux/memblock.h>\n #include <linux/of.h>\n #include <linux/of_fdt.h>\n+#include <linux/libfdt.h>\n #include <linux/uaccess.h>\n #include <uapi/linux/mount.h>\n #include <asm/io.h>\n@@ -269,8 +270,22 @@ void __ref sh_fdt_init(phys_addr_t dt_phys)\n \n void __init setup_arch(char **cmdline_p)\n {\n+#if defined(CONFIG_OF) && defined(CONFIG_OF_EARLY_FLATTREE)\n+\tif (IS_ENABLED(CONFIG_USE_BUILTIN_DTB)) {\n+\t\t/* Relocate Embedded DTB */\n+\t\tunflatten_and_copy_device_tree();\n+\t} else if (initial_boot_params) {\n+\t\t/* Reserve external DTB area */\n+\t\tmemblock_reserve(__pa(initial_boot_params),\n+\t\t\t\t fdt_totalsize(initial_boot_params));\n+\t\tunflatten_device_tree();\n+\t}\n+\t/* copy from /chosen/bootargs */\n+\tstrscpy(command_line, boot_command_line, COMMAND_LINE_SIZE);\n+#endif\n \tenable_mmu();\n \n+#ifndef CONFIG_OF\n \tROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);\n \n \tprintk(KERN_NOTICE \"Boot params:\\n\"\n@@ -299,14 +314,16 @@ void __init setup_arch(char **cmdline_p)\n \tbss_resource.start = virt_to_phys(__bss_start);\n \tbss_resource.end = virt_to_phys(__bss_stop)-1;\n \n+#endif\n #ifdef CONFIG_CMDLINE_OVERWRITE\n \tstrscpy(command_line, CONFIG_CMDLINE, sizeof(command_line));\n-#else\n-\tstrscpy(command_line, COMMAND_LINE, sizeof(command_line));\n+#elif !defined(CONFIG_OF) || defined(CONFIG_USE_BUILTIN_DTB)\n+\tif (*COMMAND_LINE)\n+\t\tstrscpy(command_line, COMMAND_LINE, sizeof(command_line));\n+#endif\n #ifdef CONFIG_CMDLINE_EXTEND\n \tstrlcat(command_line, \" \", sizeof(command_line));\n \tstrlcat(command_line, CONFIG_CMDLINE, sizeof(command_line));\n-#endif\n #endif\n \n \t/* Save unparsed command line copy for /proc/cmdline */\n@@ -322,14 +339,6 @@ void __init setup_arch(char **cmdline_p)\n \t/* Let earlyprintk output early console messages */\n \tsh_early_platform_driver_probe(\"earlyprintk\", 1, 1);\n \n-#ifdef CONFIG_OF_EARLY_FLATTREE\n-#ifdef CONFIG_USE_BUILTIN_DTB\n-\tunflatten_and_copy_device_tree();\n-#else\n-\tunflatten_device_tree();\n-#endif\n-#endif\n-\n \tpaging_init();\n \n \t/* Perform the machine specific initialisation */\n","prefixes":["DO","NOT","MERGE","v8","06/36"]}