347-MIPS-BCM6318-USB-support.patch 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. --- a/arch/mips/bcm63xx/usb-common.c
  2. +++ b/arch/mips/bcm63xx/usb-common.c
  3. @@ -109,6 +109,27 @@ void bcm63xx_usb_priv_ohci_cfg_set(void)
  4. reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG);
  5. reg |= USBH_PRIV_SETUP_IOC_MASK;
  6. bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG);
  7. + } else if (BCMCPU_IS_6318()) {
  8. + reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG);
  9. + reg |= USBH_PRIV_PLL_CTRL1_SUSP_EN;
  10. + bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG);
  11. +
  12. + reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6318_REG);
  13. + reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK;
  14. + reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK;
  15. + bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6318_REG);
  16. +
  17. + reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6318_REG);
  18. + reg |= USBH_PRIV_SETUP_IOC_MASK;
  19. + bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6318_REG);
  20. +
  21. + reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG);
  22. + reg &= ~USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN;
  23. + bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG);
  24. +
  25. + reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SIM_CTRL_6318_REG);
  26. + reg |= USBH_PRIV_SIM_CTRL_LADDR_SEL;
  27. + bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SIM_CTRL_6318_REG);
  28. }
  29. spin_unlock_irqrestore(&usb_priv_reg_lock, flags);
  30. @@ -144,6 +165,27 @@ void bcm63xx_usb_priv_ehci_cfg_set(void)
  31. reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG);
  32. reg |= USBH_PRIV_SETUP_IOC_MASK;
  33. bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG);
  34. + } else if (BCMCPU_IS_6318()) {
  35. + reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG);
  36. + reg |= USBH_PRIV_PLL_CTRL1_SUSP_EN;
  37. + bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG);
  38. +
  39. + reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6318_REG);
  40. + reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK;
  41. + reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK;
  42. + bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6318_REG);
  43. +
  44. + reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6318_REG);
  45. + reg |= USBH_PRIV_SETUP_IOC_MASK;
  46. + bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6318_REG);
  47. +
  48. + reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG);
  49. + reg &= ~USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN;
  50. + bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG);
  51. +
  52. + reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SIM_CTRL_6318_REG);
  53. + reg |= USBH_PRIV_SIM_CTRL_LADDR_SEL;
  54. + bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SIM_CTRL_6318_REG);
  55. }
  56. spin_unlock_irqrestore(&usb_priv_reg_lock, flags);
  57. --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
  58. +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
  59. @@ -681,6 +681,12 @@
  60. #define GPIO_MODE_6368_SPI_SSN4 (1 << 30)
  61. #define GPIO_MODE_6368_SPI_SSN5 (1 << 31)
  62. +#define GPIO_PINMUX_SEL0_6318 0x1c
  63. +#define GPIO_PINMUX_SEL0_GPIO13_SHIFT 26
  64. +#define GPIO_PINMUX_SEL0_GPIO13_MASK (0x3 << GPIO_PINMUX_SEL0_GPIO13_SHIFT)
  65. +#define GPIO_PINMUX_SEL0_GPIO13_PWRON (1 << GPIO_PINMUX_SEL0_GPIO13_SHIFT)
  66. +#define GPIO_PINMUX_SEL0_GPIO13_LED (2 << GPIO_PINMUX_SEL0_GPIO13_SHIFT)
  67. +#define GPIO_PINMUX_SEL0_GPIO13_GPIO (3 << GPIO_PINMUX_SEL0_GPIO13_SHIFT)
  68. #define GPIO_PINMUX_OTHR_REG 0x24
  69. #define GPIO_PINMUX_OTHR_6328_USB_SHIFT 12
  70. @@ -999,6 +1005,7 @@
  71. #define USBH_PRIV_SWAP_6358_REG 0x0
  72. #define USBH_PRIV_SWAP_6368_REG 0x1c
  73. +#define USBH_PRIV_SWAP_6318_REG 0x0c
  74. #define USBH_PRIV_SWAP_USBD_SHIFT 6
  75. #define USBH_PRIV_SWAP_USBD_MASK (1 << USBH_PRIV_SWAP_USBD_SHIFT)
  76. @@ -1024,6 +1031,13 @@
  77. #define USBH_PRIV_SETUP_IOC_SHIFT 4
  78. #define USBH_PRIV_SETUP_IOC_MASK (1 << USBH_PRIV_SETUP_IOC_SHIFT)
  79. +#define USBH_PRIV_SETUP_6318_REG 0x00
  80. +#define USBH_PRIV_PLL_CTRL1_6318_REG 0x04
  81. +#define USBH_PRIV_PLL_CTRL1_SUSP_EN (1 << 27)
  82. +#define USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN (1 << 31)
  83. +#define USBH_PRIV_SIM_CTRL_6318_REG 0x20
  84. +#define USBH_PRIV_SIM_CTRL_LADDR_SEL (1 << 5)
  85. +
  86. /*************************************************************************
  87. * _REG relative to RSET_USBD
  88. --- a/arch/mips/bcm63xx/boards/board_common.c
  89. +++ b/arch/mips/bcm63xx/boards/board_common.c
  90. @@ -126,6 +126,15 @@ void __init board_early_setup(const stru
  91. }
  92. bcm_gpio_writel(val, GPIO_MODE_REG);
  93. +
  94. +#if IS_ENABLED(CONFIG_USB)
  95. + if (BCMCPU_IS_6318() && (board.has_ehci0 || board.has_ohci0)) {
  96. + val = bcm_gpio_readl(GPIO_PINMUX_SEL0_6318);
  97. + val &= ~GPIO_PINMUX_SEL0_GPIO13_MASK;
  98. + val |= GPIO_PINMUX_SEL0_GPIO13_PWRON;
  99. + bcm_gpio_writel(val, GPIO_PINMUX_SEL0_6318);
  100. + }
  101. +#endif
  102. }
  103. --- a/arch/mips/bcm63xx/Kconfig
  104. +++ b/arch/mips/bcm63xx/Kconfig
  105. @@ -22,6 +22,8 @@ config BCM63XX_CPU_6318
  106. bool "support 6318 CPU"
  107. select SYS_HAS_CPU_BMIPS32_3300
  108. select HW_HAS_PCI
  109. + select BCM63XX_OHCI
  110. + select BCM63XX_EHCI
  111. config BCM63XX_CPU_6328
  112. bool "support 6328 CPU"