summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen Kumar Arepalli <naveenk@nvidia.com>2013-11-12 14:44:42 +0530
committerNaveen Kumar Arepalli <naveenk@nvidia.com>2013-11-13 01:05:49 -0800
commit96d98e235c0b394af6a7884493cd37dd753a54b8 (patch)
tree11614411029e1205f15a50e9c282add9703357da
parentb12a10e8a4bfd7a2e087f9e098d7c2dee399a440 (diff)
ARM: tegra: ardbeg: Enable Power Gating for SATA.
-Enable Sata registration through board files. -Enable Power Gating for SATA, if not enabled. Bug 1333671 Change-Id: I9563874edfbc732b7d717049ae0071d2f045c209 Signed-off-by: Naveen Kumar Arepalli <naveenk@nvidia.com> Reviewed-on: http://git-master/r/329513 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/Makefile2
-rw-r--r--arch/arm/mach-tegra/board-ardbeg-sata.c60
-rw-r--r--arch/arm/mach-tegra/board-ardbeg.c22
-rw-r--r--arch/arm/mach-tegra/board-ardbeg.h1
4 files changed, 64 insertions, 21 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 9a639536fd2a..a947418258d2 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -262,6 +262,7 @@ obj-${CONFIG_MACH_TEGRA_PLUTO} += panel-s-1080p-5.o
obj-${CONFIG_MACH_ARDBEG} += board-ardbeg.o
obj-${CONFIG_MACH_ARDBEG} += board-ardbeg-kbc.o
obj-${CONFIG_MACH_ARDBEG} += board-ardbeg-sdhci.o
+obj-${CONFIG_MACH_ARDBEG} += board-ardbeg-sata.o
obj-${CONFIG_MACH_ARDBEG} += board-ardbeg-sensors.o
obj-${CONFIG_MACH_ARDBEG} += board-ardbeg-panel.o
obj-${CONFIG_MACH_ARDBEG} += board-ardbeg-memory.o
@@ -302,6 +303,7 @@ obj-${CONFIG_MACH_LOKI} += panel-j-1440-810-5-8.o
obj-${CONFIG_MACH_LAGUNA} += board-ardbeg.o
obj-${CONFIG_MACH_LAGUNA} += board-ardbeg-kbc.o
obj-${CONFIG_MACH_LAGUNA} += board-ardbeg-sdhci.o
+obj-${CONFIG_MACH_LAGUNA} += board-ardbeg-sata.o
obj-${CONFIG_MACH_LAGUNA} += board-ardbeg-sensors.o
obj-${CONFIG_MACH_LAGUNA} += board-ardbeg-panel.o
obj-${CONFIG_MACH_LAGUNA} += board-laguna-pinmux.o
diff --git a/arch/arm/mach-tegra/board-ardbeg-sata.c b/arch/arm/mach-tegra/board-ardbeg-sata.c
new file mode 100644
index 000000000000..a14a8ff3702d
--- /dev/null
+++ b/arch/arm/mach-tegra/board-ardbeg-sata.c
@@ -0,0 +1,60 @@
+/*
+ *
+ * Copyright (c) 2013, 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,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/platform_data/tegra_ahci.h>
+
+#include "board.h"
+#include "board-ardbeg.h"
+#include "devices.h"
+#include "iomap.h"
+#include "tegra-board-id.h"
+
+#define CLK_RST_CNTRL_RST_DEV_W_SET 0x7000E438
+#define CLK_RST_CNTRL_RST_DEV_V_SET 0x7000E430
+#define SET_CEC_RST 0x100
+
+#ifdef CONFIG_SATA_AHCI_TEGRA
+static struct tegra_ahci_platform_data tegra_ahci_platform_data0 = {
+ .gen2_rx_eq = -1,
+ .pexp_gpio = PMU_TCA6416_GPIO(9),
+};
+#endif
+
+int __init ardbeg_sata_init(void)
+{
+ u32 val;
+#ifdef CONFIG_SATA_AHCI_TEGRA
+ struct board_info board_info;
+#endif
+ val = readl(IO_ADDRESS(CLK_RST_CNTRL_RST_DEV_W_SET));
+ if (val & SET_CEC_RST)
+ writel(0x108, IO_ADDRESS(CLK_RST_CNTRL_RST_DEV_V_SET));
+ val = readl(IO_ADDRESS(CLK_RST_CNTRL_RST_DEV_W_SET));
+ while (val & SET_CEC_RST)
+ val = readl(IO_ADDRESS(CLK_RST_CNTRL_RST_DEV_W_SET));
+#ifdef CONFIG_SATA_AHCI_TEGRA
+ tegra_get_board_info(&board_info);
+ if (board_info.board_id != BOARD_PM358)
+ tegra_ahci_platform_data0.pexp_gpio = -1;
+
+ tegra_sata_device.dev.platform_data = &tegra_ahci_platform_data0;
+ platform_device_register(&tegra_sata_device);
+#endif
+ return 0;
+}
diff --git a/arch/arm/mach-tegra/board-ardbeg.c b/arch/arm/mach-tegra/board-ardbeg.c
index 3033ad89ef94..e7093763b85d 100644
--- a/arch/arm/mach-tegra/board-ardbeg.c
+++ b/arch/arm/mach-tegra/board-ardbeg.c
@@ -396,27 +396,6 @@ static struct platform_device tegra_rtc_device = {
.num_resources = ARRAY_SIZE(tegra_rtc_resources),
};
-#ifdef CONFIG_SATA_AHCI_TEGRA
-static struct tegra_ahci_platform_data tegra_ahci_platform_data0 = {
- .gen2_rx_eq = -1,
- .pexp_gpio = PMU_TCA6416_GPIO(9),
-};
-
-static void ardbeg_sata_init(void)
-{
- struct board_info board_info;
-
- tegra_get_board_info(&board_info);
- if (board_info.board_id == BOARD_PM363)
- tegra_ahci_platform_data0.pexp_gpio = -1;
-
- tegra_sata_device.dev.platform_data = &tegra_ahci_platform_data0;
- platform_device_register(&tegra_sata_device);
-}
-#else
-static void ardbeg_sata_init(void) { }
-#endif
-
static struct tegra_pci_platform_data laguna_pcie_platform_data = {
.port_status[0] = 1,
.port_status[1] = 1,
@@ -1144,6 +1123,7 @@ static void __init tegra_ardbeg_late_init(void)
//tegra_ram_console_debug_init();
tegra_io_dpd_init();
ardbeg_sdhci_init();
+ ardbeg_sata_init();
if (board_info.board_id == BOARD_PM359 ||
board_info.board_id == BOARD_PM358 ||
board_info.board_id == BOARD_PM363)
diff --git a/arch/arm/mach-tegra/board-ardbeg.h b/arch/arm/mach-tegra/board-ardbeg.h
index 95fe9f63fa85..a986fe008a04 100644
--- a/arch/arm/mach-tegra/board-ardbeg.h
+++ b/arch/arm/mach-tegra/board-ardbeg.h
@@ -30,6 +30,7 @@ int ardbeg_emc_init(void);
int ardbeg_panel_init(void);
int ardbeg_kbc_init(void);
int ardbeg_sdhci_init(void);
+int ardbeg_sata_init(void);
int ardbeg_sensors_init(void);
int ardbeg_regulator_init(void);
int ardbeg_suspend_init(void);