i2c: imx: remove unnecessary delay at startup
PATCH 1/1 i2c: imx: remove unnecessary delay at startup
a delay on the startup of the i2c imx controller is not required or defined in the specs. By removing it, the user can see a latency decrease from up to 150μs in communication. Additional info: https://lore.kernel.org/all/[email protected]/
--- drivers/i2c/busses/i2c-imx.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/i2c/busses/i2c-imx.c +0 -6
@@ -602,12 +602,6 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx, bool atomic)imx_i2c_write_reg (i2c_imx->hwdata->i2sr_clr_opcode, i2c_imx,IMX_I2C_I2SR );imx_i2c_write_reg (i2c_imx->hwdata->i2cr_ien_opcode, i2c_imx,IMX_I2C_I2CR ); -/* Wait controller to be stable */ -if (atomic) -udelay (50 ); -else -usleep_range (50 ,150 ); -/* Start I2C transaction */ temp =imx_i2c_read_reg (i2c_imx,IMX_I2C_I2CR ); temp |=I2CR_MSTA ;
Signature · 1 line
2.25.1
Hello,
Quoted 7 lines · Ian Dannapel
drivers/i2c/busses/i2c-imx.c +0
-0@@ -602,12 +602,6 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx, bool atomic)imx_i2c_write_reg (i2c_imx->hwdata->i2sr_clr_opcode, i2c_imx,IMX_I2C_I2SR );imx_i2c_write_reg (i2c_imx->hwdata->i2cr_ien_opcode, i2c_imx,IMX_I2C_I2CR );
drivers/i2c/busses/i2c-imx.c static int i2c_imx_start(struct imx_i2c_struct *i2c_imx, bool atomic) · line 607
Quoted 10 lines
drivers/i2c/busses/i2c-imx.c +0
-6-/* Wait controller to be stable */ -if (atomic) -udelay (50 ); -else -usleep_range (50 ,150 ); -/* Start I2C transaction */ temp =imx_i2c_read_reg (i2c_imx,IMX_I2C_I2CR ); temp |=I2CR_MSTA ;
This contradicts statements made in43309f3b521302bb66c4c9e66704dd3675e4d725.
Maybe the sleep/delay should be done conditionally on the busy bit?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Oleksij Rempel
maintainerQuoted 24 lines · Uwe Kleine-König
Hello,
Quoted 7 lines · Ian Dannapel
drivers/i2c/busses/i2c-imx.c +0
-0@@ -602,12 +602,6 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx, bool atomic)imx_i2c_write_reg (i2c_imx->hwdata->i2sr_clr_opcode, i2c_imx,IMX_I2C_I2SR );imx_i2c_write_reg (i2c_imx->hwdata->i2cr_ien_opcode, i2c_imx,IMX_I2C_I2CR );drivers/i2c/busses/i2c-imx.c static int i2c_imx_start(struct imx_i2c_struct *i2c_imx, bool atomic) · line 607
Quoted 10 lines
drivers/i2c/busses/i2c-imx.c +0
-6-/* Wait controller to be stable */ -if (atomic) -udelay (50 ); -else -usleep_range (50 ,150 ); -/* Start I2C transaction */ temp =imx_i2c_read_reg (i2c_imx,IMX_I2C_I2CR ); temp |=I2CR_MSTA ;This contradicts statements made in
43309f3b521302bb66c4c9e66704dd3675e4d725.
Quoted 1 line
Maybe the sleep/delay should be done conditionally on the busy bit?
Maybe. I do not see what exact problem is this sleep addressing. How exact the can get stable? Is it addressing some clock issue or wading until something happening on the bus?
Regards,
Oleskij
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Quoted 4 lines
Maybe. I do not see what exact problem is this sleep addressing. How exact the can get stable? Is it addressing some clock issue or wading until something happening on the bus?
Yeah, it is really hard to see why it is there. And given that the introducing commit is from 2009, we can't really expect an active userbase reporting breakage. So, although it may be a useless delay, I'd like to see an opt-in approach for not using it.