Devicetree fixes for v6.2:

- Fix DT memory scanning for some MIPS boards when memory is not
   specified in DT
 
 - Redo CONFIG_CMDLINE* handling for missing /chosen node. The first
   attempt broke PS3 (and possibly other PPC platforms).
 
 - Fix constraints in QCom Soundwire schema
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEktVUI4SxYhzZyEuo+vtdtY28YcMFAmO5jqUACgkQ+vtdtY28
 YcPxLQ//VIeelvp7U8HgdB13ZlWC1DXYTDZUgIev3R/sggws4swkCu5cZP3xbKnD
 88uW9Lbv5sSSfAXdr3hbr3z4sHLilX5mSc/1QvaIDrS0eECeFAUu8Me5Rx/Om806
 0k8/1OmCgCr0RFJgjtersfw3CFnOLAauxYIr4mGCD8kWnXMgKSK/JyiTDV3+g3U2
 Y6IgR+Hn8zt8DB1LkrRZJis5LQT1AxFtEzfKUEa+j/xG4z+B1vg8wENsYDr+/s9+
 LAq4QhrzAU/Ys+ZUF3HqkZxj6WR7aMq5MSBihs1AXjR772g+EY7Ob00hPdf2MdFz
 TEF0GFTHQjvzM2TGY+V4AWKLER5Oxq0AsT7n8qsnPCJBRrVp1EHpfQUfhpibB0GN
 TGQlskUWJW8ivjl54jX/wzJyx3ZlW4SmeD5c5RRaLOKHMhfIjsAdjQJIfNfPTE93
 oCU9GniXhWoQDRCheqy5LIY7+hm1nuYra0WUzjp1rmfcZ2xia70ZKdbJe5gIAJVr
 fmefpzyxY5TeaZPIBsLysN9QURk3C5GXGyKHofcQsC4TCn3qgzNoSmYkESAjTtkW
 kUzNraoIhY92HN0jDfYD1/iGTeOzAYnL4kqILKIoNtBEQmyFZqxLUk6TX7Cm8QJU
 BZTPuxzmMJMFx88FB/nPdNlyQcELSjrTAfFMd5i7/WBuY3OTYIE=
 =qIdA
 -----END PGP SIGNATURE-----

Merge tag 'devicetree-fixes-for-6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull devicetree fixes from Rob Herring:

 - Fix DT memory scanning for some MIPS boards when memory is not
   specified in DT

 - Redo CONFIG_CMDLINE* handling for missing /chosen node. The first
   attempt broke PS3 (and possibly other PPC platforms).

 - Fix constraints in QCom Soundwire schema

* tag 'devicetree-fixes-for-6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  of: fdt: Honor CONFIG_CMDLINE* even without /chosen node, take 2
  Revert "of: fdt: Honor CONFIG_CMDLINE* even without /chosen node"
  dt-bindings: soundwire: qcom,soundwire: correct sizes related to number of ports
  of/fdt: run soc memory setup when early_init_dt_scan_memory fails
This commit is contained in:
Linus Torvalds 2023-01-07 10:20:33 -08:00
commit 0007c04038
3 changed files with 38 additions and 34 deletions

View File

@ -80,7 +80,7 @@ properties:
or applicable for the respective data port.
More info in MIPI Alliance SoundWire 1.0 Specifications.
minItems: 3
maxItems: 5
maxItems: 8
qcom,ports-sinterval-low:
$ref: /schemas/types.yaml#/definitions/uint8-array
@ -124,7 +124,7 @@ properties:
or applicable for the respective data port.
More info in MIPI Alliance SoundWire 1.0 Specifications.
minItems: 3
maxItems: 5
maxItems: 8
qcom,ports-block-pack-mode:
$ref: /schemas/types.yaml#/definitions/uint8-array
@ -154,7 +154,7 @@ properties:
or applicable for the respective data port.
More info in MIPI Alliance SoundWire 1.0 Specifications.
minItems: 3
maxItems: 5
maxItems: 8
items:
oneOf:
- minimum: 0
@ -171,7 +171,7 @@ properties:
or applicable for the respective data port.
More info in MIPI Alliance SoundWire 1.0 Specifications.
minItems: 3
maxItems: 5
maxItems: 8
items:
oneOf:
- minimum: 0
@ -187,7 +187,7 @@ properties:
or applicable for the respective data port.
More info in MIPI Alliance SoundWire 1.0 Specifications.
minItems: 3
maxItems: 5
maxItems: 8
items:
oneOf:
- minimum: 0

View File

@ -64,7 +64,7 @@ void __init plat_mem_setup(void)
dtb = get_fdt();
__dt_setup_arch(dtb);
if (!early_init_dt_scan_memory())
if (early_init_dt_scan_memory())
return;
if (soc_info.mem_detect)

View File

@ -1099,7 +1099,7 @@ u64 __init dt_mem_next_cell(int s, const __be32 **cellp)
*/
int __init early_init_dt_scan_memory(void)
{
int node;
int node, found_memory = 0;
const void *fdt = initial_boot_params;
fdt_for_each_subnode(node, fdt, 0) {
@ -1139,6 +1139,8 @@ int __init early_init_dt_scan_memory(void)
early_init_dt_add_memory_arch(base, size);
found_memory = 1;
if (!hotpluggable)
continue;
@ -1147,7 +1149,7 @@ int __init early_init_dt_scan_memory(void)
base, base + size);
}
}
return 0;
return found_memory;
}
int __init early_init_dt_scan_chosen(char *cmdline)
@ -1161,18 +1163,14 @@ int __init early_init_dt_scan_chosen(char *cmdline)
if (node < 0)
node = fdt_path_offset(fdt, "/chosen@0");
if (node < 0)
return -ENOENT;
/* Handle the cmdline config options even if no /chosen node */
goto handle_cmdline;
chosen_node_offset = node;
early_init_dt_check_for_initrd(node);
early_init_dt_check_for_elfcorehdr(node);
/* Retrieve command line */
p = of_get_flat_dt_prop(node, "bootargs", &l);
if (p != NULL && l > 0)
strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE));
rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);
if (rng_seed && l > 0) {
add_bootloader_randomness(rng_seed, l);
@ -1185,6 +1183,32 @@ int __init early_init_dt_scan_chosen(char *cmdline)
fdt_totalsize(initial_boot_params));
}
/* Retrieve command line */
p = of_get_flat_dt_prop(node, "bootargs", &l);
if (p != NULL && l > 0)
strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE));
handle_cmdline:
/*
* CONFIG_CMDLINE is meant to be a default in case nothing else
* managed to set the command line, unless CONFIG_CMDLINE_FORCE
* is set in which case we override whatever was found earlier.
*/
#ifdef CONFIG_CMDLINE
#if defined(CONFIG_CMDLINE_EXTEND)
strlcat(cmdline, " ", COMMAND_LINE_SIZE);
strlcat(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#elif defined(CONFIG_CMDLINE_FORCE)
strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#else
/* No arguments from boot loader, use kernel's cmdl*/
if (!((char *)cmdline)[0])
strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#endif
#endif /* CONFIG_CMDLINE */
pr_debug("Command line is: %s\n", (char *)cmdline);
return 0;
}
@ -1277,26 +1301,6 @@ void __init early_init_dt_scan_nodes(void)
if (rc)
pr_warn("No chosen node found, continuing without\n");
/*
* CONFIG_CMDLINE is meant to be a default in case nothing else
* managed to set the command line, unless CONFIG_CMDLINE_FORCE
* is set in which case we override whatever was found earlier.
*/
#ifdef CONFIG_CMDLINE
#if defined(CONFIG_CMDLINE_EXTEND)
strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
strlcat(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#elif defined(CONFIG_CMDLINE_FORCE)
strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#else
/* No arguments from boot loader, use kernel's cmdl */
if (!boot_command_line[0])
strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#endif
#endif /* CONFIG_CMDLINE */
pr_debug("Command line is: %s\n", boot_command_line);
/* Setup memory, calling early_init_dt_add_memory_arch */
early_init_dt_scan_memory();