Commit 0007c040 authored by Linus Torvalds's avatar Linus Torvalds

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
parents c28bdeaf 064e32dc
...@@ -80,7 +80,7 @@ properties: ...@@ -80,7 +80,7 @@ properties:
or applicable for the respective data port. or applicable for the respective data port.
More info in MIPI Alliance SoundWire 1.0 Specifications. More info in MIPI Alliance SoundWire 1.0 Specifications.
minItems: 3 minItems: 3
maxItems: 5 maxItems: 8
qcom,ports-sinterval-low: qcom,ports-sinterval-low:
$ref: /schemas/types.yaml#/definitions/uint8-array $ref: /schemas/types.yaml#/definitions/uint8-array
...@@ -124,7 +124,7 @@ properties: ...@@ -124,7 +124,7 @@ properties:
or applicable for the respective data port. or applicable for the respective data port.
More info in MIPI Alliance SoundWire 1.0 Specifications. More info in MIPI Alliance SoundWire 1.0 Specifications.
minItems: 3 minItems: 3
maxItems: 5 maxItems: 8
qcom,ports-block-pack-mode: qcom,ports-block-pack-mode:
$ref: /schemas/types.yaml#/definitions/uint8-array $ref: /schemas/types.yaml#/definitions/uint8-array
...@@ -154,7 +154,7 @@ properties: ...@@ -154,7 +154,7 @@ properties:
or applicable for the respective data port. or applicable for the respective data port.
More info in MIPI Alliance SoundWire 1.0 Specifications. More info in MIPI Alliance SoundWire 1.0 Specifications.
minItems: 3 minItems: 3
maxItems: 5 maxItems: 8
items: items:
oneOf: oneOf:
- minimum: 0 - minimum: 0
...@@ -171,7 +171,7 @@ properties: ...@@ -171,7 +171,7 @@ properties:
or applicable for the respective data port. or applicable for the respective data port.
More info in MIPI Alliance SoundWire 1.0 Specifications. More info in MIPI Alliance SoundWire 1.0 Specifications.
minItems: 3 minItems: 3
maxItems: 5 maxItems: 8
items: items:
oneOf: oneOf:
- minimum: 0 - minimum: 0
...@@ -187,7 +187,7 @@ properties: ...@@ -187,7 +187,7 @@ properties:
or applicable for the respective data port. or applicable for the respective data port.
More info in MIPI Alliance SoundWire 1.0 Specifications. More info in MIPI Alliance SoundWire 1.0 Specifications.
minItems: 3 minItems: 3
maxItems: 5 maxItems: 8
items: items:
oneOf: oneOf:
- minimum: 0 - minimum: 0
......
...@@ -64,7 +64,7 @@ void __init plat_mem_setup(void) ...@@ -64,7 +64,7 @@ void __init plat_mem_setup(void)
dtb = get_fdt(); dtb = get_fdt();
__dt_setup_arch(dtb); __dt_setup_arch(dtb);
if (!early_init_dt_scan_memory()) if (early_init_dt_scan_memory())
return; return;
if (soc_info.mem_detect) if (soc_info.mem_detect)
......
...@@ -1099,7 +1099,7 @@ u64 __init dt_mem_next_cell(int s, const __be32 **cellp) ...@@ -1099,7 +1099,7 @@ u64 __init dt_mem_next_cell(int s, const __be32 **cellp)
*/ */
int __init early_init_dt_scan_memory(void) int __init early_init_dt_scan_memory(void)
{ {
int node; int node, found_memory = 0;
const void *fdt = initial_boot_params; const void *fdt = initial_boot_params;
fdt_for_each_subnode(node, fdt, 0) { fdt_for_each_subnode(node, fdt, 0) {
...@@ -1139,6 +1139,8 @@ int __init early_init_dt_scan_memory(void) ...@@ -1139,6 +1139,8 @@ int __init early_init_dt_scan_memory(void)
early_init_dt_add_memory_arch(base, size); early_init_dt_add_memory_arch(base, size);
found_memory = 1;
if (!hotpluggable) if (!hotpluggable)
continue; continue;
...@@ -1147,7 +1149,7 @@ int __init early_init_dt_scan_memory(void) ...@@ -1147,7 +1149,7 @@ int __init early_init_dt_scan_memory(void)
base, base + size); base, base + size);
} }
} }
return 0; return found_memory;
} }
int __init early_init_dt_scan_chosen(char *cmdline) int __init early_init_dt_scan_chosen(char *cmdline)
...@@ -1161,18 +1163,14 @@ 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) if (node < 0)
node = fdt_path_offset(fdt, "/chosen@0"); node = fdt_path_offset(fdt, "/chosen@0");
if (node < 0) if (node < 0)
return -ENOENT; /* Handle the cmdline config options even if no /chosen node */
goto handle_cmdline;
chosen_node_offset = node; chosen_node_offset = node;
early_init_dt_check_for_initrd(node); early_init_dt_check_for_initrd(node);
early_init_dt_check_for_elfcorehdr(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); rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);
if (rng_seed && l > 0) { if (rng_seed && l > 0) {
add_bootloader_randomness(rng_seed, l); add_bootloader_randomness(rng_seed, l);
...@@ -1185,6 +1183,32 @@ int __init early_init_dt_scan_chosen(char *cmdline) ...@@ -1185,6 +1183,32 @@ int __init early_init_dt_scan_chosen(char *cmdline)
fdt_totalsize(initial_boot_params)); 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; return 0;
} }
...@@ -1277,26 +1301,6 @@ void __init early_init_dt_scan_nodes(void) ...@@ -1277,26 +1301,6 @@ void __init early_init_dt_scan_nodes(void)
if (rc) if (rc)
pr_warn("No chosen node found, continuing without\n"); 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 */ /* Setup memory, calling early_init_dt_add_memory_arch */
early_init_dt_scan_memory(); early_init_dt_scan_memory();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment