Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp478059lqb; Wed, 29 May 2024 01:02:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWugf9t6e2WO8p6sPYOL/9gCjtUtr7rzz/mV+sI+4as1YfjosqALWVVVLXpFznJHyPN1isXKBzczaBH+LL785ZiSJV6DxHShddo0rKAfg== X-Google-Smtp-Source: AGHT+IGCUF+aXIRInyUR0TYtsIfISPbSV0yEIjI9wI645YeFSsl64WEGKuUlLjIx7ma5uuIFdYJV X-Received: by 2002:a05:6a20:5612:b0:1b0:24e7:5a35 with SMTP id adf61e73a8af0-1b212e5273emr12671485637.56.1716969760925; Wed, 29 May 2024 01:02:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716969760; cv=pass; d=google.com; s=arc-20160816; b=b7djs5ELN4OW43I7Zd5FOsi/qbhrWZ12C0MFlDljYWDT31vRrKA75iuNMmpIWtQsFt qo3uBs31W5ptsjca5lKC8R6HZyjdWpT7drt+3g6/JUS7h4EIgiWcw7X6d8Ma+bxOtf+H cMDLYIqCIAcmUlINz+Bjk4oW+D5uXKcqtEgi0J7Sc9KswEFYg3DERSUWMzOMszAfw/4g EEPHmLQ/+9RDlt53P+kN+0vFG1Fkj1OZ6c5bP50xzj1bx7Bk9DwQhE9x/fYAyvlkYv7m GO3dBAT/Dn9I6RbV4R6tPSXE1+4DpyawUMymAxM2fMo9z4t/IjDl6dkRjLtJEkGml6dq 72hg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=86b5HE5A+IJBn9UjGvsw0zyOdSgLYJoYMfXPdkt+TW8=; fh=NCl8CixGeTFE2HqgWDW+UlfZpmTMmLot3MlKffw+YoQ=; b=vX7a4CIEtcz6PvNS9O9iqORFKdVcTR7k6Bt+G8CVTcAFK2bz/SVAWn4Bq65wGVfdOM 4N5ZhjU9FClvctmyx+tj38gGyJF5xyeBQUfrXaiSnKGqNWlJjeufzxYD1FXHO3CMUNFM WV5wfwvBOGleDW8XEQR6yRYJe6pN3yVnhA06d7xJO9fQub0MVLSQbjlv6WIGlihjWwkn hCTa6b70PXp0ny8ro5UbyNAFOsgw7R4a4yUQYWE+n9HdvW5ZfHPEmV4fIYSEPvU3JJFI pEwoQBzACiWRWqs21mR0/ZCuNT3efP6fG2ribnbIMEyA9qJbFMoOhLykdwla6Lo7ny8N I9vg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-193644-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193644-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fd8e5f06si9546868b3a.340.2024.05.29.01.02.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 01:02:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193644-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-193644-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193644-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A66302831FC for ; Wed, 29 May 2024 08:02:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF2A3169AE4; Wed, 29 May 2024 08:01:43 +0000 (UTC) Received: from sakura.ysato.name (ik1-413-38519.vs.sakura.ne.jp [153.127.30.23]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C6562F37; Wed, 29 May 2024 08:01:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=153.127.30.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716969703; cv=none; b=g87uWSnns+reruLL2xkPnoz/mvVqOBEfXvSWE/M0l8hjQcmN1D4dbwte7uDwDZ41nS8KtlPbYl+Fc9Xb9X6ot7fmaK5Rn7X5bqjn+62F+R1iq0OE4ggnL3iE0bysDp+dSZu3ttyGkXcrSFXvGDyVBFmUH3V98asjM6oY74oYZ4Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716969703; c=relaxed/simple; bh=LQRqo2R5KpFisxDuNYQDVzcbcyFMytNT9GqRgFmxwEg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SORMFTgm3eLi5COPV7efIJx1GZcjc7teO3o9thmgG/sGRiRwGmysA+ho6VBNW8Q+mpQuHA0K2HKMkH8k1olcg6o5kK+7cmG97Hglurfwh2Zdf/UO5b9yxI5gXdStoix7cXSXP/kW1Fvb/eEVsbGWPIH5uCxertTBSfwxylx0hF4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=users.sourceforge.jp; spf=fail smtp.mailfrom=users.sourceforge.jp; arc=none smtp.client-ip=153.127.30.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=users.sourceforge.jp Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=users.sourceforge.jp Received: from SIOS1075.ysato.name (al128006.dynamic.ppp.asahi-net.or.jp [111.234.128.6]) by sakura.ysato.name (Postfix) with ESMTPSA id B1C6F1C05A7; Wed, 29 May 2024 17:01:38 +0900 (JST) From: Yoshinori Sato To: linux-sh@vger.kernel.org Cc: Yoshinori Sato , Damien Le Moal , Niklas Cassel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Michael Turquette , Stephen Boyd , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Thomas Gleixner , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Greg Kroah-Hartman , Jiri Slaby , Magnus Damm , Daniel Lezcano , Rich Felker , John Paul Adrian Glaubitz , Lee Jones , Helge Deller , Heiko Stuebner , Neil Armstrong , Chris Morgan , Sebastian Reichel , Linus Walleij , Arnd Bergmann , Masahiro Yamada , Baoquan He , Andrew Morton , Guenter Roeck , Kefeng Wang , Stephen Rothwell , Azeem Shaikh , Guo Ren , Max Filippov , Jernej Skrabec , Herve Codina , Andy Shevchenko , Anup Patel , Jacky Huang , Hugo Villeneuve , Jonathan Corbet , Wolfram Sang , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Christophe JAILLET , Sam Ravnborg , Javier Martinez Canillas , Sergey Shtylyov , Laurent Pinchart , linux-ide@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org, linux-serial@vger.kernel.org, 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: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Fix extrnal fdt initialize and bootargs. Signed-off-by: Yoshinori Sato --- arch/sh/Kconfig | 1 - arch/sh/kernel/setup.c | 31 ++++++++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 91c7c72bc0db..5c9b50884995 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -712,7 +712,6 @@ config ROMIMAGE_MMCIF choice prompt "Kernel command line" default CMDLINE_OVERWRITE - depends on !OF || USE_BUILTIN_DTB help Setting this option allows the kernel command line arguments to be set. diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index 620e5cf8ae1e..03ec6f7a1153 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -269,8 +270,22 @@ void __ref sh_fdt_init(phys_addr_t dt_phys) void __init setup_arch(char **cmdline_p) { +#if defined(CONFIG_OF) && defined(CONFIG_OF_EARLY_FLATTREE) + if (IS_ENABLED(CONFIG_USE_BUILTIN_DTB)) { + /* Relocate Embedded DTB */ + unflatten_and_copy_device_tree(); + } else if (initial_boot_params) { + /* Reserve external DTB area */ + memblock_reserve(__pa(initial_boot_params), + fdt_totalsize(initial_boot_params)); + unflatten_device_tree(); + } + /* copy from /chosen/bootargs */ + strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE); +#endif enable_mmu(); +#ifndef CONFIG_OF ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); printk(KERN_NOTICE "Boot params:\n" @@ -299,14 +314,16 @@ void __init setup_arch(char **cmdline_p) bss_resource.start = virt_to_phys(__bss_start); bss_resource.end = virt_to_phys(__bss_stop)-1; +#endif #ifdef CONFIG_CMDLINE_OVERWRITE strscpy(command_line, CONFIG_CMDLINE, sizeof(command_line)); -#else - strscpy(command_line, COMMAND_LINE, sizeof(command_line)); +#elif !defined(CONFIG_OF) || defined(CONFIG_USE_BUILTIN_DTB) + if (*COMMAND_LINE) + strscpy(command_line, COMMAND_LINE, sizeof(command_line)); +#endif #ifdef CONFIG_CMDLINE_EXTEND strlcat(command_line, " ", sizeof(command_line)); strlcat(command_line, CONFIG_CMDLINE, sizeof(command_line)); -#endif #endif /* Save unparsed command line copy for /proc/cmdline */ @@ -322,14 +339,6 @@ void __init setup_arch(char **cmdline_p) /* Let earlyprintk output early console messages */ sh_early_platform_driver_probe("earlyprintk", 1, 1); -#ifdef CONFIG_OF_EARLY_FLATTREE -#ifdef CONFIG_USE_BUILTIN_DTB - unflatten_and_copy_device_tree(); -#else - unflatten_device_tree(); -#endif -#endif - paging_init(); /* Perform the machine specific initialisation */ -- 2.39.2