2
0

012-sun6i-fix-clock_twi_onoff.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 730d2f3a41c5ccae71b5008fffdf697d143be68c Mon Sep 17 00:00:00 2001
  2. From: Hans de Goede <hdegoede@redhat.com>
  3. Date: Wed, 16 Mar 2016 20:44:51 +0100
  4. Subject: [PATCH] sunxi: Fix clock_twi_onoff for sun6i
  5. The clock_sun6i.c implementation was not deasserting the reset for
  6. the regular i2c controllers, this commit fixes this.
  7. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  8. Acked-by: Ian Campbell <ijc@hellion.org.uk>
  9. ---
  10. arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 11 ++++++++---
  11. 1 file changed, 8 insertions(+), 3 deletions(-)
  12. --- a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
  13. +++ b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
  14. @@ -100,13 +100,18 @@ int clock_twi_onoff(int port, int state)
  15. return 0;
  16. }
  17. - /* set the apb clock gate for twi */
  18. - if (state)
  19. + /* set the apb clock gate and reset for twi */
  20. + if (state) {
  21. setbits_le32(&ccm->apb2_gate,
  22. CLK_GATE_OPEN << (APB2_GATE_TWI_SHIFT+port));
  23. - else
  24. + setbits_le32(&ccm->apb2_reset_cfg,
  25. + 1 << (APB2_RESET_TWI_SHIFT + port));
  26. + } else {
  27. + clrbits_le32(&ccm->apb2_reset_cfg,
  28. + 1 << (APB2_RESET_TWI_SHIFT + port));
  29. clrbits_le32(&ccm->apb2_gate,
  30. CLK_GATE_OPEN << (APB2_GATE_TWI_SHIFT+port));
  31. + }
  32. return 0;
  33. }