Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Paul Burton and committed by
Ralf Baechle
237036de 0ee958e1

+38 -74
+3
arch/mips/Kconfig
··· 868 868 bool 869 869 870 870 config CEVT_GIC 871 + select MIPS_CM 871 872 bool 872 873 873 874 config CEVT_SB1250 ··· 887 886 bool 888 887 889 888 config CSRC_GIC 889 + select MIPS_CM 890 890 bool 891 891 892 892 config CSRC_SB1250 ··· 1032 1030 bool 1033 1031 1034 1032 config IRQ_GIC 1033 + select MIPS_CM 1035 1034 bool 1036 1035 1037 1036 config PCI_GT64XXX_PCI0
+5
arch/mips/include/asm/smp-ops.h
··· 13 13 14 14 #include <linux/errno.h> 15 15 16 + #include <asm/mips-cm.h> 17 + 16 18 #ifdef CONFIG_SMP 17 19 18 20 #include <linux/cpumask.h> ··· 80 78 { 81 79 #ifdef CONFIG_MIPS_CMP 82 80 extern struct plat_smp_ops cmp_smp_ops; 81 + 82 + if (!mips_cm_present()) 83 + return -ENODEV; 83 84 84 85 register_smp_ops(&cmp_smp_ops); 85 86
+4 -4
arch/mips/mti-malta/malta-init.c
··· 20 20 #include <asm/smp-ops.h> 21 21 #include <asm/traps.h> 22 22 #include <asm/fw/fw.h> 23 - #include <asm/gcmpregs.h> 23 + #include <asm/mips-cm.h> 24 24 #include <asm/mips-boards/generic.h> 25 25 #include <asm/mips-boards/malta.h> 26 26 ··· 276 276 console_config(); 277 277 #endif 278 278 /* Early detection of CMP support */ 279 - if (gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ)) 280 - if (!register_cmp_smp_ops()) 281 - return; 279 + mips_cm_probe(); 282 280 281 + if (!register_cmp_smp_ops()) 282 + return; 283 283 if (!register_vsmp_smp_ops()) 284 284 return; 285 285
+13 -57
arch/mips/mti-malta/malta-int.c
··· 26 26 #include <asm/i8259.h> 27 27 #include <asm/irq_cpu.h> 28 28 #include <asm/irq_regs.h> 29 + #include <asm/mips-cm.h> 29 30 #include <asm/mips-boards/malta.h> 30 31 #include <asm/mips-boards/maltaint.h> 31 32 #include <asm/gt64120.h> ··· 34 33 #include <asm/mips-boards/msc01_pci.h> 35 34 #include <asm/msc01_ic.h> 36 35 #include <asm/gic.h> 37 - #include <asm/gcmpregs.h> 38 36 #include <asm/setup.h> 39 37 #include <asm/rtlx.h> 40 38 41 - int gcmp_present = -1; 42 39 static unsigned long _msc01_biu_base; 43 - static unsigned long _gcmp_base; 44 40 static unsigned int ipi_map[NR_CPUS]; 45 41 46 42 static DEFINE_RAW_SPINLOCK(mips_irq_lock); ··· 416 418 }; 417 419 #undef X 418 420 419 - /* 420 - * GCMP needs to be detected before any SMP initialisation 421 - */ 422 - int __init gcmp_probe(unsigned long addr, unsigned long size) 423 - { 424 - if ((mips_revision_sconid != MIPS_REVISION_SCON_ROCIT) && 425 - (mips_revision_sconid != MIPS_REVISION_SCON_GT64120)) { 426 - gcmp_present = 0; 427 - pr_debug("GCMP NOT present\n"); 428 - return gcmp_present; 429 - } 430 - 431 - if (gcmp_present >= 0) 432 - return gcmp_present; 433 - 434 - _gcmp_base = (unsigned long) ioremap_nocache(GCMP_BASE_ADDR, 435 - GCMP_ADDRSPACE_SZ); 436 - _msc01_biu_base = (unsigned long) ioremap_nocache(MSC01_BIU_REG_BASE, 437 - MSC01_BIU_ADDRSPACE_SZ); 438 - gcmp_present = ((GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) == 439 - GCMP_BASE_ADDR); 440 - 441 - if (gcmp_present) 442 - pr_debug("GCMP present\n"); 443 - return gcmp_present; 444 - } 445 - 446 - /* Return the number of IOCU's present */ 447 - int __init gcmp_niocu(void) 448 - { 449 - return gcmp_present ? ((GCMPGCB(GC) & GCMP_GCB_GC_NUMIOCU_MSK) >> 450 - GCMP_GCB_GC_NUMIOCU_SHF) : 0; 451 - } 452 - 453 - /* Set GCMP region attributes */ 454 - void __init gcmp_setregion(int region, unsigned long base, 455 - unsigned long mask, int type) 456 - { 457 - GCMPGCBn(CMxBASE, region) = base; 458 - GCMPGCBn(CMxMASK, region) = mask | type; 459 - } 460 - 461 421 #if defined(CONFIG_MIPS_MT_SMP) 462 422 static void __init fill_ipi_map1(int baseintr, int cpu, int cpupin) 463 423 { ··· 452 496 if (!cpu_has_veic) 453 497 mips_cpu_irq_init(); 454 498 455 - if (gcmp_present) { 456 - GCMPGCB(GICBA) = GIC_BASE_ADDR | GCMP_GCB_GICBA_EN_MSK; 499 + if (mips_cm_present()) { 500 + write_gcr_gic_base(GIC_BASE_ADDR | CM_GCR_GIC_BASE_GICEN_MSK); 457 501 gic_present = 1; 458 502 } else { 459 503 if (mips_revision_sconid == MIPS_REVISION_SCON_ROCIT) { ··· 540 584 #endif 541 585 gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map, 542 586 ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE); 543 - if (!gcmp_present) { 587 + if (!mips_cm_present()) { 544 588 /* Enable the GIC */ 545 589 i = REG(_msc01_biu_base, MSC01_SC_CFG); 546 590 REG(_msc01_biu_base, MSC01_SC_CFG) = ··· 664 708 /* This duplicates the handling in do_be which seems wrong */ 665 709 int retval = is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL; 666 710 667 - if (gcmp_present) { 668 - unsigned long cm_error = GCMPGCB(GCMEC); 669 - unsigned long cm_addr = GCMPGCB(GCMEA); 670 - unsigned long cm_other = GCMPGCB(GCMEO); 711 + if (mips_cm_present()) { 712 + unsigned long cm_error = read_gcr_error_cause(); 713 + unsigned long cm_addr = read_gcr_error_addr(); 714 + unsigned long cm_other = read_gcr_error_mult(); 671 715 unsigned long cause, ocause; 672 716 char buf[256]; 673 717 674 - cause = (cm_error & GCMP_GCB_GMEC_ERROR_TYPE_MSK); 718 + cause = cm_error & CM_GCR_ERROR_CAUSE_ERRTYPE_MSK; 675 719 if (cause != 0) { 676 - cause >>= GCMP_GCB_GMEC_ERROR_TYPE_SHF; 720 + cause >>= CM_GCR_ERROR_CAUSE_ERRTYPE_SHF; 677 721 if (cause < 16) { 678 722 unsigned long cca_bits = (cm_error >> 15) & 7; 679 723 unsigned long tr_bits = (cm_error >> 12) & 7; ··· 704 748 mcmd[cmd_bits], sport_bits); 705 749 } 706 750 707 - ocause = (cm_other & GCMP_GCB_GMEO_ERROR_2ND_MSK) >> 708 - GCMP_GCB_GMEO_ERROR_2ND_SHF; 751 + ocause = (cm_other & CM_GCR_ERROR_MULT_ERR2ND_MSK) >> 752 + CM_GCR_ERROR_MULT_ERR2ND_SHF; 709 753 710 754 pr_err("CM_ERROR=%08lx %s <%s>\n", cm_error, 711 755 causes[cause], buf); ··· 713 757 pr_err("CM_OTHER=%08lx %s\n", cm_other, causes[ocause]); 714 758 715 759 /* reprime cause register */ 716 - GCMPGCB(GCMEC) = 0; 760 + write_gcr_error_cause(0); 717 761 } 718 762 } 719 763
+2 -2
arch/mips/mti-malta/malta-setup.c
··· 26 26 #include <linux/time.h> 27 27 28 28 #include <asm/fw/fw.h> 29 + #include <asm/mips-cm.h> 29 30 #include <asm/mips-boards/generic.h> 30 31 #include <asm/mips-boards/malta.h> 31 32 #include <asm/mips-boards/maltaint.h> 32 33 #include <asm/dma.h> 33 34 #include <asm/traps.h> 34 - #include <asm/gcmpregs.h> 35 35 #ifdef CONFIG_VT 36 36 #include <linux/console.h> 37 37 #endif ··· 127 127 BONITO_PCIMEMBASECFG_MEMBASE1_CACHED); 128 128 pr_info("Enabled Bonito IOBC coherency\n"); 129 129 } 130 - } else if (gcmp_niocu() != 0) { 130 + } else if (mips_cm_numiocu() != 0) { 131 131 /* Nothing special needs to be done to enable coherency */ 132 132 pr_info("CMP IOCU detected\n"); 133 133 if ((*(unsigned int *)0xbf403000 & 0x81) != 0x81) {
+11 -11
arch/mips/pci/pci-malta.c
··· 27 27 #include <linux/init.h> 28 28 29 29 #include <asm/gt64120.h> 30 - #include <asm/gcmpregs.h> 30 + #include <asm/mips-cm.h> 31 31 #include <asm/mips-boards/generic.h> 32 32 #include <asm/mips-boards/bonito64.h> 33 33 #include <asm/mips-boards/msc01_pci.h> ··· 201 201 msc_mem_resource.start = start & mask; 202 202 msc_mem_resource.end = (start & mask) | ~mask; 203 203 msc_controller.mem_offset = (start & mask) - (map & mask); 204 - #ifdef CONFIG_MIPS_CMP 205 - if (gcmp_niocu()) 206 - gcmp_setregion(0, start, mask, 207 - GCMP_GCB_GCMPB_CMDEFTGT_IOCU1); 208 - #endif 204 + if (mips_cm_numiocu()) { 205 + write_gcr_reg0_base(start); 206 + write_gcr_reg0_mask(mask | 207 + CM_GCR_REGn_MASK_CMTGT_IOCU0); 208 + } 209 209 MSC_READ(MSC01_PCI_SC2PIOBASL, start); 210 210 MSC_READ(MSC01_PCI_SC2PIOMSKL, mask); 211 211 MSC_READ(MSC01_PCI_SC2PIOMAPL, map); ··· 213 213 msc_io_resource.end = (map & mask) | ~mask; 214 214 msc_controller.io_offset = 0; 215 215 ioport_resource.end = ~mask; 216 - #ifdef CONFIG_MIPS_CMP 217 - if (gcmp_niocu()) 218 - gcmp_setregion(1, start, mask, 219 - GCMP_GCB_GCMPB_CMDEFTGT_IOCU1); 220 - #endif 216 + if (mips_cm_numiocu()) { 217 + write_gcr_reg1_base(start); 218 + write_gcr_reg1_mask(mask | 219 + CM_GCR_REGn_MASK_CMTGT_IOCU0); 220 + } 221 221 /* If ranges overlap I/O takes precedence. */ 222 222 start = start & mask; 223 223 end = start | ~mask;