aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mti-malta
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2014-01-15 05:31:54 -0500
committerRalf Baechle <ralf@linux-mips.org>2014-03-26 18:09:06 -0400
commit237036de6540a377268db5bb2b9c8efdccbe51c1 (patch)
tree81a76206b8b67bb523d6994131faceeb62cf75e1 /arch/mips/mti-malta
parent0ee958e102b62b418c2fb46c3439d4262067a5fc (diff)
MIPS: Malta: Make use of generic CM support
Remove the Malta-specific CM probe code and instead make use of the newly added generic CM code. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/6364/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/mti-malta')
-rw-r--r--arch/mips/mti-malta/malta-init.c8
-rw-r--r--arch/mips/mti-malta/malta-int.c70
-rw-r--r--arch/mips/mti-malta/malta-setup.c4
3 files changed, 19 insertions, 63 deletions
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c
index fcebfced26d0..85a62b036df0 100644
--- a/arch/mips/mti-malta/malta-init.c
+++ b/arch/mips/mti-malta/malta-init.c
@@ -20,7 +20,7 @@
20#include <asm/smp-ops.h> 20#include <asm/smp-ops.h>
21#include <asm/traps.h> 21#include <asm/traps.h>
22#include <asm/fw/fw.h> 22#include <asm/fw/fw.h>
23#include <asm/gcmpregs.h> 23#include <asm/mips-cm.h>
24#include <asm/mips-boards/generic.h> 24#include <asm/mips-boards/generic.h>
25#include <asm/mips-boards/malta.h> 25#include <asm/mips-boards/malta.h>
26 26
@@ -276,10 +276,10 @@ mips_pci_controller:
276 console_config(); 276 console_config();
277#endif 277#endif
278 /* Early detection of CMP support */ 278 /* Early detection of CMP support */
279 if (gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ)) 279 mips_cm_probe();
280 if (!register_cmp_smp_ops())
281 return;
282 280
281 if (!register_cmp_smp_ops())
282 return;
283 if (!register_vsmp_smp_ops()) 283 if (!register_vsmp_smp_ops())
284 return; 284 return;
285 285
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index ca3e3a46a42f..93103f81bf57 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -26,6 +26,7 @@
26#include <asm/i8259.h> 26#include <asm/i8259.h>
27#include <asm/irq_cpu.h> 27#include <asm/irq_cpu.h>
28#include <asm/irq_regs.h> 28#include <asm/irq_regs.h>
29#include <asm/mips-cm.h>
29#include <asm/mips-boards/malta.h> 30#include <asm/mips-boards/malta.h>
30#include <asm/mips-boards/maltaint.h> 31#include <asm/mips-boards/maltaint.h>
31#include <asm/gt64120.h> 32#include <asm/gt64120.h>
@@ -33,13 +34,10 @@
33#include <asm/mips-boards/msc01_pci.h> 34#include <asm/mips-boards/msc01_pci.h>
34#include <asm/msc01_ic.h> 35#include <asm/msc01_ic.h>
35#include <asm/gic.h> 36#include <asm/gic.h>
36#include <asm/gcmpregs.h>
37#include <asm/setup.h> 37#include <asm/setup.h>
38#include <asm/rtlx.h> 38#include <asm/rtlx.h>
39 39
40int gcmp_present = -1;
41static unsigned long _msc01_biu_base; 40static unsigned long _msc01_biu_base;
42static unsigned long _gcmp_base;
43static unsigned int ipi_map[NR_CPUS]; 41static unsigned int ipi_map[NR_CPUS];
44 42
45static DEFINE_RAW_SPINLOCK(mips_irq_lock); 43static DEFINE_RAW_SPINLOCK(mips_irq_lock);
@@ -418,48 +416,6 @@ static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = {
418}; 416};
419#undef X 417#undef X
420 418
421/*
422 * GCMP needs to be detected before any SMP initialisation
423 */
424int __init gcmp_probe(unsigned long addr, unsigned long size)
425{
426 if ((mips_revision_sconid != MIPS_REVISION_SCON_ROCIT) &&
427 (mips_revision_sconid != MIPS_REVISION_SCON_GT64120)) {
428 gcmp_present = 0;
429 pr_debug("GCMP NOT present\n");
430 return gcmp_present;
431 }
432
433 if (gcmp_present >= 0)
434 return gcmp_present;
435
436 _gcmp_base = (unsigned long) ioremap_nocache(GCMP_BASE_ADDR,
437 GCMP_ADDRSPACE_SZ);
438 _msc01_biu_base = (unsigned long) ioremap_nocache(MSC01_BIU_REG_BASE,
439 MSC01_BIU_ADDRSPACE_SZ);
440 gcmp_present = ((GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) ==
441 GCMP_BASE_ADDR);
442
443 if (gcmp_present)
444 pr_debug("GCMP present\n");
445 return gcmp_present;
446}
447
448/* Return the number of IOCU's present */
449int __init gcmp_niocu(void)
450{
451 return gcmp_present ? ((GCMPGCB(GC) & GCMP_GCB_GC_NUMIOCU_MSK) >>
452 GCMP_GCB_GC_NUMIOCU_SHF) : 0;
453}
454
455/* Set GCMP region attributes */
456void __init gcmp_setregion(int region, unsigned long base,
457 unsigned long mask, int type)
458{
459 GCMPGCBn(CMxBASE, region) = base;
460 GCMPGCBn(CMxMASK, region) = mask | type;
461}
462
463#if defined(CONFIG_MIPS_MT_SMP) 419#if defined(CONFIG_MIPS_MT_SMP)
464static void __init fill_ipi_map1(int baseintr, int cpu, int cpupin) 420static void __init fill_ipi_map1(int baseintr, int cpu, int cpupin)
465{ 421{
@@ -496,8 +452,8 @@ void __init arch_init_irq(void)
496 if (!cpu_has_veic) 452 if (!cpu_has_veic)
497 mips_cpu_irq_init(); 453 mips_cpu_irq_init();
498 454
499 if (gcmp_present) { 455 if (mips_cm_present()) {
500 GCMPGCB(GICBA) = GIC_BASE_ADDR | GCMP_GCB_GICBA_EN_MSK; 456 write_gcr_gic_base(GIC_BASE_ADDR | CM_GCR_GIC_BASE_GICEN_MSK);
501 gic_present = 1; 457 gic_present = 1;
502 } else { 458 } else {
503 if (mips_revision_sconid == MIPS_REVISION_SCON_ROCIT) { 459 if (mips_revision_sconid == MIPS_REVISION_SCON_ROCIT) {
@@ -584,7 +540,7 @@ void __init arch_init_irq(void)
584#endif 540#endif
585 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map, 541 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map,
586 ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE); 542 ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE);
587 if (!gcmp_present) { 543 if (!mips_cm_present()) {
588 /* Enable the GIC */ 544 /* Enable the GIC */
589 i = REG(_msc01_biu_base, MSC01_SC_CFG); 545 i = REG(_msc01_biu_base, MSC01_SC_CFG);
590 REG(_msc01_biu_base, MSC01_SC_CFG) = 546 REG(_msc01_biu_base, MSC01_SC_CFG) =
@@ -708,16 +664,16 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
708 /* This duplicates the handling in do_be which seems wrong */ 664 /* This duplicates the handling in do_be which seems wrong */
709 int retval = is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL; 665 int retval = is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL;
710 666
711 if (gcmp_present) { 667 if (mips_cm_present()) {
712 unsigned long cm_error = GCMPGCB(GCMEC); 668 unsigned long cm_error = read_gcr_error_cause();
713 unsigned long cm_addr = GCMPGCB(GCMEA); 669 unsigned long cm_addr = read_gcr_error_addr();
714 unsigned long cm_other = GCMPGCB(GCMEO); 670 unsigned long cm_other = read_gcr_error_mult();
715 unsigned long cause, ocause; 671 unsigned long cause, ocause;
716 char buf[256]; 672 char buf[256];
717 673
718 cause = (cm_error & GCMP_GCB_GMEC_ERROR_TYPE_MSK); 674 cause = cm_error & CM_GCR_ERROR_CAUSE_ERRTYPE_MSK;
719 if (cause != 0) { 675 if (cause != 0) {
720 cause >>= GCMP_GCB_GMEC_ERROR_TYPE_SHF; 676 cause >>= CM_GCR_ERROR_CAUSE_ERRTYPE_SHF;
721 if (cause < 16) { 677 if (cause < 16) {
722 unsigned long cca_bits = (cm_error >> 15) & 7; 678 unsigned long cca_bits = (cm_error >> 15) & 7;
723 unsigned long tr_bits = (cm_error >> 12) & 7; 679 unsigned long tr_bits = (cm_error >> 12) & 7;
@@ -748,8 +704,8 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
748 mcmd[cmd_bits], sport_bits); 704 mcmd[cmd_bits], sport_bits);
749 } 705 }
750 706
751 ocause = (cm_other & GCMP_GCB_GMEO_ERROR_2ND_MSK) >> 707 ocause = (cm_other & CM_GCR_ERROR_MULT_ERR2ND_MSK) >>
752 GCMP_GCB_GMEO_ERROR_2ND_SHF; 708 CM_GCR_ERROR_MULT_ERR2ND_SHF;
753 709
754 pr_err("CM_ERROR=%08lx %s <%s>\n", cm_error, 710 pr_err("CM_ERROR=%08lx %s <%s>\n", cm_error,
755 causes[cause], buf); 711 causes[cause], buf);
@@ -757,7 +713,7 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
757 pr_err("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]); 713 pr_err("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]);
758 714
759 /* reprime cause register */ 715 /* reprime cause register */
760 GCMPGCB(GCMEC) = 0; 716 write_gcr_error_cause(0);
761 } 717 }
762 } 718 }
763 719
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index c72a06936781..01a55f3242de 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -26,12 +26,12 @@
26#include <linux/time.h> 26#include <linux/time.h>
27 27
28#include <asm/fw/fw.h> 28#include <asm/fw/fw.h>
29#include <asm/mips-cm.h>
29#include <asm/mips-boards/generic.h> 30#include <asm/mips-boards/generic.h>
30#include <asm/mips-boards/malta.h> 31#include <asm/mips-boards/malta.h>
31#include <asm/mips-boards/maltaint.h> 32#include <asm/mips-boards/maltaint.h>
32#include <asm/dma.h> 33#include <asm/dma.h>
33#include <asm/traps.h> 34#include <asm/traps.h>
34#include <asm/gcmpregs.h>
35#ifdef CONFIG_VT 35#ifdef CONFIG_VT
36#include <linux/console.h> 36#include <linux/console.h>
37#endif 37#endif
@@ -127,7 +127,7 @@ static int __init plat_enable_iocoherency(void)
127 BONITO_PCIMEMBASECFG_MEMBASE1_CACHED); 127 BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
128 pr_info("Enabled Bonito IOBC coherency\n"); 128 pr_info("Enabled Bonito IOBC coherency\n");
129 } 129 }
130 } else if (gcmp_niocu() != 0) { 130 } else if (mips_cm_numiocu() != 0) {
131 /* Nothing special needs to be done to enable coherency */ 131 /* Nothing special needs to be done to enable coherency */
132 pr_info("CMP IOCU detected\n"); 132 pr_info("CMP IOCU detected\n");
133 if ((*(unsigned int *)0xbf403000 & 0x81) != 0x81) { 133 if ((*(unsigned int *)0xbf403000 & 0x81) != 0x81) {