@@ -315,8 +315,8 @@ static void i2c_omap_resize_fifo(const struct device *dev, uint8_t size)
315
315
*/
316
316
static int i2c_omap_get_sda (void * io_context )
317
317
{
318
- const struct i2c_omap_cfg * cfg = ( const struct i2c_omap_cfg * ) io_context ;
319
- i2c_omap_regs_t * i2c_base_addr = ( i2c_omap_regs_t * ) cfg -> base . addr ;
318
+ const struct device * dev = io_context ;
319
+ i2c_omap_regs_t * i2c_base_addr = DEV_I2C_BASE ( dev ) ;
320
320
321
321
return (i2c_base_addr -> SYSTEST & I2C_OMAP_SYSTEST_SDA_I_FUNC ) ? 1 : 0 ;
322
322
}
@@ -331,8 +331,8 @@ static int i2c_omap_get_sda(void *io_context)
331
331
*/
332
332
static void i2c_omap_set_sda (void * io_context , int state )
333
333
{
334
- const struct i2c_omap_cfg * cfg = ( const struct i2c_omap_cfg * ) io_context ;
335
- i2c_omap_regs_t * i2c_base_addr = ( i2c_omap_regs_t * ) cfg -> base . addr ;
334
+ const struct device * dev = io_context ;
335
+ i2c_omap_regs_t * i2c_base_addr = DEV_I2C_BASE ( dev ) ;
336
336
337
337
if (state ) {
338
338
i2c_base_addr -> SYSTEST |= I2C_OMAP_SYSTEST_SDA_O ;
@@ -351,8 +351,8 @@ static void i2c_omap_set_sda(void *io_context, int state)
351
351
*/
352
352
static void i2c_omap_set_scl (void * io_context , int state )
353
353
{
354
- const struct i2c_omap_cfg * cfg = ( const struct i2c_omap_cfg * ) io_context ;
355
- i2c_omap_regs_t * i2c_base_addr = ( i2c_omap_regs_t * ) cfg -> base . addr ;
354
+ const struct device * dev = io_context ;
355
+ i2c_omap_regs_t * i2c_base_addr = DEV_I2C_BASE ( dev ) ;
356
356
357
357
if (state ) {
358
358
i2c_base_addr -> SYSTEST |= I2C_OMAP_SYSTEST_SCL_O ;
@@ -388,7 +388,7 @@ static int i2c_omap_recover_bus(const struct device *dev)
388
388
k_sem_take (& data -> lock , K_FOREVER );
389
389
i2c_base_addr -> SYSTEST |= I2C_OMAP_SYSTEST_ST_EN | (3 << I2C_OMAP_SYSTEST_TMODE_SHIFT ) |
390
390
I2C_OMAP_SYSTEST_SCL_O | I2C_OMAP_SYSTEST_SDA_O ;
391
- i2c_bitbang_init (& bitbang_omap , & bitbang_omap_io , (void * )cfg );
391
+ i2c_bitbang_init (& bitbang_omap , & bitbang_omap_io , (void * )dev );
392
392
error = i2c_bitbang_recover_bus (& bitbang_omap );
393
393
if (error != 0 ) {
394
394
LOG_ERR ("failed to recover bus (err %d)" , error );
0 commit comments