diff mbox

[V2,1/3] ARM: tegra: trimslice: enable PCIe when booting from device tree

Message ID 1337289674-18581-1-git-send-email-swarren@wwwdotorg.org
State Accepted, archived
Headers show

Commit Message

Stephen Warren May 17, 2012, 9:21 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

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 hosts the wired Ethernet controller on TrimSlice.

To support this, add infra-structure to board-dt-tegra20.c for board-
specific initialization code. Once device tree support for the relevant
features is in place, this code will be removed.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v2: Use .init_late hook in DT_MACHINE_START instead of an explicit late
initcall.
---
 arch/arm/mach-tegra/board-dt-tegra20.c |   36 +++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

Comments

Ben Dooks May 22, 2012, 10:17 a.m. UTC | #1
On 17/05/12 22:21, Stephen Warren wrote:
> From: Stephen Warren<swarren@nvidia.com>
>
> 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 hosts the wired Ethernet controller on TrimSlice.
>
> To support this, add infra-structure to board-dt-tegra20.c for board-
> specific initialization code. Once device tree support for the relevant
> features is in place, this code will be removed.
>
> Signed-off-by: Stephen Warren<swarren@nvidia.com>
> ---
> v2: Use .init_late hook in DT_MACHINE_START instead of an explicit late
> initcall.
> ---
>   arch/arm/mach-tegra/board-dt-tegra20.c |   36 +++++++++++++++++++++++++++++++-
>   1 files changed, 35 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
> index eb7249d..9537f20 100644
> --- a/arch/arm/mach-tegra/board-dt-tegra20.c
> +++ b/arch/arm/mach-tegra/board-dt-tegra20.c
> @@ -98,6 +98,40 @@ static void __init tegra_dt_init(void)
>   				tegra20_auxdata_lookup, NULL);
>   }
>
> +#ifdef CONFIG_MACH_TRIMSLICE
> +static void __init trimslice_init(void)
> +{
> +	int ret;
> +
> +	ret = tegra_pcie_init(true, true);
> +	if (ret)
> +		pr_err("tegra_pci_init() failed: %d\n", ret);
> +}
> +#endif

Given the size of some of these functions, is it worth even
bothering with an #ifdef around them, especially as they are
marked init.

How about having some sort of standard pcie binding for the pcie
part?
Stephen Warren May 22, 2012, 4:18 p.m. UTC | #2
On 05/22/2012 04:17 AM, Ben Dooks wrote:
> On 17/05/12 22:21, Stephen Warren wrote:
>> From: Stephen Warren<swarren@nvidia.com>
>>
>> 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 hosts the wired Ethernet controller on TrimSlice.
>>
>> To support this, add infra-structure to board-dt-tegra20.c for board-
>> specific initialization code. Once device tree support for the relevant
>> features is in place, this code will be removed.
>>
>> Signed-off-by: Stephen Warren<swarren@nvidia.com>

>> +++ b/arch/arm/mach-tegra/board-dt-tegra20.c

>> +#ifdef CONFIG_MACH_TRIMSLICE
>> +static void __init trimslice_init(void)
>> +{
>> +    int ret;
>> +
>> +    ret = tegra_pcie_init(true, true);
>> +    if (ret)
>> +        pr_err("tegra_pci_init() failed: %d\n", ret);
>> +}
>> +#endif
> 
> Given the size of some of these functions, is it worth even
> bothering with an #ifdef around them, especially as they are
> marked init.

The TrimSlice init function doesn't pull in anything beyond the raw
driver itself, but the Harmony and Paz00 functions do. I made everything
ifdef'd for consistency.

> How about having some sort of standard pcie binding for the pcie
> part?

Thierry Redding is working on a standardized binding and converting the
driver to a platform driver. As soon as that's complete and checked in,
we can remove some of these custom init functions.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Warren June 4, 2012, 5:46 p.m. UTC | #3
On 05/17/2012 03:21 PM, Stephen Warren wrote:
> 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 hosts the wired Ethernet controller on TrimSlice.
> 
> To support this, add infra-structure to board-dt-tegra20.c for board-
> specific initialization code. Once device tree support for the relevant
> features is in place, this code will be removed.

Applied for 3.6 (the series).
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index eb7249d..9537f20 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -98,6 +98,40 @@  static void __init tegra_dt_init(void)
 				tegra20_auxdata_lookup, NULL);
 }
 
+#ifdef CONFIG_MACH_TRIMSLICE
+static void __init trimslice_init(void)
+{
+	int ret;
+
+	ret = tegra_pcie_init(true, true);
+	if (ret)
+		pr_err("tegra_pci_init() failed: %d\n", ret);
+}
+#endif
+
+static struct {
+	char *machine;
+	void (*init)(void);
+} board_init_funcs[] = {
+#ifdef CONFIG_MACH_TRIMSLICE
+	{ "compulab,trimslice", trimslice_init },
+#endif
+};
+
+static void __init tegra_dt_init_late(void)
+{
+	int i;
+
+	tegra_init_late();
+
+	for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) {
+		if (of_machine_is_compatible(board_init_funcs[i].machine)) {
+			board_init_funcs[i].init();
+			break;
+		}
+	}
+}
+
 static const char *tegra20_dt_board_compat[] = {
 	"nvidia,tegra20",
 	NULL
@@ -110,7 +144,7 @@  DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)")
 	.handle_irq	= gic_handle_irq,
 	.timer		= &tegra_timer,
 	.init_machine	= tegra_dt_init,
-	.init_late	= tegra_init_late,
+	.init_late	= tegra_dt_init_late,
 	.restart	= tegra_assert_system_reset,
 	.dt_compat	= tegra20_dt_board_compat,
 MACHINE_END