aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-05-02 17:47:12 -0400
committerStephen Warren <swarren@nvidia.com>2012-06-20 14:37:42 -0400
commita12c0efc7a3f433377add0fa1fd0ed4836cc595e (patch)
tree5dd8af8833d4dc4361a118da90324f86e26b407e
parentc554dee35c3e6b0c19db5fb75193d4cd99736c6b (diff)
ARM: tegra: harmony: init regulators, PCIe when booting from DT
There currently aren't bindings for the Tegra PCIe controller. Work on this is in progress, but not yet complete. Manually initialize PCIe when booting from device tree, in order to bring DT support to the same feature level as board files, which will in turn allow board files to be deprecated. PCIe on Harmony requires various regulators to be registered and enabled before initializing the PCIe controller. Note that since the I2C controllers are instantiated from DT, we must use i2c_new_device() to register the PMU rather than i2c_register_board_info(). Signed-off-by: Stephen Warren <swarren@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra20.c20
-rw-r--r--arch/arm/mach-tegra/board-harmony-pcie.c15
-rw-r--r--arch/arm/mach-tegra/board-harmony-power.c25
-rw-r--r--arch/arm/mach-tegra/board.h7
4 files changed, 61 insertions, 6 deletions
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index 9537f20384fc..777138611c77 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -109,6 +109,23 @@ static void __init trimslice_init(void)
109} 109}
110#endif 110#endif
111 111
112#ifdef CONFIG_MACH_HARMONY
113static void __init harmony_init(void)
114{
115 int ret;
116
117 ret = harmony_regulator_init();
118 if (ret) {
119 pr_err("harmony_regulator_init() failed: %d\n", ret);
120 return;
121 }
122
123 ret = harmony_pcie_init();
124 if (ret)
125 pr_err("harmony_pcie_init() failed: %d\n", ret);
126}
127#endif
128
112static struct { 129static struct {
113 char *machine; 130 char *machine;
114 void (*init)(void); 131 void (*init)(void);
@@ -116,6 +133,9 @@ static struct {
116#ifdef CONFIG_MACH_TRIMSLICE 133#ifdef CONFIG_MACH_TRIMSLICE
117 { "compulab,trimslice", trimslice_init }, 134 { "compulab,trimslice", trimslice_init },
118#endif 135#endif
136#ifdef CONFIG_MACH_HARMONY
137 { "nvidia,harmony", harmony_init },
138#endif
119}; 139};
120 140
121static void __init tegra_dt_init_late(void) 141static void __init tegra_dt_init_late(void)
diff --git a/arch/arm/mach-tegra/board-harmony-pcie.c b/arch/arm/mach-tegra/board-harmony-pcie.c
index 33c4fedab840..e8c3fda9bec2 100644
--- a/arch/arm/mach-tegra/board-harmony-pcie.c
+++ b/arch/arm/mach-tegra/board-harmony-pcie.c
@@ -27,14 +27,11 @@
27 27
28#ifdef CONFIG_TEGRA_PCI 28#ifdef CONFIG_TEGRA_PCI
29 29
30static int __init harmony_pcie_init(void) 30int __init harmony_pcie_init(void)
31{ 31{
32 struct regulator *regulator = NULL; 32 struct regulator *regulator = NULL;
33 int err; 33 int err;
34 34
35 if (!machine_is_harmony())
36 return 0;
37
38 err = gpio_request(TEGRA_GPIO_EN_VDD_1V05_GPIO, "EN_VDD_1V05"); 35 err = gpio_request(TEGRA_GPIO_EN_VDD_1V05_GPIO, "EN_VDD_1V05");
39 if (err) 36 if (err)
40 return err; 37 return err;
@@ -62,7 +59,15 @@ err_reg:
62 return err; 59 return err;
63} 60}
64 61
62static int __init harmony_pcie_initcall(void)
63{
64 if (!machine_is_harmony())
65 return 0;
66
67 return harmony_pcie_init();
68}
69
65/* PCI should be initialized after I2C, mfd and regulators */ 70/* PCI should be initialized after I2C, mfd and regulators */
66subsys_initcall_sync(harmony_pcie_init); 71subsys_initcall_sync(harmony_pcie_initcall);
67 72
68#endif 73#endif
diff --git a/arch/arm/mach-tegra/board-harmony-power.c b/arch/arm/mach-tegra/board-harmony-power.c
index 82f32300796c..44dcb2e869b5 100644
--- a/arch/arm/mach-tegra/board-harmony-power.c
+++ b/arch/arm/mach-tegra/board-harmony-power.c
@@ -20,6 +20,10 @@
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
22#include <linux/mfd/tps6586x.h> 22#include <linux/mfd/tps6586x.h>
23#include <linux/of.h>
24#include <linux/of_i2c.h>
25
26#include <asm/mach-types.h>
23 27
24#include <mach/irqs.h> 28#include <mach/irqs.h>
25 29
@@ -110,7 +114,26 @@ static struct i2c_board_info __initdata harmony_regulators[] = {
110 114
111int __init harmony_regulator_init(void) 115int __init harmony_regulator_init(void)
112{ 116{
113 i2c_register_board_info(3, harmony_regulators, 1); 117 if (machine_is_harmony()) {
118 i2c_register_board_info(3, harmony_regulators, 1);
119 } else { /* Harmony, booted using device tree */
120 struct device_node *np;
121 struct i2c_adapter *adapter;
122
123 np = of_find_node_by_path("/i2c@7000d000");
124 if (np == NULL) {
125 pr_err("Could not find device_node for DVC I2C\n");
126 return -ENODEV;
127 }
128
129 adapter = of_find_i2c_adapter_by_node(np);
130 if (!adapter) {
131 pr_err("Could not find i2c_adapter for DVC I2C\n");
132 return -ENODEV;
133 }
134
135 i2c_new_device(adapter, harmony_regulators);
136 }
114 137
115 return 0; 138 return 0;
116} 139}
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index 65014968fc6c..097e0e16eacd 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -46,5 +46,12 @@ int __init tegra_powergate_debugfs_init(void);
46static inline int tegra_powergate_debugfs_init(void) { return 0; } 46static inline int tegra_powergate_debugfs_init(void) { return 0; }
47#endif 47#endif
48 48
49int __init harmony_regulator_init(void);
50#ifdef CONFIG_TEGRA_PCI
51int __init harmony_pcie_init(void);
52#else
53static inline int harmony_pcie_init(void) { return 0; }
54#endif
55
49extern struct sys_timer tegra_timer; 56extern struct sys_timer tegra_timer;
50#endif 57#endif