Re: Problems with i2c_eg20t

Christian Gmeiner
2011-10-19T06:44:00Z

2011/10/18 Tomoya MORINAGA <tomoya-linux-8lRStDepK8iSL1NxhRU65dBPR1lH4CV8@public.gmane.org>:
> (2011/10/18 20:16), Christian Gmeiner wrote:
>
> Hi, Christian
>
>> Hi all
>>
>> I am using a 3.0.7 linux kernel with "[PATCH x/7 v4] i2c-eg20t: ..."
>> from 12. October on top of
>> it.
>>
>> ...
>> ...
>> [    1.439115] i2c_eg20t 0000:02:0c.2: pch_i2c_probe :Entered.
>> [    1.439163] i2c_eg20t 0000:02:0c.2: PCI INT C ->  GSI 18 (level,
>> low) ->  IRQ 18
>> [    1.439602] i2c-dev: adapter [i2c_eg20t] registered as minor 0
>> [    1.439738] i2c i2c-0: adapter [i2c_eg20t] registered
>> [    1.460041] i2c_eg20t 0000:02:0c.2: pch_i2c_init :I2CCTL=380
>> pch_i2cbc=fc0 pch_i2ctmr=186a Enable interrupts
>> [    1.460097] i2c_eg20t 0000:02:0c.2: pch_i2c_probe :returns 0.
>> ...
>> ...
>> [    2.098641] i2c 0-0050: uevent
>> [    2.098823] at24 0-0050: probe
>> [    2.098874] i2c 0-0051: uevent
>> [    2.099070] dummy 0-0051: probe
>> [    2.099084] i2c i2c-0: client [dummy] registered with bus id 0-0051
>> [    2.099099] at24 0-0050: 512 byte 24c04 EEPROM, writable, 16
>> bytes/write
>> [    2.099130] i2c i2c-0: master_xfer[0] W, addr=0x50, len=1
>> [    2.099140] i2c i2c-0: master_xfer[1] R, addr=0x50, len=24
>> [    2.099151] i2c_eg20t 0000:02:0c.2: pch_i2c_xfer
>> :adap->p_adapter_info->pch_i2c_suspended is 0
>> [    2.099161] i2c_eg20t 0000:02:0c.2: pch_i2c_xfer :After invoking
>> I2C_MODE_SEL :flag= 0x0
>> [    2.099171] i2c_eg20t 0000:02:0c.2: pch_i2c_xfer :invoking
>> pch_i2c_writebytes
>> [    2.099187] i2c_eg20t 0000:02:0c.2: pch_i2c_writebytes :I2CCTL =
>> 390 msgs->len = 1
>> [    2.099202] i2c_eg20t 0000:02:0c.2: pch_i2c_start :I2CCTL = 390
>> [    2.099559] i2c_eg20t 0000:02:0c.2: pch_i2c_cb :PCH_I2CSR = 28
>> [    2.099586] i2c_eg20t 0000:02:0c.2: pch_i2c_writebytes :writing 0
>> to Data register
>> [    2.099872] i2c_eg20t 0000:02:0c.2: pch_i2c_cb :PCH_I2CSR = 28
>> [    2.099903] i2c_eg20t 0000:02:0c.2: pch_i2c_repstart :I2CCTL = 3b0
>> [    2.099915] i2c_eg20t 0000:02:0c.2: pch_i2c_writebytes :return=1
>> [    2.101095] i2c i2c-0: master_xfer[0] W, addr=0x50, len=1
>> [    2.101107] i2c i2c-0: master_xfer[1] R, addr=0x50, len=24
>> [    2.101118] i2c_eg20t 0000:02:0c.2: pch_i2c_xfer
>> :adap->p_adapter_info->pch_i2c_suspended is 0
>> [    2.101128] i2c_eg20t 0000:02:0c.2: pch_i2c_xfer :After invoking
>> I2C_MODE_SEL :flag= 0x0
>> [    2.101138] i2c_eg20t 0000:02:0c.2: pch_i2c_xfer :invoking
>> pch_i2c_writebytes
>> [    2.101153] i2c_eg20t 0000:02:0c.2: pch_i2c_writebytes :I2CCTL =
>> 3b4 msgs->len = 1
>> [    2.122099] i2c_eg20t 0000:02:0c.2: pch_i2c_wait_for_bus_idle :I2CSR =
>> 28
>> [    2.122116] i2c_eg20t 0000:02:0c.2: pch_i2c_wait_for_bus_idle
>> :pch_i2c_wait_for_bus_idle: Timeout Error.return-62
>> [    2.143103] i2c_eg20t 0000:02:0c.2: pch_i2c_init :I2CCTL=380
>> pch_i2cbc=fc0 pch_i2ctmr=186a Enable interrupts
>> [    2.145097] i2c i2c-0: master_xfer[0] W, addr=0x50, len=1
>> [    2.145112] i2c i2c-0: master_xfer[1] R, addr=0x50, len=24
>> [    2.145124] i2c_eg20t 0000:02:0c.2: pch_i2c_xfer
>> :adap->p_adapter_info->pch_i2c_suspended is 0
>> [    2.145135] i2c_eg20t 0000:02:0c.2: pch_i2c_xfer :After invoking
>> I2C_MODE_SEL :flag= 0x0
>> [    2.145145] i2c_eg20t 0000:02:0c.2: pch_i2c_xfer :invoking
>> pch_i2c_writebytes
>> [    2.145160] i2c_eg20t 0000:02:0c.2: pch_i2c_writebytes :I2CCTL =
>> 390 msgs->len = 1
>> [    2.145174] i2c_eg20t 0000:02:0c.2: pch_i2c_start :I2CCTL = 390
>> [    2.145530] i2c_eg20t 0000:02:0c.2: pch_i2c_cb :PCH_I2CSR = 28
>> [    2.145556] i2c_eg20t 0000:02:0c.2: pch_i2c_writebytes :writing 0
>> to Data register
>> [    2.145843] i2c_eg20t 0000:02:0c.2: pch_i2c_cb :PCH_I2CSR = 28
>> [    2.145874] i2c_eg20t 0000:02:0c.2: pch_i2c_repstart :I2CCTL = 3b0
>> [    2.145886] i2c_eg20t 0000:02:0c.2: pch_i2c_writebytes :return=1
>> [    2.147055] failed to read eeprom
>>
>> Any hints? Btw. the eg20t i2c driver works much better with the patch
>> series from 12. October.
>>
>
> We tested again for I2C EEPROM access using Linux-3.1.0-rc9.
> As a result, the test is OK.
>
> Let me know how to do your test ?

02:0c.2 Serial bus controller [0c80]: Intel Corporation Platform
Controller Hub EG20T I2C Controller
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin C routed to IRQ 18
Region 1: Memory at d0144000 (32-bit, non-prefetchable) [size=256]
Capabilities: [40] MSI: Enable- Count=1/1 Maskable- 64bit-
Address: 00000000 Data: 0000
Capabilities: [50] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Kernel driver in use: i2c_eg20t

Okay... now to the interesting part. I wrote a very simple driver,
which should read the content of the eeprom
and should export some informations via /proc. This works very well on
an other x86 based device, so
there should not be a problem in general.

Here are some parts of my driver:

/* technical description of our used EEPROM */
static struct at24_platform_data ot1300_eeprom_info = {
.byte_len = 512,
.page_size = 16,
.flags = 0,
.setup = eeprom_read,
};

static struct i2c_board_info ot1300_i2c_eeprom = {
I2C_BOARD_INFO("24c04", 0x50),
.platform_data = &ot1300_eeprom_info,
};

int e6xx_init(void)
{
struct i2c_adapter *i2c_adap;

/* we use the integrated i2c adapter */
i2c_adap = i2c_get_adapter(0);

if (!i2c_adap) {
printk(KERN_ERR "xxx: failed to get i2c adapter 0\n");
return -EIO;
}

eeprom = i2c_new_device(i2c_adap, &ot1300_i2c_eeprom);
}

What would be the next steps to fix my issues?