Skip to contentSkip to conversation

AVR32: pass i2c board info through at32_add_device_twi

PATCH Applied Ben Nizette 2 participants 2 messages Feb 7, 2008 – Feb 8, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 AVR32: pass i2c board info through at32_add_device_twi

New-style I2C drivers require that motherboard-mounted I2C devices are registered with the I2C core, typically at arch_initcall time. This can be done nice and neat by passing the struct i2c_board_info[] through at32_add_device_twi just like we do for the SPI board info.

While we've got the hood up, remove a duplicate declaration of at32_add_device_twi() in board.h.

---

arch/avr32/boards/atngw100/setup.c +1 -1
Index: linux-2.6.23.atmel.4/arch/avr32/boards/atngw100/setup.c
===================================================================
@@ -180,7 +180,7 @@
 		AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
 	platform_device_register(&i2c_gpio_device);
 #else
-	at32_add_device_twi(0);
+	at32_add_device_twi(0, NULL, 0);
 #endif
 
 	return 0;
arch/avr32/mach-at32ap/at32ap700x.c +6 -1
Index: linux-2.6.23.atmel.4/arch/avr32/mach-at32ap/at32ap700x.c
===================================================================
@@ -988,7 +988,9 @@
 	.index		= 2,
 };
 
-struct platform_device *__init at32_add_device_twi(unsigned int id)
+struct platform_device *__init at32_add_device_twi(unsigned int id,
+						    struct i2c_board_info *b,
+						    unsigned int n)
 {
 	struct platform_device *pdev;
 
@@ -1008,6 +1010,9 @@
 
 	atmel_twi0_pclk.dev = &pdev->dev;
 
+	if (b)
+		i2c_register_board_info(id, b, n);
+
 	platform_device_add(pdev);
 	return pdev;
 
arch/avr32/boards/atstk1000/atstk1002.c +1 -1
Index: linux-2.6.23.atmel.4/arch/avr32/boards/atstk1000/atstk1002.c
===================================================================
@@ -245,7 +245,7 @@
 #ifdef CONFIG_BOARD_ATSTK100X_SPI1
 	at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
 #endif
-	at32_add_device_twi(0);
+	at32_add_device_twi(0, NULL, 0);
 #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
 	at32_add_device_mci(0, &mci0_data);
 #endif
include/asm-avr32/arch-at32ap/board.h +3 -3
Index: linux-2.6.23.atmel.4/include/asm-avr32/arch-at32ap/board.h
===================================================================
@@ -33,7 +33,9 @@
 struct platform_device *
 at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n);
 
-struct platform_device *at32_add_device_twi(unsigned int id);
+struct platform_device *at32_add_device_twi(unsigned int id,
+					     struct i2c_board_info *b,
+					     unsigned int n);
 
 struct atmel_lcdfb_info;
 struct platform_device *
@@ -67,8 +69,6 @@
 struct platform_device *
 at32_add_device_ssc(unsigned int id, unsigned int flags);
 
-struct platform_device *at32_add_device_twi(unsigned int id);
-
 struct mci_platform_data {
 	int detect_pin;
 	int wp_pin;
#1 lore raw
Quoted 9 lines · On Thu, 07 Feb 2008 15:28:57 +1100 Ben Nizette <[email protected]> wrote:

New-style I2C drivers require that motherboard-mounted I2C devices are registered with the I2C core, typically at arch_initcall time. This can be done nice and neat by passing the struct i2c_board_info[] through at32_add_device_twi just like we do for the SPI board info.

While we've got the hood up, remove a duplicate declaration of at32_add_device_twi() in board.h.

Applied, thanks.

Haavard