All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Nizette <bn@niasdigital.com>
To: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: kernel@avr32linux.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] AVR32: pass i2c board info through at32_add_device_twi
Date: Thu, 07 Feb 2008 15:28:57 +1100	[thread overview]
Message-ID: <47AA8909.3040706@niasdigital.com> (raw)


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;

             reply	other threads:[~2008-02-07  4:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-07  4:28 Ben Nizette [this message]
2008-02-08 17:04 ` [PATCH] AVR32: pass i2c board info through at32_add_device_twi Haavard Skinnemoen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47AA8909.3040706@niasdigital.com \
    --to=bn@niasdigital.com \
    --cc=hskinnemoen@atmel.com \
    --cc=kernel@avr32linux.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.