ARM: tegra12: speedo: provide sku support
Prashant Malani [Fri, 30 Aug 2013 23:37:26 +0000 (16:37 -0700)]
Provide initial support to convert skus to speedo ids.

Bug 1352610

Change-Id: I7f9f85e583785576a0349ee5bac1418c7174eb74
Signed-off-by: Prashant Malani <pmalani@nvidia.com>
Reviewed-on: http://git-master/r/269722
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: Chao Xu <cxu@nvidia.com>

arch/arm/mach-tegra/tegra12_dvfs.c
arch/arm/mach-tegra/tegra12_speedo.c

index d76777e..8735828 100644 (file)
@@ -281,7 +281,7 @@ static struct dvfs core_dvfs_table[] = {
 /* TBD: fill in actual hw numbers */
 static struct gpu_cvb_dvfs gpu_cvb_dvfs_table[] = {
        {
-               .speedo_id =  0,
+               .speedo_id =  -1,
                .process_id = -1,
                .max_mv = 1100,
                .min_mv = 800,
index 3cc77ff..a3b6fca 100644 (file)
@@ -75,6 +75,27 @@ static const u32 gpu_process_speedos[][GPU_PROCESS_CORNERS_NUM] = {
        {0,     UINT_MAX}, /* [1]: threshold_index 0 */
 };
 
+static void rev_sku_to_speedo_ids(int rev, int sku)
+{
+
+       switch (sku) {
+       case 0x00: /* Eng */
+       case 0x0F:
+               gpu_speedo_id = 0;
+               break;
+
+       case 0x07:
+       case 0x81:
+               gpu_speedo_id = 1;
+               break;
+
+       default:
+               pr_err("Tegra12 Unknown SKU %d\n", sku);
+               gpu_speedo_id = 0;
+               break;
+       }
+}
+
 void tegra_init_speedo_data(void)
 {
        int i;
@@ -98,6 +119,8 @@ void tegra_init_speedo_data(void)
                return;
        }
 
+       rev_sku_to_speedo_ids(tegra_revision, tegra_sku_id);
+
        cpu_speedo_value = TEGRA124_CPU_SPEEDO;
        cpu_speedo_0_value = tegra_fuse_readl(FUSE_CPU_SPEEDO_0);
        cpu_speedo_1_value = tegra_fuse_readl(FUSE_CPU_SPEEDO_1);