ARM: tegra: emc: Fix access to emc clock lock
Alex Waterman [Thu, 20 Jun 2013 22:57:49 +0000 (15:57 -0700)]
During DSR override the clock_get_rate() function was called inside
of a spinlock. This could cause an attempt to schedule() if the emc
clock mutex was already held. This patch fixes the above problem by
knowing that the EMC clock cannot change whiel the emc access lock is
held and therefor uses clock_get_rate_all_locked() to query the EMC
rate.

Bug 1311617

Reviewed-on: http://git-master/r/241019
(cherry picked from commit 7b8d29fb9335161fd3d05528e217c5ce5ce6f3f9)
Change-Id: I4b1dbdb34f6aa79524b184d949dee0d1057bd8aa
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/248539
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

arch/arm/mach-tegra/tegra14_emc.c

index c365ee3..8bee968 100644 (file)
@@ -1551,7 +1551,7 @@ int tegra_emc_dsr_override(int override)
                                spin_unlock_irqrestore(&emc_access_lock, flags);
                                return -EINVAL;
                        }
-                       rate = clk_get_rate(emc) / 1000;
+                       rate = clk_get_rate_all_locked(emc) / 1000;
                        for (i = 0; i < tegra_emc_table_size; i++) {
                                if (tegra_emc_table[i].rate == rate) {
                                        tbl_timing = &tegra_emc_table[i];