ARM: tegra: fuse: Implement caching of fuse sku_id
Laxman Dewangan [Tue, 13 Mar 2012 03:19:12 +0000 (08:19 +0530)]
In place of reading the sku id from the fuse every time,
read once and stored it for future use.

Based on orginal change from Simon Je's
http://git-master/r/#change,51502

bug 950922
bug 949620

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/89647
(cherry picked from commit 8eda0d2b574f7dda5975115ba6990790a2d4e1cc)

Change-Id: I4aed1a7c34008b4b3f4df17f7a41e3446ad8fe4f
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/90305
Reviewed-by: Automatic_Commit_Validation_User

arch/arm/mach-tegra/fuse.c

index c24bfaf..d9fe1b0 100644 (file)
@@ -273,9 +273,11 @@ unsigned int tegra_spare_fuse(int bit)
 
 int tegra_sku_id(void)
 {
-       int sku_id;
-       u32 reg = tegra_fuse_readl(FUSE_SKU_INFO);
-       sku_id = reg & 0xFF;
+       static int sku_id = -1;
+       if (sku_id == -1) {
+               u32 reg = tegra_fuse_readl(FUSE_SKU_INFO);
+               sku_id = reg & 0xFF;
+       }
        return sku_id;
 }