Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access i2c bus from U-Boot #1358

Open
Spark1114 opened this issue Aug 16, 2024 · 1 comment
Open

Access i2c bus from U-Boot #1358

Spark1114 opened this issue Aug 16, 2024 · 1 comment

Comments

@Spark1114
Copy link

Spark1114 commented Aug 16, 2024

Hi all,

I am trying to access a TPM connected to the i2c bus 0 from U-boot without any success. I have a custom board with a CM4 and I am using Scarthgap release. The i2c bus used is 0 connected to gpio0 and gpio1. The config.txt with the dedicated overlays seems correct because everything is working fine in Linux.

I have all the commands available but I always get the error -19 when trying to select bus 0.

From the dm tree command I see that the i2c bus is not probed at all.

I tried to modify in U-Boot the device tree which is specified in the rpi_arm64_defconfig file to enable the i2c and set the gpio0 and 1 without any success. I also tried to modify the default dtb provided in /boot by the kernel (bcm2711-rpi-cm4.dtb) and load it manually into u-boot. The fdt print i2c0 shows the node but no bus are displayed when I do i2c dev or i2c bus.

To check which file is used by u-boot I also tried to disable the hdmi node in the device (bcm2711-rpi-4-b.dts) without success.

I wasn't able to find any ressources online on how to enable this i2c bus. I am sure a small thing is missing but I can't figure it out.

Thanks a lot for your help.

rpi_arm64_defconfig:

CONFIG_ARM=y
CONFIG_ARCH_BCM283X=y
CONFIG_TEXT_BASE=0x00080000
CONFIG_TARGET_RPI_ARM64=y
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x7fffe30
CONFIG_ENV_SIZE=0x4000
CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b"
CONFIG_OF_LIBFDT_OVERLAY=y
CONFIG_DM_RESET=y
CONFIG_SYS_LOAD_ADDR=0x1000000
CONFIG_PCI=y
CONFIG_BOOTSTD_DEFAULTS=y
CONFIG_OF_BOARD_SETUP=y
CONFIG_FDT_SIMPLEFB=y
# CONFIG_DISPLAY_CPUINFO is not set
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_MISC_INIT_R=y
CONFIG_SYS_PROMPT="U-Boot> "
CONFIG_SYS_PBSIZE=1049
CONFIG_CMD_GPIO=y
CONFIG_CMD_MMC=y
CONFIG_CMD_PCI=y
CONFIG_CMD_USB=y
CONFIG_CMD_FS_UUID=y
CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_TFTP_TSIZE=y
CONFIG_DM_DMA=y
CONFIG_BCM2835_GPIO=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_SDMA=y
CONFIG_MMC_SDHCI_BCM2835=y
CONFIG_BCMGENET=y
CONFIG_PCI_BRCMSTB=y
CONFIG_PINCTRL=y
# CONFIG_PINCTRL_GENERIC is not set
CONFIG_DM_RNG=y
CONFIG_RNG_IPROC200=y
# CONFIG_REQUIRE_SERIAL_CONSOLE is not set
CONFIG_SYSINFO=y
CONFIG_SYSINFO_SMBIOS=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_PCI=y
CONFIG_USB_DWC2=y
CONFIG_USB_KEYBOARD=y
CONFIG_USB_HOST_ETHER=y
CONFIG_USB_ETHER_LAN78XX=y
CONFIG_USB_ETHER_SMSC95XX=y
CONFIG_VIDEO=y
# CONFIG_VIDEO_BPP8 is not set
# CONFIG_VIDEO_BPP16 is not set
CONFIG_SYS_WHITE_ON_BLACK=y
CONFIG_VIDEO_BCM2835=y
CONFIG_CONSOLE_SCROLL_LINES=10
CONFIG_PHYS_TO_BUS=y
CONFIG_DM_I2C=y
CONFIG_DM_I2C_COMPAT=y
CONFIG_DM_I2C_GPIO=y
CONFIG_SYS_I2C=y
CONFIG_SYS_I2C_RPI=y
CONFIG_I2C=y
CONFIG_I2C_MUX=y
CONFIG_I2C_DEBUG_BUS=y
CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
CONFIG_I2C_DEFAULT_BUS_NUMBER=0x00
CONFIG_I2C0_ENABLE=y
CONFIG_CMD_I2C=y
CONFIG_TPM=y
CONFIG_TPM_TIS_I2C=y
CONFIG_TPM_TIS_I2C_DEBUG=y
CONFIG_CMD_TPM=y

bcm2711-rpi-4-b.dts (in u-boot):

// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
#include "bcm2711.dtsi"
#include "bcm2711-rpi.dtsi"
#include "bcm283x-rpi-usb-peripheral.dtsi"

/ {
	compatible = "raspberrypi,4-model-b", "brcm,bcm2711";
	model = "Raspberry Pi 4 Model B";

	chosen {
		/* 8250 auxiliary UART instead of pl011 */
		stdout-path = "serial1:115200n8";
	};

	leds {
		led-act {
			gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
		};

		led-pwr {
			label = "PWR";
			gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
			default-state = "keep";
			linux,default-trigger = "default-on";
		};
	};

	wifi_pwrseq: wifi-pwrseq {
		compatible = "mmc-pwrseq-simple";
		reset-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>;
	};

	sd_io_1v8_reg: sd_io_1v8_reg {
		compatible = "regulator-gpio";
		regulator-name = "vdd-sd-io";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <3300000>;
		regulator-boot-on;
		regulator-always-on;
		regulator-settling-time-us = <5000>;
		gpios = <&expgpio 4 GPIO_ACTIVE_HIGH>;
		states = <1800000 0x1>,
			 <3300000 0x0>;
		status = "okay";
	};

	sd_vcc_reg: sd_vcc_reg {
		compatible = "regulator-fixed";
		regulator-name = "vcc-sd";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-boot-on;
		enable-active-high;
		gpio = <&expgpio 6 GPIO_ACTIVE_HIGH>;
	};
};

&ddc0 {
	status = "okay";
};

&ddc1 {
	status = "okay";
};

&expgpio {
	gpio-line-names = "BT_ON",
			  "WL_ON",
			  "PWR_LED_OFF",
			  "GLOBAL_RESET",
			  "VDD_SD_IO_SEL",
			  "CAM_GPIO",
			  "SD_PWR_ON",
			  "";
};

&gpio {
	/*
	 * Parts taken from rpi_SCH_4b_4p0_reduced.pdf and
	 * the official GPU firmware DT blob.
	 *
	 * Legend:
	 * "FOO" = GPIO line named "FOO" on the schematic
	 * "FOO_N" = GPIO line named "FOO" on schematic, active low
	 */
	gpio-line-names = "ID_SDA",
			  "ID_SCL",
			  "SDA1",
			  "SCL1",
			  "GPIO_GCLK",
			  "GPIO5",
			  "GPIO6",
			  "SPI_CE1_N",
			  "SPI_CE0_N",
			  "SPI_MISO",
			  "SPI_MOSI",
			  "SPI_SCLK",
			  "GPIO12",
			  "GPIO13",
			  /* Serial port */
			  "TXD1",
			  "RXD1",
			  "GPIO16",
			  "GPIO17",
			  "GPIO18",
			  "GPIO19",
			  "GPIO20",
			  "GPIO21",
			  "GPIO22",
			  "GPIO23",
			  "GPIO24",
			  "GPIO25",
			  "GPIO26",
			  "GPIO27",
			  "RGMII_MDIO",
			  "RGMIO_MDC",
			  /* Used by BT module */
			  "CTS0",
			  "RTS0",
			  "TXD0",
			  "RXD0",
			  /* Used by Wifi */
			  "SD1_CLK",
			  "SD1_CMD",
			  "SD1_DATA0",
			  "SD1_DATA1",
			  "SD1_DATA2",
			  "SD1_DATA3",
			  /* Shared with SPI flash */
			  "PWM0_MISO",
			  "PWM1_MOSI",
			  "STATUS_LED_G_CLK",
			  "SPIFLASH_CE_N",
			  "SDA0",
			  "SCL0",
			  "RGMII_RXCLK",
			  "RGMII_RXCTL",
			  "RGMII_RXD0",
			  "RGMII_RXD1",
			  "RGMII_RXD2",
			  "RGMII_RXD3",
			  "RGMII_TXCLK",
			  "RGMII_TXCTL",
			  "RGMII_TXD0",
			  "RGMII_TXD1",
			  "RGMII_TXD2",
			  "RGMII_TXD3";
};

&hdmi0 {
	status = "okay";
};

&hdmi1 {
	status = "okay";
};

&pixelvalve0 {
	status = "okay";
};

&pixelvalve1 {
	status = "okay";
};

&pixelvalve2 {
	status = "okay";
};

&pixelvalve4 {
	status = "okay";
};

&pwm1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pwm1_0_gpio40 &pwm1_1_gpio41>;
	status = "okay";
};

/* SDHCI is used to control the SDIO for wireless */
&sdhci {
	#address-cells = <1>;
	#size-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&emmc_gpio34>;
	bus-width = <4>;
	non-removable;
	mmc-pwrseq = <&wifi_pwrseq>;
	status = "disabled";

	brcmf: wifi@1 {
		reg = <1>;
		compatible = "brcm,bcm4329-fmac";
	};
};

/* EMMC2 is used to drive the SD card */
&emmc2 {
	vqmmc-supply = <&sd_io_1v8_reg>;
	vmmc-supply = <&sd_vcc_reg>;
	broken-cd;
	status = "okay";
};

&genet {
	phy-handle = <&phy1>;
	phy-mode = "rgmii-rxid";
	status = "okay";
};

&genet_mdio {
	phy1: ethernet-phy@1 {
		/* No PHY interrupt */
		reg = <0x1>;
	};
};

&pcie0 {
	pci@0,0 {
		device_type = "pci";
		#address-cells = <3>;
		#size-cells = <2>;
		ranges;

		reg = <0 0 0 0 0>;

		usb@0,0 {
			reg = <0 0 0 0 0>;
			resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
		};
	};
};

/* uart0 communicates with the BT module */
&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_ctsrts_gpio30 &uart0_gpio32>;
	uart-has-rtscts;
	status = "disabled";

	bluetooth {
		compatible = "brcm,bcm43438-bt";
		max-speed = <2000000>;
		shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
	};
};

/* uart1 is mapped to the pin header */
&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart1_gpio14>;
	status = "okay";
};

&vc4 {
	status = "okay";
};

&vec {
	status = "disabled";
};


&i2c0 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&i2c0_gpio0>;
    clock-frequency = <400000>;

	slb9673: slb9673@2e {
		compatible = "infineon,slb9673", "tis,tpm2-i2c", "tcg,tpm-tis-i2c";
		reg = <0x2e>; 
		status = "okay"; 
	}; 
};

bcm2711-rpi-cm4.dts (from linux-raspberry):

// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
#define BCM2711
#define i2c0 i2c0if
#include "bcm2711.dtsi"
#include "bcm283x-rpi-wifi-bt.dtsi"
#undef i2c0
#include "bcm270x.dtsi"
#define i2c0 i2c0mux
#include "bcm2711-rpi.dtsi"
#undef i2c0
#include "bcm283x-rpi-led-deprecated.dtsi"
//#include "bcm283x-rpi-usb-peripheral.dtsi"

/ {
	compatible = "raspberrypi,4-compute-module", "brcm,bcm2711";
	model = "Raspberry Pi Compute Module 4";

	chosen {
		/* 8250 auxiliary UART instead of pl011 */
		stdout-path = "serial1:115200n8";
	};

	sd_io_1v8_reg: sd_io_1v8_reg {
		compatible = "regulator-gpio";
		regulator-name = "vdd-sd-io";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <3300000>;
		regulator-boot-on;
		regulator-always-on;
		regulator-settling-time-us = <5000>;
		gpios = <&expgpio 4 GPIO_ACTIVE_HIGH>;
		states = <1800000 0x1>,
			 <3300000 0x0>;
		status = "okay";
	};

	sd_vcc_reg: sd_vcc_reg {
		compatible = "regulator-fixed";
		regulator-name = "vcc-sd";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-boot-on;
		enable-active-high;
		gpio = <&expgpio 6 GPIO_ACTIVE_HIGH>;
	};
};

&bt {
	shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
};

&ddc0 {
	status = "okay";
};

&ddc1 {
	status = "okay";
};

&expgpio {
	gpio-line-names = "BT_ON",
			  "WL_ON",
			  "PWR_LED_OFF",
			  "ANT1",
			  "VDD_SD_IO_SEL",
			  "CAM_GPIO",
			  "SD_PWR_ON",
			  "ANT2";

	ant1: ant1 {
		gpio-hog;
		gpios = <3 GPIO_ACTIVE_HIGH>;
		output-high;
	};

	ant2: ant2 {
		gpio-hog;
		gpios = <7 GPIO_ACTIVE_HIGH>;
		output-low;
	};
};

&gpio {
	/*
	 * Parts taken from rpi_SCH_4b_4p0_reduced.pdf and
	 * the official GPU firmware DT blob.
	 *
	 * Legend:
	 * "FOO" = GPIO line named "FOO" on the schematic
	 * "FOO_N" = GPIO line named "FOO" on schematic, active low
	 */
	gpio-line-names = "ID_SDA",
			  "ID_SCL",
			  "SDA1",
			  "SCL1",
			  "GPIO_GCLK",
			  "GPIO5",
			  "GPIO6",
			  "SPI_CE1_N",
			  "SPI_CE0_N",
			  "SPI_MISO",
			  "SPI_MOSI",
			  "SPI_SCLK",
			  "GPIO12",
			  "GPIO13",
			  /* Serial port */
			  "TXD1",
			  "RXD1",
			  "GPIO16",
			  "GPIO17",
			  "GPIO18",
			  "GPIO19",
			  "GPIO20",
			  "GPIO21",
			  "GPIO22",
			  "GPIO23",
			  "GPIO24",
			  "GPIO25",
			  "GPIO26",
			  "GPIO27",
			  "RGMII_MDIO",
			  "RGMIO_MDC",
			  /* Used by BT module */
			  "CTS0",
			  "RTS0",
			  "TXD0",
			  "RXD0",
			  /* Used by Wifi */
			  "SD1_CLK",
			  "SD1_CMD",
			  "SD1_DATA0",
			  "SD1_DATA1",
			  "SD1_DATA2",
			  "SD1_DATA3",
			  /* Shared with SPI flash */
			  "PWM0_MISO",
			  "PWM1_MOSI",
			  "STATUS_LED_G_CLK",
			  "SPIFLASH_CE_N",
			  "SDA0",
			  "SCL0",
			  "RGMII_RXCLK",
			  "RGMII_RXCTL",
			  "RGMII_RXD0",
			  "RGMII_RXD1",
			  "RGMII_RXD2",
			  "RGMII_RXD3",
			  "RGMII_TXCLK",
			  "RGMII_TXCTL",
			  "RGMII_TXD0",
			  "RGMII_TXD1",
			  "RGMII_TXD2",
			  "RGMII_TXD3";
};

&hdmi0 {
	status = "disabled";
};

&hdmi1 {
	status = "disabled";
};

&led_act {
	gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
};

&leds {
	led_pwr: led-pwr {
		label = "PWR";
		gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
		default-state = "keep";
		linux,default-trigger = "default-on";
	};
};

&pixelvalve0 {
	status = "okay";
};

&pixelvalve1 {
	status = "okay";
};

&pixelvalve2 {
	status = "okay";
};

&pixelvalve4 {
	status = "okay";
};

&pwm1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pwm1_0_gpio40 &pwm1_1_gpio41>;
	status = "okay";
};

/* EMMC2 is used to drive the EMMC card */
&emmc2 {
	bus-width = <8>;
	vqmmc-supply = <&sd_io_1v8_reg>;
	vmmc-supply = <&sd_vcc_reg>;
	broken-cd;
	status = "okay";
};

&genet {
	phy-handle = <&phy1>;
	phy-mode = "rgmii-rxid";
	status = "disabled";
};

&genet_mdio {
	phy1: ethernet-phy@0 {
		/* No PHY interrupt */
		reg = <0x0>;
	};
};

&pcie0 {
	pci@0,0 {
		device_type = "pci";
		#address-cells = <3>;
		#size-cells = <2>;
		ranges;

		reg = <0 0 0 0 0>;
	};
};

/* uart0 communicates with the BT module */
&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_ctsrts_gpio30 &uart0_gpio32>;
	uart-has-rtscts;
};

/* uart1 is mapped to the pin header */
&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart1_gpio14>;
	status = "okay";
};

&vc4 {
	status = "okay";
};

&vec {
	status = "disabled";
};

&wifi_pwrseq {
	reset-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>;
};

// =============================================
// Downstream rpi- changes

#include "bcm271x-rpi-bt.dtsi"

/ {
	soc {
		/delete-node/ pixelvalve@7e807000;
		/delete-node/ hdmi@7e902000;
	};
};

#include "bcm2711-rpi-ds.dtsi"
#include "bcm283x-rpi-csi0-2lane.dtsi"
#include "bcm283x-rpi-csi1-4lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"

/ {
	chosen {
		bootargs = "coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0";
	};

	/delete-node/ wifi-pwrseq;
};

&mmcnr {
	pinctrl-names = "default";
	pinctrl-0 = <&sdio_pins>;
	bus-width = <4>;
	status = "okay";
};

&uart0 {
	pinctrl-0 = <&uart0_pins &bt_pins>;
	status = "okay";
};

&uart1 {
	pinctrl-0 = <&uart1_pins>;
};

&spi0 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
	cs-gpios = <&gpio 8 1>, <&gpio 7 1>;

	spidev0: spidev@0{
		compatible = "spidev";
		reg = <0>;	/* CE0 */
		#address-cells = <1>;
		#size-cells = <0>;
		spi-max-frequency = <125000000>;
	};

	spidev1: spidev@1{
		compatible = "spidev";
		reg = <1>;	/* CE1 */
		#address-cells = <1>;
		#size-cells = <0>;
		spi-max-frequency = <125000000>;
	};
};

&gpio {
	gpio-line-names = "ID_SDA",
			  "ID_SCL",
			  "GPIO2",
			  "GPIO3",
			  "GPIO4",
			  "GPIO5",
			  "GPIO6",
			  "GPIO7",
			  "GPIO8",
			  "GPIO9",
			  "GPIO10",
			  "GPIO11",
			  "GPIO12",
			  "GPIO13",
			  "GPIO14",
			  "GPIO15",
			  "GPIO16",
			  "GPIO17",
			  "GPIO18",
			  "GPIO19",
			  "GPIO20",
			  "GPIO21",
			  "GPIO22",
			  "GPIO23",
			  "GPIO24",
			  "GPIO25",
			  "GPIO26",
			  "GPIO27",
			  "RGMII_MDIO",
			  "RGMIO_MDC",
			  /* Used by BT module */
			  "CTS0",
			  "RTS0",
			  "TXD0",
			  "RXD0",
			  /* Used by Wifi */
			  "SD1_CLK",
			  "SD1_CMD",
			  "SD1_DATA0",
			  "SD1_DATA1",
			  "SD1_DATA2",
			  "SD1_DATA3",
			  /* Shared with SPI flash */
			  "PWM0_MISO",
			  "PWM1_MOSI",
			  "STATUS_LED_G_CLK",
			  "SPIFLASH_CE_N",
			  "SDA0",
			  "SCL0",
			  "RGMII_RXCLK",
			  "RGMII_RXCTL",
			  "RGMII_RXD0",
			  "RGMII_RXD1",
			  "RGMII_RXD2",
			  "RGMII_RXD3",
			  "RGMII_TXCLK",
			  "RGMII_TXCTL",
			  "RGMII_TXD0",
			  "RGMII_TXD1",
			  "RGMII_TXD2",
			  "RGMII_TXD3";

	bt_pins: bt_pins {
		brcm,pins = "-"; // non-empty to keep btuart happy, //4 = 0
				 // to fool pinctrl
		brcm,function = <0>;
		brcm,pull = <2>;
	};

	uart0_pins: uart0_pins {
		brcm,pins = <32 33>;
		brcm,function = <BCM2835_FSEL_ALT3>;
		brcm,pull = <0 2>;
	};

	uart1_pins: uart1_pins {
		brcm,pins;
		brcm,function;
		brcm,pull;
	};

	uart1_bt_pins: uart1_bt_pins {
		brcm,pins = <32 33 30 31>;
		brcm,function = <BCM2835_FSEL_ALT5>; /* alt5=UART1 */
		brcm,pull = <0 2 2 0>;
	};
};

&i2c0 {
	clock-frequency = <100000>;
	status = "okay";
	pinctrl-0 = <&i2c0_pins>;
	#address-cells = <1>; 
	#size-cells = <0>;

	slb9673: slb9673@2e {
		compatible = "infineon,slb9673", "tis,tpm2-i2c", "tcg,tpm-tis-i2c";
		reg = <0x2e>;
		status = "okay";
	};
};

&i2c1 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c1_pins>;
	clock-frequency = <100000>;
};

&i2s {
	pinctrl-names = "default";
	pinctrl-0 = <&i2s_pins>;
};

// =============================================
// Board specific stuff here

&pcie0 {
       brcm,enable-l1ss;
};

&sdhost {
	status = "disabled";
};

&phy1 {
	led-modes = <0x00 0x08>; /* link/activity link */
};

&gpio {
	audio_pins: audio_pins {
		brcm,pins = <>;
		brcm,function = <>;
	};
};

&led_act {
	default-state = "off";
	linux,default-trigger = "mmc0";
};

&led_pwr {
	default-state = "off";
};

&pwm1 {
	status = "disabled";
};

&vchiq {
	pinctrl-names = "default";
	pinctrl-0 = <&audio_pins>;
};

cam0_reg: &cam1_reg {
	gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
};

i2c_csi_dsi0: &i2c0 {
};

/ {
	__overrides__ {
		audio = <&chosen>,"bootargs{on='snd_bcm2835.enable_hdmi=1',off='snd_bcm2835.enable_hdmi=0'}";

		act_led_gpio = <&led_act>,"gpios:4";
		act_led_activelow = <&led_act>,"gpios:8";
		act_led_trigger = <&led_act>,"linux,default-trigger";

		pwr_led_gpio = <&led_pwr>,"gpios:4";
		pwr_led_activelow = <&led_pwr>,"gpios:8";
		pwr_led_trigger = <&led_pwr>,"linux,default-trigger";

		eth_led0 = <&phy1>,"led-modes:0";
		eth_led1 = <&phy1>,"led-modes:4";

		ant1 =  <&ant1>,"output-high?=on",
			<&ant1>, "output-low?=off",
			<&ant2>, "output-high?=off",
			<&ant2>, "output-low?=on";
		ant2 =  <&ant1>,"output-high?=off",
			<&ant1>, "output-low?=on",
			<&ant2>, "output-high?=on",
			<&ant2>, "output-low?=off";
		noant = <&ant1>,"output-high?=off",
			<&ant1>, "output-low?=on",
			<&ant2>, "output-high?=off",
			<&ant2>, "output-low?=on";

		cam0_reg = <&cam0_reg>,"status";
		cam0_reg_gpio = <&cam0_reg>,"gpio:4",
				  <&cam0_reg>,"gpio:0=", <&gpio>;
		cam1_reg = <&cam1_reg>,"status";
		cam1_reg_gpio = <&cam1_reg>,"gpio:4",
				  <&cam1_reg>,"gpio:0=", <&gpio>;

		pcie_tperst_clk_ms = <&pcie0>,"brcm,tperst-clk-ms:0";
	};
};

Some commands in U-Boot:

U-Boot> i2c dev 0
Setting bus to 0
Failure changing bus number (-19)
U-Boot> i2c dev
Default I2C bus 0 not found
Current bus is -1
U-Boot> i2c bus
U-Boot>
U-Boot> dm tree
 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
 root          0  [ + ]   root_driver           root_driver
 simple_bus    0  [ + ]   simple_bus            |-- soc
 pinctrl       0  [ + ]   bcm283x_pinctrl       |   |-- gpio@7e200000
 pinconfig     0  [   ]   pinconfig             |   |   |-- dpi-gpio0
 pinconfig     1  [   ]   pinconfig             |   |   |-- emmc-gpio22
 pinconfig     2  [   ]   pinconfig             |   |   |-- emmc-gpio34
 pinconfig     3  [   ]   pinconfig             |   |   |-- emmc-gpio48
 pinconfig     4  [   ]   pinconfig             |   |   |-- gpclk0-gpio4
 pinconfig     5  [   ]   pinconfig             |   |   |-- gpclk1-gpio5
 pinconfig     6  [   ]   pinconfig             |   |   |-- gpclk1-gpio42
 pinconfig     7  [   ]   pinconfig             |   |   |-- gpclk1-gpio44
 pinconfig     8  [   ]   pinconfig             |   |   |-- gpclk2-gpio6
 pinconfig     9  [   ]   pinconfig             |   |   |-- gpclk2-gpio43
 pinconfig    10  [   ]   pinconfig             |   |   |-- i2c0if-gpio0
 pinconfig    11  [   ]   pinconfig             |   |   |-- i2c0if-gpio28
 pinconfig    12  [   ]   pinconfig             |   |   |-- i2c0if-gpio44
 pinconfig    13  [   ]   pinconfig             |   |   |-- i2c1-gpio2
 pinconfig    14  [   ]   pinconfig             |   |   |-- i2c1-gpio44
 pinconfig    15  [   ]   pinconfig             |   |   |-- jtag-gpio22
 pinconfig    16  [   ]   pinconfig             |   |   |-- pcm-gpio18
 pinconfig    17  [   ]   pinconfig             |   |   |-- pcm-gpio28
 pinconfig    18  [   ]   pinconfig             |   |   |-- sdhost-gpio48
 pinconfig    19  [   ]   pinconfig             |   |   |-- spi0-gpio7
 pinconfig    20  [   ]   pinconfig             |   |   |-- spi0-gpio35
 pinconfig    21  [   ]   pinconfig             |   |   |-- spi1-gpio16
 pinconfig    22  [   ]   pinconfig             |   |   |-- spi2-gpio40
 pinconfig    23  [   ]   pinconfig             |   |   |-- uart0-gpio14
 pinconfig    24  [   ]   pinconfig             |   |   |-- uart0-ctsrts-gpio16
 pinconfig    25  [   ]   pinconfig             |   |   |-- uart0-ctsrts-gpio30
 pinconfig    26  [   ]   pinconfig             |   |   |-- uart0-gpio32
 pinconfig    27  [   ]   pinconfig             |   |   |-- uart0-gpio36
 pinconfig    28  [   ]   pinconfig             |   |   |-- uart0-ctsrts-gpio38
 pinconfig    29  [   ]   pinconfig             |   |   |-- uart1-gpio14
 pinconfig    30  [   ]   pinconfig             |   |   |-- uart1-ctsrts-gpio16
 pinconfig    31  [   ]   pinconfig             |   |   |-- uart1-gpio32
 pinconfig    32  [   ]   pinconfig             |   |   |-- uart1-ctsrts-gpio30
 pinconfig    33  [   ]   pinconfig             |   |   |-- uart1-gpio40
 pinconfig    34  [   ]   pinconfig             |   |   |-- uart1-ctsrts-gpio42
 pinconfig    35  [   ]   pinconfig             |   |   |-- gpclk0-gpio49
 pinconfig    36  [   ]   pinconfig             |   |   |   `-- pin-gpclk
 pinconfig    37  [   ]   pinconfig             |   |   |-- gpclk1-gpio50
 pinconfig    38  [   ]   pinconfig             |   |   |   `-- pin-gpclk
 pinconfig    39  [   ]   pinconfig             |   |   |-- gpclk2-gpio51
 pinconfig    40  [   ]   pinconfig             |   |   |   `-- pin-gpclk
 pinconfig    41  [   ]   pinconfig             |   |   |-- i2c0if-gpio46
 pinconfig    42  [   ]   pinconfig             |   |   |   |-- pin-sda
 pinconfig    43  [   ]   pinconfig             |   |   |   `-- pin-scl
 pinconfig    44  [   ]   pinconfig             |   |   |-- i2c1-gpio46
 pinconfig    45  [   ]   pinconfig             |   |   |   |-- pin-sda
 pinconfig    46  [   ]   pinconfig             |   |   |   `-- pin-scl
 pinconfig    47  [   ]   pinconfig             |   |   |-- i2c3-gpio2
 pinconfig    48  [   ]   pinconfig             |   |   |   |-- pin-sda
 pinconfig    49  [   ]   pinconfig             |   |   |   `-- pin-scl
 pinconfig    50  [   ]   pinconfig             |   |   |-- i2c3-gpio4
 pinconfig    51  [   ]   pinconfig             |   |   |   |-- pin-sda
 pinconfig    52  [   ]   pinconfig             |   |   |   `-- pin-scl
 pinconfig    53  [   ]   pinconfig             |   |   |-- i2c4-gpio6
 pinconfig    54  [   ]   pinconfig             |   |   |   |-- pin-sda
 pinconfig    55  [   ]   pinconfig             |   |   |   `-- pin-scl
 pinconfig    56  [   ]   pinconfig             |   |   |-- i2c4-gpio8
 pinconfig    57  [   ]   pinconfig             |   |   |   |-- pin-sda
 pinconfig    58  [   ]   pinconfig             |   |   |   `-- pin-scl
 pinconfig    59  [   ]   pinconfig             |   |   |-- i2c5-gpio10
 pinconfig    60  [   ]   pinconfig             |   |   |   |-- pin-sda
 pinconfig    61  [   ]   pinconfig             |   |   |   `-- pin-scl
 pinconfig    62  [   ]   pinconfig             |   |   |-- i2c5-gpio12
 pinconfig    63  [   ]   pinconfig             |   |   |   |-- pin-sda
 pinconfig    64  [   ]   pinconfig             |   |   |   `-- pin-scl
 pinconfig    65  [   ]   pinconfig             |   |   |-- i2c6-gpio0
 pinconfig    66  [   ]   pinconfig             |   |   |   |-- pin-sda
 pinconfig    67  [   ]   pinconfig             |   |   |   `-- pin-scl
 pinconfig    68  [   ]   pinconfig             |   |   |-- i2c6-gpio22
 pinconfig    69  [   ]   pinconfig             |   |   |   |-- pin-sda
 pinconfig    70  [   ]   pinconfig             |   |   |   `-- pin-scl
 pinconfig    71  [   ]   pinconfig             |   |   |-- i2c-slave-gpio8
 pinconfig    72  [   ]   pinconfig             |   |   |   `-- pins-i2c-slave
 pinconfig    73  [   ]   pinconfig             |   |   |-- jtag-gpio48
 pinconfig    74  [   ]   pinconfig             |   |   |   `-- pins-jtag
 pinconfig    75  [   ]   pinconfig             |   |   |-- mii-gpio28
 pinconfig    76  [   ]   pinconfig             |   |   |   `-- pins-mii
 pinconfig    77  [   ]   pinconfig             |   |   |-- mii-gpio36
 pinconfig    78  [   ]   pinconfig             |   |   |   `-- pins-mii
 pinconfig    79  [   ]   pinconfig             |   |   |-- pcm-gpio50
 pinconfig    80  [   ]   pinconfig             |   |   |   `-- pins-pcm
 pinconfig    81  [   ]   pinconfig             |   |   |-- pwm0-0-gpio12
 pinconfig    82  [   ]   pinconfig             |   |   |   `-- pin-pwm
 pinconfig    83  [   ]   pinconfig             |   |   |-- pwm0-0-gpio18
 pinconfig    84  [   ]   pinconfig             |   |   |   `-- pin-pwm
 pinconfig    85  [   ]   pinconfig             |   |   |-- pwm1-0-gpio40
 pinconfig    86  [   ]   pinconfig             |   |   |   `-- pin-pwm
 pinconfig    87  [   ]   pinconfig             |   |   |-- pwm0-1-gpio13
 pinconfig    88  [   ]   pinconfig             |   |   |   `-- pin-pwm
 pinconfig    89  [   ]   pinconfig             |   |   |-- pwm0-1-gpio19
 pinconfig    90  [   ]   pinconfig             |   |   |   `-- pin-pwm
 pinconfig    91  [   ]   pinconfig             |   |   |-- pwm1-1-gpio41
 pinconfig    92  [   ]   pinconfig             |   |   |   `-- pin-pwm
 pinconfig    93  [   ]   pinconfig             |   |   |-- pwm0-1-gpio45
 pinconfig    94  [   ]   pinconfig             |   |   |   `-- pin-pwm
 pinconfig    95  [   ]   pinconfig             |   |   |-- pwm0-0-gpio52
 pinconfig    96  [   ]   pinconfig             |   |   |   `-- pin-pwm
 pinconfig    97  [   ]   pinconfig             |   |   |-- pwm0-1-gpio53
 pinconfig    98  [   ]   pinconfig             |   |   |   `-- pin-pwm
 pinconfig    99  [   ]   pinconfig             |   |   |-- rgmii-gpio35
 pinconfig   100  [   ]   pinconfig             |   |   |   |-- pin-start-stop
 pinconfig   101  [   ]   pinconfig             |   |   |   `-- pin-rx-ok
 pinconfig   102  [   ]   pinconfig             |   |   |-- rgmii-irq-gpio34
 pinconfig   103  [   ]   pinconfig             |   |   |   `-- pin-irq
 pinconfig   104  [   ]   pinconfig             |   |   |-- rgmii-irq-gpio39
 pinconfig   105  [   ]   pinconfig             |   |   |   `-- pin-irq
 pinconfig   106  [   ]   pinconfig             |   |   |-- rgmii-mdio-gpio28
 pinconfig   107  [   ]   pinconfig             |   |   |   `-- pins-mdio
 pinconfig   108  [   ]   pinconfig             |   |   |-- rgmii-mdio-gpio37
 pinconfig   109  [   ]   pinconfig             |   |   |   `-- pins-mdio
 pinconfig   110  [   ]   pinconfig             |   |   |-- spi0-gpio46
 pinconfig   111  [   ]   pinconfig             |   |   |   `-- pins-spi
 pinconfig   112  [   ]   pinconfig             |   |   |-- spi2-gpio46
 pinconfig   113  [   ]   pinconfig             |   |   |   `-- pins-spi
 pinconfig   114  [   ]   pinconfig             |   |   |-- spi3-gpio0
 pinconfig   115  [   ]   pinconfig             |   |   |   `-- pins-spi
 pinconfig   116  [   ]   pinconfig             |   |   |-- spi4-gpio4
 pinconfig   117  [   ]   pinconfig             |   |   |   `-- pins-spi
 pinconfig   118  [   ]   pinconfig             |   |   |-- spi5-gpio12
 pinconfig   119  [   ]   pinconfig             |   |   |   `-- pins-spi
 pinconfig   120  [   ]   pinconfig             |   |   |-- spi6-gpio18
 pinconfig   121  [   ]   pinconfig             |   |   |   `-- pins-spi
 pinconfig   122  [   ]   pinconfig             |   |   |-- uart2-gpio0
 pinconfig   123  [   ]   pinconfig             |   |   |   |-- pin-tx
 pinconfig   124  [   ]   pinconfig             |   |   |   `-- pin-rx
 pinconfig   125  [   ]   pinconfig             |   |   |-- uart2-ctsrts-gpio2
 pinconfig   126  [   ]   pinconfig             |   |   |   |-- pin-cts
 pinconfig   127  [   ]   pinconfig             |   |   |   `-- pin-rts
 pinconfig   128  [   ]   pinconfig             |   |   |-- uart3-gpio4
 pinconfig   129  [   ]   pinconfig             |   |   |   |-- pin-tx
 pinconfig   130  [   ]   pinconfig             |   |   |   `-- pin-rx
 pinconfig   131  [   ]   pinconfig             |   |   |-- uart3-ctsrts-gpio6
 pinconfig   132  [   ]   pinconfig             |   |   |   |-- pin-cts
 pinconfig   133  [   ]   pinconfig             |   |   |   `-- pin-rts
 pinconfig   134  [   ]   pinconfig             |   |   |-- uart4-gpio8
 pinconfig   135  [   ]   pinconfig             |   |   |   |-- pin-tx
 pinconfig   136  [   ]   pinconfig             |   |   |   `-- pin-rx
 pinconfig   137  [   ]   pinconfig             |   |   |-- uart4-ctsrts-gpio10
 pinconfig   138  [   ]   pinconfig             |   |   |   |-- pin-cts
 pinconfig   139  [   ]   pinconfig             |   |   |   `-- pin-rts
 pinconfig   140  [   ]   pinconfig             |   |   |-- uart5-gpio12
 pinconfig   141  [   ]   pinconfig             |   |   |   |-- pin-tx
 pinconfig   142  [   ]   pinconfig             |   |   |   `-- pin-rx
 pinconfig   143  [   ]   pinconfig             |   |   |-- uart5-ctsrts-gpio14
 pinconfig   144  [   ]   pinconfig             |   |   |   |-- pin-cts
 pinconfig   145  [   ]   pinconfig             |   |   |   `-- pin-rts
 pinconfig   146  [   ]   pinconfig             |   |   |-- dpi_18bit_cpadhi_gpio0
 pinconfig   147  [   ]   pinconfig             |   |   |-- dpi_18bit_cpadhi_gpio2
 pinconfig   148  [   ]   pinconfig             |   |   |-- dpi_18bit_gpio0
 pinconfig   149  [   ]   pinconfig             |   |   |-- dpi_18bit_gpio2
 pinconfig   150  [   ]   pinconfig             |   |   |-- dpi_16bit_gpio0
 pinconfig   151  [   ]   pinconfig             |   |   |-- dpi_16bit_gpio2
 pinconfig   152  [   ]   pinconfig             |   |   |-- dpi_16bit_cpadhi_gpio0
 pinconfig   153  [   ]   pinconfig             |   |   |-- dpi_16bit_cpadhi_gpio2
 pinconfig   154  [   ]   pinconfig             |   |   |-- gpioout
 pinconfig   155  [   ]   pinconfig             |   |   |-- alt0
 pinconfig   156  [   ]   pinconfig             |   |   |-- spi0_pins
 pinconfig   157  [   ]   pinconfig             |   |   |-- spi0_cs_pins
 pinconfig   158  [   ]   pinconfig             |   |   |-- spi3_pins
 pinconfig   159  [   ]   pinconfig             |   |   |-- spi3_cs_pins
 pinconfig   160  [   ]   pinconfig             |   |   |-- spi4_pins
 pinconfig   161  [   ]   pinconfig             |   |   |-- spi4_cs_pins
 pinconfig   162  [   ]   pinconfig             |   |   |-- spi5_pins
 pinconfig   163  [   ]   pinconfig             |   |   |-- spi5_cs_pins
 pinconfig   164  [   ]   pinconfig             |   |   |-- spi6_pins
 pinconfig   165  [   ]   pinconfig             |   |   |-- spi6_cs_pins
 pinconfig   166  [   ]   pinconfig             |   |   |-- i2c0
 pinconfig   167  [   ]   pinconfig             |   |   |-- i2c1
 pinconfig   168  [   ]   pinconfig             |   |   |-- i2c3
 pinconfig   169  [   ]   pinconfig             |   |   |-- i2c4
 pinconfig   170  [   ]   pinconfig             |   |   |-- i2c5
 pinconfig   171  [   ]   pinconfig             |   |   |-- i2c6
 pinconfig   172  [   ]   pinconfig             |   |   |-- i2s
 pinconfig   173  [ + ]   pinconfig             |   |   |-- sdio_pins
 pinconfig   174  [   ]   pinconfig             |   |   |-- uart2_pins
 pinconfig   175  [   ]   pinconfig             |   |   |-- uart3_pins
 pinconfig   176  [   ]   pinconfig             |   |   |-- uart4_pins
 pinconfig   177  [   ]   pinconfig             |   |   |-- uart5_pins
 pinconfig   178  [   ]   pinconfig             |   |   |-- bt_pins
 pinconfig   179  [   ]   pinconfig             |   |   |-- uart0_pins
 pinconfig   180  [ + ]   pinconfig             |   |   |-- uart1_pins
 pinconfig   181  [   ]   pinconfig             |   |   |-- uart1_bt_pins
 pinconfig   182  [   ]   pinconfig             |   |   |-- audio_pins
 gpio          0  [   ]   gpio_bcm2835          |   |   `-- gpio_bcm2835
 serial        0  [   ]   serial_pl01x          |   |-- serial@7e201000
 serial        1  [ + ]   serial_bcm283x_mu     |   |-- serial@7e215040
 usb           0  [   ]   dwc2_usb              |   |-- usb@7e980000
 simple_bus    1  [   ]   simple_bus            |   |-- avs-monitor@7d5d2000
 rng           0  [   ]   iproc_rng200-rng      |   |-- rng@7e104000
 mmc           0  [ + ]   sdhci-bcm2835         |   |-- mmcnr@7e300000
 blk           0  [   ]   mmc_blk               |   |   |-- [email protected]
 bootdev       0  [   ]   mmc_bootdev           |   |   `-- [email protected]
 simple_bus    2  [   ]   simple_bus            |   `-- firmware
 reset         0  [   ]   raspberrypi-reset     |       `-- reset
 simple_bus    3  [ + ]   simple_bus            |-- emmc2bus
 mmc           1  [ + ]   sdhci-bcm2835         |   `-- mmc@7e340000
 blk           1  [ + ]   mmc_blk               |       |-- [email protected]
 partition     0  [ + ]   blk_partition         |       |   |-- [email protected]:1
 partition     1  [ + ]   blk_partition         |       |   |-- [email protected]:2
 partition     2  [ + ]   blk_partition         |       |   |-- [email protected]:3
 partition     3  [ + ]   blk_partition         |       |   |-- [email protected]:4
 partition     4  [ + ]   blk_partition         |       |   |-- [email protected]:5
 partition     5  [ + ]   blk_partition         |       |   |-- [email protected]:6
 partition     6  [ + ]   blk_partition         |       |   |-- [email protected]:7
 partition     7  [ + ]   blk_partition         |       |   |-- [email protected]:8
 partition     8  [ + ]   blk_partition         |       |   |-- [email protected]:9
 partition     9  [ + ]   blk_partition         |       |   |-- [email protected]:10
 partition    10  [ + ]   blk_partition         |       |   `-- [email protected]:11
 bootdev       1  [   ]   mmc_bootdev           |       `-- [email protected]
 simple_bus    4  [   ]   simple_bus            |-- scb
 pci           0  [   ]   pcie_brcm             |   `-- pcie@7d500000
 simple_bus    5  [   ]   simple_bus            |-- v3dbus
 video         0  [ + ]   bcm2835_video         |-- framebuffer@3e7df000
 vidconsole    0  [ + ]   vidconsole0           |   `-- [email protected]
 bootstd       0  [   ]   bootstd_drv           `-- bootstd
 bootmeth      0  [   ]   bootmeth_extlinux         |-- extlinux
 bootmeth      1  [   ]   bootmeth_script           |-- script
 bootmeth      2  [   ]   bootmeth_efi              |-- efi
 bootmeth      3  [   ]   bootmeth_pxe              `-- pxe


U-Boot> fdt print i2c0
i2c@0 {
        reg = <0x00000000>;
        #address-cells = <0x00000001>;
        #size-cells = <0x00000000>;
        clock-frequency = <0x000186a0>;
        status = "okay";
        pinctrl-0 = <0x00000035>;
        phandle = <0x000000db>;
        slb9673@2e {
                compatible = "infineon,slb9673", "tis,tpm2-i2c", "tcg,tpm-tis-i2c";
                reg = <0x0000002e>;
                status = "okay";
                phandle = <0x000000dc>;
        };
};

@Spark1114
Copy link
Author

For anyone having this issue the problem is that u-boot does not have the bcm i2c driver. In order to use a i2c bus, one has to use the i2c-gpio driver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant