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: 
Highlighted
Visitor gvelez
Visitor
12,349 Views
Registered: ‎06-05-2013

Howto compile Zynq Linux with I2C driver

Hello all,

I want to compile Zynq Linux ( http://www.wiki.xilinx.com/Fetch+Sources ) including the I2C driver. How can I do it??


According to this link: http://www.wiki.xilinx.com/Linux+I2C+Driver , I need to select I2C support from the device drivers menu, but I don't know what menu is it talking about, since I compile the kernel without any interface, using these steps:

http://www.wiki.xilinx.com/Build+kernel

 

Can anyone help me???

 

thank you in advance!

0 Kudos
9 Replies
Contributor
Contributor
12,341 Views
Registered: ‎11-28-2009

Re: Howto compile Zynq Linux with I2C driver

Just yesterday I got I2C to show up in /dev and /sys.

 

You need to do two things.  Add I2C to your kernel, and (the hard part) set up your
devicetree properly.

 

Attached find my kernel .config file and a .dts file based on release
14.7 and setup for the MicroZed board. 

 

You wlll probably need to modify the .dts if you're using a board different
than MicroZed.

 

This setup boots for me, but I get this "skb_over_panic" after about a day
of operation.  Working on that one...

 

YMMV.  Good luck.

 

llj

 

0 Kudos
Xilinx Employee
Xilinx Employee
12,329 Views
Registered: ‎03-13-2012

Re: Howto compile Zynq Linux with I2C driver

Can you please give more details what you try to do and what your problem is?

The Zynq defconfig already has I2C enabled and includes drivers for the common I2C devices (probably not for soft-IP controllers though) on Zynq platforms. Also dts files shipped with the kernel sources include proper descriptions for the I2C busses on those supported platforms.

0 Kudos
Contributor
Contributor
12,325 Views
Registered: ‎11-28-2009

Re: Howto compile Zynq Linux with I2C driver

Attached find the decompiled devicetree included in the zed directory
of the 14.7 release.

 

I see no i2c device configuration???

 

I didn't decompile the zc70x trees to see what they have.

 

llj

0 Kudos
Xilinx Employee
Xilinx Employee
12,315 Views
Registered: ‎03-13-2012

Re: Howto compile Zynq Linux with I2C driver

You're right, the Zed dts does not have any I2C information. BTW, you can see the dts sources here: https://github.com/Xilinx/linux-xlnx/tree/master/arch/arm/boot/dts

 

If you want to use the PS I2C controller, you shouldn't have to recompile the whole kernel, since that driver is included - you might have to though, depending on what I2C devices you want to talk to and whether their drivers are enabled in the kernel.

And in general you'd have to add the description for the I2C bus in the Zed dts file and recompile the DT image. You can take a look at the zc702, zc706 files or the dts leith provided to get started.

0 Kudos
Contributor
Contributor
12,308 Views
Registered: ‎11-28-2009

Re: Howto compile Zynq Linux with I2C driver

Great.  Thanks for the pointer to the dts sources.  Wished
I'd a known about that a few days ago.

 

I did look at zynq-zc702-base-trd.dts.  It uses
a different naming scheme than the base Zed .dts.   Be careful
when cutting and pasting!

 

llj

0 Kudos
Xilinx Employee
Xilinx Employee
12,305 Views
Registered: ‎03-13-2012

Re: Howto compile Zynq Linux with I2C driver

I didn't expect those to be such a secret. Anyway, you probably learned a lot by doing it the hard way :P

 

One additional note though: Make sure your dts and kernel are coming from the same commit. Otherwise you might run in fatal incompatibilities.

0 Kudos
Visitor gvelez
Visitor
12,289 Views
Registered: ‎06-05-2013

Re: Howto compile Zynq Linux with I2C driver

First of all, thank you for your answers!

I use a ZedBoard, and there is no mention of I2C in the corresponding dts file located on Xilinx Git  (zynq-zed.dts). Anyway, I will use leith's dts as base. 

 

Sorenb says that I don't need to recompile the whole kernel as the driver is included by default. Now my question is: how can I use the driver on a linux application? should i follow the steps described here?

http://www.wiki.xilinx.com/Linux+I2C+Driver

 

The thing is that this page says that it is outdated and may provide inaccurate information. At what extend is outdated??

thank you in advance!

 

 

0 Kudos
11,937 Views
Registered: ‎03-01-2014

Re: Howto compile Zynq Linux with I2C driver


@gvelez wrote:
Can anyone help me???

 


I have done this before on a zynq 7020 before using i2c-dev (userspace device driver).

 

The way I did it was get the sources for the i2c-tools package on Ubuntu/Debian.

 

$ sudo apt-get source i2c-tools

 

Inside the directory, there will be a include directory and a tools directory. The include directory has the defines for i2c and smbus. In the tools directory is the source, you need to compile that with the cross compiler. I used the one in sysroots from poky. If you have it pathed in your environment it is smart enough to know where to pick up it's files.

 

Compile the code, in take the shared libraries, they need to get copied to the embedded linux. Compile your app and link against the shared libraries. Run the binary on the device with the shared libraries.

 

That should give you a start.

 

Cheers,

Alan

0 Kudos
Visitor snehaputhani
Visitor
10,004 Views
Registered: ‎09-17-2014

Re: Howto compile Zynq Linux with I2C driver

Hi Leith,

 

I am working with Zybo board, I compiled Linux sources provided by Digilent, I also added I2C to the kernel configuration and set up the device tree.

The setup boots on the processor, but I do not find any sources under /dev/i2c folder. Its empty.

 

I am not understanding whats wrong with the set up. Could you please help?

I have verified the .config file with the ones you have attached and also checked the device tree.

0 Kudos