Lines Matching refs:lpc_ctrl
51 struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(file); in aspeed_lpc_ctrl_mmap() local
55 if (vma->vm_pgoff + vma_pages(vma) > lpc_ctrl->mem_size >> PAGE_SHIFT) in aspeed_lpc_ctrl_mmap()
62 (lpc_ctrl->mem_base >> PAGE_SHIFT) + vma->vm_pgoff, in aspeed_lpc_ctrl_mmap()
72 struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(file); in aspeed_lpc_ctrl_ioctl() local
97 if (!lpc_ctrl->mem_size) { in aspeed_lpc_ctrl_ioctl()
102 map.size = lpc_ctrl->mem_size; in aspeed_lpc_ctrl_ioctl()
138 if (!lpc_ctrl->pnor_size) { in aspeed_lpc_ctrl_ioctl()
142 addr = lpc_ctrl->pnor_base; in aspeed_lpc_ctrl_ioctl()
143 size = lpc_ctrl->pnor_size; in aspeed_lpc_ctrl_ioctl()
146 if (!lpc_ctrl->mem_size) { in aspeed_lpc_ctrl_ioctl()
150 addr = lpc_ctrl->mem_base; in aspeed_lpc_ctrl_ioctl()
151 size = lpc_ctrl->mem_size; in aspeed_lpc_ctrl_ioctl()
175 rc = regmap_write(lpc_ctrl->regmap, HICR7, in aspeed_lpc_ctrl_ioctl()
180 rc = regmap_write(lpc_ctrl->regmap, HICR8, in aspeed_lpc_ctrl_ioctl()
188 if (lpc_ctrl->fwh2ahb) { in aspeed_lpc_ctrl_ioctl()
194 regmap_update_bits(lpc_ctrl->scu, 0x0D8, BIT(2), 0); in aspeed_lpc_ctrl_ioctl()
201 regmap_write(lpc_ctrl->regmap, HICR6, SW_FWH2AHB); in aspeed_lpc_ctrl_ioctl()
208 return regmap_update_bits(lpc_ctrl->regmap, HICR5, in aspeed_lpc_ctrl_ioctl()
224 struct aspeed_lpc_ctrl *lpc_ctrl; in aspeed_lpc_ctrl_probe() local
233 lpc_ctrl = devm_kzalloc(dev, sizeof(*lpc_ctrl), GFP_KERNEL); in aspeed_lpc_ctrl_probe()
234 if (!lpc_ctrl) in aspeed_lpc_ctrl_probe()
249 lpc_ctrl->pnor_size = resource_size(&resm); in aspeed_lpc_ctrl_probe()
250 lpc_ctrl->pnor_base = resm.start; in aspeed_lpc_ctrl_probe()
254 dev_set_drvdata(&pdev->dev, lpc_ctrl); in aspeed_lpc_ctrl_probe()
268 lpc_ctrl->mem_size = resource_size(&resm); in aspeed_lpc_ctrl_probe()
269 lpc_ctrl->mem_base = resm.start; in aspeed_lpc_ctrl_probe()
271 if (!is_power_of_2(lpc_ctrl->mem_size)) { in aspeed_lpc_ctrl_probe()
273 (unsigned int)lpc_ctrl->mem_size); in aspeed_lpc_ctrl_probe()
277 if (!IS_ALIGNED(lpc_ctrl->mem_base, lpc_ctrl->mem_size)) { in aspeed_lpc_ctrl_probe()
279 (unsigned int)lpc_ctrl->mem_size); in aspeed_lpc_ctrl_probe()
292 lpc_ctrl->regmap = syscon_node_to_regmap(np); in aspeed_lpc_ctrl_probe()
293 if (IS_ERR(lpc_ctrl->regmap)) { in aspeed_lpc_ctrl_probe()
299 lpc_ctrl->fwh2ahb = true; in aspeed_lpc_ctrl_probe()
301 lpc_ctrl->scu = syscon_regmap_lookup_by_compatible("aspeed,ast2600-scu"); in aspeed_lpc_ctrl_probe()
302 if (IS_ERR(lpc_ctrl->scu)) { in aspeed_lpc_ctrl_probe()
304 return PTR_ERR(lpc_ctrl->scu); in aspeed_lpc_ctrl_probe()
308 lpc_ctrl->clk = devm_clk_get(dev, NULL); in aspeed_lpc_ctrl_probe()
309 if (IS_ERR(lpc_ctrl->clk)) in aspeed_lpc_ctrl_probe()
310 return dev_err_probe(dev, PTR_ERR(lpc_ctrl->clk), in aspeed_lpc_ctrl_probe()
312 rc = clk_prepare_enable(lpc_ctrl->clk); in aspeed_lpc_ctrl_probe()
318 lpc_ctrl->miscdev.minor = MISC_DYNAMIC_MINOR; in aspeed_lpc_ctrl_probe()
319 lpc_ctrl->miscdev.name = DEVICE_NAME; in aspeed_lpc_ctrl_probe()
320 lpc_ctrl->miscdev.fops = &aspeed_lpc_ctrl_fops; in aspeed_lpc_ctrl_probe()
321 lpc_ctrl->miscdev.parent = dev; in aspeed_lpc_ctrl_probe()
322 rc = misc_register(&lpc_ctrl->miscdev); in aspeed_lpc_ctrl_probe()
331 clk_disable_unprepare(lpc_ctrl->clk); in aspeed_lpc_ctrl_probe()
337 struct aspeed_lpc_ctrl *lpc_ctrl = dev_get_drvdata(&pdev->dev); in aspeed_lpc_ctrl_remove() local
339 misc_deregister(&lpc_ctrl->miscdev); in aspeed_lpc_ctrl_remove()
340 clk_disable_unprepare(lpc_ctrl->clk); in aspeed_lpc_ctrl_remove()