The call has been assuming all clksrc-clks' divider size is 4 bits, but
this may not be the case anymore. Use the reg_div.size parameter to
calculate the maximum value it can take and check against that.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
The WARN_ON() was only checking the first clock in the array, instead of
being executed for each clksrc clock being registered.
Since this is an array of clocks, WARN_ON() does not provide a lot of
useful information about the problem, so change to using printk(KERN_ERR)
to report the problem to the console.
As a note, we still try and register the clock even if these problems are
present just in case and to avoid changing the behaviour of the registration
process.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Adds a additional check in s3c_set_clksrc function to ensure that the clksrc_clk
does have a choice of multiple clock sources. In addition to this, a check is
added to ensure that a parent is assigned to the clksrc_clk in case it does not
have a choice of parent clocks.
Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
If there is no source register defined, do not register a clksrc
clock with a valid .set_parent in the ops.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
If the reg_div field is not set, then do not register clk_ops with the
get/set/round rate calls as these will fail to work.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
The new code calls the clock setup code on registration which
can be before the clock system has been fully initialised. The
following code re-does this setup at the end of the clock
registration and thus we get two printings.
Update the calls to only print on the last pass or when doing
the necessary resume work.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Reduce the size of struct clk by 12 bytes and make defining clocks with
common implementation functions easier by moving the set_rate, get_rate,
round_rate and set_parent calls into a new structure called 'struct clk_ops'
and using that instead.
This change does make a few clocks larger as they need their own clk_ops,
but this is outweighed by the number of clocks with either no ops or having
a common set of ops.
Update all the users of this.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Add a core for the clksrc clock implementation, which is found in many of
the newer Samsung SoCs into plat-samsung.
Signed-off-by: Harald Welte <laforge@gnumonks.org>
[ben-linux@fluff.org: split from original patch to make change smaller]
[ben-linux@fluff.org: split clk and clksrc changes]
[ben-linux@fluff.org: moved to plat-samsung from plat-s3c]
[ben-linux@fluff.org: re-wrote headers after splits]
[ben-linux@fluff.org: added better documentation to headers]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>