Srinirajini
Posts: 10
Joined: Fri Oct 05, 2018 4:17 am

Does uboot has I2c drivers for Raspberry Pi CM3

Mon Oct 22, 2018 11:22 am

Dear All,
I wonder do we need to write/port I2C driver for Raspberry Pi CM3 for u-boot because under the u-boot menuconfig option I could not see any I2C driver relating to Raspberry, I had blindly enabled the I2C command and tried to access the bus but nothing has turned out. My u-boot version is "u-boot-2018.09"

U-Boot>
No I2C bus selected
Current bus is -1
U-Boot>


I had verified the pinctrl driver module which has been enabled for bcm283x device, but I am not clear whether we need to enable the bcm2835 pin control device please help me clarify. finally, my goal is to use the I2C Bus from U-boot to control my I2c Chip device.

By the way the configuration that I am using for building the u-boot is "rpi_3_32b_defconfig" and with this configuration I could do everything else except accessing the I2C Bus, even after the kernel boot, I could access the I2C device using the command "i2cdetect - y 1" , so I doubt whether the device tree "bcm2837-rpi-3-b.dts" loaded by the default configuration is correct or not?, At kernel I tried inserting the i2c_bcm2835 and i2c_dev modules manually, but still the bus is not created under the /dev/
I have enabled the I2C device tree param to "ON" (dtparam=i2c_arm=on ) in /boot/config file , Please provide some pointer

Thanks In Advance.
Srini.

W. H. Heydt
Posts: 12785
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Does uboot has I2c drivers for Raspberry Pi CM3

Mon Oct 22, 2018 3:06 pm

I would suggest asking this question on whatever support forums exist for u-boot.

drgeoff
Posts: 10831
Joined: Wed Jan 25, 2012 6:39 pm

Re: Does uboot has I2c drivers for Raspberry Pi CM3

Mon Oct 22, 2018 3:23 pm

Have I been labouring for years under these two misapprehensions?

1. uboot is not an Operating System. It is a bootloader - some code that loads and starts an OS.

2. Drivers run as part of or on top of the OS.
Quis custodiet ipsos custodes?

Srinirajini
Posts: 10
Joined: Fri Oct 05, 2018 4:17 am

Re: Does uboot has I2c drivers for Raspberry Pi CM3

Tue Oct 23, 2018 10:33 am

drgeoff wrote:
Mon Oct 22, 2018 3:23 pm
Have I been labouring for years under these two misapprehensions?

1. uboot is not an Operating System. It is a bootloader - some code that loads and starts an OS.

2. Drivers run as part of or on top of the OS.
Firstly, thanks for the response, and I completely agree with your point that the u-boot is the minimal initial code that load and execute the kernel, but then I believe even the bootlader can support accessing peripherals of the system. and I could see from the u-boot terminal that it list all other devices either through Pincontrol subsystem or through individual driver model. but I wonder why only the I2C is missing. also, my concern is if I load the same kernel which is properly probing the I2C bus, if loaded and executed straight away by the "start.elf" which is not probing the I2C bus if loaded through u-boot.
Any Idea pointer is greatly appreciated.

Regards,
Srini.

epoch1970
Posts: 5203
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Does uboot has I2c drivers for Raspberry Pi CM3

Tue Oct 23, 2018 12:58 pm

IIRC the DT passed by the pi bootloader is used as is, unless you actively replace it with your own (with the "dt" commands available in u-boot)
I tend to believe the issue might be in u-boot's code instead.

I would try with one of the repos owned by Alexander Graf, https://github.com/agraf/u-boot/
He is the current u-boot maintainer for the RPI platform, his tree gets merged upstream but I've had denx releases fail where agraf's would work.

Personally I am using agraf's "rpi-stable" branch and have no experience with i2c.
There is an "rpi-next" branch that is more recent, but the current effort seems to be around 64-bit u-boot with EFI support.

Good luck.
PS: I you have any practical experience to share about LED control on Pi 3 within u-boot, I'd be keen on a few hints ;)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Srinirajini
Posts: 10
Joined: Fri Oct 05, 2018 4:17 am

Re: Does uboot has I2c drivers for Raspberry Pi CM3

Wed Oct 24, 2018 1:30 am

epoch1970 wrote:
Tue Oct 23, 2018 12:58 pm
IIRC the DT passed by the pi bootloader is used as is, unless you actively replace it with your own (with the "dt" commands available in u-boot)
I tend to believe the issue might be in u-boot's code instead.

I would try with one of the repos owned by Alexander Graf, https://github.com/agraf/u-boot/
He is the current u-boot maintainer for the RPI platform, his tree gets merged upstream but I've had denx releases fail where agraf's would work.

Personally I am using agraf's "rpi-stable" branch and have no experience with i2c.
There is an "rpi-next" branch that is more recent, but the current effort seems to be around 64-bit u-boot with EFI support.

Good luck.
PS: I you have any practical experience to share about LED control on Pi 3 within u-boot, I'd be keen on a few hints ;)
Thank you so much for pointer let me try with Alexander Graf's repo probably "RPI_Stable", and try to explore I2C, even I need to start with LED from u-Boot using Pinctrl, that's propriety next to the I2C access. sure I will give you an update on led as soon as work on it.

Srinirajini
Posts: 10
Joined: Fri Oct 05, 2018 4:17 am

Re: Does uboot has I2c drivers for Raspberry Pi CM3

Wed Oct 24, 2018 2:44 am

No Luck I tried most of the different branches but I2C is not working in none of the branches for Raspberry "rpi_3_32b_defconfig" configuration, I notice gpio staus of the Pin 2 and 3 is not assigned with Function Alterative_0 rather it is kept open as General I/O pin. I am checking with pinctrl drivers, let me update if I get through. meantime if anybody could help, please provide suggestions.

Thanks,

nicklat
Posts: 1
Joined: Fri Aug 07, 2020 9:44 am

Re: Does uboot has I2c drivers for Raspberry Pi CM3

Fri Aug 07, 2020 10:09 am

Hello everyone,

I'm writing in this thread as I also have the exact same issue with the I2C driver activation in U-Boot for the RPI-CM3 module.

The problem is that the i2c command does not return any available bus when issued from the U-boot environment. Nevertheless it seems to work right under the Linux kernel. Both the U-Boot and the Kernel use the same device tree (custom-made).

By running the command "dm tree", I notice that indeed the i2c device was never probed. (serial, usb, mmc, eth are successfully probed at this point).

FInally, the following configuration options are also set in order to activate I2C support.
- CONFIG_DM_I2C=y
- CONFIG_DM_I2C_COMPAT=y
- CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
- CONFIG_I2C_DEFAULT_BUS_NUMBER=0x00
- CONFIG_DM_I2C_GPIO=y

(e.g. issuing >>i2c dev 0 returns "Failure changing bus number (-19)").

PS: The device tree is correctly configured and both i2c0, i2c1 are enabled.

Any help would be much appreciated.

Thanks in advance!

Rergards,
Nick

swahren
Posts: 141
Joined: Mon Sep 19, 2016 5:24 pm
Location: Germany

Re: Does uboot has I2c drivers for Raspberry Pi CM3

Sun Aug 09, 2020 9:11 am

nicklat wrote:
Fri Aug 07, 2020 10:09 am
The problem is that the i2c command does not return any available bus when issued from the U-boot environment. Nevertheless it seems to work right under the Linux kernel. Both the U-Boot and the Kernel use the same device tree (custom-made).
Providing the i2c relevant part would be very helpful
Which u-boot version do you use?
What is your actual use case (there are a lot of I2C devices)?
nicklat wrote:
Fri Aug 07, 2020 10:09 am
PS: The device tree is correctly configured and both i2c0, i2c1 are enabled.
Instead of your interpretation the actual settings would be more helpful for diagnostics.

Return to “Advanced users”