Skip to contentSkip to conversation

i2c on mpc5200

DISCUSSION [email protected] 3 participants 5 messages Dec 20, 2004 – Jan 5, 2005

lore
Share & tools
lore
#0 lore raw

Hi!

I have a hardware clock (RTC) which is not yet supported in the linux kernel. It is RX-8025 module from EPSON and it is I2C bus-interface based. Before I start writing support for this module I would like to have I2C support working in my kernel. Has anybody succeeded in getting I2C supported for MPC5200 based boards with 2.6 kernels? I'm using the one which maintains Sylvain Munaut. If I boot up the kernel with I2C support in it I don't get any initialization messages for I2C, only this one line:
----------------------------------------------------------------------
eth0: Phy @ 0x0, type LXT971 (0x001378e2) mice: PS/2 mouse device common for all mice
i2c /dev entries driver
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
-----------------------------------------------------------------------

I tried with v various 2.4 kernels but I only had some success with a kernel
form metrowerks which I got from a colleague. This is it's output.
--------------------------------------------------------------------------------
i2c-core.o: i2c core module
i2c-dev.o: i2c /dev entries driver module
i2c-core.o: driver i2c-dev dummy driver registered.
i2c-algo-bit.o: i2c bit algorithm module
i2c-proc.o version 2.6.1 (20010825)
devfs_register(ttyS): could not append to parent, err: -17
devfs_register(ttyS): could not append to parent, err: -17
devfs_register(cua): could not append to parent, err: -17
devfs_register(cua): could not append to parent, err: -17
PORT CONFIG 4
PORT CONFIG 500044
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
i2c-dev.o: Registered 'Icecube I2C module #2 interface' as minor 0
i2c-core.o: adapter Icecube I2C module #2 interface registered as adapter 0.
i2c-algo-5xxx.o: scanning bus Icecube I2C module #2 interface... ..................................................(0x32).............................(0x50)(0x51)(0x52)(0x53)(0x54)(0x55)(0x56)(0x57).......................................(0x) i2c-icecube.o: I2C module #2 installed
------------------------------------------------------------------------------------

This kernel has some strange hacks in it and I needed to change some code in order for it to compile under gcc. Ok, it works now but I would really like to code the driver for RTC module under 2.6 tree and like it is supposed to be done. I like the 2.6 I2C directory tree and it all makes more sense to a newb like me. First I need to get those core.o and algo.o stuff working. Under the menuconfig in the I2C there is a
I2C Hardware Bus support ---> [*] MPC107/824x/85xx/52xx
'Help' says :
"If you say yes to this option, support will be included for the
built-in I2C interface on the MPC107/Tsi107/MPC8240/MPC8245 and
MPC85xx family processors. The driver may also work on 52xx
family processors, though interrupts are known not to work."

I'm guessing this (drivers/i2c/busses/i2c-mpc.c) is the part I need to work on? Of course any input on where should I start would be greatly appreciated. Also if anyone has already succeeded in supporting i2c for mpc5200 I would love to hear your experience.

Best regards,
Ivica

#1 lore raw
Quoted 1 line · In message <[email protected]> you wrote:

...

Quoted 1 line

module I would like to have I2C support working in my kernel.

...

Quoted 3 lines

I tried with v various 2.4 kernels but I only had some success with a kernel
form metrowerks which I got from a colleague. This is it's output.

It works fine with the 2.4.x kernel on our CVS server.

Quoted 9 lines

i2c-core.o: i2c core module
i2c-dev.o: i2c /dev entries driver module i2c-core.o: driver i2c-dev dummy driver registered. i2c-algo-bit.o: i2c bit algorithm module i2c-proc.o version 2.6.1 (20010825) devfs_register(ttyS): could not append to parent, err: -17 devfs_register(ttyS): could not append to parent, err: -17 devfs_register(cua): could not append to parent, err: -17 devfs_register(cua): could not append to parent, err: -17

Did you try NOT using devfs?

Quoted 3 lines

Also if anyone has already succeeded in supporting i2c for mpc5200 I would love
to hear your experience.

We did, in 2.4, where it works OK, at least as long as the hardware is OK (some of the earlier Icecube boards had some issues).

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
The ultimate barrier is one's viewpoint.
                        - Terry Pratchett, _The Dark Side of the Sun_
#2 lore raw
Quoted 9 lines · Wolfgang Denk

We did, in 2.4, where it works OK, at least as long as the hardware is OK (some of the earlier Icecube boards had some issues).

Best regards,

Wolfgang Denk

This is true. I get this output when I boot latest kernel from DENX.
I think I decided I will go to 2.6 because it had the preemptible kernel
option which I will probably need later on.
******************************************************
i2c-core.o: i2c core module version 2.6.1 (20010830)
i2c-dev.o: i2c /dev entries driver module version 2.6.1 (20010830)
i2c-algo-pcf.o: i2c pcf8584 algorithm module
i2c-proc.o version 2.6.1 (20010830)
ttyS0 on PSC1
ttyS1 on PSC2
ttyS2 on PSC3
RAMDISK driver initialized: 16 RAM disks of 10240K size 1024 blocksize
loop: loaded (max 8 devices)
i2c-algo-5xxx.o: scanning bus Icecube I2C module #2 interface... ..................................................(0x32).............................(0x50)(0x51)(0x52)(0x53)(0x54)(0x55)(0x56)(0x57).......................................(0x) i2c-icecube.o: I2C module #2 installed
eth0: Phy @ 0x0, type LXT971 (0x001378e2)
*****************************************************

Root file system on NFS doesn't work though. I get this errors:
******************************************************
Looking up port of RPC 100003/2 on 192.168.254.58 MPC5xxx_FEC_IEVENT_RFIFO_ERROR MPC5xxx_FEC_IEVENT_RFIFO_ERROR MPC5xxx_FEC_IEVENT_RFIFO_ERROR MPC5xxx_FEC_IEVENT_RFIFO_ERROR MPC5xxx_FEC_IEVENT_RFIFO_ERROR MPC5xxx_FEC_IEVENT_RFIFO_ERROR MPC5xxx_FEC_IEVENT_RFIFO_ERROR
*******************************************************

But this is not that big of a problem. I'll just boot stand alone images. So, for writing a driver for my RTC i2c module I should look at Documentation/i2c/writing-clients right?
And it should be under
[*] I2C Chips support ---> right?

Best regards,
Ivica

#3 lore raw
In reply to [email protected]

Hi

Quoted 6 lines

I have a hardware clock (RTC) which is not yet supported in the linux kernel. It is RX-8025 module from EPSON and it is I2C bus-interface based. Before I start writing support for this module I would like to have I2C support working in my kernel. Has anybody succeeded in getting I2C supported for MPC5200 based boards with 2.6 kernels? I'm using the one which maintains

Quoted 8 lines

Sylvain Munaut. If I boot up the kernel with I2C support in it I don't get any initialization messages for I2C, only this one line:
----------------------------------------------------------------------
eth0: Phy @ 0x0, type LXT971 (0x001378e2) mice: PS/2 mouse device common for all mice
i2c /dev entries driver
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
-----------------------------------------------------------------------

Are you sure it doesn't work ?
On my system there are no I2C init message either, the driver is just not noisy ... (unless you activate all the I2C debug stuff).

I have the exact same message than you but if I activate the eeprom support then in /sys/bus/i2c/devices, the lite5200 eeprom shows up and I can read it ...

Sylvain

#4 lore raw
Quoted 3 lines · Sylvain Munaut

Are you sure it doesn't work ?
On my system there are no I2C init message either, the driver is just not noisy ... (unless you activate all the I2C debug stuff).

Debug stuff didn't output any messages. Then I simply listed kernel symbol table and grep for i2c. This is what I got.:

# cat proc/kallsyms |grep i2c

c00e4134 T i2c_device_probe
c00e413c T i2c_device_remove
c00e4144 t i2c_adapter_dev_release
c00e4168 t i2c_adapter_class_dev_release
c00e41bc t i2c_client_release
c00e4210 T i2c_add_adapter
c00e447c T i2c_del_adapter
c00e4758 T i2c_add_driver
c00e48a4 T i2c_del_driver
c00e4adc t __i2c_check_addr
c00e4b20 T i2c_check_addr
c00e4be8 T i2c_adapter_id
c00e4bf0 T i2c_attach_client
c00e4dec T i2c_detach_client
c00e4f48 t i2c_dec_use_client
c00e4f4c T i2c_use_client
c00e4f98 T i2c_release_client
c00e4ff8 T i2c_clients_command
c00e512c t i2c_device_match
c00e5134 t i2c_bus_suspend
c00e5194 t i2c_bus_resume
c00e51f4 T i2c_transfer
c00e5304 T i2c_master_send
c00e5438 T i2c_master_recv
c00e55b4 T i2c_control
c00e56a4 T i2c_get_adapter
c00e57a8 T i2c_put_adapter
c00e57dc T i2c_smbus_partial_pec
c00e5870 T i2c_smbus_pec
c00e58a4 T i2c_smbus_add_pec
c00e5994 T i2c_smbus_check_pec
c00e5ad0 T i2c_get_functionality
c00e5b10 T i2c_check_functionality
c00e5b4c T i2c_smbus_xfer
c00e6130 T i2c_smbus_read_i2c_block_data
c00e61b8 T i2c_smbus_block_process_call
c00e627c T i2c_smbus_write_block_data
c00e6304 T i2c_smbus_write_word_data
c00e6348 T i2c_smbus_read_word_data
c00e6398 T i2c_smbus_write_byte_data
c00e63dc T i2c_smbus_read_byte_data
c00e642c T i2c_smbus_write_byte
c00e646c T i2c_smbus_read_byte
c00e64bc T i2c_smbus_write_quick
c00e64e0 T i2c_probe
c00e6a2c T i2c_dev_get_by_minor
c00e6a40 T i2c_dev_get_by_adapter
c00e6a80 t return_i2c_dev
c00e6b0c t i2cdev_read
c00e6c20 t i2cdev_write
c00e6d30 T i2cdev_ioctl
c00e74e0 t i2cdev_open
c00e7580 t i2cdev_release
c00e75c8 t release_i2c_dev
c00e75ec t i2cdev_attach_adapter
c00e77b4 t i2cdev_detach_adapter
c00e7868 t i2cdev_detach_client
c00e7870 t i2cdev_commandc00e7878 T i2c_detect
c00e7d74 T i2c_which_vrm
c00e7da0 t mpc_i2c_isr
c00e7e20 t i2c_wait
c00e953c t i2c_start
c00e95e0 t i2c_repstart
c00e9790 t i2c_stop
c00e9904 t i2c_outb
c00ea71c T i2c_bit_add_bus
c00eace4 T i2c_bit_del_bus
c00ead04 t i2c_start
c00ead8c t i2c_repstart
c00eae14 t i2c_stop
c00eb608 T i2c_pcf_add_bus
c00eb8e8 T i2c_pcf_del_bus
c00ec1c4 T i2c_pca_add_bus
c00ec2e4 T i2c_pca_del_bus
c01569a0 t i2c_exit
c01569e0 t i2c_dev_exit
c0156a34 t mpc_i2c_remove
c01b7e20 t i2c_init
c01b7e7c t i2c_dev_init
c01b7f40 t mpc_i2c_probe

I think this proves i2c support is in the kernel. Right?

regards,
Ivica