]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
ARM: tegra: ardbeg: Enable Power Gating for SATA.
authorNaveen Kumar Arepalli <naveenk@nvidia.com>
Tue, 12 Nov 2013 09:14:42 +0000 (14:44 +0530)
committerNaveen Kumar Arepalli <naveenk@nvidia.com>
Wed, 13 Nov 2013 09:05:49 +0000 (01:05 -0800)
-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>
arch/arm/mach-tegra/Makefile
arch/arm/mach-tegra/board-ardbeg-sata.c [new file with mode: 0644]
arch/arm/mach-tegra/board-ardbeg.c
arch/arm/mach-tegra/board-ardbeg.h

index 9a639536fd2ab936923b735cd5700793b5539dc9..a947418258d298b3f65055a90c2a51772b29f5a0 100644 (file)
@@ -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 (file)
index 0000000..a14a8ff
--- /dev/null
@@ -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;
+}
index 3033ad89ef943dd13f07a252346fbf32f01c40bc..e7093763b85de71791416dba5ce5e4bdc18be00d 100644 (file)
@@ -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)
index 95fe9f63fa85ea65d8b540260a399d7c79ccbfaa..a986fe008a04b0c8b978791c2eaba4aaf3778e2b 100644 (file)
@@ -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);