aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/extres
diff options
context:
space:
mode:
authorJared McNeill <jmcneill@FreeBSD.org>2016-03-23 19:26:53 +0000
committerJared McNeill <jmcneill@FreeBSD.org>2016-03-23 19:26:53 +0000
commit64f86dc4cb1a0d61aa41f21993621b5454b55026 (patch)
tree9cc258a69bed5a5ebd56c30813bea64a0be94685 /sys/dev/extres
parent694f5cae46cc7470beb8f2126ab8423a80a8c3ed (diff)
Notes
Diffstat (limited to 'sys/dev/extres')
-rw-r--r--sys/dev/extres/clk/clk_fixed.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/extres/clk/clk_fixed.c b/sys/dev/extres/clk/clk_fixed.c
index 8402cbc42c40..02721ae86d73 100644
--- a/sys/dev/extres/clk/clk_fixed.c
+++ b/sys/dev/extres/clk/clk_fixed.c
@@ -150,12 +150,19 @@ struct clk_fixed_softc {
static int
clk_fixed_probe(device_t dev)
{
+ intptr_t clk_type;
- if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) {
+ clk_type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
+ switch (clk_type) {
+ case CLK_TYPE_FIXED:
device_set_desc(dev, "Fixed clock");
return (BUS_PROBE_DEFAULT);
+ case CLK_TYPE_FIXED_FACTOR:
+ device_set_desc(dev, "Fixed factor clock");
+ return (BUS_PROBE_DEFAULT);
+ default:
+ return (ENXIO);
}
- return (ENXIO);
}
static int
@@ -184,11 +191,11 @@ clk_fixed_init_fixed_factor(struct clk_fixed_softc *sc, phandle_t node,
rv = OF_getencprop(node, "clock-mult", &def->mult, sizeof(def->mult));
if (rv <= 0)
return (ENXIO);
- rv = OF_getencprop(node, "clock-div", &def->mult, sizeof(def->div));
+ rv = OF_getencprop(node, "clock-div", &def->div, sizeof(def->div));
if (rv <= 0)
return (ENXIO);
/* Get name of parent clock */
- rv = clk_get_by_ofw_name(sc->dev, "clocks", &parent);
+ rv = clk_get_by_ofw_index(sc->dev, 0, &parent);
if (rv != 0)
return (ENXIO);
def->clkdef.parent_names = malloc(sizeof(char *), M_OFWPROP, M_WAITOK);