Skip to content

Commit 0007c04

Browse files
committed
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
2 parents c28bdea + 064e32d commit 0007c04

File tree

3 files changed

+38
-34
lines changed

3 files changed

+38
-34
lines changed

Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ properties:
8080
or applicable for the respective data port.
8181
More info in MIPI Alliance SoundWire 1.0 Specifications.
8282
minItems: 3
83-
maxItems: 5
83+
maxItems: 8
8484

8585
qcom,ports-sinterval-low:
8686
$ref: /schemas/types.yaml#/definitions/uint8-array
@@ -124,7 +124,7 @@ properties:
124124
or applicable for the respective data port.
125125
More info in MIPI Alliance SoundWire 1.0 Specifications.
126126
minItems: 3
127-
maxItems: 5
127+
maxItems: 8
128128

129129
qcom,ports-block-pack-mode:
130130
$ref: /schemas/types.yaml#/definitions/uint8-array
@@ -154,7 +154,7 @@ properties:
154154
or applicable for the respective data port.
155155
More info in MIPI Alliance SoundWire 1.0 Specifications.
156156
minItems: 3
157-
maxItems: 5
157+
maxItems: 8
158158
items:
159159
oneOf:
160160
- minimum: 0
@@ -171,7 +171,7 @@ properties:
171171
or applicable for the respective data port.
172172
More info in MIPI Alliance SoundWire 1.0 Specifications.
173173
minItems: 3
174-
maxItems: 5
174+
maxItems: 8
175175
items:
176176
oneOf:
177177
- minimum: 0
@@ -187,7 +187,7 @@ properties:
187187
or applicable for the respective data port.
188188
More info in MIPI Alliance SoundWire 1.0 Specifications.
189189
minItems: 3
190-
maxItems: 5
190+
maxItems: 8
191191
items:
192192
oneOf:
193193
- minimum: 0

arch/mips/ralink/of.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void __init plat_mem_setup(void)
6464
dtb = get_fdt();
6565
__dt_setup_arch(dtb);
6666

67-
if (!early_init_dt_scan_memory())
67+
if (early_init_dt_scan_memory())
6868
return;
6969

7070
if (soc_info.mem_detect)

drivers/of/fdt.c

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ u64 __init dt_mem_next_cell(int s, const __be32 **cellp)
10991099
*/
11001100
int __init early_init_dt_scan_memory(void)
11011101
{
1102-
int node;
1102+
int node, found_memory = 0;
11031103
const void *fdt = initial_boot_params;
11041104

11051105
fdt_for_each_subnode(node, fdt, 0) {
@@ -1139,6 +1139,8 @@ int __init early_init_dt_scan_memory(void)
11391139

11401140
early_init_dt_add_memory_arch(base, size);
11411141

1142+
found_memory = 1;
1143+
11421144
if (!hotpluggable)
11431145
continue;
11441146

@@ -1147,7 +1149,7 @@ int __init early_init_dt_scan_memory(void)
11471149
base, base + size);
11481150
}
11491151
}
1150-
return 0;
1152+
return found_memory;
11511153
}
11521154

11531155
int __init early_init_dt_scan_chosen(char *cmdline)
@@ -1161,18 +1163,14 @@ int __init early_init_dt_scan_chosen(char *cmdline)
11611163
if (node < 0)
11621164
node = fdt_path_offset(fdt, "/chosen@0");
11631165
if (node < 0)
1164-
return -ENOENT;
1166+
/* Handle the cmdline config options even if no /chosen node */
1167+
goto handle_cmdline;
11651168

11661169
chosen_node_offset = node;
11671170

11681171
early_init_dt_check_for_initrd(node);
11691172
early_init_dt_check_for_elfcorehdr(node);
11701173

1171-
/* Retrieve command line */
1172-
p = of_get_flat_dt_prop(node, "bootargs", &l);
1173-
if (p != NULL && l > 0)
1174-
strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE));
1175-
11761174
rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);
11771175
if (rng_seed && l > 0) {
11781176
add_bootloader_randomness(rng_seed, l);
@@ -1185,6 +1183,32 @@ int __init early_init_dt_scan_chosen(char *cmdline)
11851183
fdt_totalsize(initial_boot_params));
11861184
}
11871185

1186+
/* Retrieve command line */
1187+
p = of_get_flat_dt_prop(node, "bootargs", &l);
1188+
if (p != NULL && l > 0)
1189+
strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE));
1190+
1191+
handle_cmdline:
1192+
/*
1193+
* CONFIG_CMDLINE is meant to be a default in case nothing else
1194+
* managed to set the command line, unless CONFIG_CMDLINE_FORCE
1195+
* is set in which case we override whatever was found earlier.
1196+
*/
1197+
#ifdef CONFIG_CMDLINE
1198+
#if defined(CONFIG_CMDLINE_EXTEND)
1199+
strlcat(cmdline, " ", COMMAND_LINE_SIZE);
1200+
strlcat(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1201+
#elif defined(CONFIG_CMDLINE_FORCE)
1202+
strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1203+
#else
1204+
/* No arguments from boot loader, use kernel's cmdl*/
1205+
if (!((char *)cmdline)[0])
1206+
strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1207+
#endif
1208+
#endif /* CONFIG_CMDLINE */
1209+
1210+
pr_debug("Command line is: %s\n", (char *)cmdline);
1211+
11881212
return 0;
11891213
}
11901214

@@ -1277,26 +1301,6 @@ void __init early_init_dt_scan_nodes(void)
12771301
if (rc)
12781302
pr_warn("No chosen node found, continuing without\n");
12791303

1280-
/*
1281-
* CONFIG_CMDLINE is meant to be a default in case nothing else
1282-
* managed to set the command line, unless CONFIG_CMDLINE_FORCE
1283-
* is set in which case we override whatever was found earlier.
1284-
*/
1285-
#ifdef CONFIG_CMDLINE
1286-
#if defined(CONFIG_CMDLINE_EXTEND)
1287-
strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
1288-
strlcat(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1289-
#elif defined(CONFIG_CMDLINE_FORCE)
1290-
strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1291-
#else
1292-
/* No arguments from boot loader, use kernel's cmdl */
1293-
if (!boot_command_line[0])
1294-
strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
1295-
#endif
1296-
#endif /* CONFIG_CMDLINE */
1297-
1298-
pr_debug("Command line is: %s\n", boot_command_line);
1299-
13001304
/* Setup memory, calling early_init_dt_add_memory_arch */
13011305
early_init_dt_scan_memory();
13021306

0 commit comments

Comments
 (0)