Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Nov 2018 20:10:46 +0100
From:      Emmanuel Vadot <manu@bidouilliste.com>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r341254 - head/sys/dev/extres/clk
Message-ID:  <20181129201046.2f697637d45bf300a7e8341a@bidouilliste.com>
In-Reply-To: <201811291906.wATJ666x011804@repo.freebsd.org>
References:  <201811291906.wATJ666x011804@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 29 Nov 2018 19:06:06 +0000 (UTC)
Emmanuel Vadot <manu@FreeBSD.org> wrote:

> Author: manu
> Date: Thu Nov 29 19:06:05 2018
> New Revision: 341254
> URL: https://svnweb.freebsd.org/changeset/base/341254
> 
> Log:
>   extres: clk: Fix clk_set_assigned
>   
>   ofw_bus_parse_xref_list_get_length doesn't returns the number of elements, fix this.
>   While here when setting the clock to the assigned freqeuncy, allow the clock
>   driver to round down or up the frequency as sometimes the exact frequency cannot
>   be obtain.

MFC After:	3 days

> Modified:
>   head/sys/dev/extres/clk/clk.c
> 
> Modified: head/sys/dev/extres/clk/clk.c
> ==============================================================================
> --- head/sys/dev/extres/clk/clk.c	Thu Nov 29 18:37:48 2018	(r341253)
> +++ head/sys/dev/extres/clk/clk.c	Thu Nov 29 19:06:05 2018	(r341254)
> @@ -1297,7 +1297,7 @@ clk_set_assigned_rates(device_t dev, clk_t clk, uint32
>  {
>  	int rv;
>  
> -	rv = clk_set_freq(clk, freq, 0);
> +	rv = clk_set_freq(clk, freq, CLK_SET_ROUND_DOWN | CLK_SET_ROUND_UP);
>  	if (rv != 0) {
>  		device_printf(dev, "Failed to set %s to a frequency of %u\n",
>  		    clk_get_name(clk), freq);
> @@ -1330,9 +1330,9 @@ clk_set_assigned(device_t dev, phandle_t node)
>  	if (nrates <= 0)
>  		nrates = 0;
>  
> -	nparents = ofw_bus_parse_xref_list_get_length(node,
> -	    "assigned-clock-parents", "#clock-cells", &nparents);
> -
> +	if (ofw_bus_parse_xref_list_get_length(node,
> +	    "assigned-clock-parents", "#clock-cells", &nparents) != 0)
> +		nparents = -1;
>  	for (i = 0; i < nclocks; i++) {
>  		/* First get the clock we are supposed to modify */
>  		rv = clk_get_by_ofw_index_prop(dev, 0, "assigned-clocks",


-- 
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20181129201046.2f697637d45bf300a7e8341a>