Lines Matching refs:tc
45 struct atmel_tc *tc; in atmel_tc_alloc() local
49 list_for_each_entry(tc, &tc_list, node) { in atmel_tc_alloc()
50 if (tc->allocated) in atmel_tc_alloc()
53 if ((tc->pdev->dev.of_node && tc->id == block) || in atmel_tc_alloc()
54 (tc->pdev->id == block)) { in atmel_tc_alloc()
55 pdev = tc->pdev; in atmel_tc_alloc()
56 tc->allocated = true; in atmel_tc_alloc()
62 return pdev ? tc : NULL; in atmel_tc_alloc()
73 void atmel_tc_free(struct atmel_tc *tc) in atmel_tc_free() argument
76 if (tc->allocated) in atmel_tc_free()
77 tc->allocated = false; in atmel_tc_free()
108 struct atmel_tc *tc; in tc_probe() local
118 tc = devm_kzalloc(&pdev->dev, sizeof(struct atmel_tc), GFP_KERNEL); in tc_probe()
119 if (!tc) in tc_probe()
122 tc->pdev = pdev; in tc_probe()
128 tc->slow_clk = devm_clk_get(&pdev->dev, "slow_clk"); in tc_probe()
129 if (IS_ERR(tc->slow_clk)) in tc_probe()
130 return PTR_ERR(tc->slow_clk); in tc_probe()
133 tc->regs = devm_ioremap_resource(&pdev->dev, r); in tc_probe()
134 if (IS_ERR(tc->regs)) in tc_probe()
135 return PTR_ERR(tc->regs); in tc_probe()
142 tc->tcb_config = match->data; in tc_probe()
144 tc->id = of_alias_get_id(tc->pdev->dev.of_node, "tcb"); in tc_probe()
146 tc->id = pdev->id; in tc_probe()
149 tc->clk[0] = clk; in tc_probe()
150 tc->clk[1] = devm_clk_get(&pdev->dev, "t1_clk"); in tc_probe()
151 if (IS_ERR(tc->clk[1])) in tc_probe()
152 tc->clk[1] = clk; in tc_probe()
153 tc->clk[2] = devm_clk_get(&pdev->dev, "t2_clk"); in tc_probe()
154 if (IS_ERR(tc->clk[2])) in tc_probe()
155 tc->clk[2] = clk; in tc_probe()
157 tc->irq[0] = irq; in tc_probe()
158 tc->irq[1] = platform_get_irq(pdev, 1); in tc_probe()
159 if (tc->irq[1] < 0) in tc_probe()
160 tc->irq[1] = irq; in tc_probe()
161 tc->irq[2] = platform_get_irq(pdev, 2); in tc_probe()
162 if (tc->irq[2] < 0) in tc_probe()
163 tc->irq[2] = irq; in tc_probe()
166 writel(ATMEL_TC_ALL_IRQ, tc->regs + ATMEL_TC_REG(i, IDR)); in tc_probe()
169 list_add_tail(&tc->node, &tc_list); in tc_probe()
172 platform_set_drvdata(pdev, tc); in tc_probe()
180 struct atmel_tc *tc = platform_get_drvdata(pdev); in tc_shutdown() local
183 writel(ATMEL_TC_ALL_IRQ, tc->regs + ATMEL_TC_REG(i, IDR)); in tc_shutdown()