This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Timer 2 on 814x



Per the PSP Porting Guide:

"By default, the first two timers labelled in kernel as Timer1 and Timer2) are reserved for kernel as periodic tick timer and free running timer, respectively."

As such, I am not able to perform an omap_dm_timer_request_specific(timer2). I get an error, indicating that the request is denied, as expected.

My questions are this:: Is Timer2 critical to kernel operation, if not, can it be taken away from the kernel, and if so, how? Where in the kernel init do I need to remove the code for its use?

Thanks

  • Resolved

    I located where in the kernel Timer 2 is allocated. It's in../arch/arm/mach-omap2/timer-gp.c. It is located in function omap2_gp_timer_init(), wherein a call is made to omap2_gp_clocksource_init(). I have commented out the call for now. If it turns out there are negative affects on the OS of not having this timer, I will update the kernel code to simply use another specific timer. Currently, the kernel is just grabbing the next available timer (which happens to be Timer 2 - refer to highlighted line of code below). Since our hardware layout requires the use of Timer 2, we cannot allow the kernel to just arbitrarily grab Timer 2.

    static void __init omap2_gp_timer_init(void)
    {
    #ifdef CONFIG_LOCAL_TIMERS
            if (cpu_is_omap44xx()) {
                    twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256);
                    BUG_ON(!twd_base);
            }
    #endif
            omap_dm_timer_init();

            omap2_gp_clockevent_init();
    // JJW 09/18/2012
    // Commented out so we have use of Timer 2 for our use.
    //      omap2_gp_clocksource_init();
    }

    * Setup free-running counter for clocksource */
    static void __init omap2_gp_clocksource_init(void)
    {
            static struct omap_dm_timer *gpt;
            u32 tick_rate;
            static char err1[] __initdata = KERN_ERR
                    "%s: failed to request dm-timer\n";
            static char err2[] __initdata = KERN_ERR
                    "%s: can't register clocksource!\n";

            gpt = omap_dm_timer_request();
            if (!gpt)
                    printk(err1, clocksource_gpt.name);
            gpt_clocksource = gpt;

            omap_dm_timer_set_source(gpt, OMAP_TIMER_SRC_SYS_CLK);
            tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt));

            omap_dm_timer_set_load_start(gpt, 1, 0);

            clocksource_gpt.mult =
                    clocksource_khz2mult(tick_rate/1000, clocksource_gpt.shift);
            if (clocksource_register(&clocksource_gpt))
                    printk(err2, clocksource_gpt.name);
    }