Skip to contentSkip to conversation

i2c-imx: Autoprobe of eeproms

DISCUSSION Mattias Walstrom 4 participants 4 messages Feb 12, 2010 – Feb 14, 2010

lore
Share & tools
lore
#0 lore raw

I have tried to get autoprobe of eeproms to work on a custom freescale mx27-board, and i found out that the i2c-imx driver was missing the following, is there a reason for this, most other i2c-bus drivers seems to have it?

--- linux-2.6.32.8.orig/drivers/i2c/busses/i2c-imx.c 2010-02-09
13:57:19.000000000 +0100
+++ linux-2.6.32.8/drivers/i2c/busses/i2c-imx.c 2010-02-12 11:30:12.000000000 +0100
@@ -521,6 +521,7 @@

        i2c_imx->adapter.algo           = &i2c_imx_algo;
        i2c_imx->adapter.dev.parent     = &pdev->dev;
        i2c_imx->adapter.nr             = pdev->id;
+        i2c_imx->adapter.class          = I2C_CLASS_HWMON | I2C_CLASS_SPD;
        i2c_imx->irq                    = irq;
        i2c_imx->base                   = base;
        i2c_imx->res                    = res;

Best regards
Mattias Walstr?m

#1 lore raw

Hi Mattias,

Quoted 4 lines · Mattias Walstrom

I have tried to get autoprobe of eeproms to work on a custom freescale mx27-board, and i found out that the i2c-imx driver was missing the following, is there a reason for this, most other i2c-bus drivers seems to have it?

Yes. Autoprobing on I2C is not favoured (can have side-effects) with embedded platforms, so the proper way is to declare the eeprom as board-info or instantiate it at runtime.

Check Documentation/i2c/instantiating-devices for further info.

Regards,

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100213/0ed54079/attachment.sig>
#2 lore raw
In reply to Mattias Walstrom
Quoted 10 lines · Mattias Walstrom

I have tried to get autoprobe of eeproms to work on a custom freescale mx27-board, and i found out that the i2c-imx driver was missing the following, is there a reason for this, most other i2c-bus drivers seems to have it?

--- linux-2.6.32.8.orig/drivers/i2c/busses/i2c-imx.c 2010-02-09
13:57:19.000000000 +0100
+++ linux-2.6.32.8/drivers/i2c/busses/i2c-imx.c 2010-02-12 11:30:12.000000000 +0100

Review line 527

Quoted 7 lines
(quoted diff) +1 -0
@@ -521,6 +521,7 @@
        i2c_imx->adapter.algo           = &i2c_imx_algo;
        i2c_imx->adapter.dev.parent     = &pdev->dev;
        i2c_imx->adapter.nr             = pdev->id;
+        i2c_imx->adapter.class          = I2C_CLASS_HWMON | I2C_CLASS_SPD;
        i2c_imx->irq                    = irq;
        i2c_imx->base                   = base;
        i2c_imx->res                    = res;

Your patch is broken. drivers/i2c/busses/i2c-imx.c uses tabs for indention, not spaces.

(Note, this doesn't mean I'd ack your patch, see Wolfram's reply.)

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#3 lore raw
In reply to Mattias Walstrom
Quoted 4 lines · Mattias Walstrom

I have tried to get autoprobe of eeproms to work on a custom freescale mx27-board, and i found out that the i2c-imx driver was missing the following, is there a reason for this, most other i2c-bus drivers seems to have it?

auto-probing of anything on an i2c bus is always going to be trumped by actually knowing. The limited address space means often different types of peripherals can end up with similar addresses.

It is highly recommended in the ARM world where the board information is known from early in the initialisation process that the board registers the devices it knows to have available so that the i2c core can atatch the relevant drivers.

I'm not even sure if SPD is the right class to have on this, I think Jean Delvare has pronounced on this on the linux-i2c list (iirc, it is for probing DRAM DIMMS).

Even if Jean hasn't nixed this, I would still prefer not to apply this.

PS, this should have been cc'd to the linux-i2c list!

Quoted 16 lines

--- linux-2.6.32.8.orig/drivers/i2c/busses/i2c-imx.c 2010-02-09
13:57:19.000000000 +0100
+++ linux-2.6.32.8/drivers/i2c/busses/i2c-imx.c 2010-02-12 11:30:12.000000000 +0100

(quoted diff) +1 -0
@@ -521,6 +521,7 @@
        i2c_imx->adapter.algo           = &i2c_imx_algo;
        i2c_imx->adapter.dev.parent     = &pdev->dev;
        i2c_imx->adapter.nr             = pdev->id;
+        i2c_imx->adapter.class          = I2C_CLASS_HWMON | I2C_CLASS_SPD;
        i2c_imx->irq                    = irq;
        i2c_imx->base                   = base;
        i2c_imx->res                    = res;

Best regards
Mattias Walstr?m

Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.