diff options
author | Jonas Gorski <jogo@openwrt.org> | 2013-03-21 10:03:17 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-05-07 19:19:03 -0400 |
commit | 2c8aaf71b0a4738ae8cb70d9367089bdb892aea3 (patch) | |
tree | 5ed40900de84142b9c4ed3812001154538f7cdde /arch/mips/bcm63xx | |
parent | 13be798c57ebe5df09254832330f48c936ac39fd (diff) |
MIPS: BCM63XX: add basic BCM6362 support
Add basic support for detecting and booting the BCM6362.
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/5009/
Acked-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'arch/mips/bcm63xx')
-rw-r--r-- | arch/mips/bcm63xx/Kconfig | 4 | ||||
-rw-r--r-- | arch/mips/bcm63xx/boards/board_bcm963xx.c | 6 | ||||
-rw-r--r-- | arch/mips/bcm63xx/cpu.c | 51 | ||||
-rw-r--r-- | arch/mips/bcm63xx/irq.c | 22 | ||||
-rw-r--r-- | arch/mips/bcm63xx/prom.c | 2 | ||||
-rw-r--r-- | arch/mips/bcm63xx/reset.c | 28 | ||||
-rw-r--r-- | arch/mips/bcm63xx/setup.c | 3 |
7 files changed, 112 insertions, 4 deletions
diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig index d03e8799d1cf..5639662fd503 100644 --- a/arch/mips/bcm63xx/Kconfig +++ b/arch/mips/bcm63xx/Kconfig | |||
@@ -25,6 +25,10 @@ config BCM63XX_CPU_6358 | |||
25 | bool "support 6358 CPU" | 25 | bool "support 6358 CPU" |
26 | select HW_HAS_PCI | 26 | select HW_HAS_PCI |
27 | 27 | ||
28 | config BCM63XX_CPU_6362 | ||
29 | bool "support 6362 CPU" | ||
30 | select HW_HAS_PCI | ||
31 | |||
28 | config BCM63XX_CPU_6368 | 32 | config BCM63XX_CPU_6368 |
29 | bool "support 6368 CPU" | 33 | bool "support 6368 CPU" |
30 | select HW_HAS_PCI | 34 | select HW_HAS_PCI |
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c index 9aa7d44898ed..a9505c4867e8 100644 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c | |||
@@ -726,11 +726,11 @@ void __init board_prom_init(void) | |||
726 | u32 val; | 726 | u32 val; |
727 | 727 | ||
728 | /* read base address of boot chip select (0) | 728 | /* read base address of boot chip select (0) |
729 | * 6328 does not have MPI but boots from a fixed address | 729 | * 6328/6362 do not have MPI but boot from a fixed address |
730 | */ | 730 | */ |
731 | if (BCMCPU_IS_6328()) | 731 | if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) { |
732 | val = 0x18000000; | 732 | val = 0x18000000; |
733 | else { | 733 | } else { |
734 | val = bcm_mpi_readl(MPI_CSBASE_REG(0)); | 734 | val = bcm_mpi_readl(MPI_CSBASE_REG(0)); |
735 | val &= MPI_CSBASE_BASE_MASK; | 735 | val &= MPI_CSBASE_BASE_MASK; |
736 | } | 736 | } |
diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c index fef168d85884..79fe32df5e96 100644 --- a/arch/mips/bcm63xx/cpu.c +++ b/arch/mips/bcm63xx/cpu.c | |||
@@ -71,6 +71,15 @@ static const int bcm6358_irqs[] = { | |||
71 | 71 | ||
72 | }; | 72 | }; |
73 | 73 | ||
74 | static const unsigned long bcm6362_regs_base[] = { | ||
75 | __GEN_CPU_REGS_TABLE(6362) | ||
76 | }; | ||
77 | |||
78 | static const int bcm6362_irqs[] = { | ||
79 | __GEN_CPU_IRQ_TABLE(6362) | ||
80 | |||
81 | }; | ||
82 | |||
74 | static const unsigned long bcm6368_regs_base[] = { | 83 | static const unsigned long bcm6368_regs_base[] = { |
75 | __GEN_CPU_REGS_TABLE(6368) | 84 | __GEN_CPU_REGS_TABLE(6368) |
76 | }; | 85 | }; |
@@ -169,6 +178,42 @@ static unsigned int detect_cpu_clock(void) | |||
169 | return (16 * 1000000 * n1 * n2) / m1; | 178 | return (16 * 1000000 * n1 * n2) / m1; |
170 | } | 179 | } |
171 | 180 | ||
181 | case BCM6362_CPU_ID: | ||
182 | { | ||
183 | unsigned int tmp, mips_pll_fcvo; | ||
184 | |||
185 | tmp = bcm_misc_readl(MISC_STRAPBUS_6362_REG); | ||
186 | mips_pll_fcvo = (tmp & STRAPBUS_6362_FCVO_MASK) | ||
187 | >> STRAPBUS_6362_FCVO_SHIFT; | ||
188 | switch (mips_pll_fcvo) { | ||
189 | case 0x03: | ||
190 | case 0x0b: | ||
191 | case 0x13: | ||
192 | case 0x1b: | ||
193 | return 240000000; | ||
194 | case 0x04: | ||
195 | case 0x0c: | ||
196 | case 0x14: | ||
197 | case 0x1c: | ||
198 | return 160000000; | ||
199 | case 0x05: | ||
200 | case 0x0e: | ||
201 | case 0x16: | ||
202 | case 0x1e: | ||
203 | case 0x1f: | ||
204 | return 400000000; | ||
205 | case 0x06: | ||
206 | return 440000000; | ||
207 | case 0x07: | ||
208 | case 0x17: | ||
209 | return 384000000; | ||
210 | case 0x15: | ||
211 | case 0x1d: | ||
212 | return 200000000; | ||
213 | default: | ||
214 | return 320000000; | ||
215 | } | ||
216 | } | ||
172 | case BCM6368_CPU_ID: | 217 | case BCM6368_CPU_ID: |
173 | { | 218 | { |
174 | unsigned int tmp, p1, p2, ndiv, m1; | 219 | unsigned int tmp, p1, p2, ndiv, m1; |
@@ -205,7 +250,7 @@ static unsigned int detect_memory_size(void) | |||
205 | unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; | 250 | unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; |
206 | u32 val; | 251 | u32 val; |
207 | 252 | ||
208 | if (BCMCPU_IS_6328()) | 253 | if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) |
209 | return bcm_ddr_readl(DDR_CSEND_REG) << 24; | 254 | return bcm_ddr_readl(DDR_CSEND_REG) << 24; |
210 | 255 | ||
211 | if (BCMCPU_IS_6345()) { | 256 | if (BCMCPU_IS_6345()) { |
@@ -297,6 +342,10 @@ void __init bcm63xx_cpu_init(void) | |||
297 | bcm63xx_regs_base = bcm6358_regs_base; | 342 | bcm63xx_regs_base = bcm6358_regs_base; |
298 | bcm63xx_irqs = bcm6358_irqs; | 343 | bcm63xx_irqs = bcm6358_irqs; |
299 | break; | 344 | break; |
345 | case BCM6362_CPU_ID: | ||
346 | bcm63xx_regs_base = bcm6362_regs_base; | ||
347 | bcm63xx_irqs = bcm6362_irqs; | ||
348 | break; | ||
300 | case BCM6368_CPU_ID: | 349 | case BCM6368_CPU_ID: |
301 | bcm63xx_regs_base = bcm6368_regs_base; | 350 | bcm63xx_regs_base = bcm6368_regs_base; |
302 | bcm63xx_irqs = bcm6368_irqs; | 351 | bcm63xx_irqs = bcm6368_irqs; |
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c index da24c2bd9b7c..c0ab3887f42e 100644 --- a/arch/mips/bcm63xx/irq.c +++ b/arch/mips/bcm63xx/irq.c | |||
@@ -82,6 +82,17 @@ static void __internal_irq_unmask_64(unsigned int irq) __maybe_unused; | |||
82 | #define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6358 | 82 | #define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6358 |
83 | #define ext_irq_cfg_reg2 0 | 83 | #define ext_irq_cfg_reg2 0 |
84 | #endif | 84 | #endif |
85 | #ifdef CONFIG_BCM63XX_CPU_6362 | ||
86 | #define irq_stat_reg PERF_IRQSTAT_6362_REG | ||
87 | #define irq_mask_reg PERF_IRQMASK_6362_REG | ||
88 | #define irq_bits 64 | ||
89 | #define is_ext_irq_cascaded 1 | ||
90 | #define ext_irq_start (BCM_6362_EXT_IRQ0 - IRQ_INTERNAL_BASE) | ||
91 | #define ext_irq_end (BCM_6362_EXT_IRQ3 - IRQ_INTERNAL_BASE) | ||
92 | #define ext_irq_count 4 | ||
93 | #define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6362 | ||
94 | #define ext_irq_cfg_reg2 0 | ||
95 | #endif | ||
85 | #ifdef CONFIG_BCM63XX_CPU_6368 | 96 | #ifdef CONFIG_BCM63XX_CPU_6368 |
86 | #define irq_stat_reg PERF_IRQSTAT_6368_REG | 97 | #define irq_stat_reg PERF_IRQSTAT_6368_REG |
87 | #define irq_mask_reg PERF_IRQMASK_6368_REG | 98 | #define irq_mask_reg PERF_IRQMASK_6368_REG |
@@ -170,6 +181,16 @@ static void bcm63xx_init_irq(void) | |||
170 | ext_irq_end = BCM_6358_EXT_IRQ3 - IRQ_INTERNAL_BASE; | 181 | ext_irq_end = BCM_6358_EXT_IRQ3 - IRQ_INTERNAL_BASE; |
171 | ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6358; | 182 | ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6358; |
172 | break; | 183 | break; |
184 | case BCM6362_CPU_ID: | ||
185 | irq_stat_addr += PERF_IRQSTAT_6362_REG; | ||
186 | irq_mask_addr += PERF_IRQMASK_6362_REG; | ||
187 | irq_bits = 64; | ||
188 | ext_irq_count = 4; | ||
189 | is_ext_irq_cascaded = 1; | ||
190 | ext_irq_start = BCM_6362_EXT_IRQ0 - IRQ_INTERNAL_BASE; | ||
191 | ext_irq_end = BCM_6362_EXT_IRQ3 - IRQ_INTERNAL_BASE; | ||
192 | ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6362; | ||
193 | break; | ||
173 | case BCM6368_CPU_ID: | 194 | case BCM6368_CPU_ID: |
174 | irq_stat_addr += PERF_IRQSTAT_6368_REG; | 195 | irq_stat_addr += PERF_IRQSTAT_6368_REG; |
175 | irq_mask_addr += PERF_IRQMASK_6368_REG; | 196 | irq_mask_addr += PERF_IRQMASK_6368_REG; |
@@ -458,6 +479,7 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d, | |||
458 | case BCM6338_CPU_ID: | 479 | case BCM6338_CPU_ID: |
459 | case BCM6345_CPU_ID: | 480 | case BCM6345_CPU_ID: |
460 | case BCM6358_CPU_ID: | 481 | case BCM6358_CPU_ID: |
482 | case BCM6362_CPU_ID: | ||
461 | case BCM6368_CPU_ID: | 483 | case BCM6368_CPU_ID: |
462 | if (levelsense) | 484 | if (levelsense) |
463 | reg |= EXTIRQ_CFG_LEVELSENSE(irq); | 485 | reg |= EXTIRQ_CFG_LEVELSENSE(irq); |
diff --git a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c index 10eaff458071..fd698087fbfd 100644 --- a/arch/mips/bcm63xx/prom.c +++ b/arch/mips/bcm63xx/prom.c | |||
@@ -36,6 +36,8 @@ void __init prom_init(void) | |||
36 | mask = CKCTL_6348_ALL_SAFE_EN; | 36 | mask = CKCTL_6348_ALL_SAFE_EN; |
37 | else if (BCMCPU_IS_6358()) | 37 | else if (BCMCPU_IS_6358()) |
38 | mask = CKCTL_6358_ALL_SAFE_EN; | 38 | mask = CKCTL_6358_ALL_SAFE_EN; |
39 | else if (BCMCPU_IS_6362()) | ||
40 | mask = CKCTL_6362_ALL_SAFE_EN; | ||
39 | else if (BCMCPU_IS_6368()) | 41 | else if (BCMCPU_IS_6368()) |
40 | mask = CKCTL_6368_ALL_SAFE_EN; | 42 | mask = CKCTL_6368_ALL_SAFE_EN; |
41 | else | 43 | else |
diff --git a/arch/mips/bcm63xx/reset.c b/arch/mips/bcm63xx/reset.c index 68a31bb90cbf..317931c6cf58 100644 --- a/arch/mips/bcm63xx/reset.c +++ b/arch/mips/bcm63xx/reset.c | |||
@@ -85,6 +85,20 @@ | |||
85 | #define BCM6358_RESET_PCIE 0 | 85 | #define BCM6358_RESET_PCIE 0 |
86 | #define BCM6358_RESET_PCIE_EXT 0 | 86 | #define BCM6358_RESET_PCIE_EXT 0 |
87 | 87 | ||
88 | #define BCM6362_RESET_SPI SOFTRESET_6362_SPI_MASK | ||
89 | #define BCM6362_RESET_ENET 0 | ||
90 | #define BCM6362_RESET_USBH SOFTRESET_6362_USBH_MASK | ||
91 | #define BCM6362_RESET_USBD SOFTRESET_6362_USBS_MASK | ||
92 | #define BCM6362_RESET_DSL 0 | ||
93 | #define BCM6362_RESET_SAR SOFTRESET_6362_SAR_MASK | ||
94 | #define BCM6362_RESET_EPHY SOFTRESET_6362_EPHY_MASK | ||
95 | #define BCM6362_RESET_ENETSW SOFTRESET_6362_ENETSW_MASK | ||
96 | #define BCM6362_RESET_PCM SOFTRESET_6362_PCM_MASK | ||
97 | #define BCM6362_RESET_MPI 0 | ||
98 | #define BCM6362_RESET_PCIE (SOFTRESET_6362_PCIE_MASK | \ | ||
99 | SOFTRESET_6362_PCIE_CORE_MASK) | ||
100 | #define BCM6362_RESET_PCIE_EXT SOFTRESET_6362_PCIE_EXT_MASK | ||
101 | |||
88 | #define BCM6368_RESET_SPI SOFTRESET_6368_SPI_MASK | 102 | #define BCM6368_RESET_SPI SOFTRESET_6368_SPI_MASK |
89 | #define BCM6368_RESET_ENET 0 | 103 | #define BCM6368_RESET_ENET 0 |
90 | #define BCM6368_RESET_USBH SOFTRESET_6368_USBH_MASK | 104 | #define BCM6368_RESET_USBH SOFTRESET_6368_USBH_MASK |
@@ -119,6 +133,10 @@ static const u32 bcm6358_reset_bits[] = { | |||
119 | __GEN_RESET_BITS_TABLE(6358) | 133 | __GEN_RESET_BITS_TABLE(6358) |
120 | }; | 134 | }; |
121 | 135 | ||
136 | static const u32 bcm6362_reset_bits[] = { | ||
137 | __GEN_RESET_BITS_TABLE(6362) | ||
138 | }; | ||
139 | |||
122 | static const u32 bcm6368_reset_bits[] = { | 140 | static const u32 bcm6368_reset_bits[] = { |
123 | __GEN_RESET_BITS_TABLE(6368) | 141 | __GEN_RESET_BITS_TABLE(6368) |
124 | }; | 142 | }; |
@@ -140,6 +158,9 @@ static int __init bcm63xx_reset_bits_init(void) | |||
140 | } else if (BCMCPU_IS_6358()) { | 158 | } else if (BCMCPU_IS_6358()) { |
141 | reset_reg = PERF_SOFTRESET_6358_REG; | 159 | reset_reg = PERF_SOFTRESET_6358_REG; |
142 | bcm63xx_reset_bits = bcm6358_reset_bits; | 160 | bcm63xx_reset_bits = bcm6358_reset_bits; |
161 | } else if (BCMCPU_IS_6362()) { | ||
162 | reset_reg = PERF_SOFTRESET_6362_REG; | ||
163 | bcm63xx_reset_bits = bcm6362_reset_bits; | ||
143 | } else if (BCMCPU_IS_6368()) { | 164 | } else if (BCMCPU_IS_6368()) { |
144 | reset_reg = PERF_SOFTRESET_6368_REG; | 165 | reset_reg = PERF_SOFTRESET_6368_REG; |
145 | bcm63xx_reset_bits = bcm6368_reset_bits; | 166 | bcm63xx_reset_bits = bcm6368_reset_bits; |
@@ -182,6 +203,13 @@ static const u32 bcm63xx_reset_bits[] = { | |||
182 | #define reset_reg PERF_SOFTRESET_6358_REG | 203 | #define reset_reg PERF_SOFTRESET_6358_REG |
183 | #endif | 204 | #endif |
184 | 205 | ||
206 | #ifdef CONFIG_BCM63XX_CPU_6362 | ||
207 | static const u32 bcm63xx_reset_bits[] = { | ||
208 | __GEN_RESET_BITS_TABLE(6362) | ||
209 | }; | ||
210 | #define reset_reg PERF_SOFTRESET_6362_REG | ||
211 | #endif | ||
212 | |||
185 | #ifdef CONFIG_BCM63XX_CPU_6368 | 213 | #ifdef CONFIG_BCM63XX_CPU_6368 |
186 | static const u32 bcm63xx_reset_bits[] = { | 214 | static const u32 bcm63xx_reset_bits[] = { |
187 | __GEN_RESET_BITS_TABLE(6368) | 215 | __GEN_RESET_BITS_TABLE(6368) |
diff --git a/arch/mips/bcm63xx/setup.c b/arch/mips/bcm63xx/setup.c index 911fd7df49e5..24a24445db64 100644 --- a/arch/mips/bcm63xx/setup.c +++ b/arch/mips/bcm63xx/setup.c | |||
@@ -83,6 +83,9 @@ void bcm63xx_machine_reboot(void) | |||
83 | case BCM6358_CPU_ID: | 83 | case BCM6358_CPU_ID: |
84 | perf_regs[0] = PERF_EXTIRQ_CFG_REG_6358; | 84 | perf_regs[0] = PERF_EXTIRQ_CFG_REG_6358; |
85 | break; | 85 | break; |
86 | case BCM6362_CPU_ID: | ||
87 | perf_regs[0] = PERF_EXTIRQ_CFG_REG_6362; | ||
88 | break; | ||
86 | } | 89 | } |
87 | 90 | ||
88 | for (i = 0; i < 2; i++) { | 91 | for (i = 0; i < 2; i++) { |