diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/clk/tegra/clk-emc.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/clk/tegra/clk-emc.c b/drivers/clk/tegra/clk-emc.c index 28068584ff6e..9a0179235939 100644 --- a/drivers/clk/tegra/clk-emc.c +++ b/drivers/clk/tegra/clk-emc.c | |||
| @@ -121,7 +121,7 @@ static int emc_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) | |||
| 121 | struct tegra_clk_emc *tegra; | 121 | struct tegra_clk_emc *tegra; |
| 122 | u8 ram_code = tegra_read_ram_code(); | 122 | u8 ram_code = tegra_read_ram_code(); |
| 123 | struct emc_timing *timing = NULL; | 123 | struct emc_timing *timing = NULL; |
| 124 | int i, k; | 124 | int i, k, t; |
| 125 | 125 | ||
| 126 | tegra = container_of(hw, struct tegra_clk_emc, hw); | 126 | tegra = container_of(hw, struct tegra_clk_emc, hw); |
| 127 | 127 | ||
| @@ -130,12 +130,17 @@ static int emc_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) | |||
| 130 | break; | 130 | break; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | for (i = k; i < tegra->num_timings; i++) { | 133 | for (t = k; t < tegra->num_timings; t++) { |
| 134 | if (tegra->timings[i].ram_code != ram_code) | 134 | if (tegra->timings[t].ram_code != ram_code) |
| 135 | break; | 135 | break; |
| 136 | } | ||
| 136 | 137 | ||
| 138 | for (i = k; i < t; i++) { | ||
| 137 | timing = tegra->timings + i; | 139 | timing = tegra->timings + i; |
| 138 | 140 | ||
| 141 | if (timing->rate < req->rate && i != t - 1) | ||
| 142 | continue; | ||
| 143 | |||
| 139 | if (timing->rate > req->max_rate) { | 144 | if (timing->rate > req->max_rate) { |
| 140 | i = max(i, k + 1); | 145 | i = max(i, k + 1); |
| 141 | req->rate = tegra->timings[i - 1].rate; | 146 | req->rate = tegra->timings[i - 1].rate; |
| @@ -145,10 +150,8 @@ static int emc_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) | |||
| 145 | if (timing->rate < req->min_rate) | 150 | if (timing->rate < req->min_rate) |
| 146 | continue; | 151 | continue; |
| 147 | 152 | ||
| 148 | if (timing->rate >= req->rate) { | 153 | req->rate = timing->rate; |
| 149 | req->rate = timing->rate; | 154 | return 0; |
| 150 | return 0; | ||
| 151 | } | ||
| 152 | } | 155 | } |
| 153 | 156 | ||
| 154 | if (timing) { | 157 | if (timing) { |
