Forum Discussion

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    At first, please check whether the timer interruption is working or not. The 'calibrate_delay' routine needs the increase of 'jiffies' as follows.

    
    void __cpuinit calibrate_delay(void)
    {
    	unsigned long ticks, loopbit;
    	int lps_precision = LPS_PREC;
    	if (preset_lpj) {
    		loops_per_jiffy = preset_lpj;
    		printk(KERN_INFO
    			"Calibrating delay loop (skipped) preset value.. ");
    	} else if ((smp_processor_id() == 0) && lpj_fine) {
    		loops_per_jiffy = lpj_fine;
    		printk(KERN_INFO
    			"Calibrating delay loop (skipped), "
    			"value calculated using timer frequency.. ");
    	} else if ((loops_per_jiffy = calibrate_delay_direct()) != 0) {
    		printk(KERN_INFO
    			"Calibrating delay using timer specific routine.. ");
    	} else {
    		loops_per_jiffy = (1<<12);
    		printk(KERN_INFO "Calibrating delay loop... ");
    		while ((loops_per_jiffy <<= 1) != 0) {
    			/* wait for "start of" clock tick */
    			ticks = jiffies;
    			while (ticks == jiffies)
    				/* nothing */;
    			/* Go .. */
    			ticks = jiffies;
    			__delay(loops_per_jiffy);
    			ticks = jiffies - ticks;
    			if (ticks)
    				break;
    		}
    		/*
    		 * Do a binary approximation to get loops_per_jiffy set to
    		 * equal one clock (up to lps_precision bits)
    		 */
    		loops_per_jiffy >>= 1;
    		loopbit = loops_per_jiffy;
    		while (lps_precision-- && (loopbit >>= 1)) {
    			loops_per_jiffy |= loopbit;
    			ticks = jiffies;
    			while (ticks == jiffies)
    				/* nothing */;
    			ticks = jiffies;
    			__delay(loops_per_jiffy);
    			if (jiffies != ticks)	/* longer than 1 tick */
    				loops_per_jiffy &= ~loopbit;
    		}
    	}
    	printk(KERN_CONT "%lu.%02lu BogoMIPS (lpj=%lu)\n",
    			loops_per_jiffy/(500000/HZ),
    			(loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy);
    }

    Kazu
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    We replaced our lines of code by your own, but it has not changed the problem.

    We are always blocked in the same place.

    Is there another solution to?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    --- Quote Start ---

    We replaced our lines of code by your own, but it has not changed the problem.

    We are always blocked in the same place.

    Is there another solution to?

    --- Quote End ---

    I don't mean that your source code is wrong. The variable 'jiffies' must be increased in the interrupt service routine. And to evoke it, your hardware must generate 'timer interruptions'. So please check your timer is working first.

    Kazu