diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-07-24 17:48:12 -0400 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2012-09-06 13:47:19 -0400 |
commit | eb70e1bdd8a633e058cfb6186d45d4c8bdbdf534 (patch) | |
tree | 9c59a67a6100ca90d94a202aeff0a7c7c48ee042 /arch/arm/mach-tegra/tegra2_clocks.c | |
parent | 37c241ed668bd2271760c8e1e4138d1aba4d0b79 (diff) |
ARM: tegra: fix U16 divider range check
A U16 divider can divide a clock by 1..64K. However, the range-check
in clk_div16_get_divider() limited the range to 1..256. Fix this. NVIDIA's
downstream kernels already have the fixed range-check.
In practice this is a problem on Whistler's I2C bus, which uses a bus
clock rate of 100KHz (rather than the more common 400KHz on Tegra boards),
which requires a HW module clock of 8*100KHz. The parent clock is 216MHz,
leading to a desired divider of 270. Prior to conversion to the common
clock framework, this range error was somehow ignored/irrelevant and
caused no problems. However, the common clock framework evidently has
more rigorous error-checking, so this failure causes the I2C bus to fail
to operate correctly.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/tegra2_clocks.c')
-rw-r--r-- | arch/arm/mach-tegra/tegra2_clocks.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c index a703844b2061..83ccb85b9405 100644 --- a/arch/arm/mach-tegra/tegra2_clocks.c +++ b/arch/arm/mach-tegra/tegra2_clocks.c | |||
@@ -223,7 +223,7 @@ static int clk_div16_get_divider(unsigned long parent_rate, unsigned long rate) | |||
223 | if (divider_u16 - 1 < 0) | 223 | if (divider_u16 - 1 < 0) |
224 | return 0; | 224 | return 0; |
225 | 225 | ||
226 | if (divider_u16 - 1 > 255) | 226 | if (divider_u16 - 1 > 0xFFFF) |
227 | return -EINVAL; | 227 | return -EINVAL; |
228 | 228 | ||
229 | return divider_u16 - 1; | 229 | return divider_u16 - 1; |