341-MIPS-BCM63XX-add-support-for-BCM6318.patch 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. From 60c29522a8c77d96145d965589c56befda7d4c3d Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jogo@openwrt.org>
  3. Date: Sun, 8 Dec 2013 01:24:09 +0100
  4. Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318
  5. ---
  6. arch/mips/bcm63xx/Kconfig | 5 +
  7. arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +-
  8. arch/mips/bcm63xx/clk.c | 8 +-
  9. arch/mips/bcm63xx/cpu.c | 53 +++++++++++
  10. arch/mips/bcm63xx/dev-flash.c | 3 +
  11. arch/mips/bcm63xx/dev-spi.c | 2 +-
  12. arch/mips/bcm63xx/irq.c | 10 ++
  13. arch/mips/bcm63xx/prom.c | 2 +-
  14. arch/mips/bcm63xx/reset.c | 24 +++++
  15. arch/mips/bcm63xx/setup.c | 5 +-
  16. arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 107 ++++++++++++++++++++++
  17. arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 75 ++++++++++++++-
  18. arch/mips/include/asm/mach-bcm63xx/ioremap.h | 1 +
  19. 13 files changed, 291 insertions(+), 6 deletions(-)
  20. --- a/arch/mips/bcm63xx/Kconfig
  21. +++ b/arch/mips/bcm63xx/Kconfig
  22. @@ -18,6 +18,11 @@ config BCM63XX_EHCI
  23. select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD
  24. select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD
  25. +config BCM63XX_CPU_6318
  26. + bool "support 6318 CPU"
  27. + select SYS_HAS_CPU_BMIPS32_3300
  28. + select HW_HAS_PCI
  29. +
  30. config BCM63XX_CPU_6328
  31. bool "support 6328 CPU"
  32. select SYS_HAS_CPU_BMIPS4350
  33. --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
  34. +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
  35. @@ -712,7 +712,7 @@ void __init board_prom_init(void)
  36. /* read base address of boot chip select (0)
  37. * 6328/6362 do not have MPI but boot from a fixed address
  38. */
  39. - if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) {
  40. + if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) {
  41. val = 0x18000000;
  42. } else {
  43. val = bcm_mpi_readl(MPI_CSBASE_REG(0));
  44. --- a/arch/mips/bcm63xx/clk.c
  45. +++ b/arch/mips/bcm63xx/clk.c
  46. @@ -252,7 +252,9 @@ static void hsspi_set(struct clk *clk, i
  47. {
  48. u32 mask;
  49. - if (BCMCPU_IS_6328())
  50. + if (BCMCPU_IS_6318())
  51. + mask = CKCTL_6318_HSSPI_EN;
  52. + else if (BCMCPU_IS_6328())
  53. mask = CKCTL_6328_HSSPI_EN;
  54. else if (BCMCPU_IS_6362())
  55. mask = CKCTL_6362_HSSPI_EN;
  56. @@ -417,12 +419,16 @@ void clk_put(struct clk *clk)
  57. EXPORT_SYMBOL(clk_put);
  58. +#define HSSPI_PLL_HZ_6318 250000000
  59. #define HSSPI_PLL_HZ_6328 133333333
  60. #define HSSPI_PLL_HZ_6362 400000000
  61. static int __init bcm63xx_clk_init(void)
  62. {
  63. switch (bcm63xx_get_cpu_id()) {
  64. + case BCM6318_CPU_ID:
  65. + clk_hsspi.rate = HSSPI_PLL_HZ_6318;
  66. + break;
  67. case BCM6328_CPU_ID:
  68. clk_hsspi.rate = HSSPI_PLL_HZ_6328;
  69. break;
  70. --- a/arch/mips/bcm63xx/cpu.c
  71. +++ b/arch/mips/bcm63xx/cpu.c
  72. @@ -41,6 +41,14 @@ static const int bcm3368_irqs[] = {
  73. __GEN_CPU_IRQ_TABLE(3368)
  74. };
  75. +static const unsigned long bcm6318_regs_base[] = {
  76. + __GEN_CPU_REGS_TABLE(6318)
  77. +};
  78. +
  79. +static const int bcm6318_irqs[] = {
  80. + __GEN_CPU_IRQ_TABLE(6318)
  81. +};
  82. +
  83. static const unsigned long bcm6328_regs_base[] = {
  84. __GEN_CPU_REGS_TABLE(6328)
  85. };
  86. @@ -134,6 +142,10 @@ unsigned int bcm63xx_get_memory_size(voi
  87. return bcm63xx_memory_size;
  88. }
  89. +#define STRAP_OVERRIDE_BUS_REG 0x0
  90. +#define OVERRIDE_BUS_MIPS_FREQ_SHIFT 23
  91. +#define OVERRIDE_BUS_MIPS_FREQ_MASK (0x3 << OVERRIDE_BUS_MIPS_FREQ_SHIFT)
  92. +
  93. static unsigned int detect_cpu_clock(void)
  94. {
  95. u32 cpu_id = bcm63xx_get_cpu_id();
  96. @@ -142,6 +154,28 @@ static unsigned int detect_cpu_clock(voi
  97. case BCM3368_CPU_ID:
  98. return 300000000;
  99. + case BCM6318_CPU_ID:
  100. + {
  101. + unsigned int tmp, mips_pll_fcvo;
  102. +
  103. + tmp = bcm_readl(BCM_6318_STRAP_BASE + STRAP_OVERRIDE_BUS_REG);
  104. +
  105. + pr_info("strap_override_bus = %08x\n", tmp);
  106. +
  107. + mips_pll_fcvo = (tmp & OVERRIDE_BUS_MIPS_FREQ_MASK)
  108. + >> OVERRIDE_BUS_MIPS_FREQ_SHIFT;
  109. +
  110. + switch (mips_pll_fcvo) {
  111. + case 0:
  112. + return 166000000;
  113. + case 1:
  114. + return 400000000;
  115. + case 2:
  116. + return 250000000;
  117. + case 3:
  118. + return 333000000;
  119. + };
  120. + }
  121. case BCM6328_CPU_ID:
  122. {
  123. unsigned int tmp, mips_pll_fcvo;
  124. @@ -297,6 +331,13 @@ static unsigned int detect_memory_size(v
  125. unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
  126. u32 val;
  127. + if (BCMCPU_IS_6318()) {
  128. + val = bcm_sdram_readl(SDRAM_CFG_REG);
  129. + val = val & SDRAM_CFG_6318_SPACE_MASK;
  130. + val >>= SDRAM_CFG_6318_SPACE_SHIFT;
  131. + return 1 << (val + 20);
  132. + }
  133. +
  134. if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268())
  135. return bcm_ddr_readl(DDR_CSEND_REG) << 24;
  136. @@ -343,6 +384,12 @@ void __init bcm63xx_cpu_init(void)
  137. switch (current_cpu_type()) {
  138. case CPU_BMIPS3300:
  139. + if ((read_c0_prid() & 0xff) >= 0x33) {
  140. + /* BCM6318 */
  141. + chipid_reg = BCM_6368_PERF_BASE;
  142. + break;
  143. + }
  144. +
  145. if ((read_c0_prid() & PRID_IMP_MASK) != PRID_IMP_BMIPS3300_ALT)
  146. __cpu_name[cpu] = "Broadcom BCM6338";
  147. /* fall-through */
  148. @@ -390,6 +437,10 @@ void __init bcm63xx_cpu_init(void)
  149. bcm63xx_cpu_variant = bcm63xx_cpu_id;
  150. switch (bcm63xx_cpu_id) {
  151. + case BCM6318_CPU_ID:
  152. + bcm63xx_regs_base = bcm6318_regs_base;
  153. + bcm63xx_irqs = bcm6318_irqs;
  154. + break;
  155. case BCM3368_CPU_ID:
  156. bcm63xx_regs_base = bcm3368_regs_base;
  157. bcm63xx_irqs = bcm3368_irqs;
  158. --- a/arch/mips/bcm63xx/dev-flash.c
  159. +++ b/arch/mips/bcm63xx/dev-flash.c
  160. @@ -60,6 +60,9 @@ static int __init bcm63xx_detect_flash_t
  161. u32 val;
  162. switch (bcm63xx_get_cpu_id()) {
  163. + case BCM6318_CPU_ID:
  164. + /* only support serial flash */
  165. + return BCM63XX_FLASH_TYPE_SERIAL;
  166. case BCM6328_CPU_ID:
  167. val = bcm_misc_readl(MISC_STRAPBUS_6328_REG);
  168. if (val & STRAPBUS_6328_BOOT_SEL_SERIAL)
  169. --- a/arch/mips/bcm63xx/dev-spi.c
  170. +++ b/arch/mips/bcm63xx/dev-spi.c
  171. @@ -70,7 +70,7 @@ static struct platform_device bcm63xx_sp
  172. int __init bcm63xx_spi_register(void)
  173. {
  174. - if (BCMCPU_IS_6328() || BCMCPU_IS_6345())
  175. + if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6345())
  176. return -ENODEV;
  177. spi_resources[0].start = bcm63xx_regset_address(RSET_SPI);
  178. --- a/arch/mips/bcm63xx/irq.c
  179. +++ b/arch/mips/bcm63xx/irq.c
  180. @@ -49,6 +49,19 @@ void __init arch_init_irq(void)
  181. ext_irqs[3] = BCM_3368_EXT_IRQ3;
  182. ext_shift = 4;
  183. break;
  184. + case BCM6318_CPU_ID:
  185. + periph_bases[0] += PERF_IRQMASK_6318_REG;
  186. + periph_irq_count = 1;
  187. + periph_width = 4;
  188. +
  189. + ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6318;
  190. + ext_irq_count = 4;
  191. + ext_irqs[0] = BCM_6318_EXT_IRQ0;
  192. + ext_irqs[1] = BCM_6318_EXT_IRQ0;
  193. + ext_irqs[2] = BCM_6318_EXT_IRQ0;
  194. + ext_irqs[3] = BCM_6318_EXT_IRQ0;
  195. + ext_shift = 4;
  196. + break;
  197. case BCM6328_CPU_ID:
  198. periph_bases[0] += PERF_IRQMASK_6328_REG(0);
  199. periph_bases[1] += PERF_IRQMASK_6328_REG(1);
  200. --- a/arch/mips/bcm63xx/prom.c
  201. +++ b/arch/mips/bcm63xx/prom.c
  202. @@ -68,7 +68,7 @@ void __init prom_init(void)
  203. if (reg & OTP_6328_REG3_TP1_DISABLED)
  204. bmips_smp_enabled = 0;
  205. - } else if (BCMCPU_IS_3368() || BCMCPU_IS_6358()) {
  206. + } else if (BCMCPU_IS_6318() || BCMCPU_IS_3368() || BCMCPU_IS_6358()) {
  207. bmips_smp_enabled = 0;
  208. }
  209. --- a/arch/mips/bcm63xx/reset.c
  210. +++ b/arch/mips/bcm63xx/reset.c
  211. @@ -43,6 +43,23 @@
  212. #define BCM3368_RESET_PCIE 0
  213. #define BCM3368_RESET_PCIE_EXT 0
  214. +
  215. +#define BCM6318_RESET_SPI SOFTRESET_6318_SPI_MASK
  216. +#define BCM6318_RESET_ENET 0
  217. +#define BCM6318_RESET_USBH SOFTRESET_6318_USBH_MASK
  218. +#define BCM6318_RESET_USBD SOFTRESET_6318_USBS_MASK
  219. +#define BCM6318_RESET_DSL 0
  220. +#define BCM6318_RESET_SAR SOFTRESET_6318_SAR_MASK
  221. +#define BCM6318_RESET_EPHY SOFTRESET_6318_EPHY_MASK
  222. +#define BCM6318_RESET_ENETSW SOFTRESET_6318_ENETSW_MASK
  223. +#define BCM6318_RESET_PCM 0
  224. +#define BCM6318_RESET_MPI 0
  225. +#define BCM6318_RESET_PCIE \
  226. + (SOFTRESET_6318_PCIE_MASK | \
  227. + SOFTRESET_6318_PCIE_CORE_MASK | \
  228. + SOFTRESET_6318_PCIE_HARD_MASK)
  229. +#define BCM6318_RESET_PCIE_EXT SOFTRESET_6318_PCIE_EXT_MASK
  230. +
  231. #define BCM6328_RESET_SPI SOFTRESET_6328_SPI_MASK
  232. #define BCM6328_RESET_ENET 0
  233. #define BCM6328_RESET_USBH SOFTRESET_6328_USBH_MASK
  234. @@ -147,6 +164,10 @@ static const u32 bcm3368_reset_bits[] =
  235. __GEN_RESET_BITS_TABLE(3368)
  236. };
  237. +static const u32 bcm6318_reset_bits[] = {
  238. + __GEN_RESET_BITS_TABLE(6318)
  239. +};
  240. +
  241. static const u32 bcm6328_reset_bits[] = {
  242. __GEN_RESET_BITS_TABLE(6328)
  243. };
  244. @@ -183,6 +204,9 @@ static int __init bcm63xx_reset_bits_ini
  245. if (BCMCPU_IS_3368()) {
  246. reset_reg = PERF_SOFTRESET_6358_REG;
  247. bcm63xx_reset_bits = bcm3368_reset_bits;
  248. + } else if (BCMCPU_IS_6318()) {
  249. + reset_reg = PERF_SOFTRESET_6318_REG;
  250. + bcm63xx_reset_bits = bcm6318_reset_bits;
  251. } else if (BCMCPU_IS_6328()) {
  252. reset_reg = PERF_SOFTRESET_6328_REG;
  253. bcm63xx_reset_bits = bcm6328_reset_bits;
  254. --- a/arch/mips/bcm63xx/setup.c
  255. +++ b/arch/mips/bcm63xx/setup.c
  256. @@ -72,6 +72,9 @@ void bcm63xx_machine_reboot(void)
  257. case BCM3368_CPU_ID:
  258. perf_regs[0] = PERF_EXTIRQ_CFG_REG_3368;
  259. break;
  260. + case BCM6318_CPU_ID:
  261. + perf_regs[0] = PERF_EXTIRQ_CFG_REG_6318;
  262. + break;
  263. case BCM6328_CPU_ID:
  264. perf_regs[0] = PERF_EXTIRQ_CFG_REG_6328;
  265. break;
  266. @@ -111,7 +114,7 @@ void bcm63xx_machine_reboot(void)
  267. bcm6348_a1_reboot();
  268. printk(KERN_INFO "triggering watchdog soft-reset...\n");
  269. - if (BCMCPU_IS_6328()) {
  270. + if (BCMCPU_IS_6318() || BCMCPU_IS_6328()) {
  271. bcm_wdt_writel(1, WDT_SOFTRESET_REG);
  272. } else {
  273. reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG);
  274. --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
  275. +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
  276. @@ -10,6 +10,7 @@
  277. * arm mach-types)
  278. */
  279. #define BCM3368_CPU_ID 0x3368
  280. +#define BCM6318_CPU_ID 0x6318
  281. #define BCM6328_CPU_ID 0x6328
  282. #define BCM63281_CPU_ID 0x63281
  283. #define BCM63283_CPU_ID 0x63283
  284. @@ -38,6 +39,10 @@ static inline u32 __pure __bcm63xx_get_c
  285. case BCM3368_CPU_ID:
  286. #endif
  287. +#ifdef CONFIG_BCM63XX_CPU_6318
  288. + case BCM6318_CPU_ID:
  289. +#endif
  290. +
  291. #ifdef CONFIG_BCM63XX_CPU_6328
  292. case BCM6328_CPU_ID:
  293. #endif
  294. @@ -87,6 +92,7 @@ static inline u32 __pure bcm63xx_get_cpu
  295. }
  296. #define BCMCPU_IS_3368() (bcm63xx_get_cpu_id() == BCM3368_CPU_ID)
  297. +#define BCMCPU_IS_6318() (bcm63xx_get_cpu_id() == BCM6318_CPU_ID)
  298. #define BCMCPU_IS_6328() (bcm63xx_get_cpu_id() == BCM6328_CPU_ID)
  299. #define BCMCPU_IS_6338() (bcm63xx_get_cpu_id() == BCM6338_CPU_ID)
  300. #define BCMCPU_IS_6345() (bcm63xx_get_cpu_id() == BCM6345_CPU_ID)
  301. @@ -98,6 +104,8 @@ static inline u32 __pure bcm63xx_get_cpu
  302. #define BCMCPU_VARIANT_IS_3368() \
  303. (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID)
  304. +#define BCMCPU_VARIANT_IS_6318() \
  305. + (bcm63xx_get_cpu_variant() == BCM6318_CPU_ID)
  306. #define BCMCPU_VARIANT_IS_63281() \
  307. (bcm63xx_get_cpu_variant() == BCM63281_CPU_ID)
  308. #define BCMCPU_VARIANT_IS_63283() \
  309. @@ -252,6 +260,56 @@ enum bcm63xx_regs_set {
  310. #define BCM_3368_MISC_BASE (0xdeadbeef)
  311. /*
  312. + * 6318 register sets base address
  313. + */
  314. +#define BCM_6318_DSL_LMEM_BASE (0xdeadbeef)
  315. +#define BCM_6318_PERF_BASE (0xb0000000)
  316. +#define BCM_6318_TIMER_BASE (0xb0000040)
  317. +#define BCM_6318_WDT_BASE (0xb0000068)
  318. +#define BCM_6318_UART0_BASE (0xb0000100)
  319. +#define BCM_6318_UART1_BASE (0xdeadbeef)
  320. +#define BCM_6318_GPIO_BASE (0xb0000080)
  321. +#define BCM_6318_SPI_BASE (0xdeadbeef)
  322. +#define BCM_6318_HSSPI_BASE (0xb0003000)
  323. +#define BCM_6318_UDC0_BASE (0xdeadbeef)
  324. +#define BCM_6318_USBDMA_BASE (0xb0006800)
  325. +#define BCM_6318_OHCI0_BASE (0xb0005100)
  326. +#define BCM_6318_OHCI_PRIV_BASE (0xdeadbeef)
  327. +#define BCM_6318_USBH_PRIV_BASE (0xb0005200)
  328. +#define BCM_6318_USBD_BASE (0xb0006000)
  329. +#define BCM_6318_MPI_BASE (0xdeadbeef)
  330. +#define BCM_6318_PCMCIA_BASE (0xdeadbeef)
  331. +#define BCM_6318_PCIE_BASE (0xb0010000)
  332. +#define BCM_6318_SDRAM_REGS_BASE (0xdeadbeef)
  333. +#define BCM_6318_DSL_BASE (0xdeadbeef)
  334. +#define BCM_6318_UBUS_BASE (0xdeadbeef)
  335. +#define BCM_6318_ENET0_BASE (0xdeadbeef)
  336. +#define BCM_6318_ENET1_BASE (0xdeadbeef)
  337. +#define BCM_6318_ENETDMA_BASE (0xb0088000)
  338. +#define BCM_6318_ENETDMAC_BASE (0xb0088200)
  339. +#define BCM_6318_ENETDMAS_BASE (0xb0088400)
  340. +#define BCM_6318_ENETSW_BASE (0xb0080000)
  341. +#define BCM_6318_EHCI0_BASE (0xb0005000)
  342. +#define BCM_6318_SDRAM_BASE (0xb0004000)
  343. +#define BCM_6318_MEMC_BASE (0xdeadbeef)
  344. +#define BCM_6318_DDR_BASE (0xdeadbeef)
  345. +#define BCM_6318_M2M_BASE (0xdeadbeef)
  346. +#define BCM_6318_ATM_BASE (0xdeadbeef)
  347. +#define BCM_6318_XTM_BASE (0xdeadbeef)
  348. +#define BCM_6318_XTMDMA_BASE (0xb000c000)
  349. +#define BCM_6318_XTMDMAC_BASE (0xdeadbeef)
  350. +#define BCM_6318_XTMDMAS_BASE (0xdeadbeef)
  351. +#define BCM_6318_PCM_BASE (0xdeadbeef)
  352. +#define BCM_6318_PCMDMA_BASE (0xdeadbeef)
  353. +#define BCM_6318_PCMDMAC_BASE (0xdeadbeef)
  354. +#define BCM_6318_PCMDMAS_BASE (0xdeadbeef)
  355. +#define BCM_6318_RNG_BASE (0xdeadbeef)
  356. +#define BCM_6318_MISC_BASE (0xb0000280)
  357. +#define BCM_6318_OTP_BASE (0xdeadbeef)
  358. +
  359. +#define BCM_6318_STRAP_BASE (0xb0000900)
  360. +
  361. +/*
  362. * 6328 register sets base address
  363. */
  364. #define BCM_6328_DSL_LMEM_BASE (0xdeadbeef)
  365. @@ -774,6 +832,55 @@ enum bcm63xx_irq {
  366. #define BCM_3368_EXT_IRQ2 (IRQ_INTERNAL_BASE + 27)
  367. #define BCM_3368_EXT_IRQ3 (IRQ_INTERNAL_BASE + 28)
  368. +/*
  369. + * 6318 irqs
  370. + */
  371. +#define BCM_6318_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32)
  372. +#define BCM_6318_VERY_HIGH_IRQ_BASE (BCM_6318_HIGH_IRQ_BASE + 32)
  373. +
  374. +#define BCM_6318_TIMER_IRQ (IRQ_INTERNAL_BASE + 31)
  375. +#define BCM_6318_SPI_IRQ 0
  376. +#define BCM_6318_UART0_IRQ (IRQ_INTERNAL_BASE + 28)
  377. +#define BCM_6318_UART1_IRQ 0
  378. +#define BCM_6318_DSL_IRQ (IRQ_INTERNAL_BASE + 21)
  379. +#define BCM_6318_UDC0_IRQ 0
  380. +#define BCM_6318_ENET0_IRQ 0
  381. +#define BCM_6318_ENET1_IRQ 0
  382. +#define BCM_6318_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12)
  383. +#define BCM_6318_HSSPI_IRQ (IRQ_INTERNAL_BASE + 29)
  384. +#define BCM_6318_OHCI0_IRQ (BCM_6318_HIGH_IRQ_BASE + 9)
  385. +#define BCM_6318_EHCI0_IRQ (BCM_6318_HIGH_IRQ_BASE + 10)
  386. +#define BCM_6318_USBD_IRQ (IRQ_INTERNAL_BASE + 4)
  387. +#define BCM_6318_USBD_RXDMA0_IRQ (IRQ_INTERNAL_BASE + 5)
  388. +#define BCM_6318_USBD_TXDMA0_IRQ (IRQ_INTERNAL_BASE + 6)
  389. +#define BCM_6318_USBD_RXDMA1_IRQ (IRQ_INTERNAL_BASE + 7)
  390. +#define BCM_6318_USBD_TXDMA1_IRQ (IRQ_INTERNAL_BASE + 8)
  391. +#define BCM_6318_USBD_RXDMA2_IRQ (IRQ_INTERNAL_BASE + 9)
  392. +#define BCM_6318_USBD_TXDMA2_IRQ (IRQ_INTERNAL_BASE + 10)
  393. +#define BCM_6318_PCMCIA_IRQ 0
  394. +#define BCM_6318_ENET0_RXDMA_IRQ 0
  395. +#define BCM_6318_ENET0_TXDMA_IRQ 0
  396. +#define BCM_6318_ENET1_RXDMA_IRQ 0
  397. +#define BCM_6318_ENET1_TXDMA_IRQ 0
  398. +#define BCM_6318_PCI_IRQ (IRQ_INTERNAL_BASE + 23)
  399. +#define BCM_6318_ATM_IRQ 0
  400. +#define BCM_6318_ENETSW_RXDMA0_IRQ (BCM_6318_HIGH_IRQ_BASE + 0)
  401. +#define BCM_6318_ENETSW_RXDMA1_IRQ (BCM_6318_HIGH_IRQ_BASE + 1)
  402. +#define BCM_6318_ENETSW_RXDMA2_IRQ (BCM_6318_HIGH_IRQ_BASE + 2)
  403. +#define BCM_6318_ENETSW_RXDMA3_IRQ (BCM_6318_HIGH_IRQ_BASE + 3)
  404. +#define BCM_6318_ENETSW_TXDMA0_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 10)
  405. +#define BCM_6318_ENETSW_TXDMA1_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 11)
  406. +#define BCM_6318_ENETSW_TXDMA2_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 12)
  407. +#define BCM_6318_ENETSW_TXDMA3_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 13)
  408. +#define BCM_6318_XTM_IRQ (BCM_6318_HIGH_IRQ_BASE + 31)
  409. +#define BCM_6318_XTM_DMA0_IRQ (BCM_6318_HIGH_IRQ_BASE + 11)
  410. +
  411. +#define BCM_6318_PCM_DMA0_IRQ (IRQ_INTERNAL_BASE + 2)
  412. +#define BCM_6318_PCM_DMA1_IRQ (IRQ_INTERNAL_BASE + 3)
  413. +#define BCM_6318_EXT_IRQ0 (IRQ_INTERNAL_BASE + 24)
  414. +#define BCM_6318_EXT_IRQ1 (IRQ_INTERNAL_BASE + 25)
  415. +#define BCM_6318_EXT_IRQ2 (IRQ_INTERNAL_BASE + 26)
  416. +#define BCM_6318_EXT_IRQ3 (IRQ_INTERNAL_BASE + 27)
  417. /*
  418. * 6328 irqs
  419. --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
  420. +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
  421. @@ -52,6 +52,39 @@
  422. CKCTL_3368_EMUSB_EN | \
  423. CKCTL_3368_USBU_EN)
  424. +#define CKCTL_6318_ADSL_ASB_EN (1 << 0)
  425. +#define CKCTL_6318_USB_ASB_EN (1 << 1)
  426. +#define CKCTL_6318_MIPS_ASB_EN (1 << 2)
  427. +#define CKCTL_6318_PCIE_ASB_EN (1 << 3)
  428. +#define CKCTL_6318_PHYMIPS_ASB_EN (1 << 4)
  429. +#define CKCTL_6318_ROBOSW_ASB_EN (1 << 5)
  430. +#define CKCTL_6318_SAR_ASB_EN (1 << 6)
  431. +#define CKCTL_6318_SDR_ASB_EN (1 << 7)
  432. +#define CKCTL_6318_SWREG_ASB_EN (1 << 8)
  433. +#define CKCTL_6318_PERIPH_ASB_EN (1 << 9)
  434. +#define CKCTL_6318_CPUBUS160_EN (1 << 10)
  435. +#define CKCTL_6318_ADSL_EN (1 << 11)
  436. +#define CKCTL_6318_SAR125_EN (1 << 12)
  437. +#define CKCTL_6318_MIPS_EN (1 << 13)
  438. +#define CKCTL_6318_PCIE_EN (1 << 14)
  439. +#define CKCTL_6318_ROBOSW250_EN (1 << 16)
  440. +#define CKCTL_6318_ROBOSW025_EN (1 << 17)
  441. +#define CKCTL_6318_SDR_EN (1 << 19)
  442. +#define CKCTL_6318_USB_EN (1 << 20) /* both device and host */
  443. +#define CKCTL_6318_HSSPI_EN (1 << 25)
  444. +#define CKCTL_6318_PCIE25_EN (1 << 27)
  445. +#define CKCTL_6318_PHYMIPS_EN (1 << 28)
  446. +#define CKCTL_6318_ADSL_AFE_EN (1 << 29)
  447. +#define CKCTL_6318_ADSL_QPROC_EN (1 << 30)
  448. +
  449. +#define CKCTL_6318_ALL_SAFE_EN (CKCTL_6318_PHYMIPS_EN | \
  450. + CKCTL_6318_ADSL_QPROC_EN | \
  451. + CKCTL_6318_ADSL_AFE_EN | \
  452. + CKCTL_6318_ADSL_EN | \
  453. + CKCTL_6318_SAR_EN | \
  454. + CKCTL_6318_USB_EN | \
  455. + CKCTL_6318_PCIE_EN)
  456. +
  457. #define CKCTL_6328_PHYMIPS_EN (1 << 0)
  458. #define CKCTL_6328_ADSL_QPROC_EN (1 << 1)
  459. #define CKCTL_6328_ADSL_AFE_EN (1 << 2)
  460. @@ -259,12 +292,27 @@
  461. CKCTL_63268_TBUS_EN | \
  462. CKCTL_63268_ROBOSW250_EN)
  463. +/* UBUS Clock Control register */
  464. +#define PERF_UB_CKCTL_REG 0x10
  465. +
  466. +#define UB_CKCTL_6318_ADSL_EN (1 << 0)
  467. +#define UB_CKCTL_6318_ARB_EN (1 << 1)
  468. +#define UB_CKCTL_6318_MIPS_EN (1 << 2)
  469. +#define UB_CKCTL_6318_PCIE_EN (1 << 3)
  470. +#define UB_CKCTL_6318_PERIPH_EN (1 << 4)
  471. +#define UB_CKCTL_6318_PHYMIPS_EN (1 << 5)
  472. +#define UB_CKCTL_6318_ROBOSW_EN (1 << 6)
  473. +#define UB_CKCTL_6318_SAR_EN (1 << 7)
  474. +#define UB_CKCTL_6318_SDR_EN (1 << 8)
  475. +#define UB_CKCTL_6318_USB_EN (1 << 9)
  476. +
  477. /* System PLL Control register */
  478. #define PERF_SYS_PLL_CTL_REG 0x8
  479. #define SYS_PLL_SOFT_RESET 0x1
  480. /* Interrupt Mask register */
  481. #define PERF_IRQMASK_3368_REG 0xc
  482. +#define PERF_IRQMASK_6318_REG 0x20
  483. #define PERF_IRQMASK_6328_REG(x) (0x20 + (x) * 0x10)
  484. #define PERF_IRQMASK_6338_REG 0xc
  485. #define PERF_IRQMASK_6345_REG 0xc
  486. @@ -276,6 +324,7 @@
  487. /* Interrupt Status register */
  488. #define PERF_IRQSTAT_3368_REG 0x10
  489. +#define PERF_IRQSTAT_6318_REG 0x30
  490. #define PERF_IRQSTAT_6328_REG(x) (0x28 + (x) * 0x10)
  491. #define PERF_IRQSTAT_6338_REG 0x10
  492. #define PERF_IRQSTAT_6345_REG 0x10
  493. @@ -287,6 +336,7 @@
  494. /* External Interrupt Configuration register */
  495. #define PERF_EXTIRQ_CFG_REG_3368 0x14
  496. +#define PERF_EXTIRQ_CFG_REG_6318 0x18
  497. #define PERF_EXTIRQ_CFG_REG_6328 0x18
  498. #define PERF_EXTIRQ_CFG_REG_6338 0x14
  499. #define PERF_EXTIRQ_CFG_REG_6345 0x14
  500. @@ -321,6 +371,7 @@
  501. /* Soft Reset register */
  502. #define PERF_SOFTRESET_REG 0x28
  503. +#define PERF_SOFTRESET_6318_REG 0x10
  504. #define PERF_SOFTRESET_6328_REG 0x10
  505. #define PERF_SOFTRESET_6358_REG 0x34
  506. #define PERF_SOFTRESET_6362_REG 0x10
  507. @@ -334,6 +385,18 @@
  508. #define SOFTRESET_3368_USBS_MASK (1 << 11)
  509. #define SOFTRESET_3368_PCM_MASK (1 << 13)
  510. +#define SOFTRESET_6318_SPI_MASK (1 << 0)
  511. +#define SOFTRESET_6318_EPHY_MASK (1 << 1)
  512. +#define SOFTRESET_6318_SAR_MASK (1 << 2)
  513. +#define SOFTRESET_6318_ENETSW_MASK (1 << 3)
  514. +#define SOFTRESET_6318_USBS_MASK (1 << 4)
  515. +#define SOFTRESET_6318_USBH_MASK (1 << 5)
  516. +#define SOFTRESET_6318_PCIE_CORE_MASK (1 << 6)
  517. +#define SOFTRESET_6318_PCIE_MASK (1 << 7)
  518. +#define SOFTRESET_6318_PCIE_EXT_MASK (1 << 8)
  519. +#define SOFTRESET_6318_PCIE_HARD_MASK (1 << 9)
  520. +#define SOFTRESET_6318_ADSL_MASK (1 << 10)
  521. +
  522. #define SOFTRESET_6328_SPI_MASK (1 << 0)
  523. #define SOFTRESET_6328_EPHY_MASK (1 << 1)
  524. #define SOFTRESET_6328_SAR_MASK (1 << 2)
  525. @@ -505,8 +568,17 @@
  526. #define TIMER_IRQSTAT_TIMER1_IR_EN (1 << 9)
  527. #define TIMER_IRQSTAT_TIMER2_IR_EN (1 << 10)
  528. +#define TIMER_IRQMASK_6318_REG 0x0
  529. +#define TIMER_IRQSTAT_6318_REG 0x4
  530. +#define IRQSTATMASK_TIMER0 (1 << 0)
  531. +#define IRQSTATMASK_TIMER1 (1 << 1)
  532. +#define IRQSTATMASK_TIMER2 (1 << 2)
  533. +#define IRQSTATMASK_TIMER3 (1 << 3)
  534. +#define IRQSTATMASK_WDT (1 << 4)
  535. +
  536. /* Timer control register */
  537. #define TIMER_CTLx_REG(x) (0x4 + (x * 4))
  538. +#define TIMER_CTRx_6318_REG(x) (0x8 + (x * 4))
  539. #define TIMER_CTL0_REG 0x4
  540. #define TIMER_CTL1_REG 0x8
  541. #define TIMER_CTL2_REG 0xC
  542. @@ -1253,6 +1325,8 @@
  543. #define SDRAM_CFG_32B_MASK (1 << SDRAM_CFG_32B_SHIFT)
  544. #define SDRAM_CFG_BANK_SHIFT 13
  545. #define SDRAM_CFG_BANK_MASK (1 << SDRAM_CFG_BANK_SHIFT)
  546. +#define SDRAM_CFG_6318_SPACE_SHIFT 4
  547. +#define SDRAM_CFG_6318_SPACE_MASK (0xf << SDRAM_CFG_6318_SPACE_SHIFT)
  548. #define SDRAM_MBASE_REG 0xc
  549. --- a/arch/mips/include/asm/mach-bcm63xx/ioremap.h
  550. +++ b/arch/mips/include/asm/mach-bcm63xx/ioremap.h
  551. @@ -22,6 +22,7 @@ static inline int is_bcm63xx_internal_re
  552. if (offset >= 0xfff00000)
  553. return 1;
  554. break;
  555. + case BCM6318_CPU_ID:
  556. case BCM6328_CPU_ID:
  557. case BCM6362_CPU_ID:
  558. case BCM6368_CPU_ID:
  559. --- a/arch/mips/bcm63xx/dev-hsspi.c
  560. +++ b/arch/mips/bcm63xx/dev-hsspi.c
  561. @@ -35,7 +35,8 @@ static struct platform_device bcm63xx_hs
  562. int __init bcm63xx_hsspi_register(void)
  563. {
  564. - if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_63268())
  565. + if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6362() &&
  566. + !BCMCPU_IS_63268())
  567. return -ENODEV;
  568. spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI);
  569. --- a/arch/mips/bcm63xx/dev-usb-usbd.c
  570. +++ b/arch/mips/bcm63xx/dev-usb-usbd.c
  571. @@ -41,7 +41,7 @@ int __init bcm63xx_usbd_register(const s
  572. IRQ_USBD_RXDMA2, IRQ_USBD_TXDMA2 };
  573. int i;
  574. - if (!BCMCPU_IS_6328() && !BCMCPU_IS_6368())
  575. + if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6368())
  576. return 0;
  577. usbd_resources[0].start = bcm63xx_regset_address(RSET_USBD);
  578. --- a/arch/mips/bcm63xx/dev-enet.c
  579. +++ b/arch/mips/bcm63xx/dev-enet.c
  580. @@ -176,8 +176,8 @@ static int __init register_shared(void)
  581. else
  582. shared_res[0].end += (RSET_ENETDMA_SIZE) - 1;
  583. - if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368() ||
  584. - BCMCPU_IS_63268())
  585. + if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6362() ||
  586. + BCMCPU_IS_6368() || BCMCPU_IS_63268())
  587. chan_count = 32;
  588. else if (BCMCPU_IS_6345())
  589. chan_count = 8;
  590. @@ -277,8 +277,8 @@ bcm63xx_enetsw_register(const struct bcm
  591. {
  592. int ret;
  593. - if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368() &&
  594. - !BCMCPU_IS_63268())
  595. + if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6362() &&
  596. + !BCMCPU_IS_6368() && !BCMCPU_IS_63268())
  597. return -ENODEV;
  598. ret = register_shared();
  599. @@ -295,7 +295,7 @@ bcm63xx_enetsw_register(const struct bcm
  600. memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof(*pd));
  601. - if (BCMCPU_IS_6328())
  602. + if (BCMCPU_IS_6318() || BCMCPU_IS_6328())
  603. enetsw_pd.num_ports = ENETSW_PORTS_6328;
  604. else if (BCMCPU_IS_6362() || BCMCPU_IS_6368())
  605. enetsw_pd.num_ports = ENETSW_PORTS_6368;
  606. --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
  607. +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
  608. @@ -9,6 +9,8 @@ int __init bcm63xx_gpio_init(void);
  609. static inline unsigned long bcm63xx_gpio_count(void)
  610. {
  611. switch (bcm63xx_get_cpu_id()) {
  612. + case BCM6318_CPU_ID:
  613. + return 50;
  614. case BCM6328_CPU_ID:
  615. return 32;
  616. case BCM3368_CPU_ID:
  617. --- a/arch/mips/bcm63xx/dev-usb-ehci.c
  618. +++ b/arch/mips/bcm63xx/dev-usb-ehci.c
  619. @@ -81,7 +81,8 @@ static struct platform_device bcm63xx_eh
  620. int __init bcm63xx_ehci_register(void)
  621. {
  622. - if (!BCMCPU_IS_6328() && !BCMCPU_IS_6358() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368())
  623. + if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6358() &&
  624. + !BCMCPU_IS_6362() && !BCMCPU_IS_6368())
  625. return 0;
  626. ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0);