Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jul 2016 10:53:50 +0000 (UTC)
From:      Jared McNeill <jmcneill@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302523 - head/sys/dev/extres/clk
Message-ID:  <201607101053.u6AAroYh008434@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmcneill
Date: Sun Jul 10 10:53:50 2016
New Revision: 302523
URL: https://svnweb.freebsd.org/changeset/base/302523

Log:
  Add clk_get_by_ofw_node_index, which is like clk_get_by_ofw_index but
  operates on a specific OF node instead of the pass in device's OF node.
  
  Reviewed by:		andrew, mmel
  Differential Revision:	https://reviews.freebsd.org/D6957

Modified:
  head/sys/dev/extres/clk/clk.c
  head/sys/dev/extres/clk/clk.h

Modified: head/sys/dev/extres/clk/clk.c
==============================================================================
--- head/sys/dev/extres/clk/clk.c	Sun Jul 10 10:38:28 2016	(r302522)
+++ head/sys/dev/extres/clk/clk.c	Sun Jul 10 10:53:50 2016	(r302523)
@@ -1198,13 +1198,7 @@ clk_get_by_id(device_t dev, struct clkdo
 int
 clk_get_by_ofw_index(device_t dev, int idx, clk_t *clk)
 {
-	phandle_t cnode, parent, *cells;
-	device_t clockdev;
-	int ncells, rv;
-	struct clkdom *clkdom;
-	struct clknode *clknode;
-
-	*clk = NULL;
+	phandle_t cnode;
 
 	cnode = ofw_bus_get_node(dev);
 	if (cnode <= 0) {
@@ -1213,6 +1207,20 @@ clk_get_by_ofw_index(device_t dev, int i
 		return (ENXIO);
 	}
 
+	return (clk_get_by_ofw_node_index(dev, cnode, idx, clk));
+}
+
+int
+clk_get_by_ofw_node_index(device_t dev, phandle_t cnode, int idx, clk_t *clk)
+{
+	phandle_t parent, *cells;
+	device_t clockdev;
+	int ncells, rv;
+	struct clkdom *clkdom;
+	struct clknode *clknode;
+
+	*clk = NULL;
+
 	rv = ofw_bus_parse_xref_list_alloc(cnode, "clocks", "#clock-cells", idx,
 	    &parent, &ncells, &cells);
 	if (rv != 0) {

Modified: head/sys/dev/extres/clk/clk.h
==============================================================================
--- head/sys/dev/extres/clk/clk.h	Sun Jul 10 10:38:28 2016	(r302522)
+++ head/sys/dev/extres/clk/clk.h	Sun Jul 10 10:53:50 2016	(r302523)
@@ -131,6 +131,8 @@ const char *clk_get_name(clk_t clk);
 #ifdef FDT
 int clk_get_by_ofw_index(device_t dev, int idx, clk_t *clk);
 int clk_get_by_ofw_name(device_t dev, const char *name, clk_t *clk);
+int clk_get_by_ofw_node_index(device_t dev, phandle_t node, int idx,
+    clk_t *clk);
 int clk_parse_ofw_out_names(device_t dev, phandle_t node,
     const char ***out_names, uint32_t **indices);
 int clk_parse_ofw_clk_name(device_t dev, phandle_t node, const char **name);



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