1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-23 02:16:41 +00:00

bdk: i2c: correct order of spinlock wait

This commit is contained in:
CTCaer 2022-01-29 01:34:01 +02:00
parent 9a80f8b4b5
commit 3fdb72ce37

View file

@ -95,9 +95,9 @@ static void _i2c_load_cfg_wait(vu32 *base)
base[I2C_CONFIG_LOAD] = BIT(5) | TIMEOUT_CONFIG_LOAD | MSTR_CONFIG_LOAD; base[I2C_CONFIG_LOAD] = BIT(5) | TIMEOUT_CONFIG_LOAD | MSTR_CONFIG_LOAD;
for (u32 i = 0; i < 20; i++) for (u32 i = 0; i < 20; i++)
{ {
usleep(1);
if (!(base[I2C_CONFIG_LOAD] & MSTR_CONFIG_LOAD)) if (!(base[I2C_CONFIG_LOAD] & MSTR_CONFIG_LOAD))
break; break;
usleep(1);
} }
} }
@ -362,9 +362,9 @@ void i2c_init(u32 i2c_idx)
for (u32 i = 0; i < 10; i++) for (u32 i = 0; i < 10; i++)
{ {
usleep(20000);
if (base[I2C_INT_STATUS] & BUS_CLEAR_DONE) if (base[I2C_INT_STATUS] & BUS_CLEAR_DONE)
break; break;
usleep(25);
} }
(vu32)base[I2C_BUS_CLEAR_STATUS]; (vu32)base[I2C_BUS_CLEAR_STATUS];