Merged in david_s5/nuttx/master_kinetis_i2c_reset_hf (pull request #718)

kinetis:i2c On faild reset re-init i2c and clocking

If a reset fails, we still must reinitializes the
  i2c block so that subsequent transfers will not
  cause a hardfault due to the clock being off.
  If that transfer fails it can try to reset
  again.

Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
David Sidrane 2018-09-11 22:14:37 +00:00 committed by GregoryN
parent 884ee6e43e
commit 4a1b8e5825
1 changed files with 3 additions and 4 deletions

View File

@ -1335,17 +1335,16 @@ static int kinetis_i2c_reset(struct i2c_master_s *dev)
kinetis_pinconfig(MKI2C_INPUT(sda_gpio)); kinetis_pinconfig(MKI2C_INPUT(sda_gpio));
kinetis_pinconfig(MKI2C_INPUT(scl_gpio)); kinetis_pinconfig(MKI2C_INPUT(scl_gpio));
ret = OK;
/* Re-init the port */ /* Re-init the port (even on error to enable clock) */
out:
kinetis_i2c_init(priv); kinetis_i2c_init(priv);
/* Restore the frequency */ /* Restore the frequency */
kinetis_i2c_setfrequency(priv, frequency); kinetis_i2c_setfrequency(priv, frequency);
ret = OK;
out:
/* Release the port for re-use by other clients */ /* Release the port for re-use by other clients */