__init void plat_time_init(void) { unsigned int configPR; unsigned int n; unsigned int m; unsigned int p; unsigned int pow2p; pnx8xxx_clockevent.cpumask = cpu_none_mask; clockevents_register_device(&pnx8xxx_clockevent); clocksource_register(&pnx_clocksource); /* Timer 1 start */ configPR = read_c0_config7(); configPR &= ~0x00000008; write_c0_config7(configPR); /* Timer 2 start */ configPR = read_c0_config7(); configPR &= ~0x00000010; write_c0_config7(configPR); /* Timer 3 stop */ configPR = read_c0_config7(); configPR |= 0x00000020; write_c0_config7(configPR); /* PLL0 sets MIPS clock (PLL1 <=> TM1, PLL6 <=> TM2, PLL5 <=> mem) */ /* (but only if CLK_MIPS_CTL select value [bits 3:1] is 1: FIXME) */ n = (PNX8550_CM_PLL0_CTL & PNX8550_CM_PLL_N_MASK) >> 16; m = (PNX8550_CM_PLL0_CTL & PNX8550_CM_PLL_M_MASK) >> 8; p = (PNX8550_CM_PLL0_CTL & PNX8550_CM_PLL_P_MASK) >> 2; pow2p = (1 << p); db_assert(m != 0 && pow2p != 0); /* * Compute the frequency as in the PNX8550 User Manual 1.0, p.186 * (a.k.a. 8-10). Divide by HZ for a timer offset that results in * HZ timer interrupts per second. */ mips_hpt_frequency = 27UL * ((1000000UL * n)/(m * pow2p)); cpj = (mips_hpt_frequency + HZ / 2) / HZ; write_c0_count(0); timer_ack(); /* Setup Timer 2 */ write_c0_count2(0); write_c0_compare2(0xffffffff); setup_irq(PNX8550_INT_TIMER1, &pnx8xxx_timer_irq); setup_irq(PNX8550_INT_TIMER2, &monotonic_irqaction); }
void __init board_setup(void) { unsigned long configpr; configpr = read_c0_config7(); configpr |= (1<<19); write_c0_config7(configpr); }
void __init plat_timer_setup(struct irqaction *irq) { int configPR; setup_irq(PNX8550_INT_TIMER1, irq); /* Start timer1 */ configPR = read_c0_config7(); configPR &= ~0x00000008; write_c0_config7(configPR); /* Timer 2 stop */ configPR = read_c0_config7(); configPR |= 0x00000010; write_c0_config7(configPR); write_c0_count2(0); write_c0_compare2(0xffffffff); /* Timer 3 stop */ configPR = read_c0_config7(); configPR |= 0x00000020; write_c0_config7(configPR); }
static int pnx8550_timers_read (char* page, char** start, off_t offset, int count, int* eof, void* data) { int len = 0; int configPR = read_c0_config7(); if (offset==0) { len += sprintf(&page[len],"Timer: count, compare, tc, status\n"); len += sprintf(&page[len]," 1: %11i, %8i, %1i, %s\n", read_c0_count(), read_c0_compare(), (configPR>>6)&0x1, ((configPR>>3)&0x1)? "off":"on"); len += sprintf(&page[len]," 2: %11i, %8i, %1i, %s\n", read_c0_count2(), read_c0_compare2(), (configPR>>7)&0x1, ((configPR>>4)&0x1)? "off":"on"); len += sprintf(&page[len]," 3: %11i, %8i, %1i, %s\n", read_c0_count3(), read_c0_compare3(), (configPR>>8)&0x1, ((configPR>>5)&0x1)? "off":"on"); }
void __init board_setup(void) { unsigned long config0, configpr; config0 = read_c0_config(); /* clear all three cache coherency fields */ config0 &= ~(0x7 | (7<<25) | (7<<28)); config0 |= (CONF_CM_DEFAULT | (CONF_CM_DEFAULT<<25) | (CONF_CM_DEFAULT<<28)); write_c0_config(config0); BARRIER; configpr = read_c0_config7(); configpr |= (1<<19); /* enable tlb */ write_c0_config7(configpr); BARRIER; }
static int smtc_proc_show(struct seq_file *m, void *v) { int i; extern unsigned long ebase; seq_printf(m, "SMTC Status Word: 0x%08x\n", smtc_status); seq_printf(m, "Config7: 0x%08x\n", read_c0_config7()); seq_printf(m, "EBASE: 0x%08lx\n", ebase); seq_printf(m, "Counter Interrupts taken per CPU (TC)\n"); for (i=0; i < NR_CPUS; i++) seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].timerints); seq_printf(m, "Self-IPIs by CPU:\n"); for(i = 0; i < NR_CPUS; i++) seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis); seq_printf(m, "%d Recoveries of \"stolen\" FPU\n", atomic_read_unchecked(&smtc_fpu_recoveries)); return 0; }
int timer_init(void) { #ifdef CONFIG_MIPS_CPU_PR4450 unsigned int config7; /* enable and start counter */ config7 = read_c0_config7(); config7 &= ~0x00000008; write_c0_config7(config7); #endif // CONFIG_MIPS_CPU_PR4450 /* Set up the timer for the first expiration. */ timestamp = 0; write_c0_count(0); write_c0_compare(~0); return 0; }
static int proc_read_smtc(char *page, char **start, off_t off, int count, int *eof, void *data) { int totalen = 0; int len; int i; extern unsigned long ebase; len = sprintf(page, "SMTC Status Word: 0x%08x\n", smtc_status); totalen += len; page += len; len = sprintf(page, "Config7: 0x%08x\n", read_c0_config7()); totalen += len; page += len; len = sprintf(page, "EBASE: 0x%08lx\n", ebase); totalen += len; page += len; len = sprintf(page, "Counter Interrupts taken per CPU (TC)\n"); totalen += len; page += len; for (i=0; i < NR_CPUS; i++) { len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].timerints); totalen += len; page += len; } len = sprintf(page, "Self-IPIs by CPU:\n"); totalen += len; page += len; for(i = 0; i < NR_CPUS; i++) { len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis); totalen += len; page += len; } len = sprintf(page, "%d Recoveries of \"stolen\" FPU\n", atomic_read(&smtc_fpu_recoveries)); totalen += len; page += len; return totalen; }
void __init check_wait(void) { struct cpuinfo_mips *c = ¤t_cpu_data; if (nowait) { printk("Wait instruction disabled.\n"); return; } switch (current_cpu_type()) { case CPU_R3081: case CPU_R3081E: cpu_wait = r3081_wait; break; case CPU_TX3927: cpu_wait = r39xx_wait; break; case CPU_R4200: /* case CPU_R4300: */ case CPU_R4600: case CPU_R4640: case CPU_R4650: case CPU_R4700: case CPU_R5000: case CPU_R5500: case CPU_NEVADA: case CPU_4KC: case CPU_4KEC: case CPU_4KSC: case CPU_5KC: case CPU_25KF: case CPU_PR4450: case CPU_BMIPS3300: case CPU_BMIPS4350: case CPU_BMIPS4380: case CPU_BMIPS5000: case CPU_CAVIUM_OCTEON: case CPU_CAVIUM_OCTEON_PLUS: case CPU_CAVIUM_OCTEON2: case CPU_CAVIUM_OCTEON3: case CPU_JZRISC: case CPU_LOONGSON1: case CPU_XLR: case CPU_XLP: cpu_wait = r4k_wait; break; case CPU_RM7000: cpu_wait = rm7k_wait_irqoff; break; case CPU_PROAPTIV: case CPU_P5600: /* * Incoming Fast Debug Channel (FDC) data during a wait * instruction causes the wait never to resume, even if an * interrupt is received. Avoid using wait at all if FDC data is * likely to be received. */ if (IS_ENABLED(CONFIG_MIPS_EJTAG_FDC_TTY)) break; /* fall through */ case CPU_M14KC: case CPU_M14KEC: case CPU_24K: case CPU_34K: case CPU_1004K: case CPU_1074K: case CPU_INTERAPTIV: case CPU_M5150: case CPU_QEMU_GENERIC: cpu_wait = r4k_wait; if (read_c0_config7() & MIPS_CONF7_WII) cpu_wait = r4k_wait_irqoff; break; case CPU_74K: cpu_wait = r4k_wait; if ((c->processor_id & 0xff) >= PRID_REV_ENCODE_332(2, 1, 0)) cpu_wait = r4k_wait_irqoff; break; case CPU_TX49XX: cpu_wait = r4k_wait_irqoff; break; case CPU_ALCHEMY: cpu_wait = au1k_wait; break; case CPU_20KC: /* * WAIT on Rev1.0 has E1, E2, E3 and E16. * WAIT on Rev2.0 and Rev3.0 has E16. * Rev3.1 WAIT is nop, why bother */ if ((c->processor_id & 0xff) <= 0x64) break; /* * Another rev is incremeting c0_count at a reduced clock * rate while in WAIT mode. So we basically have the choice * between using the cp0 timer as clocksource or avoiding * the WAIT instruction. Until more details are known, * disable the use of WAIT for 20Kc entirely. cpu_wait = r4k_wait; */ break; default: break; } }