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;
96 rst = devm_kzalloc(&pdev->dev, sizeof(*rst), GFP_KERNEL);
97 if (!rst)
100 rst->regs_ctl = devm_platform_ioremap_resource(pdev, 0);
101 if (IS_ERR(rst->regs_ctl))
102 return PTR_ERR(rst->regs_ctl);
104 rst->regs_rst = devm_platform_ioremap_resource(pdev, 1);
105 if (IS_ERR(rst->regs_rst))
106 return PTR_ERR(rst->regs_rst);
108 spin_lock_init(&rst->lock);
110 rst->rcdev.owner = THIS_MODULE;
111 rst->rcdev.ops = &hsdk_reset_ops;
112 rst->rcdev.of_node = pdev->dev.of_node;
113 rst->rcdev.nr_resets = HSDK_MAX_RESETS;
114 rst->rcdev.of_reset_n_cells = 1;
116 return reset_controller_register(&rst->rcdev);