/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. */ #include <linux/init.h> #include <linux/irqchip/mips-gic.h> #include <asm/cpu.h> #include <asm/setup.h> #include <asm/time.h> #include <asm/irq.h> #include <asm/mips-boards/generic.h> static void __iomem *status_reg = (void __iomem *)0xbf000410; /* * Estimate CPU frequency. Sets mips_hpt_frequency as a side-effect. */
static unsigned int __init estimate_cpu_frequency(void) { unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK); unsigned int tick = 0; unsigned int freq; unsigned int orig; unsigned long flags; local_irq_save(flags); orig = readl(status_reg) & 0x2; /* get original sample */ /* wait for transition */ while ((readl(status_reg) & 0x2) == orig) ; orig = orig ^ 0x2; /* flip the bit */ write_c0_count(0); /* wait 1 second (the sampling clock transitions every 10ms) */ while (tick < 100) { /* wait for transition */ while ((readl(status_reg) & 0x2) == orig) ; orig = orig ^ 0x2; /* flip the bit */ tick++; } freq = read_c0_count(); local_irq_restore(flags); mips_hpt_frequency = freq; /* Adjust for processor */ if ((prid != (PRID_COMP_MIPS | PRID_IMP_20KC)) && (prid != (PRID_COMP_MIPS | PRID_IMP_25KF))) freq *= 2; freq += 5000; /* rounding */ freq -= freq%10000; return freq ; }Contributors
| Person | Tokens | Prop | Commits | CommitProp | |
| steven j. hill | steven j. hill | 167 | 97.09% | 1 | 50.00% |
| maciej w. rozycki | maciej w. rozycki | 5 | 2.91% | 1 | 50.00% |
| Total | 172 | 100.00% | 2 | 100.00% |
| Person | Tokens | Prop | Commits | CommitProp | |
| steven j. hill | steven j. hill | 22 | 100.00% | 1 | 100.00% |
| Total | 22 | 100.00% | 1 | 100.00% |
| Person | Tokens | Prop | Commits | CommitProp | |
| andrew bresticker | andrew bresticker | 15 | 50.00% | 2 | 50.00% |
| steven j. hill | steven j. hill | 14 | 46.67% | 1 | 25.00% |
| niklas cassel | niklas cassel | 1 | 3.33% | 1 | 25.00% |
| Total | 30 | 100.00% | 4 | 100.00% |
| Person | Tokens | Prop | Commits | CommitProp | |
| steven j. hill | steven j. hill | 15 | 71.43% | 1 | 50.00% |
| andrew bresticker | andrew bresticker | 6 | 28.57% | 1 | 50.00% |
| Total | 21 | 100.00% | 2 | 100.00% |
| Person | Tokens | Prop | Commits | CommitProp | |
| steven j. hill | steven j. hill | 41 | 100.00% | 1 | 100.00% |
| Total | 41 | 100.00% | 1 | 100.00% |
| Person | Tokens | Prop | Commits | CommitProp | |
| steven j. hill | steven j. hill | 289 | 88.38% | 1 | 14.29% |
| andrew bresticker | andrew bresticker | 25 | 7.65% | 3 | 42.86% |
| maciej w. rozycki | maciej w. rozycki | 7 | 2.14% | 1 | 14.29% |
| felix fietkau | felix fietkau | 5 | 1.53% | 1 | 14.29% |
| niklas cassel | niklas cassel | 1 | 0.31% | 1 | 14.29% |
| Total | 327 | 100.00% | 7 | 100.00% |