ARM: tegra: remove copy-and-pasted i2c platform data in boards
Subsystems (3)
PATCH 1/2 ARM: tegra: remove copy-and-pasted i2c platform data in boards
Every board file includes the same platform data definition for the i2c-tegra driver's bus speed. Move the platform data into devices.c, and remove it from all the board files.
--- arch/arm/mach-tegra/board-harmony.c | 22 ---------------------- arch/arm/mach-tegra/board-paz00.c | 17 ----------------- arch/arm/mach-tegra/board-seaboard.c | 22 ---------------------- arch/arm/mach-tegra/board-trimslice.c | 17 ----------------- arch/arm/mach-tegra/devices.c | 25 +++++++++++++++++++++---- 5 files changed, 21 insertions(+), 82 deletions(-)
arch/arm/mach-tegra/board-harmony.c +0 -22
@@ -25,7 +25,6 @@#include <linux/io.h> #include <linux/gpio.h> #include <linux/i2c.h> -#include <linux/i2c-tegra.h> #include <sound/wm8903.h>
@@ -83,22 +82,6 @@ static struct platform_device harmony_audio_device = { }, }; -static struct tegra_i2c_platform_data harmony_i2c1_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data harmony_i2c2_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data harmony_i2c3_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data harmony_dvc_platform_data = { - .bus_clk_rate =400000 , -}; -static struct wm8903_platform_data harmony_wm8903_pdata = { .irq_active_low =0 , .micdet_cfg =0 ,
@@ -121,11 +104,6 @@ static struct i2c_board_info __initdata wm8903_board_info = {static void __init harmony_i2c_init (void ) { - tegra_i2c_device1.dev.platform_data = &harmony_i2c1_platform_data; - tegra_i2c_device2.dev.platform_data = &harmony_i2c2_platform_data; - tegra_i2c_device3.dev.platform_data = &harmony_i2c3_platform_data; - tegra_i2c_device4.dev.platform_data = &harmony_dvc_platform_data; -platform_device_register (&tegra_i2c_device1);platform_device_register (&tegra_i2c_device2);platform_device_register (&tegra_i2c_device3);
arch/arm/mach-tegra/board-paz00.c +0 -17
@@ -26,7 +26,6 @@#include <linux/pda_power.h> #include <linux/io.h> #include <linux/i2c.h> -#include <linux/i2c-tegra.h> #include <linux/platform_data/tegra_usb.h> #include <asm/mach-types.h>
@@ -74,24 +73,8 @@ static struct platform_device *paz00_devices[] __initdata = { &tegra_sdhci_device4, }; -static struct tegra_i2c_platform_data paz00_i2c1_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data paz00_i2c2_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data paz00_dvc_platform_data = { - .bus_clk_rate =400000 , -}; -static void paz00_i2c_init (void ) { - tegra_i2c_device1.dev.platform_data = &paz00_i2c1_platform_data; - tegra_i2c_device2.dev.platform_data = &paz00_i2c2_platform_data; - tegra_i2c_device4.dev.platform_data = &paz00_dvc_platform_data; -platform_device_register (&tegra_i2c_device1);platform_device_register (&tegra_i2c_device2);platform_device_register (&tegra_i2c_device4);
arch/arm/mach-tegra/board-seaboard.c +0 -22
@@ -19,7 +19,6 @@#include <linux/platform_device.h> #include <linux/serial_8250.h> #include <linux/i2c.h> -#include <linux/i2c-tegra.h> #include <linux/delay.h> #include <linux/input.h> #include <linux/io.h>
@@ -66,22 +65,6 @@ static __initdata struct tegra_clk_init_table seaboard_clk_init_table[] = { { NULL, NULL, 0, 0}, }; -static struct tegra_i2c_platform_data seaboard_i2c1_platform_data = { - .bus_clk_rate = 400000. -}; - -static struct tegra_i2c_platform_data seaboard_i2c2_platform_data = { - .bus_clk_rate = 400000, -}; - -static struct tegra_i2c_platform_data seaboard_i2c3_platform_data = { - .bus_clk_rate = 400000, -}; - -static struct tegra_i2c_platform_data seaboard_dvc_platform_data = { - .bus_clk_rate = 400000, -}; - static struct gpio_keys_button seaboard_gpio_keys_buttons[] = { { .code = SW_LID,
@@ -161,11 +144,6 @@ static void __init seaboard_i2c_init(void)i2c_register_board_info (4 , &adt7461_device,1 ); - tegra_i2c_device1.dev.platform_data = &seaboard_i2c1_platform_data; - tegra_i2c_device2.dev.platform_data = &seaboard_i2c2_platform_data; - tegra_i2c_device3.dev.platform_data = &seaboard_i2c3_platform_data; - tegra_i2c_device4.dev.platform_data = &seaboard_dvc_platform_data; -platform_device_register (&tegra_i2c_device1);platform_device_register (&tegra_i2c_device2);platform_device_register (&tegra_i2c_device3);
arch/arm/mach-tegra/board-trimslice.c +0 -17
@@ -24,7 +24,6 @@#include <linux/serial_8250.h> #include <linux/io.h> #include <linux/i2c.h> -#include <linux/i2c-tegra.h> #include <linux/platform_data/tegra_usb.h> #include <linux/gpio.h>
@@ -92,18 +91,6 @@ static struct platform_device *trimslice_devices[] __initdata = { &trimslice_audio_device, }; -static struct tegra_i2c_platform_data trimslice_i2c1_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data trimslice_i2c2_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data trimslice_i2c3_platform_data = { - .bus_clk_rate =400000 , -}; -static struct i2c_board_info trimslice_i2c3_board_info[] = { {I2C_BOARD_INFO ("tlv320aic23" ,0x1a ),
@@ -115,10 +102,6 @@ static struct i2c_board_info trimslice_i2c3_board_info[] = {static void trimslice_i2c_init (void ) { - tegra_i2c_device1.dev.platform_data = &trimslice_i2c1_platform_data; - tegra_i2c_device2.dev.platform_data = &trimslice_i2c2_platform_data; - tegra_i2c_device3.dev.platform_data = &trimslice_i2c3_platform_data; -platform_device_register (&tegra_i2c_device1);platform_device_register (&tegra_i2c_device2);platform_device_register (&tegra_i2c_device3);
arch/arm/mach-tegra/devices.c +21 -4
@@ -22,6 +22,7 @@#include <linux/dma-mapping.h> #include <linux/fsl_devices.h> #include <linux/serial_8250.h> +#include <linux/i2c-tegra.h> #include <asm/pmu.h> #include <mach/irqs.h> #include <mach/iomap.h>
@@ -79,13 +80,29 @@ static struct resource i2c_resource4[] = { }, }; +static struct tegra_i2c_platform_data tegra_i2c1_platform_data = { + .bus_clk_rate =400000 , +}; + +static struct tegra_i2c_platform_data tegra_i2c2_platform_data = { + .bus_clk_rate =400000 , +}; + +static struct tegra_i2c_platform_data tegra_i2c3_platform_data = { + .bus_clk_rate =400000 , +}; + +static struct tegra_i2c_platform_data tegra_dvc_platform_data = { + .bus_clk_rate =400000 , +}; +struct platform_device tegra_i2c_device1 = { .name ="tegra-i2c" , .id =0 , .resource = i2c_resource1, .num_resources =ARRAY_SIZE (i2c_resource1), .dev = { - .platform_data =0 , + .platform_data = &tegra_i2c1_platform_data, }, };
@@ -95,7 +112,7 @@ struct platform_device tegra_i2c_device2 = { .resource = i2c_resource2, .num_resources = ARRAY_SIZE(i2c_resource2), .dev = { - .platform_data = 0, + .platform_data = &tegra_i2c2_platform_data, }, };
@@ -105,7 +122,7 @@ struct platform_device tegra_i2c_device3 = { .resource = i2c_resource3, .num_resources = ARRAY_SIZE(i2c_resource3), .dev = { - .platform_data = 0, + .platform_data = &tegra_i2c3_platform_data, }, };
@@ -115,7 +132,7 @@ struct platform_device tegra_i2c_device4 = { .resource = i2c_resource4, .num_resources = ARRAY_SIZE(i2c_resource4), .dev = { - .platform_data = 0, + .platform_data = &tegra_dvc_platform_data, }, };
Signature · 1 line
1.7.4.1
PATCH 2/2 ARM: tegra: remove copy-and-pasted usb platform data from boards
trimslice and paz00 both have functionally identical platform data for the tegra-ehci driver. Move the platform data into devices.c, and remove it from all the board files.
--- arch/arm/mach-tegra/board-paz00.c | 26 -------------------------- arch/arm/mach-tegra/board-trimslice.c | 19 ------------------- arch/arm/mach-tegra/devices.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 45 deletions(-)
arch/arm/mach-tegra/board-paz00.c +0 -26
@@ -26,7 +26,6 @@#include <linux/pda_power.h> #include <linux/io.h> #include <linux/i2c.h> -#include <linux/platform_data/tegra_usb.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -36,7 +35,6 @@#include <mach/iomap.h> #include <mach/irqs.h> #include <mach/sdhci.h> -#include <mach/usb_phy.h> #include <mach/gpio.h> #include "board.h"
@@ -80,32 +78,8 @@ static void paz00_i2c_init(void)platform_device_register (&tegra_i2c_device4); } -static struct tegra_ulpi_config ulpi_phy_config = { - .reset_gpio =TEGRA_ULPI_RST , - .clk ="cdev2" , -}; - -static struct tegra_ehci_platform_data tegra_ehci_pdata[] = { - [0 ] = { - .operating_mode =TEGRA_USB_OTG , - .power_down_on_bus_suspend =1 , - }, - [1 ] = { - .phy_config = &ulpi_phy_config, - .operating_mode =TEGRA_USB_HOST , - .power_down_on_bus_suspend =1 , - }, - [2 ] = { - .operating_mode =TEGRA_USB_HOST , - .power_down_on_bus_suspend =1 , - }, -}; -static void paz00_usb_init (void ) { - tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1 ]; - tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2 ]; -platform_device_register (&tegra_ehci2_device);platform_device_register (&tegra_ehci3_device); }
arch/arm/mach-tegra/board-trimslice.c +0 -19
@@ -24,7 +24,6 @@#include <linux/serial_8250.h> #include <linux/io.h> #include <linux/i2c.h> -#include <linux/platform_data/tegra_usb.h> #include <linux/gpio.h> #include <asm/mach-types.h>
@@ -33,7 +32,6 @@#include <mach/iomap.h> #include <mach/sdhci.h> -#include <mach/usb_phy.h> #include <mach/gpio.h> #include "board.h"
@@ -110,28 +108,12 @@ static void trimslice_i2c_init(void) ARRAY_SIZE(trimslice_i2c3_board_info)); } -struct tegra_ulpi_config ehci2_phy_config = { - .reset_gpio =TRIMSLICE_GPIO_USB2_RST , - .clk ="cdev2" , -}; - -static struct tegra_ehci_platform_data ehci_ulpi_data = { - .operating_mode =TEGRA_USB_HOST , - .phy_config = &ehci2_phy_config, -}; - -static struct tegra_ehci_platform_data ehci_utmi_data = { - .operating_mode =TEGRA_USB_HOST , -}; -static void trimslice_usb_init (void ) {int err; - tegra_ehci3_device.dev.platform_data = &ehci_utmi_data;platform_device_register (&tegra_ehci3_device); - tegra_ehci2_device.dev.platform_data = &ehci_ulpi_data;platform_device_register (&tegra_ehci2_device); err = gpio_request_one(TRIMSLICE_GPIO_USB1_MODE, GPIOF_OUT_INIT_HIGH,
@@ -141,7 +123,6 @@ static void trimslice_usb_init(void)return ; } - tegra_ehci1_device.dev.platform_data = &ehci_utmi_data;platform_device_register (&tegra_ehci1_device); }
arch/arm/mach-tegra/devices.c +28 -0
@@ -23,10 +23,13 @@#include <linux/fsl_devices.h> #include <linux/serial_8250.h> #include <linux/i2c-tegra.h> +#include <linux/platform_data/tegra_usb.h> #include <asm/pmu.h> #include <mach/irqs.h> #include <mach/iomap.h> #include <mach/dma.h> +#include <mach/usb_phy.h> +#include "gpio-names.h" static struct resource i2c_resource1[] = { [0 ] = {
@@ -351,6 +354,28 @@ static struct resource tegra_usb3_resources[] = { }, }; +static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = { +/* All existing boards use GPIO PV0 for phy reset */ + .reset_gpio =TEGRA_GPIO_PV0 , + .clk ="cdev2" , +}; + +static struct tegra_ehci_platform_data tegra_ehci1_pdata = { + .operating_mode =TEGRA_USB_OTG , + .power_down_on_bus_suspend =1 , +}; + +static struct tegra_ehci_platform_data tegra_ehci2_pdata = { + .phy_config = &tegra_ehci2_ulpi_phy_config, + .operating_mode =TEGRA_USB_HOST , + .power_down_on_bus_suspend =1 , +}; + +static struct tegra_ehci_platform_data tegra_ehci3_pdata = { + .operating_mode =TEGRA_USB_HOST , + .power_down_on_bus_suspend =1 , +}; +static u64 tegra_ehci_dmamask =DMA_BIT_MASK (32 );struct platform_device tegra_ehci1_device = {
@@ -359,6 +384,7 @@ struct platform_device tegra_ehci1_device = { .dev = { .dma_mask = &tegra_ehci_dmamask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &tegra_ehci1_pdata, }, .resource = tegra_usb1_resources, .num_resources = ARRAY_SIZE(tegra_usb1_resources),
@@ -370,6 +396,7 @@ struct platform_device tegra_ehci2_device = { .dev = { .dma_mask = &tegra_ehci_dmamask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &tegra_ehci2_pdata, }, .resource = tegra_usb2_resources, .num_resources = ARRAY_SIZE(tegra_usb2_resources),
@@ -381,6 +408,7 @@ struct platform_device tegra_ehci3_device = { .dev = { .dma_mask = &tegra_ehci_dmamask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &tegra_ehci3_pdata, }, .resource = tegra_usb3_resources, .num_resources = ARRAY_SIZE(tegra_usb3_resources),
Signature · 1 line
1.7.4.1
PATCH 1/2 ARM: tegra: remove copy-and-pasted i2c platform data in boards
In reply to Colin CrossColin Cross wrote at Sunday, July 10, 2011 4:20 PM:
Quoted 3 lines
Every board file includes the same platform data definition for the i2c-tegra driver's bus speed. Move the platform data into
devices.c, and remove it from all the board files.
For both these patches, it seems like pure luck that all current board happen to share the same platform data.
Given that they do, the change seems conceptually fine, but I wouldn't necessarily expect any future boards to be able to share the data, and so this change would make any differing future boards work differently to all the existing boards...
I guess the idea is that by the time any new boards come along, Device Tree will be fleshed out enough that we wouldn't need to add code for the new boards, but just a Device Tree file, so my point isn't an issue?
Signature · 1 line
nvpublic
PATCH 1/2 ARM: tegra: remove copy-and-pasted i2c platform data in boards
Quoted 7 lines · Stephen Warren
Colin Cross wrote at Sunday, July 10, 2011 4:20 PM:
Quoted 3 lines
Every board file includes the same platform data definition for the i2c-tegra driver's bus speed. ?Move the platform data into
devices.c, and remove it from all the board files.For both these patches, it seems like pure luck that all current board happen to share the same platform data.
Partially luck, partially that every board here is based on nVidia's reference designs.
Quoted 8 lines
Given that they do, the change seems conceptually fine, but I wouldn't necessarily expect any future boards to be able to share the data, and so this change would make any differing future boards work differently to all the existing boards...
I guess the idea is that by the time any new boards come along, Device Tree will be fleshed out enough that we wouldn't need to add code for the new boards, but just a Device Tree file, so my point isn't an issue?
Either device tree will solve all the world's problems, or I'll add a function to initialize the device that takes whatever data needs to be customized. That can be solved if it ever becomes necessary.
Any other comments or testers? Otherwise, I'll try to get this in the arm-soc tree.
PATCH 2/2 ARM: tegra: remove copy-and-pasted usb platform data from boards
In reply to Colin CrossHi Colin,
Sorry for the delay, I don't have the hardware at the moment, so I asked Konstantin to do the testing.
Quoted 5 lines · Colin Cross
trimslice and paz00 both have functionally identical platform data for the tegra-ehci driver. ?Move the platform data into
devices.c, and remove it from all the board files.Signed-off-by Colin Cross <[email protected]>
For the TrimSlice part:
Quoted 195 lines
---
?arch/arm/mach-tegra/board-paz00.c ? ? | ? 26 -------------------------- ?arch/arm/mach-tegra/board-trimslice.c | ? 19 ------------------- ?arch/arm/mach-tegra/devices.c ? ? ? ? | ? 28 ++++++++++++++++++++++++++++?3 files changed, 28 insertions(+), 45 deletions(-)
arch/arm/mach-tegra/board-paz00.c +0
-0@@ -26,7 +26,6 @@?#include <
linux/pda_power.h>
?#include <linux/io.h>
?#include <linux/i2c.h>
-#include <linux/platform_data/tegra_usb.h>?#include <
asm/mach-types.h>
?#include <asm/mach/arch.h>arch/arm/mach-tegra/board-paz00.c +0
-0@@ -36,7 +35,6 @@?#include <
mach/iomap.h>
?#include <mach/irqs.h>
?#include <mach/sdhci.h>
-#include <mach/usb_phy.h>
?#include <mach/gpio.h>?#include "
board.h"arch/arm/mach-tegra/board-paz00.c +0
-24@@ -80,32 +78,8 @@ static void paz00_i2c_init(void) ? ? ? ?platform_device_register(&tegra_i2c_device4); ?} -static struct tegra_ulpi_config ulpi_phy_config = { - ? ? ? ? ? ? ? .reset_gpio = TEGRA_ULPI_RST, - ? ? ? ? ? ? ? .clk = "cdev2", -}; - -static struct tegra_ehci_platform_data tegra_ehci_pdata[] = { - ? ? ? ? ? ? ? [0] = { - ? ? ? ? ? ? ? ? ? ? ? .operating_mode = TEGRA_USB_OTG, - ? ? ? ? ? ? ? ? ? ? ? .power_down_on_bus_suspend = 1, - ? ? ? ? ? ? ? }, - ? ? ? ? ? ? ? [1] = { - ? ? ? ? ? ? ? ? ? ? ? .phy_config = &ulpi_phy_config, - ? ? ? ? ? ? ? ? ? ? ? .operating_mode = TEGRA_USB_HOST, - ? ? ? ? ? ? ? ? ? ? ? .power_down_on_bus_suspend = 1, - ? ? ? ? ? ? ? }, - ? ? ? ? ? ? ? [2] = { - ? ? ? ? ? ? ? ? ? ? ? .operating_mode = TEGRA_USB_HOST, - ? ? ? ? ? ? ? ? ? ? ? .power_down_on_bus_suspend = 1, - ? ? ? ? ? ? ? }, -}; - ?static void paz00_usb_init(void) ?{ - ? ? ? tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1]; - ? ? ? tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2]; - ? ? ? ?platform_device_register(&tegra_ehci2_device); ? ? ? ?platform_device_register(&tegra_ehci3_device); ?}arch/arm/mach-tegra/board-trimslice.c +0
-0@@ -24,7 +24,6 @@?#include <
linux/serial_8250.h>
?#include <linux/io.h>
?#include <linux/i2c.h>
-#include <linux/platform_data/tegra_usb.h>
?#include <linux/gpio.h>?#include <
asm/mach-types.h>arch/arm/mach-tegra/board-trimslice.c +0
-0@@ -33,7 +32,6 @@?#include <
mach/iomap.h>
?#include <mach/sdhci.h>
-#include <mach/usb_phy.h>
?#include <mach/gpio.h>?#include "
board.h"arch/arm/mach-tegra/board-trimslice.c +0
-17@@ -110,28 +108,12 @@ static void trimslice_i2c_init(void) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ARRAY_SIZE(trimslice_i2c3_board_info)); ?} -struct tegra_ulpi_config ehci2_phy_config = { - ? ? ? .reset_gpio = TRIMSLICE_GPIO_USB2_RST, - ? ? ? .clk = "cdev2", -}; - -static struct tegra_ehci_platform_data ehci_ulpi_data = { - ? ? ? .operating_mode = TEGRA_USB_HOST, - ? ? ? .phy_config = &ehci2_phy_config, -}; - -static struct tegra_ehci_platform_data ehci_utmi_data = { - ? ? ? .operating_mode = TEGRA_USB_HOST, -}; - ?static void trimslice_usb_init(void) ?{ ? ? ? ?int err; - ? ? ? tegra_ehci3_device.dev.platform_data = &ehci_utmi_data; ? ? ? ?platform_device_register(&tegra_ehci3_device); - ? ? ? tegra_ehci2_device.dev.platform_data = &ehci_ulpi_data; ? ? ? ?platform_device_register(&tegra_ehci2_device); ? ? ? ?err = gpio_request_one(TRIMSLICE_GPIO_USB1_MODE, GPIOF_OUT_INIT_HIGH,@@ -141,7 +123,6 @@ static void trimslice_usb_init(void) ? ? ? ? ? ? ? ?return; ? ? ? ?} - ? ? ? tegra_ehci1_device.dev.platform_data = &ehci_utmi_data; ? ? ? ?platform_device_register(&tegra_ehci1_device); ?}arch/arm/mach-tegra/devices.c +0
-0@@ -23,10 +23,13 @@?#include <
linux/fsl_devices.h>
?#include <linux/serial_8250.h>
?#include <linux/i2c-tegra.h>
+#include <linux/platform_data/tegra_usb.h>
?#include <asm/pmu.h>
?#include <mach/irqs.h>
?#include <mach/iomap.h>
?#include <mach/dma.h>arch/arm/mach-tegra/devices.c +2
-0+#include <mach/usb_phy.h> +#include "gpio-names.h" ?static struct resource i2c_resource1[] = {
? ? ? ?[0] = {arch/arm/mach-tegra/devices.c +25
-1@@ -351,6 +354,28 @@ static struct resource tegra_usb3_resources[] = { ? ? ? ?}, ?}; +static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = { + ? ? ? /* All existing boards use GPIO PV0 for phy reset */ + ? ? ? .reset_gpio = TEGRA_GPIO_PV0, + ? ? ? .clk = "cdev2", +}; + +static struct tegra_ehci_platform_data tegra_ehci1_pdata = { + ? ? ? .operating_mode = TEGRA_USB_OTG, + ? ? ? .power_down_on_bus_suspend = 1, +}; + +static struct tegra_ehci_platform_data tegra_ehci2_pdata = { + ? ? ? .phy_config = &tegra_ehci2_ulpi_phy_config, + ? ? ? .operating_mode = TEGRA_USB_HOST, + ? ? ? .power_down_on_bus_suspend = 1, +}; + +static struct tegra_ehci_platform_data tegra_ehci3_pdata = { + ? ? ? .operating_mode = TEGRA_USB_HOST, + ? ? ? .power_down_on_bus_suspend = 1, +}; + ?static u64 tegra_ehci_dmamask = DMA_BIT_MASK(32); ?struct platform_device tegra_ehci1_device = {@@ -359,6 +384,7 @@ struct platform_device tegra_ehci1_device = { ? ? ? ?.dev ? ?= { ? ? ? ? ? ? ? ?.dma_mask ? ? ? = &tegra_ehci_dmamask, ? ? ? ? ? ? ? ?.coherent_dma_mask = DMA_BIT_MASK(32), + ? ? ? ? ? ? ? .platform_data = &tegra_ehci1_pdata, ? ? ? ?}, ? ? ? ?.resource = tegra_usb1_resources, ? ? ? ?.num_resources = ARRAY_SIZE(tegra_usb1_resources),@@ -370,6 +396,7 @@ struct platform_device tegra_ehci2_device = { ? ? ? ?.dev ? ?= { ? ? ? ? ? ? ? ?.dma_mask ? ? ? = &tegra_ehci_dmamask, ? ? ? ? ? ? ? ?.coherent_dma_mask = DMA_BIT_MASK(32), + ? ? ? ? ? ? ? .platform_data = &tegra_ehci2_pdata, ? ? ? ?}, ? ? ? ?.resource = tegra_usb2_resources, ? ? ? ?.num_resources = ARRAY_SIZE(tegra_usb2_resources),@@ -381,6 +408,7 @@ struct platform_device tegra_ehci3_device = { ? ? ? ?.dev ? ?= { ? ? ? ? ? ? ? ?.dma_mask ? ? ? = &tegra_ehci_dmamask, ? ? ? ? ? ? ? ?.coherent_dma_mask = DMA_BIT_MASK(32), + ? ? ? ? ? ? ? .platform_data = &tegra_ehci3_pdata, ? ? ? ?}, ? ? ? ?.resource = tegra_usb3_resources, ? ? ? ?.num_resources = ARRAY_SIZE(tegra_usb3_resources), --1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Sincerely Yours, Mike.
PATCH 1/2 ARM: tegra: remove copy-and-pasted i2c platform data in boards
In reply to Colin CrossHi Colin,
Sorry for the delay, I don't have the hardware at the moment, so I asked Konstantin to do the testing.
Quoted 5 lines · Colin Cross
Every board file includes the same platform data definition for the i2c-tegra driver's bus speed. ?Move the platform data into
devices.c, and remove it from all the board files.Signed-off-by Colin Cross <[email protected]>
For the TrimSlice part:
Quoted 259 lines
---
?arch/arm/mach-tegra/board-harmony.c ? | ? 22 ---------------------- ?arch/arm/mach-tegra/board-paz00.c ? ? | ? 17 ----------------- ?arch/arm/mach-tegra/board-seaboard.c ?| ? 22 ---------------------- ?arch/arm/mach-tegra/board-trimslice.c | ? 17 ----------------- ?arch/arm/mach-tegra/devices.c ? ? ? ? | ? 25 +++++++++++++++++++++----?5 files changed, 21 insertions(+), 82 deletions(-)
arch/arm/mach-tegra/board-harmony.c +0
-0@@ -25,7 +25,6 @@?#include <
linux/io.h>
?#include <linux/gpio.h>
?#include <linux/i2c.h>
-#include <linux/i2c-tegra.h>?#include <
sound/wm8903.h>arch/arm/mach-tegra/board-harmony.c +0
-21@@ -83,22 +82,6 @@ static struct platform_device harmony_audio_device = { ? ? ? ?}, ?}; -static struct tegra_i2c_platform_data harmony_i2c1_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - -static struct tegra_i2c_platform_data harmony_i2c2_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - -static struct tegra_i2c_platform_data harmony_i2c3_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - -static struct tegra_i2c_platform_data harmony_dvc_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - ?static struct wm8903_platform_data harmony_wm8903_pdata = { ? ? ? ?.irq_active_low = 0, ? ? ? ?.micdet_cfg = 0,@@ -121,11 +104,6 @@ static struct i2c_board_info __initdata wm8903_board_info = { ?static void __init harmony_i2c_init(void) ?{ - ? ? ? tegra_i2c_device1.dev.platform_data = &harmony_i2c1_platform_data; - ? ? ? tegra_i2c_device2.dev.platform_data = &harmony_i2c2_platform_data; - ? ? ? tegra_i2c_device3.dev.platform_data = &harmony_i2c3_platform_data; - ? ? ? tegra_i2c_device4.dev.platform_data = &harmony_dvc_platform_data; - ? ? ? ?platform_device_register(&tegra_i2c_device1); ? ? ? ?platform_device_register(&tegra_i2c_device2); ? ? ? ?platform_device_register(&tegra_i2c_device3);arch/arm/mach-tegra/board-paz00.c +0
-0@@ -26,7 +26,6 @@?#include <
linux/pda_power.h>
?#include <linux/io.h>
?#include <linux/i2c.h>
-#include <linux/i2c-tegra.h>
?#include <linux/platform_data/tegra_usb.h>?#include <
asm/mach-types.h>arch/arm/mach-tegra/board-paz00.c +0
-16@@ -74,24 +73,8 @@ static struct platform_device *paz00_devices[] __initdata = { ? ? ? ?&tegra_sdhci_device4, ?}; -static struct tegra_i2c_platform_data paz00_i2c1_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - -static struct tegra_i2c_platform_data paz00_i2c2_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - -static struct tegra_i2c_platform_data paz00_dvc_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - ?static void paz00_i2c_init(void) ?{ - ? ? ? tegra_i2c_device1.dev.platform_data = &paz00_i2c1_platform_data; - ? ? ? tegra_i2c_device2.dev.platform_data = &paz00_i2c2_platform_data; - ? ? ? tegra_i2c_device4.dev.platform_data = &paz00_dvc_platform_data; - ? ? ? ?platform_device_register(&tegra_i2c_device1); ? ? ? ?platform_device_register(&tegra_i2c_device2); ? ? ? ?platform_device_register(&tegra_i2c_device4);arch/arm/mach-tegra/board-seaboard.c +0
-0@@ -19,7 +19,6 @@?#include <
linux/platform_device.h>
?#include <linux/serial_8250.h>
?#include <linux/i2c.h>
-#include <linux/i2c-tegra.h>
?#include <linux/delay.h>
?#include <linux/input.h>
?#include <linux/io.h>arch/arm/mach-tegra/board-seaboard.c +0
-21@@ -66,22 +65,6 @@ static __initdata struct tegra_clk_init_table seaboard_clk_init_table[] = { ? ? ? ?{ NULL, ? ? ? ? NULL, ? ? ? ? ? 0, ? ? ? ? ? ? ?0}, ?}; -static struct tegra_i2c_platform_data seaboard_i2c1_platform_data = { - ? ? ? .bus_clk_rate ? = 400000. -}; - -static struct tegra_i2c_platform_data seaboard_i2c2_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - -static struct tegra_i2c_platform_data seaboard_i2c3_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - -static struct tegra_i2c_platform_data seaboard_dvc_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - ?static struct gpio_keys_button seaboard_gpio_keys_buttons[] = { ? ? ? ?{ ? ? ? ? ? ? ? ?.code ? ? ? ? ? = SW_LID,@@ -161,11 +144,6 @@ static void __init seaboard_i2c_init(void) ? ? ? ?i2c_register_board_info(4, &adt7461_device, 1); - ? ? ? tegra_i2c_device1.dev.platform_data = &seaboard_i2c1_platform_data; - ? ? ? tegra_i2c_device2.dev.platform_data = &seaboard_i2c2_platform_data; - ? ? ? tegra_i2c_device3.dev.platform_data = &seaboard_i2c3_platform_data; - ? ? ? tegra_i2c_device4.dev.platform_data = &seaboard_dvc_platform_data; - ? ? ? ?platform_device_register(&tegra_i2c_device1); ? ? ? ?platform_device_register(&tegra_i2c_device2); ? ? ? ?platform_device_register(&tegra_i2c_device3);arch/arm/mach-tegra/board-trimslice.c +0
-0@@ -24,7 +24,6 @@?#include <
linux/serial_8250.h>
?#include <linux/io.h>
?#include <linux/i2c.h>
-#include <linux/i2c-tegra.h>
?#include <linux/platform_data/tegra_usb.h>
?#include <linux/gpio.h>arch/arm/mach-tegra/board-trimslice.c +0
-16@@ -92,18 +91,6 @@ static struct platform_device *trimslice_devices[] __initdata = { ? ? ? ?&trimslice_audio_device, ?}; -static struct tegra_i2c_platform_data trimslice_i2c1_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - -static struct tegra_i2c_platform_data trimslice_i2c2_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - -static struct tegra_i2c_platform_data trimslice_i2c3_platform_data = { - ? ? ? .bus_clk_rate ? = 400000, -}; - ?static struct i2c_board_info trimslice_i2c3_board_info[] = { ? ? ? ?{ ? ? ? ? ? ? ? ?I2C_BOARD_INFO("tlv320aic23", 0x1a),@@ -115,10 +102,6 @@ static struct i2c_board_info trimslice_i2c3_board_info[] = { ?static void trimslice_i2c_init(void) ?{ - ? ? ? tegra_i2c_device1.dev.platform_data = &trimslice_i2c1_platform_data; - ? ? ? tegra_i2c_device2.dev.platform_data = &trimslice_i2c2_platform_data; - ? ? ? tegra_i2c_device3.dev.platform_data = &trimslice_i2c3_platform_data; - ? ? ? ?platform_device_register(&tegra_i2c_device1); ? ? ? ?platform_device_register(&tegra_i2c_device2); ? ? ? ?platform_device_register(&tegra_i2c_device3);arch/arm/mach-tegra/devices.c +0
-0@@ -22,6 +22,7 @@?#include <
linux/dma-mapping.h>
?#include <linux/fsl_devices.h>
?#include <linux/serial_8250.h>
+#include <linux/i2c-tegra.h>
?#include <asm/pmu.h>
?#include <mach/irqs.h>
?#include <mach/iomap.h>arch/arm/mach-tegra/devices.c +20
-5@@ -79,13 +80,29 @@ static struct resource i2c_resource4[] = { ? ? ? ?}, ?}; +static struct tegra_i2c_platform_data tegra_i2c1_platform_data = { + ? ? ? .bus_clk_rate ? = 400000, +}; + +static struct tegra_i2c_platform_data tegra_i2c2_platform_data = { + ? ? ? .bus_clk_rate ? = 400000, +}; + +static struct tegra_i2c_platform_data tegra_i2c3_platform_data = { + ? ? ? .bus_clk_rate ? = 400000, +}; + +static struct tegra_i2c_platform_data tegra_dvc_platform_data = { + ? ? ? .bus_clk_rate ? = 400000, +}; + ?struct platform_device tegra_i2c_device1 = { ? ? ? ?.name ? ? ? ? ? = "tegra-i2c", ? ? ? ?.id ? ? ? ? ? ? = 0, ? ? ? ?.resource ? ? ? = i2c_resource1, ? ? ? ?.num_resources ?= ARRAY_SIZE(i2c_resource1), ? ? ? ?.dev = { - ? ? ? ? ? ? ? .platform_data = 0, + ? ? ? ? ? ? ? .platform_data = &tegra_i2c1_platform_data, ? ? ? ?}, ?};@@ -95,7 +112,7 @@ struct platform_device tegra_i2c_device2 = { ? ? ? ?.resource ? ? ? = i2c_resource2, ? ? ? ?.num_resources ?= ARRAY_SIZE(i2c_resource2), ? ? ? ?.dev = { - ? ? ? ? ? ? ? .platform_data = 0, + ? ? ? ? ? ? ? .platform_data = &tegra_i2c2_platform_data, ? ? ? ?}, ?};@@ -105,7 +122,7 @@ struct platform_device tegra_i2c_device3 = { ? ? ? ?.resource ? ? ? = i2c_resource3, ? ? ? ?.num_resources ?= ARRAY_SIZE(i2c_resource3), ? ? ? ?.dev = { - ? ? ? ? ? ? ? .platform_data = 0, + ? ? ? ? ? ? ? .platform_data = &tegra_i2c3_platform_data, ? ? ? ?}, ?};@@ -115,7 +132,7 @@ struct platform_device tegra_i2c_device4 = { ? ? ? ?.resource ? ? ? = i2c_resource4, ? ? ? ?.num_resources ?= ARRAY_SIZE(i2c_resource4), ? ? ? ?.dev = { - ? ? ? ? ? ? ? .platform_data = 0, + ? ? ? ? ? ? ? .platform_data = &tegra_dvc_platform_data, ? ? ? ?}, ?}; --1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Sincerely Yours, Mike.
PATCH 1/2 ARM: tegra: remove copy-and-pasted i2c platform data in boards
In reply to Colin CrossQuoted 5 lines · Colin Cross
Every board file includes the same platform data definition for the i2c-tegra driver's bus speed. ?Move the platform data into
devices.c, and remove it from all the board files.Signed-off-by Colin Cross <[email protected]>
As mentioned, hopefully board-specific overrides can be done via device tree as things go in.
-Olof
PATCH 1/2 ARM: tegra: remove copy-and-pasted i2c platform data in boards
In reply to Colin CrossColin,
sorry I didn't managed to get a response from another ac100 kernel dev on the patches in an acceptable timeframe. I cannot test these myself because I don't have the required machines here in my holiday housing.
On the other hand I see no problems with these patches now. So for the paz00 related patch:
Thanks
Marc
Am Sun, 10 Jul 2011 15:19:33 -0700
schrieb Colin Cross <[email protected]>:
Quoted 270 lines
Every board file includes the same platform data definition for the i2c-tegra driver's bus speed. Move the platform data into
devices.c, and remove it from all the board files.Signed-off-by Colin Cross <[email protected]>--- arch/arm/mach-tegra/board-harmony.c | 22 ---------------------- arch/arm/mach-tegra/board-paz00.c | 17 ----------------- arch/arm/mach-tegra/board-seaboard.c | 22 ---------------------- arch/arm/mach-tegra/board-trimslice.c | 17 ----------------- arch/arm/mach-tegra/devices.c | 25+++++++++++++++++++++---- 5 files changed, 21 insertions(+), 82 deletions(-)
(quoted diff) +0
-0
b/arch/arm/mach-tegra/board-harmony.cindex 30e18bc..846cd7d 100644arch/arm/mach-tegra/board-harmony.c +0
-21@@ -25,7 +25,6 @@#include <linux/io.h> #include <linux/gpio.h> #include <linux/i2c.h> -#include <linux/i2c-tegra.h> #include <sound/wm8903.h> @@ -83,22 +82,6 @@ static struct platform_device harmony_audio_device = { }, }; -static struct tegra_i2c_platform_data harmony_i2c1_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data harmony_i2c2_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data harmony_i2c3_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data harmony_dvc_platform_data = { - .bus_clk_rate =400000 , -}; -static struct wm8903_platform_data harmony_wm8903_pdata = { .irq_active_low =0 , .micdet_cfg =0 ,@@ -121,11 +104,6 @@ static struct i2c_board_info __initdata wm8903_board_info = {static void __init harmony_i2c_init (void ) { - tegra_i2c_device1.dev.platform_data = &harmony_i2c1_platform_data; - tegra_i2c_device2.dev.platform_data = &harmony_i2c2_platform_data; - tegra_i2c_device3.dev.platform_data = &harmony_i2c3_platform_data; - tegra_i2c_device4.dev.platform_data =
&harmony_dvc_platform_data; -arch/arm/mach-tegra/board-harmony.c +0
-0platform_device_register (&tegra_i2c_device1);platform_device_register (&tegra_i2c_device2);platform_device_register (&tegra_i2c_device3);(quoted diff) +0
-0
b/arch/arm/mach-tegra/board-paz00.cindex 1b076f6..465768e 100644arch/arm/mach-tegra/board-paz00.c +0
-16@@ -26,7 +26,6 @@#include <linux/pda_power.h> #include <linux/io.h> #include <linux/i2c.h> -#include <linux/i2c-tegra.h> #include <linux/platform_data/tegra_usb.h> #include <asm/mach-types.h> @@ -74,24 +73,8 @@ static struct platform_device *paz00_devices[]__initdata = { &tegra_sdhci_device4, }; -static struct tegra_i2c_platform_data paz00_i2c1_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data paz00_i2c2_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data paz00_dvc_platform_data = { - .bus_clk_rate =400000 , -}; -static void paz00_i2c_init (void ) { - tegra_i2c_device1.dev.platform_data = &paz00_i2c1_platform_data; - tegra_i2c_device2.dev.platform_data = &paz00_i2c2_platform_data; - tegra_i2c_device4.dev.platform_data =
&paz00_dvc_platform_data; -arch/arm/mach-tegra/board-paz00.c +0
-0platform_device_register (&tegra_i2c_device1);platform_device_register (&tegra_i2c_device2);platform_device_register (&tegra_i2c_device4);(quoted diff) +0
-0
b/arch/arm/mach-tegra/board-seaboard.cindex 783de17..46d5df9 100644arch/arm/mach-tegra/board-seaboard.c +0
-21@@ -19,7 +19,6 @@#include <linux/platform_device.h> #include <linux/serial_8250.h> #include <linux/i2c.h> -#include <linux/i2c-tegra.h> #include <linux/delay.h> #include <linux/input.h> #include <linux/io.h> @@ -66,22 +65,6 @@ static __initdata struct tegra_clk_init_table seaboard_clk_init_table[] = { { NULL,NULL ,0 ,0 }, }; -static struct tegra_i2c_platform_data seaboard_i2c1_platform_data = { - .bus_clk_rate =400000. -}; - -static struct tegra_i2c_platform_data seaboard_i2c2_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data seaboard_i2c3_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data seaboard_dvc_platform_data = { - .bus_clk_rate =400000 , -}; - static struct gpio_keys_button seaboard_gpio_keys_buttons[] = { { .code = SW_LID,@@ -161,11 +144,6 @@ static void __init seaboard_i2c_init(void)i2c_register_board_info (4 , &adt7461_device,1 ); - tegra_i2c_device1.dev.platform_data = &seaboard_i2c1_platform_data; - tegra_i2c_device2.dev.platform_data = &seaboard_i2c2_platform_data; - tegra_i2c_device3.dev.platform_data = &seaboard_i2c3_platform_data; - tegra_i2c_device4.dev.platform_data =
&seaboard_dvc_platform_data; -arch/arm/mach-tegra/board-seaboard.c +0
-0platform_device_register (&tegra_i2c_device1);platform_device_register (&tegra_i2c_device2);platform_device_register (&tegra_i2c_device3);(quoted diff) +0
-0
b/arch/arm/mach-tegra/board-trimslice.cindex a8fff42..e1d7e67 100644arch/arm/mach-tegra/board-trimslice.c +0
-13@@ -24,7 +24,6 @@#include <linux/serial_8250.h> #include <linux/io.h> #include <linux/i2c.h> -#include <linux/i2c-tegra.h> #include <linux/platform_data/tegra_usb.h> #include <linux/gpio.h> @@ -92,18 +91,6 @@ static struct platform_device *trimslice_devices[]__initdata = { &trimslice_audio_device, }; -static struct tegra_i2c_platform_data trimslice_i2c1_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data trimslice_i2c2_platform_data = { - .bus_clk_rate =400000 , -}; - -static struct tegra_i2c_platform_data trimslice_i2c3_platform_data = { - .bus_clk_rate =400000 , -}; -static struct
i2c_board_infotrimslice_i2c3_board_info[] = {arch/arm/mach-tegra/board-trimslice.c +0
-3{ I2C_BOARD_INFO("tlv320aic23", 0x1a),@@ -115,10 +102,6 @@ static struct i2c_board_info trimslice_i2c3_board_info[] = {static void trimslice_i2c_init (void ) { - tegra_i2c_device1.dev.platform_data = &trimslice_i2c1_platform_data; - tegra_i2c_device2.dev.platform_data = &trimslice_i2c2_platform_data; - tegra_i2c_device3.dev.platform_data =
&trimslice_i2c3_platform_data; -arch/arm/mach-tegra/board-trimslice.c +0
-0platform_device_register (&tegra_i2c_device1);platform_device_register (&tegra_i2c_device2);platform_device_register (&tegra_i2c_device3);(quoted diff) +0
-0
b/arch/arm/mach-tegra/devices.cindex 1528f9d..066eaf9 100644arch/arm/mach-tegra/devices.c +21
-4@@ -22,6 +22,7 @@#include <linux/dma-mapping.h> #include <linux/fsl_devices.h> #include <linux/serial_8250.h> +#include <linux/i2c-tegra.h> #include <asm/pmu.h> #include <mach/irqs.h> #include <mach/iomap.h> @@ -79,13 +80,29 @@ static struct resource i2c_resource4[] = { }, }; +static struct tegra_i2c_platform_data tegra_i2c1_platform_data = { + .bus_clk_rate =400000 , +}; + +static struct tegra_i2c_platform_data tegra_i2c2_platform_data = { + .bus_clk_rate =400000 , +}; + +static struct tegra_i2c_platform_data tegra_i2c3_platform_data = { + .bus_clk_rate =400000 , +}; + +static struct tegra_i2c_platform_data tegra_dvc_platform_data = { + .bus_clk_rate =400000 , +}; +struct platform_device tegra_i2c_device1 = { .name ="tegra-i2c" , .id =0 , .resource = i2c_resource1, .num_resources =ARRAY_SIZE (i2c_resource1), .dev = { - .platform_data =0 , + .platform_data = &tegra_i2c1_platform_data, }, };@@ -95,7 +112,7 @@ struct platform_device tegra_i2c_device2 = { .resource = i2c_resource2, .num_resources = ARRAY_SIZE(i2c_resource2), .dev = { - .platform_data = 0, + .platform_data = &tegra_i2c2_platform_data, }, };@@ -105,7 +122,7 @@ struct platform_device tegra_i2c_device3 = { .resource = i2c_resource3, .num_resources = ARRAY_SIZE(i2c_resource3), .dev = { - .platform_data = 0, + .platform_data = &tegra_i2c3_platform_data, }, };@@ -115,7 +132,7 @@ struct platform_device tegra_i2c_device4 = { .resource = i2c_resource4, .num_resources = ARRAY_SIZE(i2c_resource4), .dev = { - .platform_data = 0, + .platform_data = &tegra_dvc_platform_data, }, };
PATCH 2/2 ARM: tegra: remove copy-and-pasted usb platform data from boards
In reply to Colin Crosssee comment for PATCH 1/2
Am Sun, 10 Jul 2011 15:19:34 -0700
schrieb Colin Cross <[email protected]>:
Quoted 5 lines
trimslice and paz00 both have functionally identical platform data for the tegra-ehci driver. Move the platform data into
devices.c, and remove it from all the board files.Signed-off-by Colin Cross <[email protected]>
Quoted 188 lines
--- arch/arm/mach-tegra/board-paz00.c | 26--------------------------
arch/arm/mach-tegra/board-trimslice.c|
19 -------------------arch/arm/mach-tegra/devices.c| 28
++++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 45 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-tegra/board-paz00.cindex 465768e..ea2f79c 100644arch/arm/mach-tegra/board-paz00.c +0
-26@@ -26,7 +26,6 @@#include <linux/pda_power.h> #include <linux/io.h> #include <linux/i2c.h> -#include <linux/platform_data/tegra_usb.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> @@ -36,7 +35,6 @@#include <mach/iomap.h> #include <mach/irqs.h> #include <mach/sdhci.h> -#include <mach/usb_phy.h> #include <mach/gpio.h> #include "board.h" @@ -80,32 +78,8 @@ static void paz00_i2c_init(void)platform_device_register (&tegra_i2c_device4); } -static struct tegra_ulpi_config ulpi_phy_config = { - .reset_gpio =TEGRA_ULPI_RST , - .clk ="cdev2" , -}; - -static struct tegra_ehci_platform_data tegra_ehci_pdata[] = { - [0 ] = { - .operating_mode =TEGRA_USB_OTG , - .power_down_on_bus_suspend =1 , - }, - [1 ] = { - .phy_config = &ulpi_phy_config, - .operating_mode =TEGRA_USB_HOST , - .power_down_on_bus_suspend =1 , - }, - [2 ] = { - .operating_mode =TEGRA_USB_HOST , - .power_down_on_bus_suspend =1 , - }, -}; -static void paz00_usb_init (void ) { - tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1 ]; - tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2 ]; -platform_device_register (&tegra_ehci2_device);platform_device_register (&tegra_ehci3_device); }(quoted diff) +0
-0
b/arch/arm/mach-tegra/board-trimslice.cindex e1d7e67..89a6d2a 100644arch/arm/mach-tegra/board-trimslice.c +0
-18@@ -24,7 +24,6 @@#include <linux/serial_8250.h> #include <linux/io.h> #include <linux/i2c.h> -#include <linux/platform_data/tegra_usb.h> #include <linux/gpio.h> #include <asm/mach-types.h> @@ -33,7 +32,6 @@#include <mach/iomap.h> #include <mach/sdhci.h> -#include <mach/usb_phy.h> #include <mach/gpio.h> #include "board.h" @@ -110,28 +108,12 @@ static void trimslice_i2c_init(void) ARRAY_SIZE(trimslice_i2c3_board_info)); } -struct tegra_ulpi_config ehci2_phy_config = { - .reset_gpio =TRIMSLICE_GPIO_USB2_RST , - .clk ="cdev2" , -}; - -static struct tegra_ehci_platform_data ehci_ulpi_data = { - .operating_mode =TEGRA_USB_HOST , - .phy_config = &ehci2_phy_config, -}; - -static struct tegra_ehci_platform_data ehci_utmi_data = { - .operating_mode =TEGRA_USB_HOST , -}; -static void trimslice_usb_init (void ) {int err; - tegra_ehci3_device.dev.platform_data = &ehci_utmi_data;platform_device_register (&tegra_ehci3_device); - tegra_ehci2_device.dev.platform_data = &ehci_ulpi_data;platform_device_register (&tegra_ehci2_device); err = gpio_request_one(TRIMSLICE_GPIO_USB1_MODE,
GPIOF_OUT_INIT_HIGH, @@ -141,7 +123,6 @@ static voidtrimslice_usb_init(void)return;arch/arm/mach-tegra/board-trimslice.c +0
-1} - tegra_ehci1_device.dev.platform_data = &ehci_utmi_data;platform_device_register (&tegra_ehci1_device); }(quoted diff) +0
-0
b/arch/arm/mach-tegra/devices.cindex 066eaf9..57e35d2 100644arch/arm/mach-tegra/devices.c +28
-0@@ -23,10 +23,13 @@#include <linux/fsl_devices.h> #include <linux/serial_8250.h> #include <linux/i2c-tegra.h> +#include <linux/platform_data/tegra_usb.h> #include <asm/pmu.h> #include <mach/irqs.h> #include <mach/iomap.h> #include <mach/dma.h> +#include <mach/usb_phy.h> +#include "gpio-names.h" static struct resource i2c_resource1[] = { [0 ] = {@@ -351,6 +354,28 @@ static struct resource tegra_usb3_resources[] = { }, }; +static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = { +/* All existing boards use GPIO PV0 for phy reset */ + .reset_gpio =TEGRA_GPIO_PV0 , + .clk ="cdev2" , +}; + +static struct tegra_ehci_platform_data tegra_ehci1_pdata = { + .operating_mode =TEGRA_USB_OTG , + .power_down_on_bus_suspend =1 , +}; + +static struct tegra_ehci_platform_data tegra_ehci2_pdata = { + .phy_config = &tegra_ehci2_ulpi_phy_config, + .operating_mode =TEGRA_USB_HOST , + .power_down_on_bus_suspend =1 , +}; + +static struct tegra_ehci_platform_data tegra_ehci3_pdata = { + .operating_mode =TEGRA_USB_HOST , + .power_down_on_bus_suspend =1 , +}; +static u64 tegra_ehci_dmamask =DMA_BIT_MASK (32 );struct platform_device tegra_ehci1_device = {@@ -359,6 +384,7 @@ struct platform_device tegra_ehci1_device = { .dev = { .dma_mask = &tegra_ehci_dmamask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &tegra_ehci1_pdata, }, .resource = tegra_usb1_resources, .num_resources = ARRAY_SIZE(tegra_usb1_resources),@@ -370,6 +396,7 @@ struct platform_device tegra_ehci2_device = { .dev = { .dma_mask = &tegra_ehci_dmamask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &tegra_ehci2_pdata, }, .resource = tegra_usb2_resources, .num_resources = ARRAY_SIZE(tegra_usb2_resources),@@ -381,6 +408,7 @@ struct platform_device tegra_ehci3_device = { .dev = { .dma_mask = &tegra_ehci_dmamask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &tegra_ehci3_pdata, }, .resource = tegra_usb3_resources, .num_resources = ARRAY_SIZE(tegra_usb3_resources),
PATCH 2/2 ARM: tegra: remove copy-and-pasted usb platform data from boards
Am Freitag, 15. Juli 2011, 11:13:48 schrieb Marc Dietrich:
Quoted 31 lines
see comment for PATCH 1/2
Am Sun, 10 Jul 2011 15:19:34 -0700
schrieb Colin Cross <[email protected]>:
Quoted 5 lines
trimslice and paz00 both have functionally identical platform data for the tegra-ehci driver. Move the platform data into
devices.c, and remove it from all the board files.Signed-off-by Colin Cross <[email protected]>Acked-by Marc Dietrich <[email protected]>Quoted 18 lines
---
arch/arm/mach-tegra/board-paz00.c | 26arch/arm/mach-tegra/board-paz00.c +0
-12-static struct tegra_ulpi_config ulpi_phy_config = { - .reset_gpio =TEGRA_ULPI_RST , - .clk ="cdev2" , -}; - -static struct tegra_ehci_platform_data tegra_ehci_pdata[] = { - [0 ] = { - .operating_mode =TEGRA_USB_OTG , - .power_down_on_bus_suspend =1 , - }, - [1 ] = { - .phy_config = &ulpi_phy_config,
Quoted 8 lines
arch/arm/mach-tegra/board-paz00.c static void paz00_i2c_init(void) · line 102
Quoted 8 lines
arch/arm/mach-tegra/board-paz00.c +0
-8- .operating_mode = TEGRA_USB_HOST, - .power_down_on_bus_suspend = 1, - }, - [2] = { - .operating_mode = TEGRA_USB_HOST, - .power_down_on_bus_suspend = 1, - }, -};
I'm not sure about this.
For paz00 tegra_ehci3_device also leads to an external usb port. With power_down_on_bus_suspend = 1 hotplugging usb devices doesn't work (as the bus might be suspended at the time).
Quoted 1 line
From the initial commit message of ehci-tegra on android.git.kernel.org:
"For additional power saving, the driver supports powering down the phy on bus suspend when it is used, for example, to connect an internal device that use an out-of-band remote wakeup mechanism (e.g. a gpio)."
So my guess was, that the correct handling of this was setting power_down_on_bus_suspend to 0 - which did fix the problem.
With this data moving to devices.c, setting this would also change the trimslice behaviour which would be a problem.
In the end I'm not sure if setting power_down_on_bus_suspend to 0 is the correct solution to the hotplug problem or if a better solution exists.
Thanks
Heiko
PATCH 2/2 ARM: tegra: remove copy-and-pasted usb platform data from boards
Quoted 55 lines · Heiko St?bner
Am Freitag, 15. Juli 2011, 11:13:48 schrieb Marc Dietrich:
Quoted 31 lines
see comment for PATCH 1/2
Am Sun, 10 Jul 2011 15:19:34 -0700
schrieb Colin Cross <[email protected]>:
Quoted 5 lines
trimslice and paz00 both have functionally identical platform data for the tegra-ehci driver. ?Move the platform data into
devices.c, and remove it from all the board files.Signed-off-by Colin Cross <[email protected]>Acked-by Marc Dietrich <[email protected]>Quoted 18 lines
---
?arch/arm/mach-tegra/board-paz00.c ? ? | ? 26
(quoted diff) +0
-12-static struct tegra_ulpi_config ulpi_phy_config = { - ? ? ? ? ? .reset_gpio = TEGRA_ULPI_RST, - ? ? ? ? ? .clk = "cdev2", -}; - -static struct tegra_ehci_platform_data tegra_ehci_pdata[] = { - ? ? ? ? ? [0] = { - ? ? ? ? ? ? ? ? ? .operating_mode = TEGRA_USB_OTG, - ? ? ? ? ? ? ? ? ? .power_down_on_bus_suspend = 1, - ? ? ? ? ? }, - ? ? ? ? ? [1] = { - ? ? ? ? ? ? ? ? ? .phy_config = &ulpi_phy_config,Quoted 8 lines
Quoted 8 lines
- ? ? ? ? ? ? ? ? ? .operating_mode =
TEGRA_USB_HOST,
- ? ? ? ? ? ? ? ? ? .power_down_on_bus_suspend = 1,
- ? ? ? ? ? },
- ? ? ? ? ? [2] = {
- ? ? ? ? ? ? ? ? ? .operating_mode =TEGRA_USB_HOST,
- ? ? ? ? ? ? ? ? ? .power_down_on_bus_suspend = 1,
- ? ? ? ? ? },
-};I'm not sure about this.
For paz00
tegra_ehci3_devicealso leads to an external usb port. Withpower_down_on_bus_suspend= 1 hotplugging usb devices doesn't work (as the bus might be suspended at the time).From the initial commit message of ehci-tegra on android.git.kernel.org:
"For additional power saving, the driver supports powering down the phy on bus suspend when it is used, for example, to connect an internal device that use an out-of-band remote wakeup mechanism (e.g. a gpio)."So my guess was, that the correct handling of this was setting
power_down_on_bus_suspendto 0 - which did fix the problem.
Quoted 9 lines
With this data moving to
devices.c, setting this would also change the trimslice behaviour which would be a problem.In the end I'm not sure if setting
power_down_on_bus_suspendto 0 is the correct solution to the hotplug problem or if a better solution exists.Thanks
Heiko
Can you or someone else test if power_down_on_bus_suspend is causing a problem? If it is, I'll change the default in devices.c to power_down_on_bus_suspend=0, and devices that want power_down_on_bus_suspend=1 will have to set it.
PATCH 2/2 ARM: tegra: remove copy-and-pasted usb platform data from boards
Quoted 4 lines · Colin Cross
Can you or someone else test if
power_down_on_bus_suspendis causing a problem? If it is, I'll change the default indevices.cto power_down_on_bus_suspend=0, and devices that want power_down_on_bus_suspend=1 will have to set it.
Seaboard and derivatives have power_down_on_bus_suspend set, and does OK with that. I suggest that paz00 overrides the value before device registration if it has to. If the number of boards down the road that need it off exceeds number of boards that need it on, it can always be flipped. This should come from the device tree later anyway.
(Note: I'll post a patch in a bit that keeps the IP clocked even if phy is powered down on bus suspend, since otherwise we don't get hotplug events for hub-less systems).
-Olof
PATCH 2/2 ARM: tegra: remove copy-and-pasted usb platform data from boards
In reply to Colin CrossAm Freitag 15 Juli 2011, 18:45:53 schrieb Colin Cross:
Quoted 62 lines · Heiko St?bner
Quoted 61 lines
Am Freitag, 15. Juli 2011, 11:13:48 schrieb Marc Dietrich:
Quoted 31 lines
see comment for PATCH 1/2
Am Sun, 10 Jul 2011 15:19:34 -0700
schrieb Colin Cross <[email protected]>:
Quoted 5 lines
trimslice and paz00 both have functionally identical platform data for the tegra-ehci driver. Move the platform data into
devices.c, and remove it from all the board files.Signed-off-by Colin Cross <[email protected]>Acked-by Marc Dietrich <[email protected]>Quoted 18 lines
---
arch/arm/mach-tegra/board-paz00.c | 26arch/arm/mach-tegra/board-paz00.c +0
-12-static struct tegra_ulpi_config ulpi_phy_config = { - .reset_gpio =TEGRA_ULPI_RST , - .clk ="cdev2" , -}; - -static struct tegra_ehci_platform_data tegra_ehci_pdata[] = { - [0 ] = { - .operating_mode =TEGRA_USB_OTG , - .power_down_on_bus_suspend =1 , - }, - [1 ] = { - .phy_config = &ulpi_phy_config,Quoted 8 lines
arch/arm/mach-tegra/board-paz00.c static void paz00_i2c_init(void) · line 102
Quoted 8 lines
arch/arm/mach-tegra/board-paz00.c +0
-8- .operating_mode = TEGRA_USB_HOST, - .power_down_on_bus_suspend = 1, - }, - [2] = { - .operating_mode = TEGRA_USB_HOST, - .power_down_on_bus_suspend = 1, - }, -};I'm not sure about this.
For paz00
tegra_ehci3_devicealso leads to an external usb port. Withpower_down_on_bus_suspend= 1 hotplugging usb devices doesn't work (as the bus might be suspended at the time).From the initial commit message of ehci-tegra on android.git.kernel.org:
"For additional power saving, the driver supports powering down the phy on bus suspend when it is used, for example, to connect an internal device that use an out-of-band remote wakeup mechanism (e.g. a gpio)."So my guess was, that the correct handling of this was setting
power_down_on_bus_suspendto 0 - which did fix the problem.With this data moving to
devices.c, setting this would also change the trimslice behaviour which would be a problem.In the end I'm not sure if setting
power_down_on_bus_suspendto 0 is the correct solution to the hotplug problem or if a better solution exists.
Quoted 7 lines
Quoted 2 lines
Thanks
HeikoCan you or someone else test if
power_down_on_bus_suspendis causing a problem? If it is, I'll change the default indevices.cto power_down_on_bus_suspend=0, and devices that want power_down_on_bus_suspend=1 will have to set it.
With power_down_on_bus_suspend = 1, paz00 fails to recognize newly attached devices, i.e. only devices connected during boot are accessible. But it doesn't cause problems with the devices themselfs.
Am Freitag 15 Juli 2011, 20:30:18 schrieb Olof Johansson:
Quoted 3 lines
(Note: I'll post a patch in a bit that keeps the IP clocked even if phy is powered down on bus suspend, since otherwise we don't get hotplug events for hub-less systems).
This might also fix the hotplug problem on paz00 *fingers crossed*.
Heiko