Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41d94893 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Grant Likely
Browse files

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 746c9e9f, "of/base: Fix PowerPC address parsing hack"

Tested-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
Cc: Stable <stable@vger.kernel.org> # v3.18+
parent bc465aa9
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -450,12 +450,17 @@ static struct of_bus *of_match_bus(struct device_node *np)
	return NULL;
}

static int of_empty_ranges_quirk(void)
static int of_empty_ranges_quirk(struct device_node *np)
{
	if (IS_ENABLED(CONFIG_PPC)) {
		/* To save cycles, we cache the result */
		/* To save cycles, we cache the result for global "Mac" setting */
		static int quirk_state = -1;

		/* PA-SEMI sdc DT bug */
		if (of_device_is_compatible(np, "1682m-sdc"))
			return true;

		/* Make quirk cached */
		if (quirk_state < 0)
			quirk_state =
				of_machine_is_compatible("Power Macintosh") ||
@@ -490,7 +495,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
	 * This code is only enabled on powerpc. --gcl
	 */
	ranges = of_get_property(parent, rprop, &rlen);
	if (ranges == NULL && !of_empty_ranges_quirk()) {
	if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
		pr_debug("OF: no ranges; cannot translate\n");
		return 1;
	}