348-MIPS-BCM63XX-fix-BCM63268-USB-clock.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
  2. +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
  3. @@ -586,6 +586,9 @@
  4. #define TIMER_CTL_MONOTONIC_MASK (1 << 30)
  5. #define TIMER_CTL_ENABLE_MASK (1 << 31)
  6. +/* Clock reset control (63268 only) */
  7. +#define TIMER_CLK_RST_CTL_REG 0x2c
  8. +#define CLK_RST_CTL_USB_REF_CLK_EN (1 << 18)
  9. /*************************************************************************
  10. * _REG relative to RSET_WDT
  11. @@ -1547,6 +1550,11 @@
  12. #define STRAPBUS_63268_FCVO_SHIFT 21
  13. #define STRAPBUS_63268_FCVO_MASK (0xf << STRAPBUS_63268_FCVO_SHIFT)
  14. +#define MISC_IDDQ_CTRL_6328_REG 0x48
  15. +#define MISC_IDDQ_CTRL_63268_REG 0x4c
  16. +
  17. +#define IDDQ_CTRL_63268_USBH (1 << 4)
  18. +
  19. #define MISC_STRAPBUS_6328_REG 0x240
  20. #define STRAPBUS_6328_FCVO_SHIFT 7
  21. #define STRAPBUS_6328_FCVO_MASK (0x1f << STRAPBUS_6328_FCVO_SHIFT)
  22. --- a/arch/mips/bcm63xx/clk.c
  23. +++ b/arch/mips/bcm63xx/clk.c
  24. @@ -62,6 +62,26 @@ static void bcm_ub_hwclock_set(u32 mask,
  25. bcm_perf_writel(reg, PERF_UB_CKCTL_REG);
  26. }
  27. +static void bcm_misc_iddq_set(u32 mask, int enable)
  28. +{
  29. + u32 offset;
  30. + u32 reg;
  31. +
  32. + if (BCMCPU_IS_6328() || BCMCPU_IS_6362())
  33. + offset = MISC_IDDQ_CTRL_6328_REG;
  34. + else if (BCMCPU_IS_63268())
  35. + offset = MISC_IDDQ_CTRL_63268_REG;
  36. + else
  37. + return;
  38. +
  39. + reg = bcm_misc_readl(offset);
  40. + if (enable)
  41. + reg &= ~mask;
  42. + else
  43. + reg |= mask;
  44. + bcm_misc_writel(reg, offset);
  45. +}
  46. +
  47. /*
  48. * Ethernet MAC "misc" clock: dma clocks and main clock on 6348
  49. */
  50. @@ -199,7 +219,17 @@ static void usbh_set(struct clk *clk, in
  51. } else if (BCMCPU_IS_6368()) {
  52. bcm_hwclock_set(CKCTL_6368_USBH_EN, enable);
  53. } else if (BCMCPU_IS_63268()) {
  54. + u32 reg;
  55. +
  56. bcm_hwclock_set(CKCTL_63268_USBH_EN, enable);
  57. + bcm_misc_iddq_set(IDDQ_CTRL_63268_USBH, enable);
  58. + bcm63xx_core_set_reset(BCM63XX_RESET_USBH, !enable);
  59. + reg = bcm_timer_readl(TIMER_CLK_RST_CTL_REG);
  60. + if (enable)
  61. + reg |= CLK_RST_CTL_USB_REF_CLK_EN;
  62. + else
  63. + reg &= ~CLK_RST_CTL_USB_REF_CLK_EN;
  64. + bcm_timer_writel(reg, TIMER_CLK_RST_CTL_REG);
  65. } else {
  66. return;
  67. }