Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jul 2019 10:40:52 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r350408 - head/sys/arm/ti
Message-ID:  <201907291040.x6TAeq7I042699@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Mon Jul 29 10:40:51 2019
New Revision: 350408
URL: https://svnweb.freebsd.org/changeset/base/350408

Log:
  arm: ti: Get the hwmods property either from the node or the parent
  
  r350229 changed the code to lookup the ti,hwmods property in the parent
  as it's now like that in the DTS from >= Linux 5.0, allow the property
  to be also in the node itself so we can boot with an older DTB.
  
  Reported by:	"Dr. Rolf Jansen" <rj@obsigna.com>

Modified:
  head/sys/arm/ti/ti_hwmods.c

Modified: head/sys/arm/ti/ti_hwmods.c
==============================================================================
--- head/sys/arm/ti/ti_hwmods.c	Mon Jul 29 09:34:47 2019	(r350407)
+++ head/sys/arm/ti/ti_hwmods.c	Mon Jul 29 10:40:51 2019	(r350408)
@@ -97,6 +97,16 @@ struct hwmod ti_hwmods[] = {
 	{NULL,		0}
 };
 
+static inline int
+ti_get_hwmods_prop(phandle_t node, void **name)
+{
+	int len;
+
+	if ((len = OF_getprop_alloc(node, "ti,hwmods", name)) > 0)
+		return (len);
+	return (OF_getprop_alloc(OF_parent(node), "ti,hwmods", name));
+}
+
 clk_ident_t
 ti_hwmods_get_clock(device_t dev)
 {
@@ -110,7 +120,7 @@ ti_hwmods_get_clock(device_t dev)
 	if ((node = ofw_bus_get_node(dev)) == 0)
 		return (INVALID_CLK_IDENT);
 
-	if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
+	if ((len = ti_get_hwmods_prop(node, (void **)&name)) <= 0)
 		return (INVALID_CLK_IDENT);
 
 	buf = name;
@@ -148,7 +158,7 @@ int ti_hwmods_contains(device_t dev, const char *hwmod
 	if ((node = ofw_bus_get_node(dev)) == 0)
 		return (0);
 
-	if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
+	if ((len = ti_get_hwmods_prop(node, (void **)&name)) <= 0)
 		return (0);
 
 	buf = name;
@@ -182,7 +192,7 @@ ti_hwmods_get_unit(device_t dev, const char *hwmod)
 	if ((node = ofw_bus_get_node(dev)) == 0)
 		return (0);
 
-	if ((len = OF_getprop_alloc(OF_parent(node), "ti,hwmods", (void**)&name)) <= 0)
+	if ((len = ti_get_hwmods_prop(node, (void **)&name)) <= 0)
 		return (0);
 
 	buf = name;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907291040.x6TAeq7I042699>