diff --git a/drivers/clocksource/cs5535-clockevt.c b/drivers/clocksource/cs5535-clockevt.c index a1df588343f2..446bb595030b 100644 --- a/drivers/clocksource/cs5535-clockevt.c +++ b/drivers/clocksource/cs5535-clockevt.c @@ -18,9 +18,12 @@ #include #include #include +#include #define DRV_NAME "cs5535-clockevt" +static int verbose_handler = 0; + static int timer_irq; module_param_hw_named(irq, timer_irq, int, irq, 0644); MODULE_PARM_DESC(irq, "Which IRQ to use for the clock source MFGPT ticks."); @@ -129,7 +132,14 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id) cs5535_mfgpt_write(cs5535_event_clock, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN | MFGPT_SETUP_CMP2); - cs5535_clockevent.event_handler(&cs5535_clockevent); + if (verbose_handler) + printk(KERN_INFO DRV_NAME ": mfgpt_tick called\n"); + + if (!verbose_handler && cs5535_clockevent.event_handler == NULL) + printk(KERN_ERR DRV_NAME ": mfgpt_tick with null event_handler while not verbose!\n"); + + if (cs5535_clockevent.event_handler != NULL) + cs5535_clockevent.event_handler(&cs5535_clockevent); return IRQ_HANDLED; } @@ -145,6 +155,14 @@ static int __init cs5535_mfgpt_init(void) int ret; uint16_t val; + printk(KERN_INFO DRV_NAME ": enabling verbose handler\n"); + WRITE_ONCE(verbose_handler, 1); + + printk(KERN_INFO DRV_NAME ": sleeping(1)...\n"); + msleep(1000); + printk(KERN_INFO DRV_NAME ": done(1)\n"); + + printk(KERN_INFO DRV_NAME ": calling cs5535_mfgpt_alloc_timer\n"); timer = cs5535_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); if (!timer) { printk(KERN_ERR DRV_NAME ": Could not allocate MFGPT timer\n"); @@ -152,6 +170,18 @@ static int __init cs5535_mfgpt_init(void) } cs5535_event_clock = timer; + printk(KERN_INFO DRV_NAME ": sleeping(2)...\n"); + msleep(1000); + printk(KERN_INFO DRV_NAME ": done(2)\n"); + + printk(KERN_INFO DRV_NAME ": calling disable_timer\n"); + disable_timer(cs5535_event_clock); + + printk(KERN_INFO DRV_NAME ": sleeping(3)...\n"); + msleep(1000); + printk(KERN_INFO DRV_NAME ": done(3)\n"); + + printk(KERN_INFO DRV_NAME ": calling cs5535_mfgpt_setup_irq\n"); /* Set up the IRQ on the MFGPT side */ if (cs5535_mfgpt_setup_irq(timer, MFGPT_CMP2, &timer_irq)) { printk(KERN_ERR DRV_NAME ": Could not set up IRQ %d\n", @@ -159,6 +189,11 @@ static int __init cs5535_mfgpt_init(void) goto err_timer; } + printk(KERN_INFO DRV_NAME ": sleeping(4)...\n"); + msleep(1000); + printk(KERN_INFO DRV_NAME ": done(4)\n"); + + printk(KERN_INFO DRV_NAME ": calling setup_irq\n"); /* And register it with the kernel */ ret = setup_irq(timer_irq, &mfgptirq); if (ret) { @@ -166,17 +201,30 @@ static int __init cs5535_mfgpt_init(void) goto err_irq; } + printk(KERN_INFO DRV_NAME ": sleeping(5)...\n"); + msleep(1000); + printk(KERN_INFO DRV_NAME ": done(5)\n"); + /* Set the clock scale and enable the event mode for CMP2 */ val = MFGPT_SCALE | (3 << 8); + printk(KERN_INFO DRV_NAME ": doing write\n"); cs5535_mfgpt_write(cs5535_event_clock, MFGPT_REG_SETUP, val); + printk(KERN_INFO DRV_NAME ": sleeping(6)...\n"); + msleep(1000); + printk(KERN_INFO DRV_NAME ": done(6)\n"); + /* Set up the clock event */ printk(KERN_INFO DRV_NAME ": Registering MFGPT timer as a clock event, using IRQ %d\n", timer_irq); clockevents_config_and_register(&cs5535_clockevent, MFGPT_HZ, 0xF, 0xFFFE); + printk(KERN_INFO DRV_NAME ": clockevents_config_and_register returned\n"); + + printk(KERN_INFO DRV_NAME ": disabling verbose handler\n"); + WRITE_ONCE(verbose_handler, 0); return 0;