ARM: tegra: Unify board-dt-tegra{20,30,114}
Subsystems (3)
cover ARM: tegra: Unify board-dt-tegra{20,30,114}
Hi,
Common Clock Framework(CCF) has been introduced in Tegra recently, which could allow us to unify board-dt-tegra{20,30,114} and to have a single DT board file as Arnd Bergmann suggested originally[1]. Still there are some driver specific code from USB/PCIE. They would be reverted/removed as the new DT supports are coming soon.
Verified that Dalmore(Tegra114) booted. Testing with Tegra20/Tegra30 based board would be appreciated.
The following changes since commit 82c2958263492ca8d23c5f07e183600f951edbe5:
ARM: set evt->broadcast for clock_event devices (2013-02-06 14:11:09 -0700)
are available in the git repository at:
git://nv-tegra.nvidia.com/user/hdoyu/linux unify-board-dt
for you to fetch changes up to b2c8557932fbe558fbec2932c98882e47478bdf1:
ARM: tegra: Restore USB/PCIE info in new DT board file (2013-02-08 09:23:13 +0200)
----------------------------------------------------------------
Hiroshi Doyu (4):
ARM: tegra: Unify tegra{20,30,114}_init_early()
ARM: tegra: Unify board-dt-tegra{30,114}.c
ARM: tegra: Unify board-dt-tegra{20,30}.c to tegra.c
ARM: tegra: Restore USB/PCIE info in new DT board file
arch/arm/mach-tegra/Makefile | 5 +- arch/arm/mach-tegra/board-dt-tegra114.c | 46 ---------- arch/arm/mach-tegra/board-dt-tegra20.c | 2 +- arch/arm/mach-tegra/board-dt-tegra30.c | 60 ------------- arch/arm/mach-tegra/board.h | 4 +- arch/arm/mach-tegra/common.c | 26 +----- arch/arm/mach-tegra/hotplug.c | 31 ++++--- arch/arm/mach-tegra/sleep.h | 10 +-- arch/arm/mach-tegra/tegra.c | 148 +++++++++++++++++++++++++++++++ 9 files changed, 176 insertions(+), 156 deletions(-) delete mode 100644 arch/arm/mach-tegra/board-dt-tegra114.c delete mode 100644 arch/arm/mach-tegra/board-dt-tegra30.c create mode 100644 arch/arm/mach-tegra/tegra.c
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2013-January/139451.html
PATCH 1/4 ARM: tegra: Unify tegra{20,30,114}_init_early()
Refactored tegra{20,30,114}_init_early() so that we have the unified tegra_init_early().
--- arch/arm/mach-tegra/board-dt-tegra114.c | 2 +- arch/arm/mach-tegra/board-dt-tegra20.c | 2 +- arch/arm/mach-tegra/board-dt-tegra30.c | 4 ++-- arch/arm/mach-tegra/board.h | 4 +--- arch/arm/mach-tegra/common.c | 26 ++------------------------ arch/arm/mach-tegra/hotplug.c | 31 +++++++++++++++++-------------- arch/arm/mach-tegra/sleep.h | 10 +++++----- 7 files changed, 29 insertions(+), 50 deletions(-)
arch/arm/mach-tegra/board-dt-tegra114.c +1 -1
@@ -36,7 +36,7 @@ static const char * const tegra114_dt_board_compat[] = {DT_MACHINE_START (TEGRA114_DT ,"NVIDIA Tegra114 (Flattened Device Tree)" ) .smp = smp_ops(tegra_smp_ops), .map_io = tegra_map_common_io, - .init_early = tegra114_init_early, + .init_early = tegra_init_early, .init_irq = tegra_dt_init_irq, .init_time = clocksource_of_init, .init_machine = tegra114_dt_init,
arch/arm/mach-tegra/board-dt-tegra20.c +1 -1
@@ -145,7 +145,7 @@ static const char *tegra20_dt_board_compat[] = {DT_MACHINE_START (TEGRA_DT ,"nVidia Tegra20 (Flattened Device Tree)" ) .map_io = tegra_map_common_io, .smp = smp_ops(tegra_smp_ops), - .init_early = tegra20_init_early, + .init_early = tegra_init_early, .init_irq = tegra_dt_init_irq, .init_time = clocksource_of_init, .init_machine = tegra_dt_init,
arch/arm/mach-tegra/board-dt-tegra30.c +2 -2
@@ -3,7 +3,7 @@* * NVIDIA Tegra30 device tree board support * -* Copyright (C) 2011 NVIDIA Corporation +* Copyright (C) 2011, 2013, NVIDIA Corporation * * Derived from: *
@@ -50,7 +50,7 @@ static const char *tegra30_dt_board_compat[] = {DT_MACHINE_START (TEGRA30_DT ,"NVIDIA Tegra30 (Flattened Device Tree)" ) .smp = smp_ops(tegra_smp_ops), .map_io = tegra_map_common_io, - .init_early = tegra30_init_early, + .init_early = tegra_init_early, .init_irq = tegra_dt_init_irq, .init_time = clocksource_of_init, .init_machine = tegra30_dt_init,
arch/arm/mach-tegra/board.h +1 -3
@@ -26,9 +26,7 @@void tegra_assert_system_reset (char mode,const char *cmd); -void __init tegra20_init_early (void ); -void __init tegra30_init_early (void ); -void __init tegra114_init_early (void ); +void __init tegra_init_early (void );void __init tegra_map_common_io (void );void __init tegra_init_irq (void );void __init tegra_dt_init_irq (void );
arch/arm/mach-tegra/common.c +2 -24
@@ -94,7 +94,7 @@ static void __init tegra_init_cache(void) } -static void __init tegra_init_early (void ) +void __init tegra_init_early (void ) {tegra_cpu_reset_handler_init ();tegra_apb_io_init ();
@@ -102,31 +102,9 @@ static void __init tegra_init_early(void)tegra_init_cache ();tegra_pmc_init ();tegra_powergate_init (); +tegra_hotplug_init (); } -#ifdef CONFIG_ARCH_TEGRA_2x_SOC -void __init tegra20_init_early (void ) -{ -tegra_init_early (); -tegra20_hotplug_init (); -} -#endif - -#ifdef CONFIG_ARCH_TEGRA_3x_SOC -void __init tegra30_init_early (void ) -{ -tegra_init_early (); -tegra30_hotplug_init (); -} -#endif - -#ifdef CONFIG_ARCH_TEGRA_114_SOC -void __init tegra114_init_early (void ) -{ -tegra_init_early (); -} -#endif -void __init tegra_init_late (void ) {tegra_powergate_debugfs_init ();
arch/arm/mach-tegra/hotplug.c +17 -14
@@ -1,8 +1,7 @@/* -* * Copyright (C) 2002 ARM Ltd. * All Rights Reserved -* Copyright (c) 2010, 2012 NVIDIA Corporation. All rights reserved. +* Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -15,6 +14,7 @@#include <asm/cacheflush.h> #include <asm/smp_plat.h> +#include "fuse.h" #include "sleep.h" static void (*tegra_hotplug_shutdown)(void );
@@ -56,18 +56,21 @@ int tegra_cpu_disable(unsigned int cpu)return cpu ==0 ? -EPERM :0 ; } -#ifdef CONFIG_ARCH_TEGRA_2x_SOC -extern void tegra20_hotplug_shutdown (void ); -void __init tegra20_hotplug_init (void ) +void __init tegra_hotplug_init (void ) { - tegra_hotplug_shutdown = tegra20_hotplug_shutdown; -} +switch (tegra_chip_id) { +#ifdef CONFIG_ARCH_TEGRA_2x_SOC +case TEGRA20 : + tegra_hotplug_shutdown = tegra20_hotplug_shutdown; +break ;#endif - -#ifdef CONFIG_ARCH_TEGRA_3x_SOC -extern void tegra30_hotplug_shutdown (void ); -void __init tegra30_hotplug_init (void ) -{ - tegra_hotplug_shutdown = tegra30_hotplug_shutdown; -} +#if defined(CONFIG_ARCH_TEGRA_3x_SOC) +case TEGRA30 : + tegra_hotplug_shutdown = tegra30_hotplug_shutdown; +break ;#endif +default : +BUG_ON (IS_ENABLED (CONFIG_HOTPLUG_CPU )); +break ; + } +}
arch/arm/mach-tegra/sleep.h +5 -5
@@ -1,5 +1,5 @@/* -* Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved. +* Copyright (c) 2010-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,
@@ -124,11 +124,11 @@ int tegra_sleep_cpu_finish(unsigned long);void tegra_disable_clean_inv_dcache (void );#ifdef CONFIG_HOTPLUG_CPU -void tegra20_hotplug_init (void ); -void tegra30_hotplug_init (void ); +void tegra20_hotplug_shutdown (void ); +void tegra30_hotplug_shutdown (void ); +void tegra_hotplug_init (void );#else -static inline void tegra20_hotplug_init (void ) {} -static inline void tegra30_hotplug_init (void ) {} +static inline void tegra_hotplug_init (void ) {}#endif void tegra20_cpu_shutdown (int cpu);
Signature · 1 line
1.7.9.5
Re: [PATCH 1/4] ARM: tegra: Unify tegra{20,30,114}_init_early()
Hi,
Quoted 15 lines · Hiroshi Doyu
arch/arm/mach-tegra/hotplug.c +5
-5@@ -56,18 +56,21 @@ int tegra_cpu_disable(unsigned int cpu)return cpu ==0 ? -EPERM :0 ; } -#ifdef CONFIG_ARCH_TEGRA_2x_SOC -extern void tegra20_hotplug_shutdown (void ); -void __init tegra20_hotplug_init (void ) +void __init tegra_hotplug_init (void ) { - tegra_hotplug_shutdown = tegra20_hotplug_shutdown; -} +switch (tegra_chip_id) { +#ifdef CONFIG_ARCH_TEGRA_2x_SOC +case TEGRA20 : + tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
arch/arm/mach-tegra/hotplug.c int tegra_cpu_disable(unsigned int cpu) · line 67
Quoted 10 lines
arch/arm/mach-tegra/hotplug.c +2
-7+break ;#endif - -#ifdef CONFIG_ARCH_TEGRA_3x_SOC -extern void tegra30_hotplug_shutdown (void ); -void __init tegra30_hotplug_init (void ) -{ - tegra_hotplug_shutdown = tegra30_hotplug_shutdown; -} +#if defined(CONFIG_ARCH_TEGRA_3x_SOC)
how about using:
#if IS_BUILTIN(CONFIG_ARCH_TEGRA_3x_SOC)
instead ?
Quoted 12 lines
arch/arm/mach-tegra/sleep.h +1
-1@@ -1,5 +1,5 @@/* -* Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved. +* Copyright (c) 2010-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,
arch/arm/mach-tegra/sleep.h int tegra_sleep_cpu_finish(unsigned long); · line 128
Quoted 7 lines
arch/arm/mach-tegra/sleep.h +2
-2@@ -124,11 +124,11 @@ int tegra_sleep_cpu_finish(unsigned long);void tegra_disable_clean_inv_dcache (void );#ifdef CONFIG_HOTPLUG_CPU -void tegra20_hotplug_init (void ); -void tegra30_hotplug_init (void ); +void tegra20_hotplug_shutdown (void ); +void tegra30_hotplug_shutdown (void );
aren't these two called only by tegra_hotplug_init() now ? That means they don't need to be exposed.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130208/78dcda85/attachment-0001.sig>
Re: [PATCH 1/4] ARM: tegra: Unify tegra{20,30,114}_init_early()
Hi Felipe,
Felipe Balbi <[email protected]> wrote @ Fri, 8 Feb 2013 08:47:20 +0100:
Quoted 7 lines
Quoted 1 line
+#if
defined(CONFIG_ARCH_TEGRA_3x_SOC)how about using:
#if
IS_BUILTIN(CONFIG_ARCH_TEGRA_3x_SOC)instead ?
Why is IS_BUILTIN() prefered?
Quoted 6 lines
arch/arm/mach-tegra/sleep.h int tegra_sleep_cpu_finish(unsigned long); · line 128
Quoted 4 lines
arch/arm/mach-tegra/sleep.h +2
-2-void tegra20_hotplug_init (void ); -void tegra30_hotplug_init (void ); +void tegra20_hotplug_shutdown (void ); +void tegra30_hotplug_shutdown (void );aren't these two called only by
tegra_hotplug_init()now ?
Yes
Quoted 1 line
That means they don't need to be exposed.
tegra{20,30}_hotplug_shutdown are defined in sleep-tegra{20,30}.S and used in hotplug.c So I think that the above are necessary here.
Re: [PATCH 1/4] ARM: tegra: Unify tegra{20,30,114}_init_early()
Quoted 10 lines · Hiroshi Doyu
Quoted 7 lines
Quoted 1 line
+#if
defined(CONFIG_ARCH_TEGRA_3x_SOC)how about using:
#if
IS_BUILTIN(CONFIG_ARCH_TEGRA_3x_SOC)instead ?
Why is
IS_BUILTIN()prefered?
Inside of a function, if(IS_ENABLED(CONFIG_FOO)) or the respective IS_BUILTIN is preferred over #ifdef because it provides better compile coverage and better readability. Also, IS_ENABLED() is nice when you want to check if something is builtin or module, without having to write a complex expression.
If you just replace the #ifdef with #if IS_BUILTIN as Felipe suggested, I see no real benefit, but it would be nice to write this as
void __init tegra_hotplug_init(void)
{
if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
return;
if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC)) && tegra_chip_id == TEGRA20)
tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC)) && tegra_chip_id == TEGRA30)
tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
}which completely avoids all preprocessor conditionals and replaces them with compile-time choices based on constant expressions to eliminate the code paths for disabled platforms.
Arnd
Re: [PATCH 1/4] ARM: tegra: Unify tegra{20,30,114}_init_early()
In reply to Hiroshi DoyuHiroshi,
Am Freitag, 8. Februar 2013, 09:29:31 schrieb Hiroshi Doyu:
Quoted 4 lines
Refactored tegra{20,30,114}_init_early() so that we have the unified
tegra_init_early().Signed-off-by Hiroshi Doyu <[email protected]>
[...]
Quoted 46 lines
arch/arm/mach-tegra/hotplug.c +8
-14@@ -1,8 +1,7 @@/* -* * Copyright (C) 2002 ARM Ltd. * All Rights Reserved -* Copyright (c) 2010, 2012 NVIDIA Corporation. All rights reserved. +* Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -15,6 +14,7 @@#include <asm/cacheflush.h> #include <asm/smp_plat.h> +#include "fuse.h" #include "sleep.h" static void (*tegra_hotplug_shutdown)(void );@@ -56,18 +56,21 @@ int tegra_cpu_disable(unsigned int cpu)return cpu ==0 ? -EPERM :0 ; } -#ifdef CONFIG_ARCH_TEGRA_2x_SOC -extern void tegra20_hotplug_shutdown (void ); -void __init tegra20_hotplug_init (void ) +void __init tegra_hotplug_init (void ) { - tegra_hotplug_shutdown = tegra20_hotplug_shutdown; -} +switch (tegra_chip_id) { +#ifdef CONFIG_ARCH_TEGRA_2x_SOC +case TEGRA20 : + tegra_hotplug_shutdown = tegra20_hotplug_shutdown; +break ;#endif - -#ifdef CONFIG_ARCH_TEGRA_3x_SOC -extern void tegra30_hotplug_shutdown (void ); -void __init tegra30_hotplug_init (void ) -{ - tegra_hotplug_shutdown = tegra30_hotplug_shutdown; -}
arch/arm/mach-tegra/hotplug.c int tegra_cpu_disable(unsigned int cpu) · line 76
Quoted 10 lines
arch/arm/mach-tegra/hotplug.c +9
-0+#if defined(CONFIG_ARCH_TEGRA_3x_SOC) +case TEGRA30 : + tegra_hotplug_shutdown = tegra30_hotplug_shutdown; +break ;#endif +default : +BUG_ON (IS_ENABLED (CONFIG_HOTPLUG_CPU )); +break ; + } +}
are these ifdefs really needed? Multisoc kernels will enable them all anyway and there is a case structure which protects the assignments. Also the hotplug functions are very tiny, so there shouldn't be a big loss.
Marc
Re: [PATCH 1/4] ARM: tegra: Unify tegra{20,30,114}_init_early()
Quoted 22 lines · Marc Dietrich
Hiroshi,
Am Freitag, 8. Februar 2013, 09:29:31 schrieb Hiroshi Doyu:
Quoted 19 lines
Refactored tegra{20,30,114}_init_early() so that we have the unified
tegra_init_early().arch/arm/mach-tegra/hotplug.c +11
-0+void __init tegra_hotplug_init (void ) { +switch (tegra_chip_id) { +#ifdef CONFIG_ARCH_TEGRA_2x_SOC +case TEGRA20 : + tegra_hotplug_shutdown = tegra20_hotplug_shutdown; +break ;#endif +#if defined(CONFIG_ARCH_TEGRA_3x_SOC) +case TEGRA30 : + tegra_hotplug_shutdown = tegra30_hotplug_shutdown; +break ;#endif +default :
Quoted 8 lines
arch/arm/mach-tegra/hotplug.c int tegra_cpu_disable(unsigned int cpu) · line 76
Quoted 4 lines
arch/arm/mach-tegra/hotplug.c +4
-0+BUG_ON (IS_ENABLED (CONFIG_HOTPLUG_CPU )); +break ; + } +}are these ifdefs really needed? Multisoc kernels will enable them all anyway and there is a case structure which protects the assignments. Also the hotplug functions are very tiny, so there shouldn't be a big loss.
The files that contain/implement those functions are separate for each SoC and only included in the build when the individual SoCs are enabled.
While multi-platform SoCs do make sense for distros, we also very specifically want to support the case where only Tegra, and only a single Tegra SoC, is enabled, hence this separation.
(and Tegra doesn't support multi-platform yet; maybe in another kernel release or two)
Re: [PATCH 1/4] ARM: tegra: Unify tegra{20,30,114}_init_early()
Quoted 39 lines · On Friday 08 February 2013 10:09:10 Stephen Warren wrote:
Quoted 28 lines · Marc Dietrich
Hiroshi,
Am Freitag, 8. Februar 2013, 09:29:31 schrieb Hiroshi Doyu:
Quoted 25 lines
Refactored tegra{20,30,114}_init_early() so that we have the unified
tegra_init_early().arch/arm/mach-tegra/hotplug.c +10
-0+void __init tegra_hotplug_init (void ) { +switch (tegra_chip_id) { +#ifdef CONFIG_ARCH_TEGRA_2x_SOC +case TEGRA20 : + tegra_hotplug_shutdown = tegra20_hotplug_shutdown; +break ;#endif +#if defined(CONFIG_ARCH_TEGRA_3x_SOC) +case TEGRA30 : + tegra_hotplug_shutdown = tegra30_hotplug_shutdown; +break ;#endif Quoted 9 lines
arch/arm/mach-tegra/hotplug.c int tegra_cpu_disable(unsigned int cpu) · line 76
Quoted 5 lines
arch/arm/mach-tegra/hotplug.c +5
-0+default : +BUG_ON (IS_ENABLED (CONFIG_HOTPLUG_CPU )); +break ; + } +}are these ifdefs really needed? Multisoc kernels will enable them all anyway and there is a case structure which protects the assignments. Also the hotplug functions are very tiny, so there shouldn't be a big loss.
Quoted 6 lines
The files that contain/implement those functions are separate for each SoC and only included in the build when the individual SoCs are enabled.
While multi-platform SoCs do make sense for distros, we also very specifically want to support the case where only Tegra, and only a single Tegra SoC, is enabled, hence this separation.
Huh? so tegra_defconfig is not supported?
grep "TEGRA_.*_SOC" tegra_defconfig:
CONFIG_ARCH_TEGRA_2x_SOC=y
CONFIG_ARCH_TEGRA_3x_SOC=y
Marc
Re: [PATCH 1/4] ARM: tegra: Unify tegra{20,30,114}_init_early()
Quoted 7 lines · Marc Dietrich
Quoted 6 lines · On Friday 08 February 2013 10:09:10 Stephen Warren wrote:
Quoted 5 lines · Marc Dietrich
Hiroshi,
Am Freitag, 8. Februar 2013, 09:29:31 schrieb Hiroshi Doyu:
Quoted 2 lines
Refactored tegra{20,30,114}_init_early() so that we have the unified
tegra_init_early().
...
Quoted 11 lines
Quoted 10 lines
Quoted 3 lines
are these ifdefs really needed? Multisoc kernels will enable them all anyway and there is a case structure which protects the assignments. Also the hotplug functions are very tiny, so there shouldn't be a big loss.
The files that contain/implement those functions are separate for each SoC and only included in the build when the individual SoCs are enabled.
While multi-platform SoCs do make sense for distros, we also very specifically want to support the case where only Tegra, and only a single Tegra SoC, is enabled, hence this separation.
Quoted 6 lines
Huh? so
tegra_defconfigis not supported?grep "TEGRA_.*_SOC"
tegra_defconfig:CONFIG_ARCH_TEGRA_2x_SOC=y
CONFIG_ARCH_TEGRA_3x_SOC=y
I don't understand the question.
But to be clear. There are now 3 variants of Tegra supported. (Tegra20, Tegra30, Tegra114). We want to be able to build a minimal-size kernel (e.g. for embedded applications) that supports just one, any combination of two, or all three Tegra variants.
Re: [PATCH 1/4] ARM: tegra: Unify tegra{20,30,114}_init_early()
Quoted 30 lines · On Sunday 10 February 2013 13:20:49 Stephen Warren wrote:
Quoted 7 lines · Marc Dietrich
Quoted 6 lines · On Friday 08 February 2013 10:09:10 Stephen Warren wrote:
Quoted 5 lines · Marc Dietrich
Hiroshi,
Am Freitag, 8. Februar 2013, 09:29:31 schrieb Hiroshi Doyu:
Quoted 2 lines
Refactored tegra{20,30,114}_init_early() so that we have the unified
tegra_init_early()....
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines
are these ifdefs really needed? Multisoc kernels will enable them all anyway and there is a case structure which protects the assignments. Also
the hotplug functions are very tiny, so there shouldn't be a big loss.The files that contain/implement those functions are separate for each SoC and only included in the build when the individual SoCs are enabled.
While multi-platform SoCs do make sense for distros, we also very specifically want to support the case where only Tegra, and only a single Tegra SoC, is enabled, hence this separation.
Quoted 6 lines
Huh? so
tegra_defconfigis not supported?grep "TEGRA_.*_SOC"
tegra_defconfig:CONFIG_ARCH_TEGRA_2x_SOC=y
CONFIG_ARCH_TEGRA_3x_SOC=y
Quoted 6 lines
I don't understand the question.
But to be clear. There are now 3 variants of Tegra supported. (Tegra20, Tegra30, Tegra114). We want to be able to build a minimal-size kernel (e.g. for embedded applications) that supports just one, any combination of two, or all three Tegra variants.
ah, ok - I just skipped the "also" in your sentence above. But still, the #ifdefs look strange to me and save only a few byte of code. Just me few cents.
Marc
Re: [PATCH 1/4] ARM: tegra: Unify tegra{20,30,114}_init_early()
Hi Marc,
Marc Dietrich <[email protected]> wrote @ Sun, 10 Feb 2013 22:16:14 +0100:
Quoted 3 lines
ah, ok - I just skipped the "also" in your sentence above. But still, the #ifdefs look strange to me and save only a few byte of code. Just me few cents.
What about the following as Arnd suggested[1]?
void __init tegra_hotplug_init(void)
{
if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
return;
if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC)) && tegra_chip_id == TEGRA20)
tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC)) && tegra_chip_id == TEGRA30)
tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
}[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2013-February/148632.html
PATCH 2/4 ARM: tegra: Unify board-dt-tegra{30,114}.c
In reply to Hiroshi DoyuRefactored that Tegra114 uses board-dt-tegra30.
--- arch/arm/mach-tegra/Makefile | 2 +- arch/arm/mach-tegra/board-dt-tegra114.c | 46 ------------------------------- arch/arm/mach-tegra/board-dt-tegra30.c | 3 +- 3 files changed, 3 insertions(+), 48 deletions(-) delete mode 100644 arch/arm/mach-tegra/board-dt-tegra114.c
arch/arm/mach-tegra/Makefile +1 -1
@@ -29,7 +29,7 @@ obj-$(CONFIG_TEGRA_PCI) += pcie.o obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-dt-tegra20.o obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o -obj-$(CONFIG_ARCH_TEGRA_114_SOC) += board-dt-tegra114.o +obj-$(CONFIG_ARCH_TEGRA_114_SOC) += board-dt-tegra30.o ifeq ($(CONFIG_CPU_IDLE),y) obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o endif
arch/arm/mach-tegra/board-dt-tegra114.c deleted +0 -46
46 lines not on this page · raw message
arch/arm/mach-tegra/board-dt-tegra30.c +2 -1
@@ -44,10 +44,11 @@ static void __init tegra30_dt_init(void)static const char *tegra30_dt_board_compat[] = {"nvidia,tegra30" , +"nvidia,tegra114" ,NULL }; -DT_MACHINE_START (TEGRA30_DT ,"NVIDIA Tegra30 (Flattened Device Tree)" ) +DT_MACHINE_START (TEGRA30_DT ,"NVIDIA Tegra30/114 (Flattened Device Tree)" ) .smp = smp_ops(tegra_smp_ops), .map_io = tegra_map_common_io, .init_early = tegra_init_early,
Signature · 1 line
1.7.9.5
PATCH 3/4 ARM: tegra: Unify board-dt-tegra{20,30}.c to tegra.c
In reply to Hiroshi DoyuRefactored that Tegra{20,30,114} use the same board file.
---
arch/arm/mach-tegra/Makefile | 5 ++--
.../arm/mach-tegra/{board-dt-tegra30.c => tegra.c} | 27 ++++++++++----------
2 files changed, 15 insertions(+), 17 deletions(-)
rename arch/arm/mach-tegra/{board-dt-tegra30.c => tegra.c} (71%)arch/arm/mach-tegra/Makefile +2 -3
@@ -27,9 +27,8 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o obj-$(CONFIG_TEGRA_PCI) += pcie.o -obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-dt-tegra20.o -obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o -obj-$(CONFIG_ARCH_TEGRA_114_SOC) += board-dt-tegra30.o +obj-y += tegra.o + ifeq ($(CONFIG_CPU_IDLE),y) obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o endif
arch/arm/mach-tegra/tegra.c renamed from arch/arm/mach-tegra/board-dt-tegra30.c +13 -14
@@ -1,14 +1,7 @@/* -* arch/arm/mach-tegra/board-dt-tegra30.c -* -* NVIDIA Tegra30 device tree board support +* NVIDIA Tegra SoC device tree board support * * Copyright (C) 2011, 2013, NVIDIA Corporation -* -* Derived from: -* -* arch/arm/mach-tegra/board-dt-tegra20.c -* * Copyright (C) 2010 Secret Lab Technologies, Ltd. * Copyright (C) 2010 Google, Inc. *
@@ -37,25 +30,31 @@#include "common.h" #include "iomap.h" -static void __init tegra30_dt_init (void ) +static struct of_dev_auxdata tegra_auxdata_lookup[]__initdata = { + {}, +}; + +static void __init tegra_dt_init (void ) { -of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +of_platform_populate (NULL , of_default_bus_match_table, + tegra_auxdata_lookup,NULL ); } -static const char *tegra30_dt_board_compat[] = { +static const char *const tegra_dt_board_compat[] = { +"nvidia,tegra20" ,"nvidia,tegra30" ,"nvidia,tegra114" ,NULL }; -DT_MACHINE_START (TEGRA30_DT ,"NVIDIA Tegra30/114 (Flattened Device Tree)" ) +DT_MACHINE_START (TEGRA_DT ,"NVIDIA Tegra SoC (Flattened Device Tree)" ) .smp = smp_ops(tegra_smp_ops), .map_io = tegra_map_common_io, .init_early = tegra_init_early, .init_irq = tegra_dt_init_irq, .init_time = clocksource_of_init, - .init_machine = tegra30_dt_init, + .init_machine = tegra_dt_init, .init_late = tegra_init_late, .restart = tegra_assert_system_reset, - .dt_compat = tegra30_dt_board_compat, + .dt_compat = tegra_dt_board_compat,MACHINE_END
Signature · 1 line
1.7.9.5
PATCH 4/4 ARM: tegra: Restore USB/PCIE info in new DT board file
In reply to Hiroshi DoyuMainly for the compatibility for the existing driver. This would be removed once new USB/PCIE DT supports come.
--- arch/arm/mach-tegra/tegra.c | 92 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 2 deletions(-)
arch/arm/mach-tegra/tegra.c +90 -2
@@ -23,6 +23,8 @@#include <linux/of_fdt.h> #include <linux/of_irq.h> #include <linux/of_platform.h> +#include <linux/platform_data/tegra_usb.h> +#include <linux/usb/tegra_usb_phy.h> #include <asm/mach/arch.h>
@@ -30,9 +32,63 @@#include "common.h" #include "iomap.h" +#ifdef USB_EHCI_TEGRA +static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = { + .reset_gpio =-1 , + .clk ="cdev2" , +}; + +static struct tegra_ehci_platform_data tegra_ehci_pdata[] = { + { + .operating_mode =TEGRA_USB_OTG , + .power_down_on_bus_suspend =1 , + .vbus_gpio =-1 , + }, + { + .operating_mode =TEGRA_USB_HOST , + .power_down_on_bus_suspend =1 , + .vbus_gpio =-1 , + .phy_config = &tegra_ehci2_ulpi_phy_config, + }, + { + .operating_mode =TEGRA_USB_HOST , + .power_down_on_bus_suspend =1 , + .vbus_gpio =-1 , + }, +}; +static struct of_dev_auxdata tegra_auxdata_lookup[]__initdata = { - {}, +OF_DEV_AUXDATA ("nvidia,tegra20-ehci" ,0xc5000000 ,"tegra-ehci.0" , &tegra_ehci_pdata[0 ]), +OF_DEV_AUXDATA ("nvidia,tegra20-ehci" ,0xc5004000 ,"tegra-ehci.1" , &tegra_ehci_pdata[1 ]), +OF_DEV_AUXDATA ("nvidia,tegra20-ehci" ,0xC5008000 ,"tegra-ehci.2" , &tegra_ehci_pdata[2 ]), + {} }; +#else +#define tegra_auxdata_lookup NULL +#endif + +#if defined(CONFIG_TEGRA_PCI ) && defined(CONFIG_ARCH_TEGRA_2x_SOC) +static void __init trimslice_init (void ) +{ +int err; + + err =tegra_pcie_init (true, true); +if (err) +pr_err ("%s failed: %d\n" , __func__, err); +} +static void __init harmony_init (void ) +{ +harmony_pcie_init (); +} +static void __init paz00_init (void ) +{ +tegra_paz00_wifikill_init (); +} +#else +#define trimslice_init NULL +#define harmony_init NULL +#define paz00_init NULL +#endif static void __init tegra_dt_init (void ) {
@@ -40,6 +96,38 @@ static void __init tegra_dt_init(void) tegra_auxdata_lookup, NULL); } +static void __init tegra_dt_init_late (void ) +{ +int i; +struct { +const char *name; +void (*init)(void ); + } board[] = { + { + .name ="compulab,trimslice" , + .init = trimslice_init, + }, + { + .name ="nvidia,harmony" , + .init = harmony_init, + }, + { + .name ="compal,paz00" , + .init = paz00_init + }, + }; + +tegra_init_late (); + +for (i =0 ; i <ARRAY_SIZE (board); i++) { +if (of_machine_is_compatible (board[i].name)) { +if (board[i].init) + board[i].init (); +break ; + } + } +} +static const char *const tegra_dt_board_compat[] = {"nvidia,tegra20" ,"nvidia,tegra30" ,
@@ -54,7 +142,7 @@ DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)") .init_irq = tegra_dt_init_irq, .init_time = clocksource_of_init, .init_machine = tegra_dt_init, - .init_late = tegra_init_late, + .init_late = tegra_dt_init_late, .restart = tegra_assert_system_reset, .dt_compat = tegra_dt_board_compat,MACHINE_END
Signature · 1 line
1.7.9.5
Re: [PATCH 4/4] ARM: tegra: Restore USB/PCIE info in new DT board file
Quoted 2 lines · Hiroshi Doyu
Mainly for the compatibility for the existing driver. This would be removed once new USB/PCIE DT supports come.
This series makes Tegra20 broken between commit 3/4 and 4/4. Why not do the following instead:
1) Patch 1/4 as-is.
2) Rename board-dt-tegra20.c to tegra.c with no code changes to it.
3) Add Tegra30/114 compatible values into tegra.c, and delete the old Tegra30/114-specific board files.
Fewer patches, and each patch builds and runs on all systems without any issue.