aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/pxcab
Commit message (Expand)AuthorAgeFilesLines
* massive: replace occurences of .$(LINUX_KMOD_SUFFIX) with .ko after r21950Claudio Mignanti2010-07-121-1/+1
* generic: don't override CONFIG_DEBUG_FSGabor Juhos2010-06-101-1/+0
* package/kernel: move target specific modules to their own target filesNicolas Thill2010-04-241-0/+21
* target: remove CONFIG_CRC16 override (closes: #7194)Nicolas Thill2010-04-241-1/+0
* define a shared IMG_PREFIX variable used as a basename for image files, it co...Nicolas Thill2010-04-121-3/+3
* pxcab: remove 2.6.31 configGabor Juhos2010-03-261-466/+0
* do *not* enable CONFIG_PCI in generic config, but on targets where it makes s...Nicolas Thill2010-03-112-0/+2
* clean up handling of some kernel symbolsImre Kaloz2010-02-112-8/+0
* preinit: use grep -q where applicableJo-Philipp Wich2010-02-011-1/+1
* preinit: Remove Ctrl-C prompt...impossible on /dev/console (patch by cshore)Felix Fietkau2010-01-281-1/+1
* add preinit modularization work by Daniel Dickinson (cshore)Felix Fietkau2010-01-253-2/+22
* update to 2.6.30, refresh patchesFlorian Fainelli2009-12-041-1/+1
* some more Kconfig symbol move..Imre Kaloz2009-11-112-4/+0
* another round of kernel config cleanupsImre Kaloz2009-11-112-4/+0
* sort all target config filesImre Kaloz2009-11-112-107/+107
* move CONFIG_CRASH_DUMP to the generic configsImre Kaloz2009-11-112-2/+0
* update to 2.6.30.9Florian Fainelli2009-10-231-1/+1
* move common CONFIG_FB entries to genericNicolas Thill2009-10-052-94/+0
* kernel: upgrade to 2.6.30.8 and refresh patchesGabor Juhos2009-10-011-1/+1
* update to latest 2.6.27 and 2.6.30 kernelsImre Kaloz2009-09-171-1/+1
* update to 2.6.30.6, compile tested on some targets onlyFlorian Fainelli2009-09-091-1/+1
* pxcab: Add config-2.6.31Geoff Levand2009-08-271-0/+521
* pxcab: Build fixGeoff Levand2009-08-271-107/+0
* pxcab: Replace TARGET_pxcab with feature powerpc64Geoff Levand2009-08-181-1/+1
* use 2.6.30.5Florian Fainelli2009-08-171-1/+1
* update to 2.6.30.4Florian Fainelli2009-07-311-1/+1
* switch to 2.6.30.3Florian Fainelli2009-07-271-1/+1
* resync kernel configurationFlorian Fainelli2009-07-251-4/+0
* update to 2.6.30.2Imre Kaloz2009-07-201-1/+1
* This patch adds a target for the IBM PowerXCell Accelerator Board. (aka mvXCe...Florian Fainelli2009-07-165-0/+655
>((noinline)) void myusec_delay(int usecs) { unsigned long i; for (i = 0; i < usecs * micro; i++) { /* Make sure the compiler doesn't optimize the loop away. */ asm volatile ("" : : "rm" (i) ); } } static unsigned long measure_os_delay_resolution(void) { unsigned long timeusec; struct timeval start, end; unsigned long counter = 0; gettimeofday(&start, 0); timeusec = 0; while (!timeusec && (++counter < 1000000000)) { gettimeofday(&end, 0); timeusec = 1000000 * (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec); /* Protect against time going forward too much. */ if ((end.tv_sec > start.tv_sec) && ((end.tv_sec - start.tv_sec) >= LONG_MAX / 1000000 - 1)) timeusec = 0; /* Protect against time going backwards during leap seconds. */ if ((end.tv_sec < start.tv_sec) || (timeusec > LONG_MAX)) timeusec = 0; } return timeusec; } static unsigned long measure_delay(int usecs) { unsigned long timeusec; struct timeval start, end; gettimeofday(&start, 0); myusec_delay(usecs); gettimeofday(&end, 0); timeusec = 1000000 * (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec); /* Protect against time going forward too much. */ if ((end.tv_sec > start.tv_sec) && ((end.tv_sec - start.tv_sec) >= LONG_MAX / 1000000 - 1)) timeusec = LONG_MAX; /* Protect against time going backwards during leap seconds. */ if ((end.tv_sec < start.tv_sec) || (timeusec > LONG_MAX)) timeusec = 1; return timeusec; } void myusec_calibrate_delay(void) { unsigned long count = 1000; unsigned long timeusec, resolution; int i, tries = 0; msg_pinfo("Calibrating delay loop... "); resolution = measure_os_delay_resolution(); if (resolution) { msg_pdbg("OS timer resolution is %lu usecs, ", resolution); } else { msg_pinfo("OS timer resolution is unusable. "); } recalibrate: count = 1000; while (1) { timeusec = measure_delay(count); if (timeusec > 1000000 / 4) break; if (count >= ULONG_MAX / 2) { msg_pinfo("timer loop overflow, reduced precision. "); break; } count *= 2; } tries ++; /* Avoid division by zero, but in that case the loop is shot anyway. */ if (!timeusec) timeusec = 1; /* Compute rounded up number of loops per microsecond. */ micro = (count * micro) / timeusec + 1; msg_pdbg("%luM loops per second, ", micro); /* Did we try to recalibrate less than 5 times? */ if (tries < 5) { /* Recheck our timing to make sure we weren't just hitting * a scheduler delay or something similar. */ for (i = 0; i < 4; i++) { if (resolution && (resolution < 10)) { timeusec = measure_delay(100); } else if (resolution && (resolution < ULONG_MAX / 200)) { timeusec = measure_delay(resolution * 10) * 100 / (resolution * 10); } else { /* This workaround should be active for broken * OS and maybe libpayload. The criterion * here is horrible or non-measurable OS timer * resolution which will result in * measure_delay(100)=0 whereas a longer delay * (1000 ms) may be sufficient * to get a nonzero time measurement. */ timeusec = measure_delay(1000000) / 10000; } if (timeusec < 90) { msg_pdbg("delay more than 10%% too short (got " "%lu%% of expected delay), " "recalculating... ", timeusec); goto recalibrate; } } } else { msg_perr("delay loop is unreliable, trying to continue "); } /* We're interested in the actual precision. */ timeusec = measure_delay(10); msg_pdbg("10 myus = %ld us, ", timeusec); timeusec = measure_delay(100); msg_pdbg("100 myus = %ld us, ", timeusec); timeusec = measure_delay(1000); msg_pdbg("1000 myus = %ld us, ", timeusec); timeusec = measure_delay(10000); msg_pdbg("10000 myus = %ld us, ", timeusec); timeusec = measure_delay(resolution * 4); msg_pdbg("%ld myus = %ld us, ", resolution * 4, timeusec); msg_pinfo("OK.\n"); } void internal_delay(int usecs) { /* If the delay is >1 s, use usleep because timing does not need to * be so precise. */ if (usecs > 1000000) { usleep(usecs); } else { myusec_delay(usecs); } }