Lines Matching refs:rst
52 static void hsdk_reset_config(struct hsdk_rst *rst, unsigned long id) in hsdk_reset_config() argument
54 writel(rst_map[id], rst->regs_ctl + CGU_SYS_RST_CTRL); in hsdk_reset_config()
57 static int hsdk_reset_do(struct hsdk_rst *rst) in hsdk_reset_do() argument
61 reg = readl(rst->regs_rst + CGU_IP_SW_RESET); in hsdk_reset_do()
65 writel(reg, rst->regs_rst + CGU_IP_SW_RESET); in hsdk_reset_do()
68 return readl_poll_timeout_atomic(rst->regs_rst + CGU_IP_SW_RESET, reg, in hsdk_reset_do()
75 struct hsdk_rst *rst = to_hsdk_rst(rcdev); in hsdk_reset_reset() local
79 spin_lock_irqsave(&rst->lock, flags); in hsdk_reset_reset()
80 hsdk_reset_config(rst, id); in hsdk_reset_reset()
81 ret = hsdk_reset_do(rst); in hsdk_reset_reset()
82 spin_unlock_irqrestore(&rst->lock, flags); in hsdk_reset_reset()
94 struct hsdk_rst *rst; in hsdk_reset_probe() local
97 rst = devm_kzalloc(&pdev->dev, sizeof(*rst), GFP_KERNEL); in hsdk_reset_probe()
98 if (!rst) in hsdk_reset_probe()
102 rst->regs_ctl = devm_ioremap_resource(&pdev->dev, mem); in hsdk_reset_probe()
103 if (IS_ERR(rst->regs_ctl)) in hsdk_reset_probe()
104 return PTR_ERR(rst->regs_ctl); in hsdk_reset_probe()
107 rst->regs_rst = devm_ioremap_resource(&pdev->dev, mem); in hsdk_reset_probe()
108 if (IS_ERR(rst->regs_rst)) in hsdk_reset_probe()
109 return PTR_ERR(rst->regs_rst); in hsdk_reset_probe()
111 spin_lock_init(&rst->lock); in hsdk_reset_probe()
113 rst->rcdev.owner = THIS_MODULE; in hsdk_reset_probe()
114 rst->rcdev.ops = &hsdk_reset_ops; in hsdk_reset_probe()
115 rst->rcdev.of_node = pdev->dev.of_node; in hsdk_reset_probe()
116 rst->rcdev.nr_resets = HSDK_MAX_RESETS; in hsdk_reset_probe()
117 rst->rcdev.of_reset_n_cells = 1; in hsdk_reset_probe()
119 return reset_controller_register(&rst->rcdev); in hsdk_reset_probe()