You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/11/05 11:43:44 UTC

[GitHub] [incubator-nuttx] davids5 commented on a change in pull request #4786: rp2040: support I2C_RESET

davids5 commented on a change in pull request #4786:
URL: https://github.com/apache/incubator-nuttx/pull/4786#discussion_r743592637



##########
File path: arch/arm/src/rp2040/rp2040_i2c.c
##########
@@ -639,7 +642,158 @@ static int rp2040_i2c_transfer(FAR struct i2c_master_s *dev,
 #ifdef CONFIG_I2C_RESET
 static int rp2040_i2c_reset(FAR struct i2c_master_s *dev)
 {
-  return OK;
+  FAR struct rp2040_i2cdev_s *priv = (struct rp2040_i2cdev_s *)dev;
+  unsigned int clock_count;
+  unsigned int stretch_count;
+  uint32_t scl_gpio;
+  uint32_t sda_gpio;
+  uint32_t subsys;
+  uint32_t frequency;
+  int ret;
+
+  DEBUGASSERT(dev);
+
+  /* Our caller must own a ref */
+
+  DEBUGASSERT(priv->refs > 0);
+
+  /* Lock out other clients */
+
+  i2c_takesem(&priv->mutex);
+
+  ret = -EIO;
+
+  /* De-init the port */
+
+  rp2040_i2c_disable(priv);
+
+  /* Use GPIO configuration to un-wedge the bus */
+
+  switch (priv->port)
+    {
+      case 0:
+#if defined(CONFIG_RP2040_I2C0) && CONFIG_RP2040_I2C0_GPIO >= 0
+        sda_gpio = CONFIG_RP2040_I2C0_GPIO;

Review comment:
       Is something like this https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/stm32h7/stm32_i2c.c#L2596-L2597 possible this the GPIO IP on the RP240.
   
   It would make this have less config option and code.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org