Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arch: cxd56xx: Fix i2c bus freeze at i2c initialization #15870

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions arch/arm/src/cxd56xx/cxd56_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,10 @@ static int cxd56_i2c_reset(struct i2c_master_s *dev)

nxmutex_lock(&priv->lock);

/* Disable clock gating (clock enable) */

cxd56_i2c_clock_gate_disable(priv->port);

/* Use GPIO configuration to un-wedge the bus */

cxd56_i2c_pincontrol(priv->port, false);
Expand Down Expand Up @@ -794,6 +798,11 @@ static int cxd56_i2c_reset(struct i2c_master_s *dev)
up_udelay(10);
}

/* Disable input of SCL and SDA pins */

cxd56_gpio_config(scl_gpio, false);
cxd56_gpio_config(sda_gpio, false);

/* Generate a start followed by a stop to reset slave
* state machines.
*/
Expand All @@ -820,6 +829,10 @@ static int cxd56_i2c_reset(struct i2c_master_s *dev)

cxd56_i2c_pincontrol(priv->port, true);

/* Enable clock gating (clock disable) */

cxd56_i2c_clock_gate_enable(priv->port);

/* Release the port for re-use by other clients */

nxmutex_unlock(&priv->lock);
Expand Down Expand Up @@ -1127,10 +1140,6 @@ struct i2c_master_s *cxd56_i2cbus_initialize(int port)

cxd56_i2c_setfrequency(priv, I2C_DEFAULT_FREQUENCY);

/* Configure pin */

cxd56_i2c_pincontrol(port, true);

/* Attach Interrupt Handler */

irq_attach(priv->irqid, cxd56_i2c_interrupt, priv);
Expand All @@ -1151,6 +1160,10 @@ struct i2c_master_s *cxd56_i2cbus_initialize(int port)

cxd56_i2c_clock_gate_enable(port);

/* Configure pin */

cxd56_i2c_pincontrol(port, true);

nxmutex_unlock(&priv->lock);
return &priv->dev;
}
Expand Down
Loading