From: Marek Vasut Date: Fri, 5 Jul 2019 14:23:40 +0200 Subject: [U-Boot] [PATCH v2] ARM: imx6: DHCOM i.MX6 PDK: Switch to DM for I2C In-Reply-To: <20190705104655.97037-1-lzenz@dh-electronics.com> References: <20190705104655.97037-1-lzenz@dh-electronics.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 7/5/19 12:46 PM, Ludwig Zenz wrote: [...] > static int setup_dhcom_mac_from_fuse(void) > { > + struct udevice *dev; > unsigned char enetaddr[6]; > int ret; > > @@ -228,13 +142,13 @@ static int setup_dhcom_mac_from_fuse(void) > return 0; > } > > - ret = i2c_set_bus_num(2); > + ret = uclass_first_device_err(UCLASS_I2C_EEPROM, &dev); What about uclass_find_device_by_of_node() ? Then you can specify a stable fixed hardware path to the EEPROM, and no matter how many EEPROMs someone connects to the board, this code won't be affected. [...]