Skip to content

Commit

Permalink
Merge tag 'devicetree-fixes-for-6.2-2' of git://git.kernel.org/pub/sc…
Browse files Browse the repository at this point in the history
…m/linux/kernel/git/robh/linux

Pull devicetree fixes from Rob Herring:

 - Fix handling of multiple OF framebuffer devices

 - Fix booting on Socionext Synquacer with bad 'dma-ranges' entries

 - Add DT binding .yamllint to .gitignore

* tag 'devicetree-fixes-for-6.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  dt-bindings: interrupt-controller: arm,gic-v3: Fix typo in description of msi-controller property
  dt-bindings: Fix .gitignore
  of/address: Return an error when no valid dma-ranges are found
  of: Make OF framebuffer device names unique
  • Loading branch information
Linus Torvalds committed Feb 7, 2023
2 parents 513c1a3 + 707344c commit 0983f6b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
5 changes: 5 additions & 0 deletions Documentation/devicetree/bindings/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
*.example.dts
/processed-schema*.yaml
/processed-schema*.json

#
# We don't want to ignore the following even if they are dot-files
#
!.yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ properties:

msi-controller:
description:
Only present if the Message Based Interrupt functionnality is
Only present if the Message Based Interrupt functionality is
being exposed by the HW, and the mbi-ranges property present.

mbi-ranges:
Expand Down
21 changes: 15 additions & 6 deletions drivers/of/address.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,19 @@ int of_dma_get_range(struct device_node *np, const struct bus_dma_region **map)
}

of_dma_range_parser_init(&parser, node);
for_each_of_range(&parser, &range)
for_each_of_range(&parser, &range) {
if (range.cpu_addr == OF_BAD_ADDR) {
pr_err("translation of DMA address(%llx) to CPU address failed node(%pOF)\n",
range.bus_addr, node);
continue;
}
num_ranges++;
}

if (!num_ranges) {
ret = -EINVAL;
goto out;
}

r = kcalloc(num_ranges + 1, sizeof(*r), GFP_KERNEL);
if (!r) {
Expand All @@ -975,18 +986,16 @@ int of_dma_get_range(struct device_node *np, const struct bus_dma_region **map)
}

/*
* Record all info in the generic DMA ranges array for struct device.
* Record all info in the generic DMA ranges array for struct device,
* returning an error if we don't find any parsable ranges.
*/
*map = r;
of_dma_range_parser_init(&parser, node);
for_each_of_range(&parser, &range) {
pr_debug("dma_addr(%llx) cpu_addr(%llx) size(%llx)\n",
range.bus_addr, range.cpu_addr, range.size);
if (range.cpu_addr == OF_BAD_ADDR) {
pr_err("translation of DMA address(%llx) to CPU address failed node(%pOF)\n",
range.bus_addr, node);
if (range.cpu_addr == OF_BAD_ADDR)
continue;
}
r->cpu_start = range.cpu_addr;
r->dma_start = range.bus_addr;
r->size = range.size;
Expand Down
12 changes: 10 additions & 2 deletions drivers/of/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ static int __init of_platform_default_populate_init(void)
if (IS_ENABLED(CONFIG_PPC)) {
struct device_node *boot_display = NULL;
struct platform_device *dev;
int display_number = 0;
int ret;

/* Check if we have a MacOS display without a node spec */
Expand Down Expand Up @@ -555,16 +556,23 @@ static int __init of_platform_default_populate_init(void)
if (!of_get_property(node, "linux,opened", NULL) ||
!of_get_property(node, "linux,boot-display", NULL))
continue;
dev = of_platform_device_create(node, "of-display", NULL);
dev = of_platform_device_create(node, "of-display.0", NULL);
of_node_put(node);
if (WARN_ON(!dev))
return -ENOMEM;
boot_display = node;
display_number++;
break;
}
for_each_node_by_type(node, "display") {
char buf[14];
const char *of_display_format = "of-display.%d";

if (!of_get_property(node, "linux,opened", NULL) || node == boot_display)
continue;
of_platform_device_create(node, "of-display", NULL);
ret = snprintf(buf, sizeof(buf), of_display_format, display_number++);
if (ret < sizeof(buf))
of_platform_device_create(node, buf, NULL);
}

} else {
Expand Down

0 comments on commit 0983f6b

Please sign in to comment.