From owner-svn-src-all@freebsd.org Sun Jul 10 10:53:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3695B84DC0; Sun, 10 Jul 2016 10:53:51 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A2891E94; Sun, 10 Jul 2016 10:53:51 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6AArofK008436; Sun, 10 Jul 2016 10:53:50 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6AAroYh008434; Sun, 10 Jul 2016 10:53:50 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201607101053.u6AAroYh008434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Sun, 10 Jul 2016 10:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302523 - head/sys/dev/extres/clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jul 2016 10:53:52 -0000 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);