[PATCH] AVR32: pass i2c board info through at32_add_device_twi

From: Ben Nizette
Date: Wed Feb 06 2008 - 23:58:42 EST



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.

Signed-Off-By: Ben Nizette <bn@xxxxxxxxxxxxxxx>


---
Index: linux-2.6.23.atmel.4/arch/avr32/boards/atngw100/setup.c
===================================================================
--- linux-2.6.23.atmel.4.orig/arch/avr32/boards/atngw100/setup.c
+++ 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;
Index: linux-2.6.23.atmel.4/arch/avr32/mach-at32ap/at32ap700x.c
===================================================================
--- linux-2.6.23.atmel.4.orig/arch/avr32/mach-at32ap/at32ap700x.c
+++ 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;

Index: linux-2.6.23.atmel.4/arch/avr32/boards/atstk1000/atstk1002.c
===================================================================
--- linux-2.6.23.atmel.4.orig/arch/avr32/boards/atstk1000/atstk1002.c
+++ 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
Index: linux-2.6.23.atmel.4/include/asm-avr32/arch-at32ap/board.h
===================================================================
--- linux-2.6.23.atmel.4.orig/include/asm-avr32/arch-at32ap/board.h
+++ 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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/