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
This commit is contained in:
Jared McNeill 2016-07-10 10:53:50 +00:00
parent 22a81821b0
commit 0e1cdf8ba6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=302523
2 changed files with 17 additions and 7 deletions

View File

@ -1198,13 +1198,7 @@ clk_get_by_id(device_t dev, struct clkdom *clkdom, intptr_t id, clk_t *clk)
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 idx, clk_t *clk)
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) {

View File

@ -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);