LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] AVR32: pass i2c board info through at32_add_device_twi
@ 2008-02-07  4:28 Ben Nizette
  2008-02-08 17:04 ` Haavard Skinnemoen
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Nizette @ 2008-02-07  4:28 UTC (permalink / raw)
  To: Haavard Skinnemoen; +Cc: kernel, LKML


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@niasdigital.com>


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] AVR32: pass i2c board info through at32_add_device_twi
  2008-02-07  4:28 [PATCH] AVR32: pass i2c board info through at32_add_device_twi Ben Nizette
@ 2008-02-08 17:04 ` Haavard Skinnemoen
  0 siblings, 0 replies; 2+ messages in thread
From: Haavard Skinnemoen @ 2008-02-08 17:04 UTC (permalink / raw)
  To: Ben Nizette; +Cc: kernel, LKML

On Thu, 07 Feb 2008 15:28:57 +1100
Ben Nizette <bn@niasdigital.com> 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.
> 
> Signed-Off-By: Ben Nizette <bn@niasdigital.com>

Applied, thanks.

Haavard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-08 22:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-07  4:28 [PATCH] AVR32: pass i2c board info through at32_add_device_twi Ben Nizette
2008-02-08 17:04 ` Haavard Skinnemoen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).