ARM: tegra12: Add emc use case table
Xue Dong [Wed, 21 Aug 2013 01:17:41 +0000 (18:17 -0700)]
bug 1162232

Change-Id: I2bf4cdec47b98da45852e3fd345dd1833bb020af
Signed-off-by: Xue Dong <xdong@nvidia.com>
Reviewed-on: http://git-master/r/264134
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Chao Xu <cxu@nvidia.com>

arch/arm/mach-tegra/tegra12_emc.c

index 5b062a6..b01639a 100644 (file)
@@ -47,6 +47,14 @@ module_param(emc_enable, bool, 0644);
 
 u8 tegra_emc_bw_efficiency = 100;
 
+static struct emc_iso_usage tegra12_emc_iso_usage[] = {
+       { BIT(EMC_USER_DC1),                     80 },
+       { BIT(EMC_USER_DC2),                     80 },
+       { BIT(EMC_USER_DC1) | BIT(EMC_USER_DC2),        50 },
+       { BIT(EMC_USER_DC1) | BIT(EMC_USER_VI),  50 },
+       { BIT(EMC_USER_DC2) | BIT(EMC_USER_VI),  50 },
+};
+
 #define PLL_C_DIRECT_FLOOR             333500000
 #define EMC_STATUS_UPDATE_TIMEOUT      100
 #define TEGRA_EMC_TABLE_MAX_SIZE       16
@@ -1215,7 +1223,19 @@ static struct platform_driver tegra12_emc_driver = {
 
 int __init tegra12_emc_init(void)
 {
-       return platform_driver_register(&tegra12_emc_driver);
+       int ret = platform_driver_register(&tegra12_emc_driver);
+
+       if (!ret) {
+               tegra_emc_iso_usage_table_init(tegra12_emc_iso_usage,
+                               ARRAY_SIZE(tegra12_emc_iso_usage));
+               if (emc_enable) {
+                       unsigned long rate = tegra_emc_round_rate_updown(
+                               emc->boot_rate, false);
+                       if (!IS_ERR_VALUE(rate))
+                               tegra_clk_preset_emc_monitor(rate);
+               }
+       }
+       return ret;
 }
 
 void tegra_emc_timing_invalidate(void)
@@ -1401,6 +1421,9 @@ static int __init tegra_emc_debug_init(void)
                                 emc_debugfs_root, NULL, &efficiency_fops))
                goto err_out;
 
+       if (tegra_emc_iso_usage_debugfs_init(emc_debugfs_root))
+               goto err_out;
+
        return 0;
 
 err_out: