UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
4,967 Views
Registered: ‎05-09-2016

Zynq PS I2C Cadence Driver/Device Reset

I am using the Cadence I2C drivers with the ZYNQ PS I2C busses.

It seems my Bus 0 is in a stuck position with both lines high, but I don't want to reset my board in case I don't get it in this state again.

 

Is there a way to reset an I2C device driver or bus from linux user space? I've tried mmaping the I2C device @ 0xe0004000, and reading the registers, and everything reads 0. The I2C device @ 0xe0005000 seems fine and the registers make sense.

Thanks

0 Kudos
5 Replies
Moderator
Moderator
4,918 Views
Registered: ‎04-17-2011

Re: Zynq PS I2C Cadence Driver/Device Reset

You can try to compile Cadence I2C driver as a module and when it stuck - rmmod/insmod it. Zynq MP has a new Reset Controller Driver which can be used but not in Zynq.

https://www.xilinx.com/support/answers/68058.html
Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Moderator
Moderator
4,895 Views
Registered: ‎07-31-2012

Re: Zynq PS I2C Cadence Driver/Device Reset

Hi,

Can you get dump of IIC registers to get what is the status of each to debug it?

 

Else, you can enable IIC debug message in kernel configuration.

 

Regards

Praveen


-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Adventurer
Adventurer
4,879 Views
Registered: ‎05-09-2016

Re: Zynq PS I2C Cadence Driver/Device Reset

So far I have tried rmmod/insmod the module on another board, but it seems the second time I insmod the driver, the I2C bus is completely unusable, both lines measure high.

 

On bootup I start the i2c-cadence.ko module automatically, and with 

i2cdetect -y -r 0

I can see all my devices addresses listed. I rmmod and insmod the driver, and then I see  none of the devices when I run the command above.

0 Kudos
Highlighted
Adventurer
Adventurer
4,861 Views
Registered: ‎05-09-2016

Re: Zynq PS I2C Cadence Driver/Device Reset

I've looked at the latest I2C cadence driver which has more bus recovery features: https://github.com/Xilinx/linux-xlnx/blob/master/drivers/i2c/busses/i2c-cadence.c  I'd hope this would help when I rmmod/insmod the driver to keep it working.

 

It requires that the I2C node also be setup to use the pincntrl drivers, but I am unsure how to do this. 

 

My current entry for the i2c node in the device tree is: 

		i2c@e0004000 {
			compatible = "cdns,i2c-r1p10";
			status = "okay";
			clocks = <0x1 0x26>;
			interrupt-parent = <0x3>;
			interrupts = <0x0 0x19 0x4>;
			reg = <0xe0004000 0x1000>;
			#address-cells = <0x1>;
			#size-cells = <0x0>;
			clock-frequency = <0x186a0>;
		};

I am unsure how to set up the pinctrl node to also handle the I2C pins (MIO14, MIO15).

 

 

 

Tags (3)
0 Kudos
Visitor kentbarker
Visitor
3,717 Views
Registered: ‎06-28-2017

Re: Zynq PS I2C Cadence Driver/Device Reset

I am having the same problem, did you find a solution to set up the pinctrl?  If I physically assert the I2C data line low for about 50ms it resets the bus and the zynq I2C controller starts working again. I want to do that from software, from /sys/class/gpio, IOCTL, or something like that if possible. 

 

When  build the kernel, I don't even see drivers/pinctrl/core.c being built, which is where pinctrl_lookup_state() is defined, which the new cadence driver calls to do the bus reset.

0 Kudos