brcm63xx: add kernel 4.14 support
[oweals/openwrt.git] / target / linux / brcm63xx / patches-4.14 / 339-MIPS-BCM63XX-add-support-for-BCM63268.patch
1 From 98f63141190ac02c58b78d58f771bd263c61d756 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Sat, 7 Dec 2013 17:14:17 +0100
4 Subject: [PATCH 48/56] MIPS: BCM63XX: add support for BCM63268
5
6 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
7 ---
8  arch/mips/bcm63xx/Kconfig                         |   5 +
9  arch/mips/bcm63xx/boards/board_bcm963xx.c         |   2 +-
10  arch/mips/bcm63xx/clk.c                           |  25 ++++-
11  arch/mips/bcm63xx/cpu.c                           |  59 +++++++++-
12  arch/mips/bcm63xx/dev-flash.c                     |   6 +
13  arch/mips/bcm63xx/dev-spi.c                       |   4 +-
14  arch/mips/bcm63xx/irq.c                           |  20 +++-
15  arch/mips/bcm63xx/reset.c                         |  21 ++++
16  arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h  | 130 ++++++++++++++++++++++
17  arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h |   2 +
18  arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h |  79 +++++++++++++
19  arch/mips/include/asm/mach-bcm63xx/ioremap.h      |   1 +
20  12 files changed, 342 insertions(+), 12 deletions(-)
21
22 --- a/arch/mips/bcm63xx/Kconfig
23 +++ b/arch/mips/bcm63xx/Kconfig
24 @@ -61,6 +61,11 @@ config BCM63XX_CPU_6368
25         select HW_HAS_PCI
26         select BCM63XX_OHCI
27         select BCM63XX_EHCI
28 +
29 +config BCM63XX_CPU_63268
30 +       bool "support 63268 CPU"
31 +       select SYS_HAS_CPU_BMIPS4350
32 +       select HW_HAS_PCI
33  endmenu
34  
35  source "arch/mips/bcm63xx/boards/Kconfig"
36 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
37 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
38 @@ -713,7 +713,7 @@ void __init board_prom_init(void)
39         /* read base address of boot chip select (0)
40          * 6328/6362 do not have MPI but boot from a fixed address
41          */
42 -       if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) {
43 +       if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) {
44                 val = 0x18000000;
45         } else {
46                 val = bcm_mpi_readl(MPI_CSBASE_REG(0));
47 --- a/arch/mips/bcm63xx/clk.c
48 +++ b/arch/mips/bcm63xx/clk.c
49 @@ -169,6 +169,8 @@ static void enetsw_set(struct clk *clk,
50                         clk_disable_unlocked(&clk_swpkt_sar);
51                 }
52                 bcm_hwclock_set(CKCTL_6368_ROBOSW_EN, enable);
53 +       } else if (BCMCPU_IS_63268()) {
54 +               bcm_hwclock_set(CKCTL_63268_ROBOSW_EN, enable);
55         } else {
56                 return;
57         }
58 @@ -214,6 +216,8 @@ static void usbh_set(struct clk *clk, in
59                 bcm_hwclock_set(CKCTL_6362_USBH_EN, enable);
60         else if (BCMCPU_IS_6368())
61                 bcm_hwclock_set(CKCTL_6368_USBH_EN, enable);
62 +       else if (BCMCPU_IS_63268())
63 +               bcm_hwclock_set(CKCTL_63268_USBH_EN, enable);
64         else
65                 return;
66  
67 @@ -236,6 +240,8 @@ static void usbd_set(struct clk *clk, in
68                 bcm_hwclock_set(CKCTL_6362_USBD_EN, enable);
69         else if (BCMCPU_IS_6368())
70                 bcm_hwclock_set(CKCTL_6368_USBD_EN, enable);
71 +       else if (BCMCPU_IS_63268())
72 +               bcm_hwclock_set(CKCTL_63268_USBD_EN, enable);
73         else
74                 return;
75  
76 @@ -262,9 +268,13 @@ static void spi_set(struct clk *clk, int
77                 mask = CKCTL_6358_SPI_EN;
78         else if (BCMCPU_IS_6362())
79                 mask = CKCTL_6362_SPI_EN;
80 -       else
81 -               /* BCMCPU_IS_6368 */
82 +       else if (BCMCPU_IS_6368())
83                 mask = CKCTL_6368_SPI_EN;
84 +       else if (BCMCPU_IS_63268())
85 +               mask = CKCTL_63268_SPI_EN;
86 +       else
87 +               return;
88 +
89         bcm_hwclock_set(mask, enable);
90  }
91  
92 @@ -283,6 +293,8 @@ static void hsspi_set(struct clk *clk, i
93                 mask = CKCTL_6328_HSSPI_EN;
94         else if (BCMCPU_IS_6362())
95                 mask = CKCTL_6362_HSSPI_EN;
96 +       else if (BCMCPU_IS_63268())
97 +               mask = CKCTL_63268_HSSPI_EN;
98         else
99                 return;
100  
101 @@ -352,6 +364,8 @@ static void pcie_set(struct clk *clk, in
102                 bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable);
103         else if (BCMCPU_IS_6362())
104                 bcm_hwclock_set(CKCTL_6362_PCIE_EN, enable);
105 +       else if (BCMCPU_IS_63268())
106 +               bcm_hwclock_set(CKCTL_63268_PCIE_EN, enable);
107  }
108  
109  static struct clk clk_pcie = {
110 @@ -536,6 +550,21 @@ static struct clk_lookup bcm6368_clks[]
111         CLKDEV_INIT(NULL, "ipsec", &clk_ipsec),
112  };
113  
114 +static struct clk_lookup bcm63268_clks[] = {
115 +       /* fixed rate clocks */
116 +       CLKDEV_INIT(NULL, "periph", &clk_periph),
117 +       CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph),
118 +       CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph),
119 +       CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll),
120 +       /* gated clocks */
121 +       CLKDEV_INIT(NULL, "enetsw", &clk_enetsw),
122 +       CLKDEV_INIT(NULL, "usbh", &clk_usbh),
123 +       CLKDEV_INIT(NULL, "usbd", &clk_usbd),
124 +       CLKDEV_INIT(NULL, "spi", &clk_spi),
125 +       CLKDEV_INIT(NULL, "hsspi", &clk_hsspi),
126 +       CLKDEV_INIT(NULL, "pcie", &clk_pcie),
127 +};
128 +
129  #define HSSPI_PLL_HZ_6328      133333333
130  #define HSSPI_PLL_HZ_6362      400000000
131  
132 @@ -568,6 +597,10 @@ static int __init bcm63xx_clk_init(void)
133         case BCM6368_CPU_ID:
134                 clkdev_add_table(bcm6368_clks, ARRAY_SIZE(bcm6368_clks));
135                 break;
136 +       case BCM63268_CPU_ID:
137 +               clk_hsspi_pll.rate = HSSPI_PLL_HZ_6362;
138 +               clkdev_add_table(bcm63268_clks, ARRAY_SIZE(bcm63268_clks));
139 +               break;
140         }
141  
142         return 0;
143 --- a/arch/mips/bcm63xx/cpu.c
144 +++ b/arch/mips/bcm63xx/cpu.c
145 @@ -101,6 +101,15 @@ static const int bcm6368_irqs[] = {
146  
147  };
148  
149 +static const unsigned long bcm63268_regs_base[] = {
150 +       __GEN_CPU_REGS_TABLE(63268)
151 +};
152 +
153 +static const int bcm63268_irqs[] = {
154 +       __GEN_CPU_IRQ_TABLE(63268)
155 +
156 +};
157 +
158  u32 bcm63xx_get_cpu_variant(void)
159  {
160         return bcm63xx_cpu_variant;
161 @@ -253,6 +262,27 @@ static unsigned int detect_cpu_clock(voi
162  
163                 return (((64 * 1000000) / p1) * p2 * ndiv) / m1;
164         }
165 +       case BCM63268_CPU_ID:
166 +       {
167 +               unsigned int tmp, mips_pll_fcvo;
168 +
169 +               tmp = bcm_misc_readl(MISC_STRAPBUS_63268_REG);
170 +               mips_pll_fcvo = (tmp & STRAPBUS_63268_FCVO_MASK) >>
171 +                               STRAPBUS_63268_FCVO_SHIFT;
172 +               switch (mips_pll_fcvo) {
173 +               case 0x3:
174 +               case 0xe:
175 +                       return 320000000;
176 +               case 0xa:
177 +                       return 333000000;
178 +               case 0x2:
179 +               case 0xb:
180 +               case 0xf:
181 +                       return 400000000;
182 +               default:
183 +                       return 0;
184 +               }
185 +       }
186  
187         default:
188                 panic("Failed to detect clock for CPU with id=%04X\n", cpu_id);
189 @@ -267,7 +297,7 @@ static unsigned int detect_memory_size(v
190         unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
191         u32 val;
192  
193 -       if (BCMCPU_IS_6328() || BCMCPU_IS_6362())
194 +       if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268())
195                 return bcm_ddr_readl(DDR_CSEND_REG) << 24;
196  
197         if (BCMCPU_IS_6345()) {
198 @@ -305,6 +335,7 @@ void __init bcm63xx_cpu_init(void)
199         unsigned int tmp;
200         unsigned int cpu = smp_processor_id();
201         u32 chipid_reg;
202 +       bool long_chipid = false;
203         u8 __maybe_unused varid = 0;
204  
205         /* soc registers location depends on cpu type */
206 @@ -326,6 +357,9 @@ void __init bcm63xx_cpu_init(void)
207                 case 0x10:
208                         chipid_reg = BCM_6345_PERF_BASE;
209                         break;
210 +               case 0x80:
211 +                       long_chipid = true;
212 +                       /* fall-through */
213                 default:
214                         chipid_reg = BCM_6368_PERF_BASE;
215                         break;
216 @@ -333,6 +367,7 @@ void __init bcm63xx_cpu_init(void)
217                 break;
218         }
219  
220 +
221         /*
222          * really early to panic, but delaying panic would not help since we
223          * will never get any working console
224 @@ -342,10 +377,17 @@ void __init bcm63xx_cpu_init(void)
225  
226         /* read out CPU type */
227         tmp = bcm_readl(chipid_reg);
228 -       bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT;
229 -       bcm63xx_cpu_variant = bcm63xx_cpu_id;
230 +
231 +       if (long_chipid) {
232 +               bcm63xx_cpu_id = tmp & REV_LONG_CHIPID_MASK;
233 +               bcm63xx_cpu_id >>= REV_LONG_CHIPID_SHIFT;
234 +       } else {
235 +               bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT;
236 +               varid = (tmp & REV_VARID_MASK) >> REV_VARID_SHIFT;
237 +       }
238 +
239         bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT;
240 -       varid = (tmp & REV_VARID_MASK) >> REV_VARID_SHIFT;
241 +       bcm63xx_cpu_variant = bcm63xx_cpu_id;
242  
243         switch (bcm63xx_cpu_id) {
244         case BCM3368_CPU_ID:
245 @@ -400,6 +442,15 @@ void __init bcm63xx_cpu_init(void)
246                 /* BCM6369 is a BCM6368 without xDSL, so treat it the same */
247                 bcm63xx_cpu_id = BCM6368_CPU_ID;
248                 break;
249 +       case BCM63168_CPU_ID:
250 +       case BCM63169_CPU_ID:
251 +       case BCM63268_CPU_ID:
252 +       case BCM63269_CPU_ID:
253 +               bcm63xx_regs_base = bcm63268_regs_base;
254 +               bcm63xx_irqs = bcm63268_irqs;
255 +
256 +               bcm63xx_cpu_id = BCM63268_CPU_ID;
257 +               break;
258         default:
259                 panic("unsupported broadcom CPU %x", bcm63xx_cpu_id);
260                 break;
261 --- a/arch/mips/bcm63xx/dev-flash.c
262 +++ b/arch/mips/bcm63xx/dev-flash.c
263 @@ -94,6 +94,12 @@ static int __init bcm63xx_detect_flash_t
264                 case STRAPBUS_6368_BOOT_SEL_PARALLEL:
265                         return BCM63XX_FLASH_TYPE_PARALLEL;
266                 }
267 +       case BCM63268_CPU_ID:
268 +               val = bcm_misc_readl(MISC_STRAPBUS_63268_REG);
269 +               if (val & STRAPBUS_63268_BOOT_SEL_SERIAL)
270 +                       return BCM63XX_FLASH_TYPE_SERIAL;
271 +               else
272 +                       return BCM63XX_FLASH_TYPE_NAND;
273         default:
274                 return -EINVAL;
275         }
276 --- a/arch/mips/bcm63xx/dev-spi.c
277 +++ b/arch/mips/bcm63xx/dev-spi.c
278 @@ -51,7 +51,7 @@ int __init bcm63xx_spi_register(void)
279         }
280  
281         if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6362() ||
282 -               BCMCPU_IS_6368()) {
283 +               BCMCPU_IS_6368() || BCMCPU_IS_63268()) {
284                 bcm63xx_spi_device.name = "bcm6358-spi",
285                 spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1;
286         }
287 --- a/arch/mips/bcm63xx/irq.c
288 +++ b/arch/mips/bcm63xx/irq.c
289 @@ -149,6 +149,20 @@ void __init arch_init_irq(void)
290                 ext_irqs[5] = BCM_6368_EXT_IRQ5;
291                 ext_shift = 4;
292                 break;
293 +       case BCM63268_CPU_ID:
294 +               periph_bases[0] += PERF_IRQMASK_63268_REG(0);
295 +               periph_bases[1] += PERF_IRQMASK_63268_REG(1);
296 +               periph_irq_count = 2;
297 +               periph_width = 4;
298 +
299 +               ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_63268;
300 +               ext_irq_count = 4;
301 +               ext_irqs[0] = BCM_63268_EXT_IRQ0;
302 +               ext_irqs[1] = BCM_63268_EXT_IRQ1;
303 +               ext_irqs[2] = BCM_63268_EXT_IRQ2;
304 +               ext_irqs[3] = BCM_63268_EXT_IRQ3;
305 +               ext_shift = 4;
306 +               break;
307         default:
308                 BUG();
309         }
310 --- a/arch/mips/bcm63xx/reset.c
311 +++ b/arch/mips/bcm63xx/reset.c
312 @@ -126,6 +126,20 @@
313  #define BCM6368_RESET_PCIE     0
314  #define BCM6368_RESET_PCIE_EXT 0
315  
316 +#define BCM63268_RESET_SPI     SOFTRESET_63268_SPI_MASK
317 +#define BCM63268_RESET_ENET    0
318 +#define BCM63268_RESET_USBH    SOFTRESET_63268_USBH_MASK
319 +#define BCM63268_RESET_USBD    SOFTRESET_63268_USBS_MASK
320 +#define BCM63268_RESET_DSL     0
321 +#define BCM63268_RESET_SAR     SOFTRESET_63268_SAR_MASK
322 +#define BCM63268_RESET_EPHY    0
323 +#define BCM63268_RESET_ENETSW  SOFTRESET_63268_ENETSW_MASK
324 +#define BCM63268_RESET_PCM     SOFTRESET_63268_PCM_MASK
325 +#define BCM63268_RESET_MPI     0
326 +#define BCM63268_RESET_PCIE    (SOFTRESET_63268_PCIE_MASK | \
327 +                                SOFTRESET_63268_PCIE_CORE_MASK)
328 +#define BCM63268_RESET_PCIE_EXT        SOFTRESET_63268_PCIE_EXT_MASK
329 +
330  /*
331   * core reset bits
332   */
333 @@ -157,6 +171,10 @@ static const u32 bcm6368_reset_bits[] =
334         __GEN_RESET_BITS_TABLE(6368)
335  };
336  
337 +static const u32 bcm63268_reset_bits[] = {
338 +       __GEN_RESET_BITS_TABLE(63268)
339 +};
340 +
341  const u32 *bcm63xx_reset_bits;
342  static int reset_reg;
343  
344 @@ -183,6 +201,9 @@ static int __init bcm63xx_reset_bits_ini
345         } else if (BCMCPU_IS_6368()) {
346                 reset_reg = PERF_SOFTRESET_6368_REG;
347                 bcm63xx_reset_bits = bcm6368_reset_bits;
348 +       } else if (BCMCPU_IS_63268()) {
349 +               reset_reg = PERF_SOFTRESET_63268_REG;
350 +               bcm63xx_reset_bits = bcm63268_reset_bits;
351         }
352  
353         return 0;
354 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
355 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
356 @@ -22,6 +22,10 @@
357  #define BCM6362_CPU_ID         0x6362
358  #define BCM6368_CPU_ID         0x6368
359  #define BCM6369_CPU_ID         0x6369
360 +#define BCM63168_CPU_ID                0x63168
361 +#define BCM63169_CPU_ID                0x63169
362 +#define BCM63268_CPU_ID                0x63268
363 +#define BCM63269_CPU_ID                0x63269
364  
365  void __init bcm63xx_cpu_init(void);
366  u32 bcm63xx_get_cpu_variant(void);
367 @@ -62,6 +66,10 @@ static inline u32 __pure __bcm63xx_get_c
368  #ifdef CONFIG_BCM63XX_CPU_6368
369                 case BCM6368_CPU_ID:
370  #endif
371 +
372 +#ifdef CONFIG_BCM63XX_CPU_63268
373 +               case BCM63268_CPU_ID:
374 +#endif
375                 break;
376         default:
377                 unreachable();
378 @@ -87,6 +95,7 @@ static inline u32 __pure bcm63xx_get_cpu
379  #define BCMCPU_IS_6358()       (bcm63xx_get_cpu_id() == BCM6358_CPU_ID)
380  #define BCMCPU_IS_6362()       (bcm63xx_get_cpu_id() == BCM6362_CPU_ID)
381  #define BCMCPU_IS_6368()       (bcm63xx_get_cpu_id() == BCM6368_CPU_ID)
382 +#define BCMCPU_IS_63268()      (bcm63xx_get_cpu_id() == BCM63268_CPU_ID)
383  
384  #define BCMCPU_VARIANT_IS_3368() \
385         (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID)
386 @@ -110,6 +119,14 @@ static inline u32 __pure bcm63xx_get_cpu
387         (bcm63xx_get_cpu_variant() == BCM6368_CPU_ID)
388  #define BCMCPU_VARIANT_IS_6369() \
389         (bcm63xx_get_cpu_variant() == BCM6369_CPU_ID)
390 +#define BCMCPU_VARIANT_IS_63168() \
391 +       (bcm63xx_get_cpu_variant() == BCM63168_CPU_ID)
392 +#define BCMCPU_VARIANT_IS_63169() \
393 +       (bcm63xx_get_cpu_variant() == BCM63169_CPU_ID)
394 +#define BCMCPU_VARIANT_IS_63268() \
395 +       (bcm63xx_get_cpu_variant() == BCM63268_CPU_ID)
396 +#define BCMCPU_VARIANT_IS_63269() \
397 +       (bcm63xx_get_cpu_variant() == BCM63269_CPU_ID)
398  
399  /*
400   * While registers sets are (mostly) the same across 63xx CPU, base
401 @@ -574,6 +591,52 @@ enum bcm63xx_regs_set {
402  #define BCM_6368_RNG_BASE              (0xb0004180)
403  #define BCM_6368_MISC_BASE             (0xdeadbeef)
404  
405 +/*
406 + * 63268 register sets base address
407 + */
408 +#define BCM_63268_DSL_LMEM_BASE                (0xdeadbeef)
409 +#define BCM_63268_PERF_BASE            (0xb0000000)
410 +#define BCM_63268_TIMER_BASE           (0xb0000080)
411 +#define BCM_63268_WDT_BASE             (0xb000009c)
412 +#define BCM_63268_UART0_BASE           (0xb0000180)
413 +#define BCM_63268_UART1_BASE           (0xb00001a0)
414 +#define BCM_63268_GPIO_BASE            (0xb00000c0)
415 +#define BCM_63268_SPI_BASE             (0xb0000800)
416 +#define BCM_63268_HSSPI_BASE           (0xb0001000)
417 +#define BCM_63268_UDC0_BASE            (0xdeadbeef)
418 +#define BCM_63268_USBDMA_BASE          (0xb000c800)
419 +#define BCM_63268_OHCI0_BASE           (0xb0002600)
420 +#define BCM_63268_OHCI_PRIV_BASE       (0xdeadbeef)
421 +#define BCM_63268_USBH_PRIV_BASE       (0xb0002700)
422 +#define BCM_63268_USBD_BASE            (0xb0002400)
423 +#define BCM_63268_MPI_BASE             (0xdeadbeef)
424 +#define BCM_63268_PCMCIA_BASE          (0xdeadbeef)
425 +#define BCM_63268_PCIE_BASE            (0xb06e0000)
426 +#define BCM_63268_SDRAM_REGS_BASE      (0xdeadbeef)
427 +#define BCM_63268_DSL_BASE             (0xdeadbeef)
428 +#define BCM_63268_UBUS_BASE            (0xdeadbeef)
429 +#define BCM_63268_ENET0_BASE           (0xdeadbeef)
430 +#define BCM_63268_ENET1_BASE           (0xdeadbeef)
431 +#define BCM_63268_ENETDMA_BASE         (0xb000d800)
432 +#define BCM_63268_ENETDMAC_BASE                (0xb000da00)
433 +#define BCM_63268_ENETDMAS_BASE                (0xb000dc00)
434 +#define BCM_63268_ENETSW_BASE          (0xb0700000)
435 +#define BCM_63268_EHCI0_BASE           (0xb0002500)
436 +#define BCM_63268_SDRAM_BASE           (0xdeadbeef)
437 +#define BCM_63268_MEMC_BASE            (0xdeadbeef)
438 +#define BCM_63268_DDR_BASE             (0xb0003000)
439 +#define BCM_63268_M2M_BASE             (0xdeadbeef)
440 +#define BCM_63268_ATM_BASE             (0xdeadbeef)
441 +#define BCM_63268_XTM_BASE             (0xb0007000)
442 +#define BCM_63268_XTMDMA_BASE          (0xb000b800)
443 +#define BCM_63268_XTMDMAC_BASE         (0xdeadbeef)
444 +#define BCM_63268_XTMDMAS_BASE         (0xdeadbeef)
445 +#define BCM_63268_PCM_BASE             (0xb000b000)
446 +#define BCM_63268_PCMDMA_BASE          (0xb000b800)
447 +#define BCM_63268_PCMDMAC_BASE         (0xdeadbeef)
448 +#define BCM_63268_PCMDMAS_BASE         (0xdeadbeef)
449 +#define BCM_63268_RNG_BASE             (0xdeadbeef)
450 +#define BCM_63268_MISC_BASE            (0xb0001800)
451  
452  extern const unsigned long *bcm63xx_regs_base;
453  
454 @@ -1042,6 +1105,73 @@ enum bcm63xx_irq {
455  #define BCM_6368_EXT_IRQ4              (IRQ_INTERNAL_BASE + 24)
456  #define BCM_6368_EXT_IRQ5              (IRQ_INTERNAL_BASE + 25)
457  
458 +/*
459 + * 63268 irqs
460 + */
461 +#define BCM_63268_HIGH_IRQ_BASE                (IRQ_INTERNAL_BASE + 32)
462 +#define BCM_63268_VERY_HIGH_IRQ_BASE   (BCM_63268_HIGH_IRQ_BASE + 32)
463 +
464 +#define BCM_63268_TIMER_IRQ            (IRQ_INTERNAL_BASE + 0)
465 +#define BCM_63268_SPI_IRQ              (BCM_63268_VERY_HIGH_IRQ_BASE + 16)
466 +#define BCM_63268_UART0_IRQ            (IRQ_INTERNAL_BASE + 5)
467 +#define BCM_63268_UART1_IRQ            (BCM_63268_HIGH_IRQ_BASE + 2)
468 +#define BCM_63268_DSL_IRQ              (IRQ_INTERNAL_BASE + 23)
469 +#define BCM_63268_UDC0_IRQ             0
470 +#define BCM_63268_ENET0_IRQ            0
471 +#define BCM_63268_ENET1_IRQ            0
472 +#define BCM_63268_ENET_PHY_IRQ         (IRQ_INTERNAL_BASE + 13)
473 +#define BCM_63268_HSSPI_IRQ            (IRQ_INTERNAL_BASE + 6)
474 +#define BCM_63268_OHCI0_IRQ            (IRQ_INTERNAL_BASE + 9)
475 +#define BCM_63268_EHCI0_IRQ            (IRQ_INTERNAL_BASE + 10)
476 +#define BCM_63268_USBD_IRQ             (IRQ_INTERNAL_BASE + 11)
477 +#define BCM_63268_USBD_RXDMA0_IRQ      (IRQ_INTERNAL_BASE + 19)
478 +#define BCM_63268_USBD_TXDMA0_IRQ      (BCM_63268_HIGH_IRQ_BASE + 4)
479 +#define BCM_63268_USBD_RXDMA1_IRQ      (IRQ_INTERNAL_BASE + 20)
480 +#define BCM_63268_USBD_TXDMA1_IRQ      (BCM_63268_HIGH_IRQ_BASE + 5)
481 +#define BCM_63268_USBD_RXDMA2_IRQ      (IRQ_INTERNAL_BASE + 21)
482 +#define BCM_63268_USBD_TXDMA2_IRQ      (BCM_63268_HIGH_IRQ_BASE + 6)
483 +#define BCM_63268_PCMCIA_IRQ           0
484 +#define BCM_63268_ENET0_RXDMA_IRQ      0
485 +#define BCM_63268_ENET0_TXDMA_IRQ      0
486 +#define BCM_63268_ENET1_RXDMA_IRQ      0
487 +#define BCM_63268_ENET1_TXDMA_IRQ      0
488 +#define BCM_63268_PCI_IRQ              (BCM_63268_HIGH_IRQ_BASE + 8)
489 +#define BCM_63268_ATM_IRQ              0
490 +#define BCM_63268_ENETSW_RXDMA0_IRQ    (IRQ_INTERNAL_BASE + 1)
491 +#define BCM_63268_ENETSW_RXDMA1_IRQ    (IRQ_INTERNAL_BASE + 2)
492 +#define BCM_63268_ENETSW_RXDMA2_IRQ    (IRQ_INTERNAL_BASE + 3)
493 +#define BCM_63268_ENETSW_RXDMA3_IRQ    (IRQ_INTERNAL_BASE + 4)
494 +#define BCM_63268_ENETSW_TXDMA0_IRQ    (BCM_63268_VERY_HIGH_IRQ_BASE + 0)
495 +#define BCM_63268_ENETSW_TXDMA1_IRQ    (BCM_63268_VERY_HIGH_IRQ_BASE + 1)
496 +#define BCM_63268_ENETSW_TXDMA2_IRQ    (BCM_63268_VERY_HIGH_IRQ_BASE + 2)
497 +#define BCM_63268_ENETSW_TXDMA3_IRQ    (BCM_63268_VERY_HIGH_IRQ_BASE + 3)
498 +#define BCM_63268_XTM_IRQ              (BCM_63268_HIGH_IRQ_BASE + 17)
499 +#define BCM_63268_XTM_DMA0_IRQ         (IRQ_INTERNAL_BASE + 26)
500 +
501 +#define BCM_63268_RING_OSC_IRQ         (BCM_63268_HIGH_IRQ_BASE + 20)
502 +#define BCM_63268_WLAN_GPIO_IRQ                (BCM_63268_HIGH_IRQ_BASE + 3)
503 +#define BCM_63268_WLAN_IRQ             (IRQ_INTERNAL_BASE + 7)
504 +#define BCM_63268_IPSEC_IRQ            (IRQ_INTERNAL_BASE + 8)
505 +#define BCM_63268_NAND_IRQ             (BCM_63268_HIGH_IRQ_BASE + 18)
506 +#define BCM_63268_PCM_IRQ              (IRQ_INTERNAL_BASE + 13)
507 +#define BCM_63268_DG_IRQ               (IRQ_INTERNAL_BASE + 15)
508 +#define BCM_63268_EPHY_ENERGY0_IRQ     (IRQ_INTERNAL_BASE + 16)
509 +#define BCM_63268_EPHY_ENERGY1_IRQ     (IRQ_INTERNAL_BASE + 17)
510 +#define BCM_63268_EPHY_ENERGY2_IRQ     (IRQ_INTERNAL_BASE + 18)
511 +#define BCM_63268_EPHY_ENERGY3_IRQ     (IRQ_INTERNAL_BASE + 19)
512 +#define BCM_63268_IPSEC_DMA0_IRQ       (IRQ_INTERNAL_BASE + 22)
513 +#define BCM_63268_IPSEC_DMA1_IRQ       (BCM_63268_HIGH_IRQ_BASE + 7)
514 +#define BCM_63268_FAP0_IRQ             (IRQ_INTERNAL_BASE + 24)
515 +#define BCM_63268_FAP1_IRQ             (IRQ_INTERNAL_BASE + 25)
516 +#define BCM_63268_PCM_DMA0_IRQ         (BCM_63268_HIGH_IRQ_BASE + 10)
517 +#define BCM_63268_PCM_DMA1_IRQ         (BCM_63268_HIGH_IRQ_BASE + 11)
518 +#define BCM_63268_DECT0_IRQ            (BCM_63268_HIGH_IRQ_BASE + 0)
519 +#define BCM_63268_DECT1_IRQ            (BCM_63268_HIGH_IRQ_BASE + 1)
520 +#define BCM_63268_EXT_IRQ0             (BCM_63268_HIGH_IRQ_BASE + 12)
521 +#define BCM_63268_EXT_IRQ1             (BCM_63268_HIGH_IRQ_BASE + 13)
522 +#define BCM_63268_EXT_IRQ2             (BCM_63268_HIGH_IRQ_BASE + 14)
523 +#define BCM_63268_EXT_IRQ3             (BCM_63268_HIGH_IRQ_BASE + 15)
524 +
525  extern const int *bcm63xx_irqs;
526  
527  #define __GEN_CPU_IRQ_TABLE(__cpu)                                     \
528 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
529 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
530 @@ -23,6 +23,8 @@ static inline unsigned long bcm63xx_gpio
531                 return 48;
532         case BCM6368_CPU_ID:
533                 return 38;
534 +       case BCM63268_CPU_ID:
535 +               return 52;
536         case BCM6348_CPU_ID:
537         default:
538                 return 37;
539 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
540 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
541 @@ -10,6 +10,8 @@
542  #define PERF_REV_REG                   0x0
543  #define REV_CHIPID_SHIFT               16
544  #define REV_CHIPID_MASK                        (0xffff << REV_CHIPID_SHIFT)
545 +#define REV_LONG_CHIPID_SHIFT          12
546 +#define REV_LONG_CHIPID_MASK           (0xfffff << REV_LONG_CHIPID_SHIFT)
547  #define REV_VARID_SHIFT                        12
548  #define REV_VARID_MASK                 (0xf << REV_VARID_SHIFT)
549  #define REV_REVID_SHIFT                        0
550 @@ -212,6 +214,52 @@
551                                         CKCTL_6368_NAND_EN |            \
552                                         CKCTL_6368_IPSEC_EN)
553  
554 +#define CKCTL_63268_DISABLE_GLESS      (1 << 0)
555 +#define CKCTL_63268_VDSL_QPROC_EN      (1 << 1)
556 +#define CKCTL_63268_VDSL_AFE_EN                (1 << 2)
557 +#define CKCTL_63268_VDSL_EN            (1 << 3)
558 +#define CKCTL_63268_MIPS_EN            (1 << 4)
559 +#define CKCTL_63268_WLAN_OCP_EN                (1 << 5)
560 +#define CKCTL_63268_DECT_EN            (1 << 6)
561 +#define CKCTL_63268_FAP0_EN            (1 << 7)
562 +#define CKCTL_63268_FAP1_EN            (1 << 8)
563 +#define CKCTL_63268_SAR_EN             (1 << 9)
564 +#define CKCTL_63268_ROBOSW_EN          (1 << 10)
565 +#define CKCTL_63268_PCM_EN             (1 << 11)
566 +#define CKCTL_63268_USBD_EN            (1 << 12)
567 +#define CKCTL_63268_USBH_EN            (1 << 13)
568 +#define CKCTL_63268_IPSEC_EN           (1 << 14)
569 +#define CKCTL_63268_SPI_EN             (1 << 15)
570 +#define CKCTL_63268_HSSPI_EN           (1 << 16)
571 +#define CKCTL_63268_PCIE_EN            (1 << 17)
572 +#define CKCTL_63268_PHYMIPS_EN         (1 << 18)
573 +#define CKCTL_63268_GMAC_EN            (1 << 19)
574 +#define CKCTL_63268_NAND_EN            (1 << 20)
575 +#define CKCTL_63268_TBUS_EN            (1 << 27)
576 +#define CKCTL_63268_ROBOSW250_EN       (1 << 31)
577 +
578 +#define CKCTL_63268_ALL_SAFE_EN                (CKCTL_63268_VDSL_QPROC_EN |    \
579 +                                       CKCTL_63268_VDSL_AFE_EN |       \
580 +                                       CKCTL_63268_VDSL_EN |           \
581 +                                       CKCTL_63268_WLAN_OCP_EN |       \
582 +                                       CKCTL_63268_DECT_EN |           \
583 +                                       CKCTL_63268_FAP0_EN |           \
584 +                                       CKCTL_63268_FAP1_EN |           \
585 +                                       CKCTL_63268_SAR_EN |            \
586 +                                       CKCTL_63268_ROBOSW_EN |         \
587 +                                       CKCTL_63268_PCM_EN |            \
588 +                                       CKCTL_63268_USBD_EN |           \
589 +                                       CKCTL_63268_USBH_EN |           \
590 +                                       CKCTL_63268_IPSEC_EN |          \
591 +                                       CKCTL_63268_SPI_EN |            \
592 +                                       CKCTL_63268_HSSPI_EN |          \
593 +                                       CKCTL_63268_PCIE_EN |           \
594 +                                       CKCTL_63268_PHYMIPS_EN |        \
595 +                                       CKCTL_63268_GMAC_EN |           \
596 +                                       CKCTL_63268_NAND_EN |           \
597 +                                       CKCTL_63268_TBUS_EN |           \
598 +                                       CKCTL_63268_ROBOSW250_EN)
599 +
600  /* System PLL Control register */
601  #define PERF_SYS_PLL_CTL_REG           0x8
602  #define SYS_PLL_SOFT_RESET             0x1
603 @@ -225,6 +273,7 @@
604  #define PERF_IRQMASK_6358_REG(x)       (0xc + (x) * 0x2c)
605  #define PERF_IRQMASK_6362_REG(x)       (0x20 + (x) * 0x10)
606  #define PERF_IRQMASK_6368_REG(x)       (0x20 + (x) * 0x10)
607 +#define PERF_IRQMASK_63268_REG(x)      (0x20 + (x) * 0x20)
608  
609  /* Interrupt Status register */
610  #define PERF_IRQSTAT_3368_REG          0x10
611 @@ -235,6 +284,7 @@
612  #define PERF_IRQSTAT_6358_REG(x)       (0x10 + (x) * 0x2c)
613  #define PERF_IRQSTAT_6362_REG(x)       (0x28 + (x) * 0x10)
614  #define PERF_IRQSTAT_6368_REG(x)       (0x28 + (x) * 0x10)
615 +#define PERF_IRQSTAT_63268_REG(x)      (0x30 + (x) * 0x20)
616  
617  /* External Interrupt Configuration register */
618  #define PERF_EXTIRQ_CFG_REG_3368       0x14
619 @@ -245,6 +295,7 @@
620  #define PERF_EXTIRQ_CFG_REG_6358       0x14
621  #define PERF_EXTIRQ_CFG_REG_6362       0x18
622  #define PERF_EXTIRQ_CFG_REG_6368       0x18
623 +#define PERF_EXTIRQ_CFG_REG_63268      0x18
624  
625  #define PERF_EXTIRQ_CFG_REG2_6358      0x1c
626  #define PERF_EXTIRQ_CFG_REG2_6368      0x1c
627 @@ -275,6 +326,7 @@
628  #define PERF_SOFTRESET_6358_REG                0x34
629  #define PERF_SOFTRESET_6362_REG                0x10
630  #define PERF_SOFTRESET_6368_REG                0x10
631 +#define PERF_SOFTRESET_63268_REG       0x10
632  
633  #define SOFTRESET_3368_SPI_MASK                (1 << 0)
634  #define SOFTRESET_3368_ENET_MASK       (1 << 2)
635 @@ -368,6 +420,26 @@
636  #define SOFTRESET_6368_USBH_MASK       (1 << 12)
637  #define SOFTRESET_6368_PCM_MASK                (1 << 13)
638  
639 +#define SOFTRESET_63268_SPI_MASK       (1 << 0)
640 +#define SOFTRESET_63268_IPSEC_MASK     (1 << 1)
641 +#define SOFTRESET_63268_EPHY_MASK      (1 << 2)
642 +#define SOFTRESET_63268_SAR_MASK       (1 << 3)
643 +#define SOFTRESET_63268_ENETSW_MASK    (1 << 4)
644 +#define SOFTRESET_63268_USBS_MASK      (1 << 5)
645 +#define SOFTRESET_63268_USBH_MASK      (1 << 6)
646 +#define SOFTRESET_63268_PCM_MASK       (1 << 7)
647 +#define SOFTRESET_63268_PCIE_CORE_MASK (1 << 8)
648 +#define SOFTRESET_63268_PCIE_MASK      (1 << 9)
649 +#define SOFTRESET_63268_PCIE_EXT_MASK  (1 << 10)
650 +#define SOFTRESET_63268_WLAN_SHIM_MASK (1 << 11)
651 +#define SOFTRESET_63268_DDR_PHY_MASK   (1 << 12)
652 +#define SOFTRESET_63268_FAP0_MASK      (1 << 13)
653 +#define SOFTRESET_63268_WLAN_UBUS_MASK (1 << 14)
654 +#define SOFTRESET_63268_DECT_MASK      (1 << 15)
655 +#define SOFTRESET_63268_FAP1_MASK      (1 << 16)
656 +#define SOFTRESET_63268_PCIE_HARD_MASK (1 << 17)
657 +#define SOFTRESET_63268_GPHY_MASK      (1 << 18)
658 +
659  /* MIPS PLL control register */
660  #define PERF_MIPSPLLCTL_REG            0x34
661  #define MIPSPLLCTL_N1_SHIFT            20
662 @@ -1367,6 +1439,13 @@
663  #define STRAPBUS_6362_BOOT_SEL_SERIAL  (1 << 15)
664  #define STRAPBUS_6362_BOOT_SEL_NAND    (0 << 15)
665  
666 +#define MISC_STRAPBUS_63268_REG                0x14
667 +#define STRAPBUS_63268_HSSPI_CLK_FAST  (1 << 9)
668 +#define STRAPBUS_63268_BOOT_SEL_SERIAL (1 << 11)
669 +#define STRAPBUS_63268_BOOT_SEL_NAND   (0 << 11)
670 +#define STRAPBUS_63268_FCVO_SHIFT      21
671 +#define STRAPBUS_63268_FCVO_MASK       (0xf << STRAPBUS_63268_FCVO_SHIFT)
672 +
673  #define MISC_STRAPBUS_6328_REG         0x240
674  #define STRAPBUS_6328_FCVO_SHIFT       7
675  #define STRAPBUS_6328_FCVO_MASK                (0x1f << STRAPBUS_6328_FCVO_SHIFT)
676 --- a/arch/mips/include/asm/mach-bcm63xx/ioremap.h
677 +++ b/arch/mips/include/asm/mach-bcm63xx/ioremap.h
678 @@ -26,6 +26,7 @@ static inline int is_bcm63xx_internal_re
679         case BCM6328_CPU_ID:
680         case BCM6362_CPU_ID:
681         case BCM6368_CPU_ID:
682 +       case BCM63268_CPU_ID:
683                 if (offset >= 0xb0000000 && offset < 0xb1000000)
684                         return 1;
685                 break;
686 --- a/arch/mips/bcm63xx/dev-hsspi.c
687 +++ b/arch/mips/bcm63xx/dev-hsspi.c
688 @@ -35,7 +35,7 @@ static struct platform_device bcm63xx_hs
689  
690  int __init bcm63xx_hsspi_register(void)
691  {
692 -       if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362())
693 +       if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_63268())
694                 return -ENODEV;
695  
696         spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI);
697 --- a/arch/mips/bcm63xx/dev-enet.c
698 +++ b/arch/mips/bcm63xx/dev-enet.c
699 @@ -176,7 +176,8 @@ static int __init register_shared(void)
700         else
701                 shared_res[0].end += (RSET_ENETDMA_SIZE)  - 1;
702  
703 -       if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368())
704 +       if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368() ||
705 +               BCMCPU_IS_63268())
706                 chan_count = 32;
707         else if (BCMCPU_IS_6345())
708                 chan_count = 8;
709 @@ -284,7 +285,8 @@ bcm63xx_enetsw_register(const struct bcm
710  {
711         int ret;
712  
713 -       if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368())
714 +       if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368() &&
715 +               !BCMCPU_IS_63268())
716                 return -ENODEV;
717  
718         ret = register_shared();
719 @@ -305,6 +307,8 @@ bcm63xx_enetsw_register(const struct bcm
720                 enetsw_pd.num_ports = ENETSW_PORTS_6328;
721         else if (BCMCPU_IS_6362() || BCMCPU_IS_6368())
722                 enetsw_pd.num_ports = ENETSW_PORTS_6368;
723 +       else if (BCMCPU_IS_63268())
724 +               enetsw_pd.num_ports = ENETSW_PORTS_63268;
725  
726         enetsw_pd.dma_has_sram = true;
727         enetsw_pd.dma_chan_width = ENETDMA_CHAN_WIDTH;
728 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
729 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
730 @@ -67,6 +67,7 @@ struct bcm63xx_enet_platform_data {
731  #define ENETSW_MAX_PORT        8
732  #define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */
733  #define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */
734 +#define ENETSW_PORTS_63268 8 /* 3 FE PHY + 1 GE PHY + 4 RGMII */
735  
736  #define ENETSW_RGMII_PORT0     4
737