Lines Matching refs:lpc_snoop
132 struct aspeed_lpc_snoop *lpc_snoop = arg; in aspeed_lpc_snoop_irq() local
135 if (regmap_read(lpc_snoop->regmap, HICR6, ®)) in aspeed_lpc_snoop_irq()
144 regmap_write(lpc_snoop->regmap, HICR6, reg); in aspeed_lpc_snoop_irq()
147 regmap_read(lpc_snoop->regmap, SNPWDR, &data); in aspeed_lpc_snoop_irq()
152 put_fifo_with_discard(&lpc_snoop->chan[0], val); in aspeed_lpc_snoop_irq()
157 put_fifo_with_discard(&lpc_snoop->chan[1], val); in aspeed_lpc_snoop_irq()
163 static int aspeed_lpc_snoop_config_irq(struct aspeed_lpc_snoop *lpc_snoop, in aspeed_lpc_snoop_config_irq() argument
169 lpc_snoop->irq = platform_get_irq(pdev, 0); in aspeed_lpc_snoop_config_irq()
170 if (!lpc_snoop->irq) in aspeed_lpc_snoop_config_irq()
173 rc = devm_request_irq(dev, lpc_snoop->irq, in aspeed_lpc_snoop_config_irq()
175 DEVICE_NAME, lpc_snoop); in aspeed_lpc_snoop_config_irq()
177 dev_warn(dev, "Unable to request IRQ %d\n", lpc_snoop->irq); in aspeed_lpc_snoop_config_irq()
178 lpc_snoop->irq = 0; in aspeed_lpc_snoop_config_irq()
185 static int aspeed_lpc_enable_snoop(struct aspeed_lpc_snoop *lpc_snoop, in aspeed_lpc_enable_snoop() argument
194 init_waitqueue_head(&lpc_snoop->chan[channel].wq); in aspeed_lpc_enable_snoop()
196 rc = kfifo_alloc(&lpc_snoop->chan[channel].fifo, in aspeed_lpc_enable_snoop()
201 lpc_snoop->chan[channel].miscdev.minor = MISC_DYNAMIC_MINOR; in aspeed_lpc_enable_snoop()
202 lpc_snoop->chan[channel].miscdev.name = in aspeed_lpc_enable_snoop()
204 lpc_snoop->chan[channel].miscdev.fops = &snoop_fops; in aspeed_lpc_enable_snoop()
205 lpc_snoop->chan[channel].miscdev.parent = dev; in aspeed_lpc_enable_snoop()
206 rc = misc_register(&lpc_snoop->chan[channel].miscdev); in aspeed_lpc_enable_snoop()
228 regmap_update_bits(lpc_snoop->regmap, HICR5, hicr5_en, hicr5_en); in aspeed_lpc_enable_snoop()
229 regmap_update_bits(lpc_snoop->regmap, SNPWADR, snpwadr_mask, in aspeed_lpc_enable_snoop()
232 regmap_update_bits(lpc_snoop->regmap, HICRB, in aspeed_lpc_enable_snoop()
238 static void aspeed_lpc_disable_snoop(struct aspeed_lpc_snoop *lpc_snoop, in aspeed_lpc_disable_snoop() argument
243 regmap_update_bits(lpc_snoop->regmap, HICR5, in aspeed_lpc_disable_snoop()
248 regmap_update_bits(lpc_snoop->regmap, HICR5, in aspeed_lpc_disable_snoop()
256 kfifo_free(&lpc_snoop->chan[channel].fifo); in aspeed_lpc_disable_snoop()
257 misc_deregister(&lpc_snoop->chan[channel].miscdev); in aspeed_lpc_disable_snoop()
262 struct aspeed_lpc_snoop *lpc_snoop; in aspeed_lpc_snoop_probe() local
270 lpc_snoop = devm_kzalloc(dev, sizeof(*lpc_snoop), GFP_KERNEL); in aspeed_lpc_snoop_probe()
271 if (!lpc_snoop) in aspeed_lpc_snoop_probe()
282 lpc_snoop->regmap = syscon_node_to_regmap(np); in aspeed_lpc_snoop_probe()
283 if (IS_ERR(lpc_snoop->regmap)) { in aspeed_lpc_snoop_probe()
288 dev_set_drvdata(&pdev->dev, lpc_snoop); in aspeed_lpc_snoop_probe()
296 lpc_snoop->clk = devm_clk_get(dev, NULL); in aspeed_lpc_snoop_probe()
297 if (IS_ERR(lpc_snoop->clk)) { in aspeed_lpc_snoop_probe()
298 rc = PTR_ERR(lpc_snoop->clk); in aspeed_lpc_snoop_probe()
303 rc = clk_prepare_enable(lpc_snoop->clk); in aspeed_lpc_snoop_probe()
309 rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev); in aspeed_lpc_snoop_probe()
313 rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port); in aspeed_lpc_snoop_probe()
320 rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port); in aspeed_lpc_snoop_probe()
322 aspeed_lpc_disable_snoop(lpc_snoop, 0); in aspeed_lpc_snoop_probe()
330 clk_disable_unprepare(lpc_snoop->clk); in aspeed_lpc_snoop_probe()
337 struct aspeed_lpc_snoop *lpc_snoop = dev_get_drvdata(&pdev->dev); in aspeed_lpc_snoop_remove() local
340 aspeed_lpc_disable_snoop(lpc_snoop, 0); in aspeed_lpc_snoop_remove()
341 aspeed_lpc_disable_snoop(lpc_snoop, 1); in aspeed_lpc_snoop_remove()
343 clk_disable_unprepare(lpc_snoop->clk); in aspeed_lpc_snoop_remove()