Lines Matching +full:interrupt +full:- +full:clk

1 // SPDX-License-Identifier: GPL-2.0-only
8 #include <linux/interrupt.h>
15 #include "../clk.h"
23 /* interrupt node enable */
25 /* interrupt control register */
27 /* interrupt capture register */
75 int timer = irq - irqres[0].start; in timer_irq_handler()
94 static int gptu_enable(struct clk *clk) in gptu_enable() argument
96 int ret = request_irq(irqres[clk->bits].start, timer_irq_handler, in gptu_enable()
104 GPTU_CON(clk->bits)); in gptu_enable()
105 gptu_w32(1, GPTU_RLD(clk->bits)); in gptu_enable()
106 gptu_w32(gptu_r32(GPTU_IRNEN) | BIT(clk->bits), GPTU_IRNEN); in gptu_enable()
107 gptu_w32(RUN_SEN | RUN_RL, GPTU_RUN(clk->bits)); in gptu_enable()
111 static void gptu_disable(struct clk *clk) in gptu_disable() argument
113 gptu_w32(0, GPTU_RUN(clk->bits)); in gptu_disable()
114 gptu_w32(0, GPTU_CON(clk->bits)); in gptu_disable()
115 gptu_w32(0, GPTU_RLD(clk->bits)); in gptu_disable()
116 gptu_w32(gptu_r32(GPTU_IRNEN) & ~BIT(clk->bits), GPTU_IRNEN); in gptu_disable()
117 free_irq(irqres[clk->bits].start, NULL); in gptu_disable()
123 struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL); in clkdev_add_gptu() local
125 if (!clk) in clkdev_add_gptu()
127 clk->cl.dev_id = dev_name(dev); in clkdev_add_gptu()
128 clk->cl.con_id = con; in clkdev_add_gptu()
129 clk->cl.clk = clk; in clkdev_add_gptu()
130 clk->enable = gptu_enable; in clkdev_add_gptu()
131 clk->disable = gptu_disable; in clkdev_add_gptu()
132 clk->bits = timer; in clkdev_add_gptu()
133 clkdev_add(&clk->cl); in clkdev_add_gptu()
138 struct clk *clk; in gptu_probe() local
141 if (of_irq_to_resource_table(pdev->dev.of_node, irqres, 6) != 6) { in gptu_probe()
142 dev_err(&pdev->dev, "Failed to get IRQ list\n"); in gptu_probe()
143 return -EINVAL; in gptu_probe()
149 gptu_membase = devm_ioremap_resource(&pdev->dev, res); in gptu_probe()
154 clk = clk_get(&pdev->dev, NULL); in gptu_probe()
155 if (IS_ERR(clk)) { in gptu_probe()
156 dev_err(&pdev->dev, "Failed to get clock\n"); in gptu_probe()
157 return -ENOENT; in gptu_probe()
159 clk_enable(clk); in gptu_probe()
166 dev_err(&pdev->dev, "Failed to find magic\n"); in gptu_probe()
168 clk_disable(clk); in gptu_probe()
169 clk_put(clk); in gptu_probe()
170 return -ENAVAIL; in gptu_probe()
174 clkdev_add_gptu(&pdev->dev, "timer1a", TIMER1A); in gptu_probe()
175 clkdev_add_gptu(&pdev->dev, "timer1b", TIMER1B); in gptu_probe()
176 clkdev_add_gptu(&pdev->dev, "timer2a", TIMER2A); in gptu_probe()
177 clkdev_add_gptu(&pdev->dev, "timer2b", TIMER2B); in gptu_probe()
178 clkdev_add_gptu(&pdev->dev, "timer3a", TIMER3A); in gptu_probe()
179 clkdev_add_gptu(&pdev->dev, "timer3b", TIMER3B); in gptu_probe()
181 dev_info(&pdev->dev, "gptu: 6 timers loaded\n"); in gptu_probe()
187 { .compatible = "lantiq,gptu-xway" },
194 .name = "gptu-xway",