[PATCH 1/2] ARM: tegra: remove copy-and-pasted i2c platform data in boards

Subsystems: arm port, the rest

STALE5494d

13 messages, 6 authors, 2011-07-15 · open the first message on its own page

[PATCH 1/2] ARM: tegra: remove copy-and-pasted i2c platform data in boards

From: Colin Cross <hidden>
Date: 2011-07-10 22:19:33

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 <redacted>
---
 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(-)
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
index 30e18bc..846cd7d 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -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);
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 1b076f6..465768e 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -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);
diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c
index 783de17..46d5df9 100644
--- a/arch/arm/mach-tegra/board-seaboard.c
+++ b/arch/arm/mach-tegra/board-seaboard.c
@@ -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);
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index a8fff42..e1d7e67 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -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);
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c
index 1528f9d..066eaf9 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -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,
 	},
 };
 
-- 
1.7.4.1

[PATCH 2/2] ARM: tegra: remove copy-and-pasted usb platform data from boards

From: Colin Cross <hidden>
Date: 2011-07-10 22:19:34

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 <redacted>
---
 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(-)
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 465768e..ea2f79c 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -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);
 }
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index e1d7e67..89a6d2a 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -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);
 }
 
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c
index 066eaf9..57e35d2 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -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),
-- 
1.7.4.1

[PATCH 2/2] ARM: tegra: remove copy-and-pasted usb platform data from boards

From: Mike Rapoport <hidden>
Date: 2011-07-12 19:28:04

Hi Colin,
Sorry for the delay, I don't have the hardware at the moment, so I
asked Konstantin to do the testing.

On Mon, Jul 11, 2011 at 1:19 AM, Colin Cross [off-list ref] wrote:
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 <redacted>
For the TrimSlice part:

Tested-by: Konstantin Sinyuk <redacted>
quoted hunk
---
?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(-)
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 465768e..ea2f79c 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -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);
?}
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index e1d7e67..89a6d2a 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -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);
?}
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c
index 066eaf9..57e35d2 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -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),
--
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


-- 
Sincerely Yours,
Mike.

[PATCH 2/2] ARM: tegra: remove copy-and-pasted usb platform data from boards

From: marvin24@gmx.de (Marc Dietrich)
Date: 2011-07-15 09:13:48

see comment for PATCH 1/2

Am Sun, 10 Jul 2011 15:19:34 -0700
schrieb Colin Cross [off-list ref]:
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 <redacted>
Acked-By: Marc Dietrich <marvin24@gmx.de>
quoted hunk
---
 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(-)
diff --git a/arch/arm/mach-tegra/board-paz00.c
b/arch/arm/mach-tegra/board-paz00.c index 465768e..ea2f79c 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -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);
 }
diff --git a/arch/arm/mach-tegra/board-trimslice.c
b/arch/arm/mach-tegra/board-trimslice.c index e1d7e67..89a6d2a 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -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);
 }
 
diff --git a/arch/arm/mach-tegra/devices.c
b/arch/arm/mach-tegra/devices.c index 066eaf9..57e35d2 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -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

From: heiko@sntech.de (Heiko Stübner)
Date: 2011-07-15 09:55:56

Am Freitag, 15. Juli 2011, 11:13:48 schrieb Marc Dietrich:
see comment for PATCH 1/2

Am Sun, 10 Jul 2011 15:19:34 -0700

schrieb Colin Cross [off-list ref]:
quoted
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 <redacted>
Acked-By: Marc Dietrich <marvin24@gmx.de>
quoted
---

 arch/arm/mach-tegra/board-paz00.c     |   26
quoted
-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,
-		},
-};
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).
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

From: Colin Cross <hidden>
Date: 2011-07-15 16:45:53

On Fri, Jul 15, 2011 at 2:55 AM, Heiko St?bner [off-list ref] wrote:
Am Freitag, 15. Juli 2011, 11:13:48 schrieb Marc Dietrich:
quoted
see comment for PATCH 1/2

Am Sun, 10 Jul 2011 15:19:34 -0700

schrieb Colin Cross [off-list ref]:
quoted
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 <redacted>
Acked-By: Marc Dietrich <marvin24@gmx.de>
quoted
---

?arch/arm/mach-tegra/board-paz00.c ? ? | ? 26
quoted
quoted
-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,
- ? ? ? ? ? },
-};
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).

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
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

From: Olof Johansson <hidden>
Date: 2011-07-15 18:30:18

On Fri, Jul 15, 2011 at 09:45:53AM -0700, Colin Cross wrote:
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.
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

From: heiko@sntech.de (Heiko Stübner)
Date: 2011-07-15 19:40:41

Am Freitag 15 Juli 2011, 18:45:53 schrieb Colin Cross:
On Fri, Jul 15, 2011 at 2:55 AM, Heiko St?bner [off-list ref] wrote:
quoted
Am Freitag, 15. Juli 2011, 11:13:48 schrieb Marc Dietrich:
quoted
see comment for PATCH 1/2

Am Sun, 10 Jul 2011 15:19:34 -0700

schrieb Colin Cross [off-list ref]:
quoted
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 <redacted>
Acked-By: Marc Dietrich <marvin24@gmx.de>
quoted
---

 arch/arm/mach-tegra/board-paz00.c     |   26



-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,
-           },
-};
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).

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
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.
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:
(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

[PATCH 1/2] ARM: tegra: remove copy-and-pasted i2c platform data in boards

From: Stephen Warren <hidden>
Date: 2011-07-11 15:02:39

Colin Cross wrote at Sunday, July 10, 2011 4:20 PM:
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?

-- 
nvpublic

[PATCH 1/2] ARM: tegra: remove copy-and-pasted i2c platform data in boards

From: Colin Cross <hidden>
Date: 2011-07-12 04:02:41

On Mon, Jul 11, 2011 at 8:02 AM, Stephen Warren [off-list ref] wrote:
Colin Cross wrote at Sunday, July 10, 2011 4:20 PM:
quoted
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.
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 1/2] ARM: tegra: remove copy-and-pasted i2c platform data in boards

From: Mike Rapoport <hidden>
Date: 2011-07-12 19:28:12

Hi Colin,
Sorry for the delay, I don't have the hardware at the moment, so I
asked Konstantin to do the testing.

On Mon, Jul 11, 2011 at 1:19 AM, Colin Cross [off-list ref] wrote:
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 <redacted>
For the TrimSlice part:

Tested-by: Konstantin Sinyuk <redacted>
quoted hunk
---
?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(-)
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
index 30e18bc..846cd7d 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -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);
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 1b076f6..465768e 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -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);
diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c
index 783de17..46d5df9 100644
--- a/arch/arm/mach-tegra/board-seaboard.c
+++ b/arch/arm/mach-tegra/board-seaboard.c
@@ -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);
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index a8fff42..e1d7e67 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -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);
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c
index 1528f9d..066eaf9 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -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,
? ? ? ?},
?};

--
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


-- 
Sincerely Yours,
Mike.

[PATCH 1/2] ARM: tegra: remove copy-and-pasted i2c platform data in boards

From: Olof Johansson <hidden>
Date: 2011-07-12 19:43:24

On Sun, Jul 10, 2011 at 3:19 PM, Colin Cross [off-list ref] wrote:
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 <redacted>
Acked-by: Olof Johansson <redacted>


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

From: marvin24@gmx.de (Marc Dietrich)
Date: 2011-07-15 09:11:25

Colin,

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:

Acked-By: Marc Dietrich <marvin24@gmx.de>

Thanks

Marc

Am Sun, 10 Jul 2011 15:19:33 -0700
schrieb Colin Cross [off-list ref]:
quoted hunk
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 <redacted>
---
 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(-)
diff --git a/arch/arm/mach-tegra/board-harmony.c
b/arch/arm/mach-tegra/board-harmony.c index 30e18bc..846cd7d 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -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);
diff --git a/arch/arm/mach-tegra/board-paz00.c
b/arch/arm/mach-tegra/board-paz00.c index 1b076f6..465768e 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -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);
diff --git a/arch/arm/mach-tegra/board-seaboard.c
b/arch/arm/mach-tegra/board-seaboard.c index 783de17..46d5df9 100644
--- a/arch/arm/mach-tegra/board-seaboard.c
+++ b/arch/arm/mach-tegra/board-seaboard.c
@@ -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);
diff --git a/arch/arm/mach-tegra/board-trimslice.c
b/arch/arm/mach-tegra/board-trimslice.c index a8fff42..e1d7e67 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -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);
diff --git a/arch/arm/mach-tegra/devices.c
b/arch/arm/mach-tegra/devices.c index 1528f9d..066eaf9 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -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,
 	},
 };
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help