Lines Matching full:lpc_snoop
131 struct aspeed_lpc_snoop *lpc_snoop = arg; in aspeed_lpc_snoop_irq() local
134 if (regmap_read(lpc_snoop->regmap, HICR6, ®)) in aspeed_lpc_snoop_irq()
143 regmap_write(lpc_snoop->regmap, HICR6, reg); in aspeed_lpc_snoop_irq()
146 regmap_read(lpc_snoop->regmap, SNPWDR, &data); in aspeed_lpc_snoop_irq()
151 put_fifo_with_discard(&lpc_snoop->chan[0], val); in aspeed_lpc_snoop_irq()
156 put_fifo_with_discard(&lpc_snoop->chan[1], val); in aspeed_lpc_snoop_irq()
162 static int aspeed_lpc_snoop_config_irq(struct aspeed_lpc_snoop *lpc_snoop, in aspeed_lpc_snoop_config_irq() argument
168 lpc_snoop->irq = platform_get_irq(pdev, 0); in aspeed_lpc_snoop_config_irq()
169 if (!lpc_snoop->irq) in aspeed_lpc_snoop_config_irq()
172 rc = devm_request_irq(dev, lpc_snoop->irq, in aspeed_lpc_snoop_config_irq()
174 DEVICE_NAME, lpc_snoop); in aspeed_lpc_snoop_config_irq()
176 dev_warn(dev, "Unable to request IRQ %d\n", lpc_snoop->irq); in aspeed_lpc_snoop_config_irq()
177 lpc_snoop->irq = 0; in aspeed_lpc_snoop_config_irq()
184 static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop, in aspeed_lpc_enable_snoop() argument
193 init_waitqueue_head(&lpc_snoop->chan[channel].wq); in aspeed_lpc_enable_snoop()
195 rc = kfifo_alloc(&lpc_snoop->chan[channel].fifo, in aspeed_lpc_enable_snoop()
200 lpc_snoop->chan[channel].miscdev.minor = MISC_DYNAMIC_MINOR; in aspeed_lpc_enable_snoop()
201 lpc_snoop->chan[channel].miscdev.name = in aspeed_lpc_enable_snoop()
203 lpc_snoop->chan[channel].miscdev.fops = &snoop_fops; in aspeed_lpc_enable_snoop()
204 lpc_snoop->chan[channel].miscdev.parent = dev; in aspeed_lpc_enable_snoop()
205 rc = misc_register(&lpc_snoop->chan[channel].miscdev); in aspeed_lpc_enable_snoop()
227 regmap_update_bits(lpc_snoop->regmap, HICR5, hicr5_en, hicr5_en); in aspeed_lpc_enable_snoop()
228 regmap_update_bits(lpc_snoop->regmap, SNPWADR, snpwadr_mask, in aspeed_lpc_enable_snoop()
231 regmap_update_bits(lpc_snoop->regmap, HICRB, in aspeed_lpc_enable_snoop()
237 static void aspeed_lpc_disable_snoop(struct aspeed_lpc_snoop *lpc_snoop, in aspeed_lpc_disable_snoop() argument
242 regmap_update_bits(lpc_snoop->regmap, HICR5, in aspeed_lpc_disable_snoop()
247 regmap_update_bits(lpc_snoop->regmap, HICR5, in aspeed_lpc_disable_snoop()
255 kfifo_free(&lpc_snoop->chan[channel].fifo); in aspeed_lpc_disable_snoop()
256 misc_deregister(&lpc_snoop->chan[channel].miscdev); in aspeed_lpc_disable_snoop()
261 struct aspeed_lpc_snoop *lpc_snoop; in aspeed_lpc_snoop_probe() local
269 lpc_snoop = devm_kzalloc(dev, sizeof(*lpc_snoop), GFP_KERNEL); in aspeed_lpc_snoop_probe()
270 if (!lpc_snoop) in aspeed_lpc_snoop_probe()
281 lpc_snoop->regmap = syscon_node_to_regmap(np); in aspeed_lpc_snoop_probe()
282 if (IS_ERR(lpc_snoop->regmap)) { in aspeed_lpc_snoop_probe()
287 dev_set_drvdata(&pdev->dev, lpc_snoop); in aspeed_lpc_snoop_probe()
295 lpc_snoop->clk = devm_clk_get(dev, NULL); in aspeed_lpc_snoop_probe()
296 if (IS_ERR(lpc_snoop->clk)) { in aspeed_lpc_snoop_probe()
297 rc = PTR_ERR(lpc_snoop->clk); in aspeed_lpc_snoop_probe()
302 rc = clk_prepare_enable(lpc_snoop->clk); in aspeed_lpc_snoop_probe()
308 rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev); in aspeed_lpc_snoop_probe()
312 rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port); in aspeed_lpc_snoop_probe()
319 rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port); in aspeed_lpc_snoop_probe()
321 aspeed_lpc_disable_snoop(lpc_snoop, 0); in aspeed_lpc_snoop_probe()
329 clk_disable_unprepare(lpc_snoop->clk); in aspeed_lpc_snoop_probe()
336 struct aspeed_lpc_snoop *lpc_snoop = dev_get_drvdata(&pdev->dev); in aspeed_lpc_snoop_remove() local
339 aspeed_lpc_disable_snoop(lpc_snoop, 0); in aspeed_lpc_snoop_remove()
340 aspeed_lpc_disable_snoop(lpc_snoop, 1); in aspeed_lpc_snoop_remove()
342 clk_disable_unprepare(lpc_snoop->clk); in aspeed_lpc_snoop_remove()