k1x: i2c: fix sda pull down after ack signal
set I2C_SDA_GLITCH_FIX_BYPASS bit before xfer. If I2C_SDA_GLITCH_FIX_BYPASS bit is not set, sda signal will keep low for a period to reduce glitch. We set this bit for restart signal work normally. Change-Id: Icd45af66fe47151eb911cdce558efa66c958a888 Signed-off-by: yanhaodong <haodong.yan@spacemit.com>
This commit is contained in:
@@ -98,7 +98,7 @@ static void spacemit_i2c_controller_reset(struct spacemit_i2c_dev *spacemit_i2c)
|
||||
static void spacemit_i2c_bus_reset(struct spacemit_i2c_dev *spacemit_i2c)
|
||||
{
|
||||
int clk_cnt = 0;
|
||||
u32 bus_status;
|
||||
u32 bus_status, val;
|
||||
|
||||
/* if bus is locked, reset unit. 0: locked */
|
||||
bus_status = spacemit_i2c_read_reg(spacemit_i2c, REG_BMR);
|
||||
@@ -119,7 +119,8 @@ static void spacemit_i2c_bus_reset(struct spacemit_i2c_dev *spacemit_i2c)
|
||||
break;
|
||||
|
||||
/* if still locked, send one clk to slave to request release */
|
||||
spacemit_i2c_write_reg(spacemit_i2c, REG_RST_CYC, 0x1);
|
||||
val = spacemit_i2c_read_reg(spacemit_i2c, REG_RST_CYC);
|
||||
spacemit_i2c_write_reg(spacemit_i2c, REG_RST_CYC, val | 0x1);
|
||||
spacemit_i2c_write_reg(spacemit_i2c, REG_CR, CR_RSTREQ);
|
||||
usleep_range(20, 30);
|
||||
clk_cnt++;
|
||||
@@ -1337,6 +1338,9 @@ xfer_retry:
|
||||
|
||||
spacemit_i2c_init_xfer_params(spacemit_i2c);
|
||||
|
||||
ret = spacemit_i2c_read_reg(spacemit_i2c, REG_RST_CYC);
|
||||
spacemit_i2c_write_reg(spacemit_i2c, REG_RST_CYC, I2C_SDA_GLITCH_FIX_BYPASS | ret);
|
||||
|
||||
spacemit_i2c_mark_rw_flag(spacemit_i2c);
|
||||
|
||||
reinit_completion(&spacemit_i2c->complete);
|
||||
|
||||
@@ -185,6 +185,8 @@ enum spacemit_i2c_xfer_phase {
|
||||
#define SPACEMIT_I2C_APB_CLOCK_26M (26000000)
|
||||
#define SPACEMIT_I2C_APB_CLOCK_52M (52000000)
|
||||
|
||||
#define I2C_SDA_GLITCH_FIX_BYPASS BIT(7)
|
||||
|
||||
/* i2c-spacemit driver's main struct */
|
||||
struct spacemit_i2c_dev {
|
||||
struct device *dev;
|
||||
|
||||
Reference in New Issue
Block a user