From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Wed, 15 Apr 2015 13:38:24 +0200 Subject: [U-Boot] [PATCH] dm: i2c: mxc support DM In-Reply-To: <1429090554-24295-1-git-send-email-Peng.Fan@freescale.com> References: <1429090554-24295-1-git-send-email-Peng.Fan@freescale.com> Message-ID: <201504151338.24947.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wednesday, April 15, 2015 at 11:35:54 AM, Peng Fan wrote: > Add support when CONFIG_DM_I2C configured. > > Test results: > => i2c dev 0 > Setting bus to 0 > => i2c probe > Valid chip addresses: 08 50 > => i2c md 8 38 > 0038: 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 ................ > => i2c mw 8 38 5 1 > => i2c md 8 38 > 0038: 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 ................ > => dm tree > Class Probed Name > ---------------------------------------- > root [ + ] root_driver > thermal [ ] |-- imx_thermal > simple_bus [ + ] |-- soc > simple_bus [ ] | |-- aips-bus at 30000000 > simple_bus [ ] | | |-- anatop at 30360000 > simple_bus [ ] | | `-- snvs at 30370000 > simple_bus [ ] | |-- aips-bus at 30400000 > simple_bus [ + ] | `-- aips-bus at 30800000 > i2c [ + ] | |-- i2c at 30a20000 > i2c_generic [ + ] | | |-- generic_8 > i2c_generic [ + ] | | `-- generic_50 > i2c [ ] | |-- i2c at 30a40000 > spi [ ] | `-- qspi at 30bb0000 > simple_bus [ ] `-- regulators > > Signed-off-by: Peng Fan Hi, [...] > +static int i2c_init_transfer_(struct i2c_bus *i2c_bus, u32 chip, > + bool read) > +{ > + unsigned int temp; > + int ret; > + struct mxc_i2c_regs *i2c_regs = i2c_bus->regs; > + > + /* Enable I2C controller */ > +#ifdef I2C_QUIRK_REG > + if (readb(&i2c_regs->i2cr) & I2CR_IDIS) { > +#else > + if (!(readb(&i2c_regs->i2cr) & I2CR_IEN)) { > +#endif This is a little odd, maybe you can rename this to some sensible name since it's IMX specific ?