avr32: pass i2c board info through at32_add_device_twi
authorBen Nizette <bn@niasdigital.com>
Thu, 7 Feb 2008 04:28:57 +0000 (15:28 +1100)
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Sun, 20 Apr 2008 00:40:06 +0000 (20:40 -0400)
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.

[hskinnemoen@atmel.com: add missing i2c_board_info forward-declaration]
Signed-Off-By: Ben Nizette <bn@niasdigital.com>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
arch/avr32/mach-at32ap/at32ap700x.c
include/asm-avr32/arch-at32ap/board.h

index cb47afc9fffcaca6505cc4bc49a13ae1d105135b..6302bfd585140542e6fa11b946758def8eacd1d1 100644 (file)
@@ -990,7 +990,9 @@ static struct clk atmel_twi0_pclk = {
        .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;
 
@@ -1010,6 +1012,9 @@ struct platform_device *__init at32_add_device_twi(unsigned int id)
 
        atmel_twi0_pclk.dev = &pdev->dev;
 
+       if (b)
+               i2c_register_board_info(id, b, n);
+
        platform_device_add(pdev);
        return pdev;
 
index 3fea2004f7db76b9eb71a2a039efe37a5e3cbde2..a4e2d28bfb5884c52af09f110fa543d776386f57 100644 (file)
@@ -66,7 +66,10 @@ struct platform_device *at32_add_device_pwm(u32 mask);
 struct platform_device *
 at32_add_device_ssc(unsigned int id, unsigned int flags);
 
-struct platform_device *at32_add_device_twi(unsigned int id);
+struct i2c_board_info;
+struct platform_device *at32_add_device_twi(unsigned int id,
+                                           struct i2c_board_info *b,
+                                           unsigned int n);
 struct platform_device *at32_add_device_mci(unsigned int id);
 struct platform_device *at32_add_device_ac97c(unsigned int id);
 struct platform_device *at32_add_device_abdac(unsigned int id);