imxtm 77 drivers/clocksource/timer-imx-gpt.c void (*gpt_setup_tctl)(struct imx_timer *imxtm); imxtm 78 drivers/clocksource/timer-imx-gpt.c void (*gpt_irq_enable)(struct imx_timer *imxtm); imxtm 79 drivers/clocksource/timer-imx-gpt.c void (*gpt_irq_disable)(struct imx_timer *imxtm); imxtm 80 drivers/clocksource/timer-imx-gpt.c void (*gpt_irq_acknowledge)(struct imx_timer *imxtm); imxtm 90 drivers/clocksource/timer-imx-gpt.c static void imx1_gpt_irq_disable(struct imx_timer *imxtm) imxtm 94 drivers/clocksource/timer-imx-gpt.c tmp = readl_relaxed(imxtm->base + MXC_TCTL); imxtm 95 drivers/clocksource/timer-imx-gpt.c writel_relaxed(tmp & ~MX1_2_TCTL_IRQEN, imxtm->base + MXC_TCTL); imxtm 99 drivers/clocksource/timer-imx-gpt.c static void imx31_gpt_irq_disable(struct imx_timer *imxtm) imxtm 101 drivers/clocksource/timer-imx-gpt.c writel_relaxed(0, imxtm->base + V2_IR); imxtm 105 drivers/clocksource/timer-imx-gpt.c static void imx1_gpt_irq_enable(struct imx_timer *imxtm) imxtm 109 drivers/clocksource/timer-imx-gpt.c tmp = readl_relaxed(imxtm->base + MXC_TCTL); imxtm 110 drivers/clocksource/timer-imx-gpt.c writel_relaxed(tmp | MX1_2_TCTL_IRQEN, imxtm->base + MXC_TCTL); imxtm 114 drivers/clocksource/timer-imx-gpt.c static void imx31_gpt_irq_enable(struct imx_timer *imxtm) imxtm 116 drivers/clocksource/timer-imx-gpt.c writel_relaxed(1<<0, imxtm->base + V2_IR); imxtm 120 drivers/clocksource/timer-imx-gpt.c static void imx1_gpt_irq_acknowledge(struct imx_timer *imxtm) imxtm 122 drivers/clocksource/timer-imx-gpt.c writel_relaxed(0, imxtm->base + MX1_2_TSTAT); imxtm 125 drivers/clocksource/timer-imx-gpt.c static void imx21_gpt_irq_acknowledge(struct imx_timer *imxtm) imxtm 128 drivers/clocksource/timer-imx-gpt.c imxtm->base + MX1_2_TSTAT); imxtm 131 drivers/clocksource/timer-imx-gpt.c static void imx31_gpt_irq_acknowledge(struct imx_timer *imxtm) imxtm 133 drivers/clocksource/timer-imx-gpt.c writel_relaxed(V2_TSTAT_OF1, imxtm->base + V2_TSTAT); imxtm 153 drivers/clocksource/timer-imx-gpt.c static int __init mxc_clocksource_init(struct imx_timer *imxtm) imxtm 155 drivers/clocksource/timer-imx-gpt.c unsigned int c = clk_get_rate(imxtm->clk_per); imxtm 156 drivers/clocksource/timer-imx-gpt.c void __iomem *reg = imxtm->base + imxtm->gpt->reg_tcn; imxtm 176 drivers/clocksource/timer-imx-gpt.c struct imx_timer *imxtm = to_imx_timer(ced); imxtm 179 drivers/clocksource/timer-imx-gpt.c tcmp = readl_relaxed(imxtm->base + MX1_2_TCN) + evt; imxtm 181 drivers/clocksource/timer-imx-gpt.c writel_relaxed(tcmp, imxtm->base + MX1_2_TCMP); imxtm 183 drivers/clocksource/timer-imx-gpt.c return (int)(tcmp - readl_relaxed(imxtm->base + MX1_2_TCN)) < 0 ? imxtm 190 drivers/clocksource/timer-imx-gpt.c struct imx_timer *imxtm = to_imx_timer(ced); imxtm 193 drivers/clocksource/timer-imx-gpt.c tcmp = readl_relaxed(imxtm->base + V2_TCN) + evt; imxtm 195 drivers/clocksource/timer-imx-gpt.c writel_relaxed(tcmp, imxtm->base + V2_TCMP); imxtm 198 drivers/clocksource/timer-imx-gpt.c (int)(tcmp - readl_relaxed(imxtm->base + V2_TCN)) < 0 ? imxtm 204 drivers/clocksource/timer-imx-gpt.c struct imx_timer *imxtm = to_imx_timer(ced); imxtm 208 drivers/clocksource/timer-imx-gpt.c imxtm->gpt->gpt_irq_disable(imxtm); imxtm 210 drivers/clocksource/timer-imx-gpt.c tcn = readl_relaxed(imxtm->base + imxtm->gpt->reg_tcn); imxtm 212 drivers/clocksource/timer-imx-gpt.c writel_relaxed(tcn - 3, imxtm->base + imxtm->gpt->reg_tcmp); imxtm 215 drivers/clocksource/timer-imx-gpt.c imxtm->gpt->gpt_irq_acknowledge(imxtm); imxtm 226 drivers/clocksource/timer-imx-gpt.c struct imx_timer *imxtm = to_imx_timer(ced); imxtm 229 drivers/clocksource/timer-imx-gpt.c imxtm->gpt->gpt_irq_disable(imxtm); imxtm 232 drivers/clocksource/timer-imx-gpt.c u32 tcn = readl_relaxed(imxtm->base + imxtm->gpt->reg_tcn); imxtm 234 drivers/clocksource/timer-imx-gpt.c writel_relaxed(tcn - 3, imxtm->base + imxtm->gpt->reg_tcmp); imxtm 237 drivers/clocksource/timer-imx-gpt.c imxtm->gpt->gpt_irq_acknowledge(imxtm); imxtm 250 drivers/clocksource/timer-imx-gpt.c imxtm->gpt->gpt_irq_enable(imxtm); imxtm 261 drivers/clocksource/timer-imx-gpt.c struct imx_timer *imxtm = to_imx_timer(ced); imxtm 264 drivers/clocksource/timer-imx-gpt.c tstat = readl_relaxed(imxtm->base + imxtm->gpt->reg_tstat); imxtm 266 drivers/clocksource/timer-imx-gpt.c imxtm->gpt->gpt_irq_acknowledge(imxtm); imxtm 273 drivers/clocksource/timer-imx-gpt.c static int __init mxc_clockevent_init(struct imx_timer *imxtm) imxtm 275 drivers/clocksource/timer-imx-gpt.c struct clock_event_device *ced = &imxtm->ced; imxtm 276 drivers/clocksource/timer-imx-gpt.c struct irqaction *act = &imxtm->act; imxtm 283 drivers/clocksource/timer-imx-gpt.c ced->set_next_event = imxtm->gpt->set_next_event; imxtm 286 drivers/clocksource/timer-imx-gpt.c ced->irq = imxtm->irq; imxtm 287 drivers/clocksource/timer-imx-gpt.c clockevents_config_and_register(ced, clk_get_rate(imxtm->clk_per), imxtm 295 drivers/clocksource/timer-imx-gpt.c return setup_irq(imxtm->irq, act); imxtm 298 drivers/clocksource/timer-imx-gpt.c static void imx1_gpt_setup_tctl(struct imx_timer *imxtm) imxtm 303 drivers/clocksource/timer-imx-gpt.c writel_relaxed(tctl_val, imxtm->base + MXC_TCTL); imxtm 307 drivers/clocksource/timer-imx-gpt.c static void imx31_gpt_setup_tctl(struct imx_timer *imxtm) imxtm 312 drivers/clocksource/timer-imx-gpt.c if (clk_get_rate(imxtm->clk_per) == V2_TIMER_RATE_OSC_DIV8) imxtm 317 drivers/clocksource/timer-imx-gpt.c writel_relaxed(tctl_val, imxtm->base + MXC_TCTL); imxtm 320 drivers/clocksource/timer-imx-gpt.c static void imx6dl_gpt_setup_tctl(struct imx_timer *imxtm) imxtm 325 drivers/clocksource/timer-imx-gpt.c if (clk_get_rate(imxtm->clk_per) == V2_TIMER_RATE_OSC_DIV8) { imxtm 328 drivers/clocksource/timer-imx-gpt.c writel_relaxed(7 << V2_TPRER_PRE24M, imxtm->base + MXC_TPRER); imxtm 334 drivers/clocksource/timer-imx-gpt.c writel_relaxed(tctl_val, imxtm->base + MXC_TCTL); imxtm 381 drivers/clocksource/timer-imx-gpt.c static int __init _mxc_timer_init(struct imx_timer *imxtm) imxtm 385 drivers/clocksource/timer-imx-gpt.c switch (imxtm->type) { imxtm 387 drivers/clocksource/timer-imx-gpt.c imxtm->gpt = &imx1_gpt_data; imxtm 390 drivers/clocksource/timer-imx-gpt.c imxtm->gpt = &imx21_gpt_data; imxtm 393 drivers/clocksource/timer-imx-gpt.c imxtm->gpt = &imx31_gpt_data; imxtm 396 drivers/clocksource/timer-imx-gpt.c imxtm->gpt = &imx6dl_gpt_data; imxtm 402 drivers/clocksource/timer-imx-gpt.c if (IS_ERR(imxtm->clk_per)) { imxtm 404 drivers/clocksource/timer-imx-gpt.c return PTR_ERR(imxtm->clk_per); imxtm 407 drivers/clocksource/timer-imx-gpt.c if (!IS_ERR(imxtm->clk_ipg)) imxtm 408 drivers/clocksource/timer-imx-gpt.c clk_prepare_enable(imxtm->clk_ipg); imxtm 410 drivers/clocksource/timer-imx-gpt.c clk_prepare_enable(imxtm->clk_per); imxtm 416 drivers/clocksource/timer-imx-gpt.c writel_relaxed(0, imxtm->base + MXC_TCTL); imxtm 417 drivers/clocksource/timer-imx-gpt.c writel_relaxed(0, imxtm->base + MXC_TPRER); /* see datasheet note */ imxtm 419 drivers/clocksource/timer-imx-gpt.c imxtm->gpt->gpt_setup_tctl(imxtm); imxtm 422 drivers/clocksource/timer-imx-gpt.c ret = mxc_clocksource_init(imxtm); imxtm 426 drivers/clocksource/timer-imx-gpt.c return mxc_clockevent_init(imxtm); imxtm 431 drivers/clocksource/timer-imx-gpt.c struct imx_timer *imxtm; imxtm 433 drivers/clocksource/timer-imx-gpt.c imxtm = kzalloc(sizeof(*imxtm), GFP_KERNEL); imxtm 434 drivers/clocksource/timer-imx-gpt.c BUG_ON(!imxtm); imxtm 436 drivers/clocksource/timer-imx-gpt.c imxtm->clk_per = clk_get_sys("imx-gpt.0", "per"); imxtm 437 drivers/clocksource/timer-imx-gpt.c imxtm->clk_ipg = clk_get_sys("imx-gpt.0", "ipg"); imxtm 439 drivers/clocksource/timer-imx-gpt.c imxtm->base = ioremap(pbase, SZ_4K); imxtm 440 drivers/clocksource/timer-imx-gpt.c BUG_ON(!imxtm->base); imxtm 442 drivers/clocksource/timer-imx-gpt.c imxtm->type = type; imxtm 443 drivers/clocksource/timer-imx-gpt.c imxtm->irq = irq; imxtm 445 drivers/clocksource/timer-imx-gpt.c _mxc_timer_init(imxtm); imxtm 450 drivers/clocksource/timer-imx-gpt.c struct imx_timer *imxtm; imxtm 458 drivers/clocksource/timer-imx-gpt.c imxtm = kzalloc(sizeof(*imxtm), GFP_KERNEL); imxtm 459 drivers/clocksource/timer-imx-gpt.c if (!imxtm) imxtm 462 drivers/clocksource/timer-imx-gpt.c imxtm->base = of_iomap(np, 0); imxtm 463 drivers/clocksource/timer-imx-gpt.c if (!imxtm->base) imxtm 466 drivers/clocksource/timer-imx-gpt.c imxtm->irq = irq_of_parse_and_map(np, 0); imxtm 467 drivers/clocksource/timer-imx-gpt.c if (imxtm->irq <= 0) imxtm 470 drivers/clocksource/timer-imx-gpt.c imxtm->clk_ipg = of_clk_get_by_name(np, "ipg"); imxtm 473 drivers/clocksource/timer-imx-gpt.c imxtm->clk_per = of_clk_get_by_name(np, "osc_per"); imxtm 474 drivers/clocksource/timer-imx-gpt.c if (IS_ERR(imxtm->clk_per)) imxtm 475 drivers/clocksource/timer-imx-gpt.c imxtm->clk_per = of_clk_get_by_name(np, "per"); imxtm 477 drivers/clocksource/timer-imx-gpt.c imxtm->type = type; imxtm 479 drivers/clocksource/timer-imx-gpt.c ret = _mxc_timer_init(imxtm);