Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/of: Add empty ranges quirk for PA-Semi

The "sdc" node is missing the ranges property, it needs to be treated
as having an empty one otherwise translation fails for its children.

Fixes 746c9e9f92dd, "of/base: Fix PowerPC address parsing hack"

Tested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Stable <stable@vger.kernel.org> # v3.18+

authored by

Benjamin Herrenschmidt and committed by
Grant Likely
a5ed1ad0 121c92ca

+8 -3
+8 -3
drivers/of/address.c
··· 450 450 return NULL; 451 451 } 452 452 453 - static int of_empty_ranges_quirk(void) 453 + static int of_empty_ranges_quirk(struct device_node *np) 454 454 { 455 455 if (IS_ENABLED(CONFIG_PPC)) { 456 - /* To save cycles, we cache the result */ 456 + /* To save cycles, we cache the result for global "Mac" setting */ 457 457 static int quirk_state = -1; 458 458 459 + /* PA-SEMI sdc DT bug */ 460 + if (of_device_is_compatible(np, "1682m-sdc")) 461 + return true; 462 + 463 + /* Make quirk cached */ 459 464 if (quirk_state < 0) 460 465 quirk_state = 461 466 of_machine_is_compatible("Power Macintosh") || ··· 495 490 * This code is only enabled on powerpc. --gcl 496 491 */ 497 492 ranges = of_get_property(parent, rprop, &rlen); 498 - if (ranges == NULL && !of_empty_ranges_quirk()) { 493 + if (ranges == NULL && !of_empty_ranges_quirk(parent)) { 499 494 pr_debug("OF: no ranges; cannot translate\n"); 500 495 return 1; 501 496 }