mirror of
https://github.com/u-boot/u-boot.git
synced 2024-12-01 08:33:31 +08:00
f77780b0ee
Samsung clock drivers usually define the clock indices that are unique per one CMU, but are not unique across all CMUs. That is, clock indices start from 1 for each CMU, as provided in CMU bindings header. The way the clock lookup via clk_get_by_index() works at the moment is by using clk_of_xlate_default(), which returns globally non-unique clock ids for for clocks registered with Samsung CCF API, which leads to incorrect clocks being obtained. One way to fix that would be to make all clock ids defined in the bindings header unique, but it'd make it incompatible with Linux kernel bindings header. A better way to solve this issue is to calculate the global clock id and use it when registering a clock with clk_dm() and when obtaining it, in a custom .of_xlate function. This patch adds an API for such mapping calculation, introducing the necessary modifications to CMU registering functions in Samsung CCF. Exynos850 clock driver (the only driver that uses Samsung CCF at the moment) is modified accordingly, as it uses the changed API. So the clock lookup with clk-exynos850.c driver is also fixed here. The global clock id is calculated from CMU id and local clock id in SAMSUNG_TO_CLK_ID() macro like this: clk_id_global = cmu_id * 256 + clk_id_local leaving a range of up to 256 clocks for each CMU. Then this mapping macro is used in clk_dm() to register clocks using their global ids, and in .of_xlate() to lookup the clock by its local id correctly. Because .of_xlate() operation has a separate function for each CMU, it "knows" the correct way of finding the correct clk_id_global by provided clk_id_local. Fixes: |
||
---|---|---|
.. | ||
clk-exynos850.c | ||
clk-exynos7420.c | ||
clk-pll.c | ||
clk-pll.h | ||
clk.c | ||
clk.h | ||
Kconfig | ||
Makefile |