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