Date: Wed, 23 Mar 2016 19:26:53 +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: r297215 - head/sys/dev/extres/clk Message-ID: <201603231926.u2NJQro3073463@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jmcneill Date: Wed Mar 23 19:26:53 2016 New Revision: 297215 URL: https://svnweb.freebsd.org/changeset/base/297215 Log: Fix support for fixed factor clocks. - Use a different device description for fixed and fixed factor clocks. - Fix a bug where the "clock-div" property was stored in the "mult" field of the clock definition. - Get the fixed factor parent clock by index instead of by name, as a clock-names property is not required to be present here. Reviewed by: mmel, adrian (mentor) Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5703 Modified: head/sys/dev/extres/clk/clk_fixed.c Modified: head/sys/dev/extres/clk/clk_fixed.c ============================================================================== --- head/sys/dev/extres/clk/clk_fixed.c Wed Mar 23 19:24:09 2016 (r297214) +++ head/sys/dev/extres/clk/clk_fixed.c Wed Mar 23 19:26:53 2016 (r297215) @@ -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_f 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603231926.u2NJQro3073463>