Page MenuHomeFreeBSD

extres: add clk_get_by_ofw_node_index
ClosedPublic

Authored by jmcneill on Jun 24 2016, 10:57 AM.
Tags
Referenced Files
Unknown Object (File)
Sun, Apr 14, 4:17 AM
Unknown Object (File)
Tue, Apr 2, 12:34 AM
Unknown Object (File)
Jan 9 2024, 8:23 PM
Unknown Object (File)
Dec 30 2023, 8:17 AM
Unknown Object (File)
Dec 27 2023, 5:32 AM
Unknown Object (File)
Dec 27 2023, 5:29 AM
Unknown Object (File)
Dec 20 2023, 12:20 AM
Unknown Object (File)
Dec 9 2023, 7:19 PM
Subscribers

Details

Summary

This diff adds clk_get_by_ofw_node_index, which is like clk_get_by_ofw_index but operates on a specific OF node instead of the passed in device's OF node.

I'm using this in my Allwinner A64 branch for a clock node that looks like this:

bus_gates {
    #clock-cells = <1>;
    compatible = "allwinner,sunxi-multi-bus-gates-clk";
    ...
    ahb1_parent {
        clocks = <&ahb1>;
        ...
    }
    ahb2_parent {
        clocks = <&ahb2>;
        ...
    }
}

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jmcneill retitled this revision from to extres: add clk_get_by_ofw_node_index.
jmcneill updated this object.
jmcneill edited the test plan for this revision. (Show Details)
jmcneill added reviewers: ARM, mmel.
jmcneill set the repository for this revision to rS FreeBSD src repository - subversion.
jmcneill added a project: ARM.

Because this is not that uncommon situation, i think that missing OFW node argument is clear issue in <foo>_get_by_ofw_<bar> interface design. Due to this,
i prefer to add node as argument to existing functions.

@@ -1196,7 +1196,7 @@ clk_get_by_id(device_t dev, struct clkdom *clkdom, intptr_t id, clk_t *clk)
 #ifdef FDT

 int
-clk_get_by_ofw_index(device_t dev, int idx, clk_t *clk)
+clk_get_by_ofw_index(device_t dev, phandle_t cnode, int idx, clk_t *clk)
 {
        phandle_t cnode, parent, *cells;
        device_t clockdev;
@@ -1206,7 +1206,8 @@ clk_get_by_ofw_index(device_t dev, int idx, clk_t *clk)

        *clk = NULL;

-       cnode = ofw_bus_get_node(dev);
+       if (cnode <= 0)
+               cnode = ofw_bus_get_node(dev);
        if (cnode <= 0) {
                device_printf(dev, "%s called on not ofw based device\n",
                 __func__);
In D6957#146073, @meloun-miracle-cz wrote:

Because this is not that uncommon situation, i think that missing OFW node argument is clear issue in <foo>_get_by_ofw_<bar> interface design. Due to this,
i prefer to add node as argument to existing functions.

I don't think you'll get this past re@. It changes KBI so for now we would need to create a second function. This can then be fixed in 12.

mmel edited edge metadata.

Hmm, right, i agree. I forget that we are in KBI freeze state. So feel free to commit this, i will change all all <foo>_get_by_ofw_<bar>() functions later in 12.

This revision is now accepted and ready to land.Jun 27 2016, 10:18 AM
This revision was automatically updated to reflect the committed changes.