RPI CM4 - I2C BUS and Device Tree
Romain Crausaz
crausaz.romain at gmail.com
Mon Aug 19 09:15:41 CEST 2024
Hi Simon, Hi Peter,
First of all, thanks a lot for your answers.
1. When I enable the i2c bus in the config.txt (which is parsed by the rpi
first stage bootloader), the overlay put this as compatible:"brcm,bcm2835".
I checked in the source of U-Boot and the driver is not available.
2. One solution could be to use the i2c-gpio driver instead of the default
i2c controller. U-Boot has this driver.
3. Since the device tree passed by the rpi bootloader is stored in the
variable fw_dtb_pointer (see the lowlevel_init.S) would I be able to do the
following:
3.1 remove the automatic selection for the device tree passed by the
rpi bootload
3.2 system starts and use the default device tree where the i2c bus is
defined with i2c-gpio, access the device I need and store the information
needed
3.3 get the device tree address from fw_dtb_pointer, set fdt address
fdt addr with the new device tree and then start the kernel
I have another question, what triggers the DM to check for the device (with
dm tree command there is a X under the column probed). Because here we
could have a really simple device tree with the minimum configuration for
just the i2c and load it from U-Boot, perform the action needed and then
boot the kernel by passing the device tree provided by the first stage
bootloder.
Regards
Romain
Le sam. 17 août 2024 à 17:57, Simon Glass <sjg at chromium.org> a écrit :
> +Peter Robinson
> +Matthias Brugger
>
> Hi Romain,
>
> On Sat, 17 Aug 2024 at 07:01, Romain Crausaz <crausaz.romain at gmail.com>
> wrote:
> >
> > Hi all,
> >
> >
> >
> > I am currently facing an issue with U-Boot and a raspberry pi CM4. Here
> is
> > the setup:
> >
> >
> >
> > 1. Yocto Scarthgap
> >
> > 2. U-Boot 2024.01
> >
> > 3. rpi_arm64_defconfig
> >
> >
> >
> > I am trying to access the i2c bus from U-Boot. I have been trying to
> modify
> > the device tree which is referenced as
> > “CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b”” in the defconfig without
> > success. I can remove everything, set all nodes to disabled and I see no
> > change in U-Boot (I am using dm commands to check the status of the
> > peripherals).
> >
> >
> >
> > It seems that with the rpi, U-Boot will only configure itself against the
> > device tree passed by the bootloader of RPI. Could someone confirm this ?
>
> Yes. It isn't quite obvious, but this is a clue:
>
> Core: 211 devices, 16 uclasses, devicetree: board
>
> 'board' means that the board can do whatever it wants.
>
> >
> >
> >
> > Is there a way to configure / modify U-Boot to use its own devicetree and
> > simply pass the device tree generated by the rpi bootloader to the
> kernel ?
> >
> >
> >
> > Because the second issue is that the i2c driver defined in the device
> tree
> > passed to u-boot is not available in u-boot.
> >
> >
> >
> > Thanks for your help
>
> Since OF_HAS_PRIOR_STAGE is a hidden option, you cannot disable it in
> the defconfig. The only way I know of is to comment out the 'imply
> OF_HAS_PRIOR_STAGE' in ARCH_BCM283X in arch/arm/Kconfig
>
> For me, that stops the rpi_4 booting, so perhaps the devicetree is
> out-of-date or ft_board_setup() is doing something strange, or
> something else. The in-tree devicetree may have got out-of-date, so
> perhaps use the Linux one.
>
> Regards,
> Simon
>
More information about the U-Boot
mailing list