Tegra board patches
Subsystems (3)
v3 cover Tegra board patches
Third spin of board patches for .39. They have been tested on harmony and seaboard.
Chances since v2:
* Fixed up a mismerge resulting in a bad sdhci patch for harmony
* Revised seaboard patch based on comments
* Synced up harmony pinmux and seaboard pinmux with runtime debugfs info
Changes since v1:
* I dropped the PCI-e patch since Mike is actively working on fixing up that subsystem, and the reboot patch from Simon went in to Colin's branch already.
PATCH v3 1/6 ARM: tegra: add tegra_gpio_table and tegra_gpio_config
To give one place to setup the pins that are used as GPIOs instead of as their pinmuxed functions. Specifying enabled as false explicitly disables the gpio mode of that pin (if left on by firmware).
This should remove the need for calling these from specific drivers and thus reduce tegra-specific code from them.
--- arch/arm/mach-tegra/board-harmony-pinmux.c | 13 +++++++++++++ arch/arm/mach-tegra/gpio.c | 15 ++++++++++++++- arch/arm/mach-tegra/include/mach/gpio.h | 7 +++++++ 3 files changed, 34 insertions(+), 1 deletions(-)
arch/arm/mach-tegra/board-harmony-pinmux.c +13 -0
@@ -16,7 +16,9 @@#include <linux/kernel.h> #include <mach/pinmux.h> +#include <mach/gpio.h> +#include "gpio-names.h" #include "board-harmony.h" static struct tegra_pingroup_config harmony_pinmux[] = {
@@ -138,7 +140,18 @@ static struct tegra_pingroup_config harmony_pinmux[] = { {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, }; +static struct tegra_gpio_table gpio_table[] = { + { .gpio =TEGRA_GPIO_PI5 , .enable = true },/* mmc2 cd */ + { .gpio =TEGRA_GPIO_PH1 , .enable = true },/* mmc2 wp */ + { .gpio =TEGRA_GPIO_PT3 , .enable = true },/* mmc2 pwr */ + { .gpio =TEGRA_GPIO_PH2 , .enable = true },/* mmc4 cd */ + { .gpio =TEGRA_GPIO_PH3 , .enable = true },/* mmc4 wp */ + { .gpio =TEGRA_GPIO_PI6 , .enable = true },/* mmc4 pwr */ +}; +void harmony_pinmux_init (void ) {tegra_pinmux_config_table (harmony_pinmux,ARRAY_SIZE (harmony_pinmux)); + +tegra_gpio_config (gpio_table,ARRAY_SIZE (gpio_table)); }
arch/arm/mach-tegra/gpio.c +14 -1
@@ -378,9 +378,22 @@ static int __init tegra_gpio_init(void)return 0 ; } -postcore_initcall (tegra_gpio_init); +void __init tegra_gpio_config (struct tegra_gpio_table *table,int num) +{ +int i; + +for (i =0 ; i < num; i++) { +int gpio = table[i].gpio; + +if (table[i].enable) +tegra_gpio_enable (gpio); +else +tegra_gpio_disable (gpio); + } +} +#ifdef CONFIG_DEBUG_FS #include <linux/debugfs.h>
arch/arm/mach-tegra/include/mach/gpio.h +7 -0
@@ -20,6 +20,7 @@#ifndef __MACH_TEGRA_GPIO_H#define __MACH_TEGRA_GPIO_H +#include <linux/init.h> #include <mach/irqs.h> #define TEGRA_NR_GPIOS INT_GPIO_NR
@@ -47,6 +48,12 @@ static inline int irq_to_gpio(unsigned int irq)return -EINVAL ; } +struct tegra_gpio_table { +int gpio;/* GPIO number */ +bool enable;/* Enable for GPIO at init? */ +}; + +void __init tegra_gpio_config (struct tegra_gpio_table *table,int num);void tegra_gpio_enable (int gpio);void tegra_gpio_disable (int gpio);
Signature · 1 line
1.7.0.4
PATCH 1/6 ARM: tegra: add tegra_gpio_table and tegra_gpio_config
Hello.
Quoted 8 lines · Olof Johansson
To give one place to setup the pins that are used as GPIOs instead of as their pinmuxed functions. Specifying enabled as false explicitly disables the gpio mode of that pin (if left on by firmware).
This should remove the need for calling these from specific drivers and thus reduce tegra-specific code from them.
Signed-off-by Olof Johansson<[email protected]>
[...]
Quoted 13 lines
arch/arm/mach-tegra/include/mach/gpio.h +1
-0@@ -20,6 +20,7 @@#ifndef __MACH_TEGRA_GPIO_H#define __MACH_TEGRA_GPIO_H +#include <linux/init.h> #include <mach/irqs.h> #define TEGRA_NR_GPIOS INT_GPIO_NR
arch/arm/mach-tegra/include/mach/gpio.h static inline int irq_to_gpio(unsigned int irq) · line 56
Quoted 9 lines
arch/arm/mach-tegra/include/mach/gpio.h +6
-0@@ -47,6 +48,12 @@ static inline int irq_to_gpio(unsigned int irq)return -EINVAL ; } +struct tegra_gpio_table { +int gpio;/* GPIO number */ +bool enable;/* Enable for GPIO at init? */ +}; + +void __init tegra_gpio_config (struct tegra_gpio_table *table,int num);
You don't need to annotate the declaration as __init.
WBR, Sergei
PATCH v3 1/6 ARM: tegra: add tegra_gpio_table and tegra_gpio_config
Hi,
Quoted 3 lines · Sergei Shtylyov
Quoted 1 line
+void
__inittegra_gpio_config(struct tegra_gpio_table *table, int num);? You don't need to annotate the declaration as
__init.
D'oh. Fixed. Thanks.
-Olof
PATCH 1/6 ARM: tegra: add tegra_gpio_table and tegra_gpio_config
In reply to Olof JohanssonCan you split the boardfile changes into their own patch? Also see the below whitespace only change. Other than that, looks good.
On Mon, Feb 21, 2011 at 9:55 PM, Olof Johansson <[email protected]> wrote:
snip
arch/arm/mach-tegra/gpio.c static int __init tegra_gpio_init(void) · line 381
Quoted 10 lines
arch/arm/mach-tegra/gpio.c +0
-1@@ -378,9 +378,22 @@ static int __init tegra_gpio_init(void) ? ? ? ?return 0; ?} - ?postcore_initcall(tegra_gpio_init);
whitespace only change
Quoted 47 lines
arch/arm/mach-tegra/gpio.c +14
-0+void __init tegra_gpio_config (struct tegra_gpio_table *table,int num) +{ + ? ? ? int i; + + ? ? ? for (i = 0; i < num; i++) { + ? ? ? ? ? ? ? int gpio = table[i].gpio; + + ? ? ? ? ? ? ? if (table[i].enable) + ? ? ? ? ? ? ? ? ? ? ? tegra_gpio_enable(gpio); + ? ? ? ? ? ? ? else + ? ? ? ? ? ? ? ? ? ? ? tegra_gpio_disable(gpio); + ? ? ? } +} +?#ifdef
CONFIG_DEBUG_FS?#include <
linux/debugfs.h>arch/arm/mach-tegra/include/mach/gpio.h +0
-0@@ -20,6 +20,7 @@?#ifndef
__MACH_TEGRA_GPIO_H
?#define__MACH_TEGRA_GPIO_H+#include <
linux/init.h>
?#include <mach/irqs.h>?#define
TEGRA_NR_GPIOS? ? ? ?INT_GPIO_NRarch/arm/mach-tegra/include/mach/gpio.h +6
-1@@ -47,6 +48,12 @@ static inline int irq_to_gpio(unsigned int irq) ? ? ? ?return -EINVAL; ?} +struct tegra_gpio_table { + ? ? ? int ? ? gpio; ? /* GPIO number */ + ? ? ? bool ? ?enable; /* Enable for GPIO at init? */ +}; + +void __init tegra_gpio_config (struct tegra_gpio_table *table,int num); ?void tegra_gpio_enable(int gpio); ?void tegra_gpio_disable(int gpio); --1.7.0.4
PATCH v3 1/6 ARM: tegra: add tegra_gpio_table and tegra_gpio_config
Hi
Quoted 2 lines · Erik Gilling
Can you split the boardfile changes into their own patch? ?Also see the below whitespace only change. ?Other than that, looks good.
Ok, done (will push separately, no need to repost just with the split though).
Thanks.
Quoted 5 lines
Quoted 3 lines
?}
-
?postcore_initcall(tegra_gpio_init);whitespace only change
D'oh, sloppy of me. Fixed.
-Olof
PATCH 1/6 ARM: tegra: add tegra_gpio_table and tegra_gpio_config
Cool
Quoted 22 lines · Olof Johansson
Hi
Quoted 2 lines · Erik Gilling
Can you split the boardfile changes into their own patch? ?Also see the below whitespace only change. ?Other than that, looks good.
Ok, done (will push separately, no need to repost just with the split though).
Thanks.
Quoted 5 lines
Quoted 3 lines
?}
-
?postcore_initcall(tegra_gpio_init);whitespace only change
D'oh, sloppy of me. Fixed.
-Olof
PATCH 1/6 ARM: tegra: add tegra_gpio_table and tegra_gpio_config
In reply to Olof JohanssonQuoted 3 lines · Olof Johansson
#include <
linux/kernel.h>
#include <mach/pinmux.h>
+#include <mach/gpio.h>
linux/gpio.h please
PATCH v3 1/6 ARM: tegra: add tegra_gpio_table and tegra_gpio_config
Quoted 6 lines · Russell King - ARM Linux
Quoted 3 lines · Olof Johansson
?#include <
linux/kernel.h>
?#include <mach/pinmux.h>
+#include <mach/gpio.h>
linux/gpio.hplease
Thanks, fixed.
-Olof
PATCH v3 2/6 ARM: tegra: common device resources
In reply to Olof JohanssonAdd a common location to register resources for used on-chip devices that are commonly configured on boards. Devices will be added to this file as more drivers are added that can make use of them.
This is based on work contributed by several people, most of it from Colin Cross and Erik Gilling.
--- arch/arm/mach-tegra/Makefile | 1 + arch/arm/mach-tegra/devices.c | 505 +++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-tegra/devices.h | 46 ++++ 3 files changed, 552 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-tegra/devices.c create mode 100644 arch/arm/mach-tegra/devices.h
arch/arm/mach-tegra/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-y += common.o +obj-y += devices.o obj-y += io.o obj-y += irq.o legacy_irq.o obj-y += clock.o
arch/arm/mach-tegra/devices.c new file +505 -0
505 lines not on this page · raw message
arch/arm/mach-tegra/devices.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v3 3/6 ARM: tegra: remove stale nvidia atag handler
In reply to Olof JohanssonRemove dead atag handling code for nvidia-specific tags.
--- arch/arm/mach-tegra/board-harmony.c | 25 ------------------------- 1 files changed, 0 insertions(+), 25 deletions(-)
arch/arm/mach-tegra/board-harmony.c +0 -25
@@ -35,31 +35,6 @@#include "board-harmony.h" #include "clock.h" -/* NVidia bootloader tags */ -#define ATAG_NVIDIA 0x41000801 - -#define ATAG_NVIDIA_RM 0x1 -#define ATAG_NVIDIA_DISPLAY 0x2 -#define ATAG_NVIDIA_FRAMEBUFFER 0x3 -#define ATAG_NVIDIA_CHIPSHMOO 0x4 -#define ATAG_NVIDIA_CHIPSHMOOPHYS 0x5 -#define ATAG_NVIDIA_PRESERVED_MEM_0 0x10000 -#define ATAG_NVIDIA_PRESERVED_MEM_N 2 -#define ATAG_NVIDIA_FORCE_32 0x7fffffff - -struct tag_tegra { -__u32 bootarg_key; -__u32 bootarg_len; -char bootarg[1 ]; -}; - -static int __init parse_tag_nvidia (const struct tag *tag) -{ - -return 0 ; -} -__tagtable (ATAG_NVIDIA , parse_tag_nvidia); -static struct plat_serial8250_port debug_uart_platform_data[] = { { .membase =IO_ADDRESS (TEGRA_UARTD_BASE ),
Signature · 1 line
1.7.0.4
PATCH 3/6 ARM: tegra: remove stale nvidia atag handler
Quoted 40 lines · Olof Johansson
Remove dead atag handling code for nvidia-specific tags.
Signed-off-by Olof Johansson <[email protected]>---
?arch/arm/mach-tegra/board-harmony.c | ? 25 ------------------------- ?1 files changed, 0 insertions(+), 25 deletions(-)arch/arm/mach-tegra/board-harmony.c +0
-0@@ -35,31 +35,6 @@?#include "
board-harmony.h"
?#include "clock.h"arch/arm/mach-tegra/board-harmony.c +0
-25-/* NVidia bootloader tags */ -#define ATAG_NVIDIA ? ? ? ? ? ?0x41000801 - -#define ATAG_NVIDIA_RM ? ? ? ? ? ? ? ? 0x1 -#define ATAG_NVIDIA_DISPLAY ? ? ? ? ? ?0x2 -#define ATAG_NVIDIA_FRAMEBUFFER ? ? ? ? ? ? ? ?0x3 -#define ATAG_NVIDIA_CHIPSHMOO ? ? ? ? ?0x4 -#define ATAG_NVIDIA_CHIPSHMOOPHYS ? ? ?0x5 -#define ATAG_NVIDIA_PRESERVED_MEM_0 ? ?0x10000 -#define ATAG_NVIDIA_PRESERVED_MEM_N ? ?2 -#define ATAG_NVIDIA_FORCE_32 ? ? ? ? ? 0x7fffffff - -struct tag_tegra { - ? ? ? __u32 bootarg_key; - ? ? ? __u32 bootarg_len; - ? ? ? char bootarg[1]; -}; - -static int __init parse_tag_nvidia (const struct tag *tag) -{ - - ? ? ? return 0; -} -__tagtable (ATAG_NVIDIA , parse_tag_nvidia); -
Quoted 7 lines
?static struct
plat_serial8250_portdebug_uart_platform_data[] = { ? ? ? ?{
? ? ? ? ? ? ? ?.membase ? ? ? ?=IO_ADDRESS(TEGRA_UARTD_BASE), --
1.7.0.4
Our version of the kernel will never use these atags, so it's better to warn that they are being ignored and get the bootloaders updated.
PATCH v3 4/6 ARM: tegra: harmony: register sdhci devices
In reply to Olof JohanssonAdd the 3 sdhci devices that are available on Harmony as platform devices. Two go to slots (one 4-lane, one 8-lane), and one goes to onboard wifi.
--- arch/arm/mach-tegra/board-harmony.c | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-)
arch/arm/mach-tegra/board-harmony.c +30 -0
@@ -30,10 +30,13 @@#include <mach/iomap.h> #include <mach/irqs.h> +#include <mach/sdhci.h> #include "board.h" #include "board-harmony.h" #include "clock.h" +#include "devices.h" +#include "gpio-names.h" static struct plat_serial8250_port debug_uart_platform_data[] = { {
@@ -59,6 +62,9 @@ static struct platform_device debug_uart = {static struct platform_device *harmony_devices[]__initdata = { &debug_uart, + &tegra_sdhci_device1, + &tegra_sdhci_device2, + &tegra_sdhci_device4, }; static void __init tegra_harmony_fixup(struct machine_desc *desc,
@@ -77,6 +83,26 @@ static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = { { NULL, NULL, 0, 0}, }; + +static struct tegra_sdhci_platform_data sdhci_pdata1 = { + .cd_gpio =-1 , + .wp_gpio =-1 , + .power_gpio =-1 , +}; + +static struct tegra_sdhci_platform_data sdhci_pdata2 = { + .cd_gpio =TEGRA_GPIO_PI5 , + .wp_gpio =TEGRA_GPIO_PH1 , + .power_gpio =TEGRA_GPIO_PT3 , +}; + +static struct tegra_sdhci_platform_data sdhci_pdata4 = { + .cd_gpio =TEGRA_GPIO_PH2 , + .wp_gpio =TEGRA_GPIO_PH3 , + .power_gpio =TEGRA_GPIO_PI6 , + .is_8bit =1 , +}; +static void __init tegra_harmony_init (void ) {tegra_common_init ();
@@ -85,6 +111,10 @@ static void __init tegra_harmony_init(void)harmony_pinmux_init (); + tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1; + tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2; + tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4; +platform_add_devices (harmony_devices,ARRAY_SIZE (harmony_devices)); }
Signature · 1 line
1.7.0.4
PATCH 4/6 ARM: tegra: harmony: register sdhci devices
Hi Olof,
Sorry for jumping late, haven't thought about the proposal below yesterday. I'm not objecting to applying the patch as is, we can refactor the code afterwards as well.
Quoted 65 lines · Olof Johansson
Add the 3 sdhci devices that are available on Harmony as platform devices. Two go to slots (one 4-lane, one 8-lane), and one goes to onboard wifi.
Signed-off-by Olof Johansson <[email protected]>--- arch/arm/mach-tegra/board-harmony.c | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-)arch/arm/mach-tegra/board-harmony.c +26
-0@@ -30,10 +30,13 @@#include <mach/iomap.h> #include <mach/irqs.h> +#include <mach/sdhci.h> #include "board.h" #include "board-harmony.h" #include "clock.h" +#include "devices.h" +#include "gpio-names.h" static struct plat_serial8250_port debug_uart_platform_data[] = { {@@ -59,6 +62,9 @@ static struct platform_device debug_uart = {static struct platform_device *harmony_devices[]__initdata = { &debug_uart, + &tegra_sdhci_device1, + &tegra_sdhci_device2, + &tegra_sdhci_device4, }; static void __init tegra_harmony_fixup(struct machine_desc *desc,@@ -77,6 +83,26 @@ static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = { { NULL, NULL, 0, 0}, }; + +static struct tegra_sdhci_platform_data sdhci_pdata1 = { + .cd_gpio =-1 , + .wp_gpio =-1 , + .power_gpio =-1 , +}; + +static struct tegra_sdhci_platform_data sdhci_pdata2 = { + .cd_gpio =TEGRA_GPIO_PI5 , + .wp_gpio =TEGRA_GPIO_PH1 , + .power_gpio =TEGRA_GPIO_PT3 , +}; + +static struct tegra_sdhci_platform_data sdhci_pdata4 = { + .cd_gpio =TEGRA_GPIO_PH2 , + .wp_gpio =TEGRA_GPIO_PH3 , + .power_gpio =TEGRA_GPIO_PI6 , + .is_8bit =1 , +}; +static void __init tegra_harmony_init (void ) {tegra_common_init ();
arch/arm/mach-tegra/board-harmony.c static void __init tegra_harmony_init(void) · line 117
Quoted 7 lines
arch/arm/mach-tegra/board-harmony.c +4
-0@@ -85,6 +111,10 @@ static void __init tegra_harmony_init(void)harmony_pinmux_init (); + tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1; + tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2; + tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4; +
I think that instead of copying explicit initialization of the platform_data member from board to board we can do something similar to what PXA does. The board file would have to call something like tegra_set_device_X_info(struct tegra_device_X_platform_data *data); and then static registration of platform devices in the board files can be dropped.
For instance, the devices.c would have
void __init tegra_register_device(struct platform_device *dev, void *data)
{
int ret;
dev->dev.platform_data = data;
ret = platform_device_register(dev);
if (ret)
dev_err(&dev->dev, "unable to register device: %d\n", ret);
}void __init tegra_set_sdhci1_info(struct tegra_sdhci_platform_data *info)
{
tegra_register_device(&tegra_sdhci_device1, info);
}and the board files would just call tegra_set_sdhci1_info to pass the platform data for the tegra_sdhci_device1 and register the device.
This way we could reduce amount of copy/paste between the board files. Besides, if/when tegra will be using device trees, handling of the device registration in common place would make the transition easier.
Quoted 3 lines
arch/arm/mach-tegra/board-harmony.c +0
-0platform_add_devices (harmony_devices,ARRAY_SIZE (harmony_devices)); }
Signature · 2 lines
Sincerely yours, Mike.
PATCH v3 4/6 ARM: tegra: harmony: register sdhci devices
Quoted 4 lines · Mike Rapoport
Hi Olof,
Sorry for jumping late, haven't thought about the proposal below yesterday. I'm not objecting to applying the patch as is, we can refactor the code afterwards as well.
Thanks for the input. And yeah, I'd say we can refactor later when we see how things will fit well with flat devicetrees. More below.
Quoted 36 lines
Review static void __init tegra_harmony_init(void) · line 117
Quoted 11 lines
?static void
__inittegra_harmony_init(void)
?{
? ? ?tegra_common_init();(quoted diff) +4
-0@@ -85,6 +111,10 @@ static void __init tegra_harmony_init(void) ? ? ? harmony_pinmux_init(); + ? ? tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1; + ? ? tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2; + ? ? tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4; +I think that instead of copying explicit initialization of the
platform_datamember from board to board we can do something similar to what PXA does. The board file would have to call something liketegra_set_device_X_info(struct tegra_device_X_platform_data *data); and then static registration of platform devices in the board files can be dropped.For instance, the
devices.cwould havevoid
__inittegra_register_device(struct platform_device *dev, void *data){
? ? ? ?int ret;? ? ? ?dev->dev.platform_data = data;
? ? ? ?ret =
platform_device_register(dev);
? ? ? ?if (ret)
? ? ? ? ? ? ? ?dev_err(&dev->dev, "unable to register device: %d\n", ret); }void
__inittegra_set_sdhci1_info(struct tegra_sdhci_platform_data *info){
? ? ? ?tegra_register_device(&tegra_sdhci_device1, info);
}
Quoted 6 lines
and the board files would just call
tegra_set_sdhci1_infoto pass the platform data for thetegra_sdhci_device1and register the device.This way we could reduce amount of copy/paste between the board files. Besides, if/when tegra will be using device trees, handling of the device registration in common place would make the transition easier.
I don't see how that reduces the amount of copy and paste (significantly), since you still need the platform_data defined per board so you'll need to add the calls there. Maybe a generic "set_platform_data" hook instead of doing the pointer assignment open-coded would be an improvement though.
I'm personally not a fan of the style where data is described as code, i.e. where there would be a tegra_set_<dev>_info function for every possible device out there. If anything that adds to the amount of copy-and-paste (per device), when it could just be handled with one common function being passed the appropriate data (i.e. like tegra_register_device).
Anyway, I'm not looking to argue over it. :) I think we'll see when the FDT pieces start to take shape what kind of model will work well, and there's no reason to do premature refactoring.
-Olof
PATCH 4/6 ARM: tegra: harmony: register sdhci devices
Quoted 53 lines · Olof Johansson
Quoted 4 lines · Mike Rapoport
Hi Olof,
Sorry for jumping late, haven't thought about the proposal below yesterday. I'm not objecting to applying the patch as is, we can refactor the code afterwards as well.Thanks for the input. And yeah, I'd say we can refactor later when we see how things will fit well with flat devicetrees. More below.
Quoted 36 lines
Review static void __init tegra_harmony_init(void) · line 117
Quoted 11 lines
?static void
__inittegra_harmony_init(void)
?{
? ? ?tegra_common_init();(quoted diff) +4
-0@@ -85,6 +111,10 @@ static void __init tegra_harmony_init(void) ? ? ? harmony_pinmux_init(); + ? ? tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1; + ? ? tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2; + ? ? tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4; +I think that instead of copying explicit initialization of the
platform_datamember from board to board we can do something similar to what PXA does. The board file would have to call something liketegra_set_device_X_info(struct tegra_device_X_platform_data *data); and then static registration of platform devices in the board files can be dropped.For instance, the
devices.cwould havevoid
__inittegra_register_device(struct platform_device *dev, void *data){
? ? ? ?int ret;? ? ? ?dev->dev.platform_data = data;
? ? ? ?ret =
platform_device_register(dev);
? ? ? ?if (ret)
? ? ? ? ? ? ? ?dev_err(&dev->dev, "unable to register device: %d\n", ret); }void
__inittegra_set_sdhci1_info(struct tegra_sdhci_platform_data *info){
? ? ? ?tegra_register_device(&tegra_sdhci_device1, info);
}Quoted 6 lines
and the board files would just call
tegra_set_sdhci1_infoto pass the platform data for thetegra_sdhci_device1and register the device.This way we could reduce amount of copy/paste between the board files. Besides, if/when tegra will be using device trees, handling of the device registration in common place would make the transition easier.
Quoted 5 lines
I don't see how that reduces the amount of copy and paste (significantly), since you still need the
platform_datadefined per board so you'll need to add the calls there. Maybe a generic "set_platform_data" hook instead of doing the pointer assignment open-coded would be an improvement though.
Option 3 is to use a bus notifier to attach additional platform data when the device gets registered. That is turning out to be the cleanest solution when it comes to getting additional pdata to a device that is pulled out of the dt, and this sounds like a similar situation.
Quoted 7 lines
I'm personally not a fan of the style where data is described as code, i.e. where there would be a tegra_set_<dev>_info function for every possible device out there. If anything that adds to the amount of copy-and-paste (per device), when it could just be handled with one common function being passed the appropriate data (i.e. like
tegra_register_device).
+1
Quoted 7 lines
Anyway, I'm not looking to argue over it. :) I think we'll see when the FDT pieces start to take shape what kind of model will work well, and there's no reason to do premature refactoring.
-Olof
PATCH 4/6 ARM: tegra: harmony: register sdhci devices
In reply to Olof JohanssonQuoted 76 lines · Olof Johansson
Add the 3 sdhci devices that are available on Harmony as platform devices. Two go to slots (one 4-lane, one 8-lane), and one goes to onboard wifi.
Signed-off-by Olof Johansson <[email protected]>---
?arch/arm/mach-tegra/board-harmony.c | ? 30 ++++++++++++++++++++++++++++++ ?1 files changed, 30 insertions(+), 0 deletions(-)arch/arm/mach-tegra/board-harmony.c +0
-0@@ -30,10 +30,13 @@?#include <
mach/iomap.h>
?#include <mach/irqs.h>
+#include <mach/sdhci.h>?#include "
board.h"
?#include "board-harmony.h"
?#include "clock.h"arch/arm/mach-tegra/board-harmony.c +2
-0+#include "devices.h" +#include "gpio-names.h" ?static struct
plat_serial8250_portdebug_uart_platform_data[] = { ? ? ? ?{arch/arm/mach-tegra/board-harmony.c +27
-1@@ -59,6 +62,9 @@ static struct platform_device debug_uart = { ?static struct platform_device *harmony_devices[] __initdata = { ? ? ? ?&debug_uart, + ? ? ? &tegra_sdhci_device1, + ? ? ? &tegra_sdhci_device2, + ? ? ? &tegra_sdhci_device4, ?}; ?static void __init tegra_harmony_fixup(struct machine_desc *desc,@@ -77,6 +83,26 @@ static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = { ? ? ? ?{ NULL, ? ? ? ? NULL, ? ? ? ? ? 0, ? ? ? ? ? ? ?0}, ?}; + +static struct tegra_sdhci_platform_data sdhci_pdata1 = { + ? ? ? .cd_gpio ? ? ? ?= -1, + ? ? ? .wp_gpio ? ? ? ?= -1, + ? ? ? .power_gpio ? ? = -1, +}; + +static struct tegra_sdhci_platform_data sdhci_pdata2 = { + ? ? ? .cd_gpio ? ? ? ?= TEGRA_GPIO_PI5, + ? ? ? .wp_gpio ? ? ? ?= TEGRA_GPIO_PH1, + ? ? ? .power_gpio ? ? = TEGRA_GPIO_PT3, +}; + +static struct tegra_sdhci_platform_data sdhci_pdata4 = { + ? ? ? .cd_gpio ? ? ? ?= TEGRA_GPIO_PH2, + ? ? ? .wp_gpio ? ? ? ?= TEGRA_GPIO_PH3, + ? ? ? .power_gpio ? ? = TEGRA_GPIO_PI6, + ? ? ? .is_8bit ? ? ? ?= 1, +}; + ?static void __init tegra_harmony_init(void) ?{ ? ? ? ?tegra_common_init();@@ -85,6 +111,10 @@ static void __init tegra_harmony_init(void) ? ? ? ?harmony_pinmux_init(); + ? ? ? tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1; + ? ? ? tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2; + ? ? ? tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4; + ? ? ? ?platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices)); ?} --
Quoted 3 lines
1.7.0.4
PATCH v3 5/6 ARM: tegra: harmony: fix pinmux for MMC slot
In reply to Olof JohanssonTurns out MMC2 (the bayonet 4-lane port) wasn't enabled in the original pinmux. Fix that.
--- arch/arm/mach-tegra/board-harmony-pinmux.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-tegra/board-harmony-pinmux.c +3 -3
@@ -36,10 +36,10 @@ static struct tegra_pingroup_config harmony_pinmux[] = { {TEGRA_PINGROUP_DAP3, TEGRA_MUX_DAP3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_DAP4, TEGRA_MUX_DAP4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_DDC, TEGRA_MUX_I2C2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, - {TEGRA_PINGROUP_DTA, TEGRA_MUX_SDIO2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, - {TEGRA_PINGROUP_DTB, TEGRA_MUX_RSVD1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, + {TEGRA_PINGROUP_DTA, TEGRA_MUX_SDIO2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, + {TEGRA_PINGROUP_DTB, TEGRA_MUX_RSVD1, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_DTC, TEGRA_MUX_RSVD1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, - {TEGRA_PINGROUP_DTD, TEGRA_MUX_SDIO2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, + {TEGRA_PINGROUP_DTD, TEGRA_MUX_SDIO2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_DTE, TEGRA_MUX_RSVD1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_DTF, TEGRA_MUX_I2C3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_GMA, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
Signature · 1 line
1.7.0.4
PATCH v3 6/6 ARM: tegra: add seaboard, wario and kaen boards
In reply to Olof JohanssonThis adds board support for the Seaboard eval platform and some of the derivatives that are very similar. Since they only differ in some very minor ways, most of the code is shared.
--- arch/arm/mach-tegra/Kconfig | 17 +++ arch/arm/mach-tegra/Makefile | 3 + arch/arm/mach-tegra/board-seaboard-pinmux.c | 179 ++++++++++++++++++++++++ arch/arm/mach-tegra/board-seaboard.c | 195 +++++++++++++++++++++++++++ arch/arm/mach-tegra/board-seaboard.h | 38 +++++ 5 files changed, 432 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-tegra/board-seaboard-pinmux.c create mode 100644 arch/arm/mach-tegra/board-seaboard.c create mode 100644 arch/arm/mach-tegra/board-seaboard.h
arch/arm/mach-tegra/Kconfig +17 -0
@@ -27,12 +27,29 @@ config MACH_HARMONY help Support for nVidia Harmony development platform +config MACH_KAEN + bool "Kaen board" + select MACH_SEABOARD + help + Support for the Kaen version of Seaboard + +config MACH_SEABOARD + bool "Seaboard board family" + help + Support for nVidia Seaboard development platform + config MACH_TRIMSLICE bool "TrimSlice board" select TEGRA_PCI help Support for CompuLab TrimSlice platform +config MACH_WARIO + bool "Wario board" + select MACH_SEABOARD + help + Support for the Wario version of Seaboard + choice prompt "Low-level debug console UART" default TEGRA_DEBUG_UART_NONE
arch/arm/mach-tegra/Makefile +3 -0
@@ -22,5 +22,8 @@ obj-${CONFIG_MACH_HARMONY} += board-harmony.o obj-${CONFIG_MACH_HARMONY} += board-harmony-pinmux.o obj-${CONFIG_MACH_HARMONY} += board-harmony-pcie.o +obj-${CONFIG_MACH_SEABOARD} += board-seaboard.o +obj-${CONFIG_MACH_SEABOARD} += board-seaboard-pinmux.o + obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice.o obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice-pinmux.o
arch/arm/mach-tegra/board-seaboard-pinmux.c new file +179 -0
179 lines not on this page · raw message
arch/arm/mach-tegra/board-seaboard.c new file +195 -0
195 lines not on this page · raw message
arch/arm/mach-tegra/board-seaboard.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* arch/arm/mach-tegra/board-seaboard.h +* +* Copyright (C) 2010 Google, Inc. +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that 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. +* +*/ + +#ifndef _MACH_TEGRA_BOARD_SEABOARD_H +#define _MACH_TEGRA_BOARD_SEABOARD_H + +#define TEGRA_GPIO_LIDSWITCH TEGRA_GPIO_PC7 +#define TEGRA_GPIO_USB1 TEGRA_GPIO_PD0 +#define TEGRA_GPIO_POWERKEY TEGRA_GPIO_PV2 +#define TEGRA_GPIO_BACKLIGHT TEGRA_GPIO_PD4 +#define TEGRA_GPIO_LVDS_SHUTDOWN TEGRA_GPIO_PB2 +#define TEGRA_GPIO_BACKLIGHT_PWM TEGRA_GPIO_PU5 +#define TEGRA_GPIO_BACKLIGHT_VDD TEGRA_GPIO_PW0 +#define TEGRA_GPIO_EN_VDD_PNL TEGRA_GPIO_PC6 +#define TEGRA_GPIO_MAGNETOMETER TEGRA_GPIO_PN5 +#define TEGRA_GPIO_ISL29018_IRQ TEGRA_GPIO_PZ2 +#define TEGRA_GPIO_AC_ONLINE TEGRA_GPIO_PV3 + +#define TPS_GPIO_BASE TEGRA_NR_GPIOS + +#define TPS_GPIO_WWAN_PWR (TPS_GPIO_BASE + 2) + +void seaboard_pinmux_init (void ); + +#endif
Signature · 1 line
1.7.0.4
PATCH 6/6 ARM: tegra: add seaboard, wario and kaen boards
Quoted 5 lines · Olof Johansson
This adds board support for the Seaboard eval platform and some of the derivatives that are very similar. Since they only differ in some very minor ways, most of the code is shared.
Signed-off-by Olof Johansson <[email protected]>
<snip>
Quoted 2 lines
+config
MACH_SEABOARD
+ ? ? ? bool "Seaboard board family"
Nit: is the Seaboard a family or a board or both? If both, maybe "Seaboard and family of related boards" or something similar?
<snip>
Quoted 1 line
+#include <
mach/io.h>
linux/io.h?
Other than that, Acked-by: Colin Cross <[email protected]>
PATCH 6/6 ARM: tegra: add seaboard, wario and kaen boards
In reply to Olof JohanssonQuoted 12 lines · Olof Johansson
+++
b/arch/arm/mach-tegra/board-seaboard-pinmux.carch/arm/mach-tegra/board-seaboard-pinmux.c new file +10
-0@@ -0,0 +1,179 @@ +/* +* Copyright (C) 2010 NVIDIA Corporation +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
arch/arm/mach-tegra/board-seaboard-pinmux.c line 20
Quoted 10 lines
arch/arm/mach-tegra/board-seaboard-pinmux.c new file +10
-0+* GNU General Public License for more details. +* +*/ + +#include <linux/kernel.h> +#include <linux/init.h> + +#include <mach/pinmux.h> +#include <mach/pinmux-t2.h> +#include <mach/gpio.h>
Another linux/gpio.h please.
PATCH v3 6/6 ARM: tegra: add seaboard, wario and kaen boards
Quoted 3 lines · Russell King - ARM Linux
Quoted 1 line
+#include <
mach/gpio.h>Another
linux/gpio.hplease.
Another d'oh. Thanks.
mach/io.h and mach/gpio.h seem to be common mistakes in general. I'll look at adding it to checkpatch while I'm still annoyed at having made the mistakes. :)
-olof