On Thu, 29 Nov 2018 19:06:06 +0000 (UTC)
Emmanuel Vadot <m...@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 <m...@bidouilliste.com> <m...@freebsd.org>
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to