FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5924 Discussions

Cyclone V I2C0 on HPS fails to start

Alberto_F
New Contributor I
414 Views

Hello all,

 

I have a custom CycloneV SOM board with several peripherals: Ethernet, UART1 and 0, SDMMC, GPIO, I2C.

I'm using Buildroot to build the project. uBoot is v2020.10.

Ethernet, SDMMC, UART0/1 and GPIO all work very well.

I'm having trouble getting I2C0 to work. I've added it via QSys and created the BSP and QTS files.

What I get:

If I stop autoboot, I can:

> i2c dev 0
Setting bus to 0
I2C bus i2c@ffc04000 version 0x3132302a
> i2c probe
Valid chip addresses: 48 68

That's all good, as I have two chips with both addresses on the board.

After a reboot, on Linux:

...
[    1.501678] i2c /dev entries driver
[    1.506237] Synopsys Designware Multimedia Card Interface Driver
...
$ i2cdetect -y 0
i2cdetect: can't open '/dev/i2c/0': No such file or directory
$ i2cdetect -l
$

This is my uboot config:

CONFIG_CMD_I2C=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_DW=y

The dts entry:

&i2c0 {
 	status = "okay";
 	clock-frequency = <100000>;
	compatible = "snps,designware-i2c-17.0", "snps,designware-i2c";
	clocks = <&l4_sp_clk>;
	clock-frequency = <100000>;
	i2c-sda-hold-time-ns = <100>;
	i2c-sda-falling-time-ns = <100>;
	i2c-scl-falling-time-ns = <300>;
}

I've read there was an issue with Arria10 devices with designware_i2c.c:

int designware_i2c_remove(struct udevice *dev)
{
	struct dw_i2c *priv = dev_get_priv(dev);

#if CONFIG_IS_ENABLED(CLK)
	clk_disable(&priv->clk);
	clk_free(&priv->clk);
#endif

	return reset_release_bulk(&priv->resets);
}

But commenting out "clk_disable" and "clk_free" don't make any difference.

I'd be really grateful if you can shed some light on this. It seems that it has been an issue in the past, and I'm not able to find the solution.

Any help is appreciated.

 

Cheers,

 

Alberto

0 Kudos
1 Reply
Alberto_F
New Contributor I
385 Views

Solved. That was a silly mistake.

 

I had to explicitly add

 

      i2c0: i2c@ffc04000 {
          speed-mode = <0>;
          status = "okay";
      };
 
to my .dts file. It all works now.
 
Cheers,
 
Alberto
0 Kudos
Reply