vireshk

Untitled

May 2nd, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. commit d738e17e341675931d4a0deeaa412d23cf4f2a74
  2. Author: Ryan Lim <[email protected]>
  3. Date: Mon Apr 25 18:51:10 2016 -0700
  4.  
  5. SW-4909: i2c: Remove status check in the watchdog timeout callback
  6.  
  7. When I2C bus is not available (i.e. the bus signals are not pulled
  8. up in the case for the stand alone GPB module), the I2C driver
  9. watchdog correctly times out. But the problem was that the watchdog
  10. timeout callback was incorrectly assuming the driver status could not
  11. be in the IDLE state. This commit removes the driver status check and
  12. instead prints out the current driver status.
  13.  
  14. Testing Done: 1) Tested white-camera and white-audio functionality.
  15. 2) Ran I2C test script on a GPB module with bridged PHY
  16. daughter board attached.
  17. 3) Detected the GPB module correctly w/o any daughter
  18. board attached (addressed SW-4909)
  19. 4) Ran i2cdetect with GPB module with bridged PHY
  20. daughter board attached. It found address 0x50
  21. of I2C EEPROM on /dev/i2c-0
  22. 5) Ran i2cdect with GPI module w/o any daughter board
  23. attached. It did not find any I2C address on /dev/i2c-0.
  24.  
  25. Change-Id: I883d945b8d3320fc31022c29d1beaf480caf2f2b
  26. Signed-off-by: Ryan Lim <[email protected]>
  27. ---
  28. nuttx/arch/arm/src/tsb/tsb_i2c.c | 14 ++++----------
  29. nuttx/arch/arm/src/tsb/tsb_i2c.h | 2 +-
  30. 2 files changed, 5 insertions(+), 11 deletions(-)
  31.  
  32. diff --git a/nuttx/arch/arm/src/tsb/tsb_i2c.c b/nuttx/arch/arm/src/tsb/tsb_i2c.c
  33. index ff5b5cdcac19..4116e33e0b70 100644
  34. --- a/nuttx/arch/arm/src/tsb/tsb_i2c.c
  35. +++ b/nuttx/arch/arm/src/tsb/tsb_i2c.c
  36. @@ -392,18 +392,12 @@ static void tsb_i2c_read(struct tsb_i2c_info *info)
  37. static void tsb_i2c_timeout(int argc, uint32_t arg, ...)
  38. {
  39. struct tsb_i2c_info *info = (struct tsb_i2c_info*)arg;
  40. -
  41. - lldbg("\n");
  42. -
  43. irqstate_t flags = irqsave();
  44.  
  45. - if (info->status != TSB_I2C_STATUS_IDLE)
  46. - {
  47. - lldbg("finished\n");
  48. - /* Mark the transfer as finished */
  49. - info->status = TSB_I2C_STATUS_TIMEOUT;
  50. - sem_post(&info->wait);
  51. - }
  52. + lldbg("\n%s: timeout. status was %d\n", __func__, info->status);
  53. + /* Mark the transfer as finished */
  54. + info->status = TSB_I2C_STATUS_TIMEOUT;
  55. + sem_post(&info->wait);
  56.  
  57. irqrestore(flags);
  58. }
  59. diff --git a/nuttx/arch/arm/src/tsb/tsb_i2c.h b/nuttx/arch/arm/src/tsb/tsb_i2c.h
  60. index 36d11a94fc9e..c6e56df509cd 100644
  61. --- a/nuttx/arch/arm/src/tsb/tsb_i2c.h
  62. +++ b/nuttx/arch/arm/src/tsb/tsb_i2c.h
  63. @@ -92,7 +92,7 @@
  64. #define TSB_I2C_STATUS_IDLE 0x0
  65. #define TSB_I2C_STATUS_WRITE_IN_PROGRESS 0x1
  66. #define TSB_I2C_STATUS_READ_IN_PROGRESS 0x2
  67. -#define TSB_I2C_STATUS_TIMEOUT 0x3
  68. +#define TSB_I2C_STATUS_TIMEOUT 0x4
  69.  
  70. /* hardware abort codes from the TSB_I2C_TX_ABRT_SOURCE register */
  71. #define ABRT_7B_ADDR_NOACK 0
Add Comment
Please, Sign In to add comment