Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clocksource/drivers/fttmr010: Set interrupt and shutdown

In preparation for supporting the ast2600, pass the shutdown and
interrupt functions to the common init callback.

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20191107094218.13210-3-joel@jms.id.au

authored by

Joel Stanley and committed by
Daniel Lezcano
5422413c 84fb64c2

+46 -5
+46 -5
drivers/clocksource/timer-fttmr010.c
··· 38 38 #define TIMER_CR (0x30) 39 39 40 40 /* 41 + * Control register set to clear for ast2600 only. 42 + */ 43 + #define AST2600_TIMER_CR_CLR (0x3c) 44 + 45 + /* 41 46 * Control register (TMC30) bit fields for fttmr010/gemini/moxart timers. 42 47 */ 43 48 #define TIMER_1_CR_ENABLE BIT(0) ··· 168 163 return 0; 169 164 } 170 165 166 + static int ast2600_timer_shutdown(struct clock_event_device *evt) 167 + { 168 + struct fttmr010 *fttmr010 = to_fttmr010(evt); 169 + 170 + /* Stop */ 171 + writel(fttmr010->t1_enable_val, fttmr010->base + AST2600_TIMER_CR_CLR); 172 + 173 + return 0; 174 + } 175 + 171 176 static int fttmr010_timer_shutdown(struct clock_event_device *evt) 172 177 { 173 178 struct fttmr010 *fttmr010 = to_fttmr010(evt); ··· 259 244 return IRQ_HANDLED; 260 245 } 261 246 262 - static int __init fttmr010_common_init(struct device_node *np, bool is_aspeed) 247 + static irqreturn_t ast2600_timer_interrupt(int irq, void *dev_id) 248 + { 249 + struct clock_event_device *evt = dev_id; 250 + struct fttmr010 *fttmr010 = to_fttmr010(evt); 251 + 252 + writel(0x1, fttmr010->base + TIMER_INTR_STATE); 253 + 254 + evt->event_handler(evt); 255 + return IRQ_HANDLED; 256 + } 257 + 258 + static int __init fttmr010_common_init(struct device_node *np, 259 + bool is_aspeed, 260 + int (*timer_shutdown)(struct clock_event_device *), 261 + irq_handler_t irq_handler) 263 262 { 264 263 struct fttmr010 *fttmr010; 265 264 int irq; ··· 374 345 fttmr010->tick_rate); 375 346 } 376 347 377 - fttmr010->timer_shutdown = fttmr010_timer_shutdown; 348 + fttmr010->timer_shutdown = timer_shutdown; 378 349 379 350 /* 380 351 * Setup clockevent timer (interrupt-driven) on timer 1. ··· 383 354 writel(0, fttmr010->base + TIMER1_LOAD); 384 355 writel(0, fttmr010->base + TIMER1_MATCH1); 385 356 writel(0, fttmr010->base + TIMER1_MATCH2); 386 - ret = request_irq(irq, fttmr010_timer_interrupt, IRQF_TIMER, 357 + ret = request_irq(irq, irq_handler, IRQF_TIMER, 387 358 "FTTMR010-TIMER1", &fttmr010->clkevt); 388 359 if (ret) { 389 360 pr_err("FTTMR010-TIMER1 no IRQ\n"); ··· 430 401 return ret; 431 402 } 432 403 404 + static __init int ast2600_timer_init(struct device_node *np) 405 + { 406 + return fttmr010_common_init(np, true, 407 + ast2600_timer_shutdown, 408 + ast2600_timer_interrupt); 409 + } 410 + 433 411 static __init int aspeed_timer_init(struct device_node *np) 434 412 { 435 - return fttmr010_common_init(np, true); 413 + return fttmr010_common_init(np, true, 414 + fttmr010_timer_shutdown, 415 + fttmr010_timer_interrupt); 436 416 } 437 417 438 418 static __init int fttmr010_timer_init(struct device_node *np) 439 419 { 440 - return fttmr010_common_init(np, false); 420 + return fttmr010_common_init(np, false, 421 + fttmr010_timer_shutdown, 422 + fttmr010_timer_interrupt); 441 423 } 442 424 443 425 TIMER_OF_DECLARE(fttmr010, "faraday,fttmr010", fttmr010_timer_init); ··· 456 416 TIMER_OF_DECLARE(moxart, "moxa,moxart-timer", fttmr010_timer_init); 457 417 TIMER_OF_DECLARE(ast2400, "aspeed,ast2400-timer", aspeed_timer_init); 458 418 TIMER_OF_DECLARE(ast2500, "aspeed,ast2500-timer", aspeed_timer_init); 419 + TIMER_OF_DECLARE(ast2600, "aspeed,ast2600-timer", ast2600_timer_init);