ARM: tegra: sdhci: Pass speedo id in platform data
Naveen Kumar Arepalli [Tue, 7 Jan 2014 10:50:26 +0000 (15:50 +0530)]
-Passing speedo id from sdhci platform data. Speedo id is required
for some calculation in auto tuning.

-Set trim value to 3 for SDMMC4

Bug 1423429

Reviewed-on: http://git-master/r/359376
(cherry picked from commit 533c3b6bf9f6ca622a35ace6f9865e76ca7a0fc6)

Change-Id: If130f95175397c2943967edcba5466d01cd4ada8
Signed-off-by: Naveen Kumar Arepalli <naveenk@nvidia.com>
Signed-off-by: R Raj Kumar <rrajk@nvidia.com>
Reviewed-on: http://git-master/r/363811
(cherry picked from commit c17402b37013f13b7c0f0c0dc56187eff47576fe)
Reviewed-on: http://git-master/r/410190
GVS: Gerrit_Virtual_Submit
Reviewed-by: Shreshtha Sahu <ssahu@nvidia.com>
Tested-by: Shreshtha Sahu <ssahu@nvidia.com>
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

arch/arm/mach-tegra/board-ardbeg-sdhci.c
arch/arm/mach-tegra/board-loki-sdhci.c

index 3a18f37..19420ed 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/wl12xx.h>
 #include <linux/platform_data/mmc-sdhci-tegra.h>
 #include <linux/mfd/max77660/max77660-core.h>
+#include <linux/tegra-fuse.h>
 
 #include <asm/mach-types.h>
 #include <mach/irqs.h>
@@ -50,6 +51,7 @@ static unsigned int wifi_states[] = {ON, OFF};
 
 #define ARDBEG_SD_CD   TEGRA_GPIO_PV2
 #define ARDBEG_SD_WP   TEGRA_GPIO_PQ4
+#define FUSE_SOC_SPEEDO_0      0x134
 
 static void (*wifi_status_cb)(int card_present, void *dev_id);
 static void *wifi_status_cb_devid;
@@ -206,7 +208,7 @@ static struct tegra_sdhci_platform_data tegra_sdhci_platform_data3 = {
        .power_gpio = -1,
        .is_8bit = 1,
        .tap_delay = 0x4,
-       .trim_delay = 0x4,
+       .trim_delay = 0x3,
        .ddr_trim_delay = 0x0,
        .mmc_data = {
                .built_in = 1,
@@ -400,6 +402,7 @@ int __init ardbeg_sdhci_init(void)
        int nominal_core_mv;
        int min_vcore_override_mv;
        int boot_vcore_mv;
+       u32 speedo;
        struct board_info board_info;
 
        nominal_core_mv =
@@ -445,6 +448,16 @@ int __init ardbeg_sdhci_init(void)
                board_info.board_id == BOARD_PM359)
                        tegra_sdhci_platform_data0.disable_clock_gate = 1;
 
+       speedo = tegra_fuse_readl(FUSE_SOC_SPEEDO_0);
+       tegra_sdhci_platform_data0.cpu_speedo = speedo;
+       tegra_sdhci_platform_data2.cpu_speedo = speedo;
+       tegra_sdhci_platform_data3.cpu_speedo = speedo;
+
+       speedo = tegra_fuse_readl(FUSE_SOC_SPEEDO_0);
+       tegra_sdhci_platform_data0.cpu_speedo = speedo;
+       tegra_sdhci_platform_data2.cpu_speedo = speedo;
+       tegra_sdhci_platform_data3.cpu_speedo = speedo;
+
        platform_device_register(&tegra_sdhci_device3);
        platform_device_register(&tegra_sdhci_device2);
        if (board_info.board_id != BOARD_PM359 &&
index 8650467..42e2ab6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-loki-sdhci.c
  *
- * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2013-2014, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -28,6 +28,7 @@
 #include <linux/wl12xx.h>
 #include <linux/platform_data/mmc-sdhci-tegra.h>
 #include <linux/mfd/max77660/max77660-core.h>
+#include <linux/tegra-fuse.h>
 
 #include <asm/mach-types.h>
 #include <mach/irqs.h>
@@ -46,6 +47,8 @@
 
 #define LOKI_SD_CD     TEGRA_GPIO_PV2
 
+#define FUSE_SOC_SPEEDO_0      0x134
+
 static void (*wifi_status_cb)(int card_present, void *dev_id);
 static void *wifi_status_cb_devid;
 static int loki_wifi_status_register(void (*callback)(int , void *), void *);
@@ -174,7 +177,7 @@ static struct tegra_sdhci_platform_data tegra_sdhci_platform_data3 = {
        .power_gpio = -1,
        .is_8bit = 1,
        .tap_delay = 0x4,
-       .trim_delay = 0x4,
+       .trim_delay = 0x3,
        .ddr_trim_delay = 0x0,
        .mmc_data = {
                .built_in = 1,
@@ -453,6 +456,7 @@ int __init loki_sdhci_init(void)
        int nominal_core_mv;
        int min_vcore_override_mv;
        int boot_vcore_mv;
+       u32 speedo;
        struct board_info bi;
 
        tegra_get_board_info(&bi);
@@ -488,6 +492,12 @@ int __init loki_sdhci_init(void)
 
        tegra_sdhci_platform_data0.max_clk_limit = 204000000;
 
+       speedo = tegra_fuse_readl(FUSE_SOC_SPEEDO_0);
+       tegra_sdhci_platform_data0.cpu_speedo = speedo;
+       tegra_sdhci_platform_data2.cpu_speedo = speedo;
+       tegra_sdhci_platform_data3.cpu_speedo = speedo;
+
+
        platform_device_register(&tegra_sdhci_device3);
 
        if (!is_uart_over_sd_enabled())