cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
736 Views
Registered: ‎10-15-2015

Petalinux 15.4 Add I2C support to u-boot

Jump to solution

I am trying to add I2C support to an existing project that is currently using Petalinux 15.4 on the ZC706. I have searched and added the following to the project.

 

To <project>/subsystems/linux/configs/u-boot/config:

CONFIG_CMD_I2C=y

 

To <project>/subsystems/linux/configs/u-boot/platform-top.h:

/* Configure I2C support. */
#define CONFIG_SYS_I2C_ZYNQ

#if defined(CONFIG_SYS_I2C_ZYNQ)
/*# define CONFIG_CMD_I2C*/
# define CONFIG_SYS_I2C
# define CONFIG_SYS_I2C_ZYNQ_SPEED 100000
# define CONFIG_SYS_I2C_ZYNQ_SLAVE 0
#endif

 

Our device tree:

i2c0: i2c@e0004000 {
compatible = "cdns,i2c-r1p10";
status = "disabled";
clocks = <&clkc 38>;
interrupt-parent = <&intc>;
interrupts = <0 25 4>;
reg = <0xe0004000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
};

 

i2c1: i2c@e0005000 {
compatible = "cdns,i2c-r1p10";
status = "disabled";
clocks = <&clkc 39>;
interrupt-parent = <&intc>;
interrupts = <0 48 4>;
reg = <0xe0005000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
};

 

&i2c0 {
clock-frequency = <400000>;
status = "okay";
};

 

I now get the I2C in the command set, but unfortunately when I boot, I get the following. I also get this when I try any u-boot i2c command on the u-boot command line.

U-Boot 2015.07 (May 03 2018 - 11:31:43 -0500)

I2C: Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possible
ready
DRAM: ECC disabled 512 MiB
MMC: zynq_sdhci: 0
SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiB
Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possible
In: serial
Out: serial
Err: serial
Net: Gem.e000b000
Hit any key to stop autoboot: 0

 

U-Boot-PetaLinux> i2c md 0x70 0.0 1
Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possible

 

Any suggestions on how to get u-boot to support I2C?

BR,

Ralph

 

 

 

0 Kudos
1 Solution

Accepted Solutions
Observer
Observer
857 Views
Registered: ‎10-15-2015
I debugged down to seeing the adapter is invalid, that's when I found I should be setting:
#define CONFIG_ZYNQ_I2C0
#define CONFIG_ZYNQ_I2C1
So now I don't get the initialization error anymore. Have not tested accessing the devices yet. That will be tomorrow :).

View solution in original post

0 Kudos
1 Reply
Observer
Observer
858 Views
Registered: ‎10-15-2015
I debugged down to seeing the adapter is invalid, that's when I found I should be setting:
#define CONFIG_ZYNQ_I2C0
#define CONFIG_ZYNQ_I2C1
So now I don't get the initialization error anymore. Have not tested accessing the devices yet. That will be tomorrow :).

View solution in original post

0 Kudos