summaryrefslogtreecommitdiffstats
path: root/drivers/clk/sunxi-ng/ccu_nkmp.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'sunxi-clk-for-4.12-2' of ↵Stephen Boyd2017-04-211-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux into HEAD Pull Allwinner clock changes, take 2 from Maxime Ripard: A few minor bug and comment fixes, plus some fixes for the PRCM CCU driver merged in the prior pull request * tag 'sunxi-clk-for-4.12-2' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux: clk: sunxi-ng: a80: Fix audio PLL comment not matching actual code clk: sunxi-ng: Fix round_rate/set_rate multiplier minimum mismatch clk: sunxi-ng: use 1 as fallback for minimum multiplier clk: sunxi-ng: fix PRCM CCU CLK_NUMBER value clk: sunxi-ng: fix PRCM CCU ir clk parent
| * clk: sunxi-ng: Fix round_rate/set_rate multiplier minimum mismatchChen-Yu Tsai2017-04-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | In commit 2beaa601c849 ("clk: sunxi-ng: Implement minimum for multipliers"), the multiplier minimums in the set_rate callback for NM and NKMP style clocks were not updated. This patch fixes them to match their round_rate callbacks. Fixes: 2beaa601c849 ("clk: sunxi-ng: Implement minimum for multipliers") Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
| * clk: sunxi-ng: use 1 as fallback for minimum multiplierChen-Yu Tsai2017-04-131-2/+2
| | | | | | | | | | | | | | | | | | | | A zero multiplier does not make sense for clocks. Use 1 as the minimum when a multiplier minimum isn't specified. Fixes: 2beaa601c849 ("clk: sunxi-ng: Implement minimum for multipliers") Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
* | clk: sunxi-ng: fix recalc_rate formula of NKMP clocksIcenowy Zheng2017-03-201-1/+1
|/ | | | | | | | | | | | | | | | In commit e66f81bbd746 ("clk: sunxi-ng: Implement factors offsets"), the final formula of NKMP clocks' recalc_rate is refactored; however, the refactored formula broke the calculation due to some C language operand priority problem -- the priority of operand >> is lower than * and /, makes the formula being parsed as "(parent_rate * n * k) >> (p / m)", but it should be "(parent_rate * n * k >> p) / m". Add the pair of parentheses to fix up this issue. This pair of parentheses used to exist in the old formula. Fixes: e66f81bbd746 ("clk: sunxi-ng: Implement factors offsets") Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
* clk: sunxi-ng: Implement multiplier maximumMaxime Ripard2017-01-231-4/+4
| | | | | | | | | Some multipliers have a maximum rate that is lower than what the register width allows to. Add a field in the multiplier structure to allow CCU driver to set that maximum. Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
* clk: sunxi-ng: Implement factors offsetsMaxime Ripard2017-01-231-4/+13
| | | | | | | | | | | | | | | | | | The factors we've seen so far all had an offset of one. However, on the earlier Allwinner SoCs, some factors could have no offset at all, meaning that the value computed to reach the rate we want to use was the one we had to program in the registers. Implement an additional field for the factors that can have such an offset (linears, not based on a power of two) to specify that offset. This offset is not linked to the extremums that can be specified in those structures too. The minimum and maximum are representing the range of values we can use to try to compute the best rate. The offset comes later on when we want to set the best value in the registers. Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
* clk: sunxi-ng: Implement minimum for multipliersMaxime Ripard2016-10-251-2/+2
| | | | | | | Allow the CCU drivers to specify a multiplier for their clocks. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org>
* clk: sunxi-ng: Add minimums for all the relevant structures and clocksMaxime Ripard2016-10-251-8/+16
| | | | | | | | Modify the current clocks we have to be able to specify the minimum for each clocks we support, just like we support the max. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org>
* clk: sunxi-ng: Remove the use of rational computationsMaxime Ripard2016-10-251-19/+18
| | | | | | | | | | While the rational library works great, it doesn't really allow us to add more constraints, like the minimum. Remove that in order to be able to deal with the constraints we'll need. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org>
* clk: sunxi-ng: div: Allow to set a maximumMaxime Ripard2016-09-101-11/+10
| | | | | | | | | | | | | | Some dividers might have a maximum value that is lower than the width of the register. Add a field to _ccu_div to handle those case properly. If the field is set to 0, the code will assume that the maximum value is the maximum one that can be used with the field register width. Otherwise, we'll use whatever value has been set. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org>
* clk: sunxi-ng: Add N-K-M-P factor clockMaxime Ripard2016-07-081-0/+167
Introduce support for clocks that use a combination of two linear multipliers (N and K factors), one linear divider (M) and one power of two divider (P). Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Michael Turquette <mturquette@baylibre.com> Link: lkml.kernel.org/r/20160629190535.11855-13-maxime.ripard@free-electrons.com
OpenPOWER on IntegriCloud