[i2c] [patch 2.6.21-rc3-git +i2c] switch at91 to new-style i2c drivers
Jean Delvare
khali at linux-fr.org
Sat Mar 10 21:33:29 CET 2007
Hi David,
On Thu, 8 Mar 2007 21:36:12 -0800, David Brownell wrote:
> Update AT91 platform support to support "new style" I2C drivers.
>
> - Board-specific init functions take i2c_board_info describing ach
> I2C device on that board, and register that after configuring the
> adapter and its platform_device.
>
> - Make i2c-at91 register as i2c adapter zero (none of these chips
> seem to have more than one TWI controllers) to make it kick in
> any board-specific device declarations..
>
> - Update all the board specific init code to use that new signature,
> adding chip declarations (often from schematics) for:
>
> * csb337 (ds1307 rtc)
> * eb9200 (at24c512 eeprom)
> * rm9200-dk (at24c1024 eeprom, ics1523 clock chip, x9429 pot)
> * rm9200-ek (ics1523 clock chip, dac3550a audio controller)
>
> The ds1307 rtc driver is updated to "new style" in the next patch;
> there's a new-style at24c eeprom driver I'll post sometime too.
> So far as I know, the other chips have no Linux-I2C drivers, so
> those declarations couldn't break old-style drivers.
>
> Signed-off-by: David Brownell <dbrownell at users.sourceforge.net>
> ---
> NOTE that this doesn't affect the ability to use legacy drivers at
> all ... except for the specific updates listed above. So the ds1307
> updates will matter, but no other in-tree drivers will care.
>
> arch/arm/mach-at91/at91rm9200_devices.c | 3 ++-
> arch/arm/mach-at91/at91sam9260_devices.c | 3 ++-
> arch/arm/mach-at91/at91sam9261_devices.c | 3 ++-
> arch/arm/mach-at91/board-carmeva.c | 2 +-
> arch/arm/mach-at91/board-csb337.c | 7 ++++++-
> arch/arm/mach-at91/board-csb637.c | 2 +-
> arch/arm/mach-at91/board-dk.c | 10 +++++++++-
> arch/arm/mach-at91/board-eb9200.c | 6 +++++-
> arch/arm/mach-at91/board-ek.c | 8 +++++++-
> arch/arm/mach-at91/board-kafa.c | 2 +-
> arch/arm/mach-at91/board-kb9202.c | 3 ++-
> arch/arm/mach-at91/board-sam9261ek.c | 2 +-
> drivers/i2c/busses/i2c-at91.c | 6 +++++-
> include/asm-arm/arch-at91/board.h | 3 ++-
> 14 files changed, 46 insertions(+), 14 deletions(-)
>
>
> Index: at91/drivers/i2c/busses/i2c-at91.c
> ===================================================================
> --- at91.orig/drivers/i2c/busses/i2c-at91.c 2007-03-06 12:19:29.000000000 -0800
> +++ at91/drivers/i2c/busses/i2c-at91.c 2007-03-08 09:18:09.000000000 -0800
> @@ -230,13 +230,14 @@ static int __devinit at91_i2c_probe(stru
> adapter->algo = &at91_algorithm;
> adapter->class = I2C_CLASS_HWMON;
> adapter->dev.parent = &pdev->dev;
> + /* adapter->id == 0 ... only one TWI controller for now */
>
> platform_set_drvdata(pdev, adapter);
>
> clk_enable(twi_clk); /* enable peripheral clock */
> at91_twi_hwinit(); /* initialize TWI controller */
>
> - rc = i2c_add_adapter(adapter);
> + rc = i2c_add_numbered_adapter(adapter);
> if (rc) {
> dev_err(&pdev->dev, "Adapter %s registration failed\n",
> adapter->name);
> @@ -299,6 +300,9 @@ static int at91_i2c_resume(struct platfo
> #define at91_i2c_resume NULL
> #endif
>
> +/* work with "modprobe at91_i2c" from hotplugging or coldplugging */
> +MODULE_ALIAS("at91_i2c");
What is it useful for?
> +
> static struct platform_driver at91_i2c_driver = {
> .probe = at91_i2c_probe,
> .remove = __devexit_p(at91_i2c_remove),
> (...)
> Index: at91/arch/arm/mach-at91/board-dk.c
> ===================================================================
> --- at91.orig/arch/arm/mach-at91/board-dk.c 2007-03-04 15:40:41.000000000 -0800
> +++ at91/arch/arm/mach-at91/board-dk.c 2007-03-08 09:21:56.000000000 -0800
> @@ -99,6 +99,14 @@ static struct at91_mmc_data __initdata d
> .wire4 = 1,
> };
>
> +static struct i2c_board_info __initdata dk_i2c_devices[] = { {
> + I2C_BOARD_INFO("ics1523", 0x26, ""),
Why not simply NULL?
> +}, {
> + I2C_BOARD_INFO("x9429", 0x28, ""),
> +}, {
> + I2C_BOARD_INFO("at24c", 0x50, "24c1024"),
> +} };
Also, I guess it's a matter of personal taste, but:
static struct i2c_board_info __initdata dk_i2c_devices[] = {
{ I2C_BOARD_INFO("ics1523", 0x26, "") },
{ I2C_BOARD_INFO("x9429", 0x28, "") },
{ I2C_BOARD_INFO("at24c", 0x50, "24c1024") },
};
looks much better IMVHO.
--
Jean Delvare
More information about the i2c
mailing list