Lines Matching refs:rc

101 	struct npcm_rc_data *rc = container_of(nb, struct npcm_rc_data,  in npcm_rc_restart()  local
104 writel(NPCM_SWRST << rc->sw_reset_number, rc->base + NPCM_SWRSTR); in npcm_rc_restart()
115 struct npcm_rc_data *rc = to_rc_data(rcdev); in npcm_rc_setclear_reset() local
121 spin_lock_irqsave(&rc->lock, flags); in npcm_rc_setclear_reset()
122 stat = readl(rc->base + ctrl_offset); in npcm_rc_setclear_reset()
124 writel(stat | rst_bit, rc->base + ctrl_offset); in npcm_rc_setclear_reset()
126 writel(stat & ~rst_bit, rc->base + ctrl_offset); in npcm_rc_setclear_reset()
127 spin_unlock_irqrestore(&rc->lock, flags); in npcm_rc_setclear_reset()
146 struct npcm_rc_data *rc = to_rc_data(rcdev); in npcm_rc_status() local
150 return (readl(rc->base + ctrl_offset) & rst_bit); in npcm_rc_status()
156 struct npcm_rc_data *rc = to_rc_data(rcdev); in npcm_reset_xlate() local
162 for (off_num = 0 ; off_num < rc->info->num_ipsrst ; off_num++) { in npcm_reset_xlate()
163 if (offset == rc->info->ipsrst[off_num]) { in npcm_reset_xlate()
189 static void npcm_usb_reset_npcm7xx(struct npcm_rc_data *rc) in npcm_usb_reset_npcm7xx() argument
197 regmap_read(rc->gcr_regmap, NPCM_MDLR_OFFSET, &mdlr); in npcm_usb_reset_npcm7xx()
215 iprst1 = readl(rc->base + NPCM_IPSRST1); in npcm_usb_reset_npcm7xx()
216 iprst2 = readl(rc->base + NPCM_IPSRST2); in npcm_usb_reset_npcm7xx()
217 iprst3 = readl(rc->base + NPCM_IPSRST3); in npcm_usb_reset_npcm7xx()
224 writel(iprst1, rc->base + NPCM_IPSRST1); in npcm_usb_reset_npcm7xx()
225 writel(iprst2, rc->base + NPCM_IPSRST2); in npcm_usb_reset_npcm7xx()
226 writel(iprst3, rc->base + NPCM_IPSRST3); in npcm_usb_reset_npcm7xx()
229 regmap_update_bits(rc->gcr_regmap, NPCM_USB1PHYCTL_OFFSET, in npcm_usb_reset_npcm7xx()
231 regmap_update_bits(rc->gcr_regmap, NPCM_USB2PHYCTL_OFFSET, in npcm_usb_reset_npcm7xx()
236 writel(iprst3, rc->base + NPCM_IPSRST3); in npcm_usb_reset_npcm7xx()
241 regmap_update_bits(rc->gcr_regmap, NPCM_USB1PHYCTL_OFFSET, in npcm_usb_reset_npcm7xx()
243 regmap_update_bits(rc->gcr_regmap, NPCM_USB2PHYCTL_OFFSET, in npcm_usb_reset_npcm7xx()
251 writel(iprst1, rc->base + NPCM_IPSRST1); in npcm_usb_reset_npcm7xx()
252 writel(iprst2, rc->base + NPCM_IPSRST2); in npcm_usb_reset_npcm7xx()
253 writel(iprst3, rc->base + NPCM_IPSRST3); in npcm_usb_reset_npcm7xx()
256 static void npcm_usb_reset_npcm8xx(struct npcm_rc_data *rc) in npcm_usb_reset_npcm8xx() argument
265 regmap_read(rc->gcr_regmap, NPCM_MDLR_OFFSET, &mdlr); in npcm_usb_reset_npcm8xx()
285 iprst1 = readl(rc->base + NPCM_IPSRST1); in npcm_usb_reset_npcm8xx()
286 iprst2 = readl(rc->base + NPCM_IPSRST2); in npcm_usb_reset_npcm8xx()
287 iprst3 = readl(rc->base + NPCM_IPSRST3); in npcm_usb_reset_npcm8xx()
288 iprst4 = readl(rc->base + NPCM_IPSRST4); in npcm_usb_reset_npcm8xx()
296 writel(iprst1, rc->base + NPCM_IPSRST1); in npcm_usb_reset_npcm8xx()
297 writel(iprst2, rc->base + NPCM_IPSRST2); in npcm_usb_reset_npcm8xx()
298 writel(iprst3, rc->base + NPCM_IPSRST3); in npcm_usb_reset_npcm8xx()
299 writel(iprst4, rc->base + NPCM_IPSRST4); in npcm_usb_reset_npcm8xx()
302 regmap_update_bits(rc->gcr_regmap, NPCM_USB1PHYCTL_OFFSET, in npcm_usb_reset_npcm8xx()
304 regmap_update_bits(rc->gcr_regmap, NPCM_USB2PHYCTL_OFFSET, in npcm_usb_reset_npcm8xx()
306 regmap_update_bits(rc->gcr_regmap, NPCM_USB3PHYCTL_OFFSET, in npcm_usb_reset_npcm8xx()
311 writel(iprst3, rc->base + NPCM_IPSRST3); in npcm_usb_reset_npcm8xx()
313 writel(iprst4, rc->base + NPCM_IPSRST4); in npcm_usb_reset_npcm8xx()
316 regmap_update_bits(rc->gcr_regmap, NPCM_USB1PHYCTL_OFFSET, in npcm_usb_reset_npcm8xx()
318 regmap_update_bits(rc->gcr_regmap, NPCM_USB2PHYCTL_OFFSET, in npcm_usb_reset_npcm8xx()
320 regmap_update_bits(rc->gcr_regmap, NPCM_USB3PHYCTL_OFFSET, in npcm_usb_reset_npcm8xx()
329 writel(iprst1, rc->base + NPCM_IPSRST1); in npcm_usb_reset_npcm8xx()
330 writel(iprst2, rc->base + NPCM_IPSRST2); in npcm_usb_reset_npcm8xx()
331 writel(iprst3, rc->base + NPCM_IPSRST3); in npcm_usb_reset_npcm8xx()
332 writel(iprst4, rc->base + NPCM_IPSRST4); in npcm_usb_reset_npcm8xx()
339 static int npcm_usb_reset(struct platform_device *pdev, struct npcm_rc_data *rc) in npcm_usb_reset() argument
343 rc->gcr_regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "nuvoton,sysgcr"); in npcm_usb_reset()
344 if (IS_ERR(rc->gcr_regmap)) { in npcm_usb_reset()
347 rc->gcr_regmap = syscon_regmap_lookup_by_compatible("nuvoton,npcm750-gcr"); in npcm_usb_reset()
348 if (IS_ERR(rc->gcr_regmap)) { in npcm_usb_reset()
350 return PTR_ERR(rc->gcr_regmap); in npcm_usb_reset()
354 rc->info = (const struct npcm_reset_info *) in npcm_usb_reset()
356 switch (rc->info->bmc_id) { in npcm_usb_reset()
358 npcm_usb_reset_npcm7xx(rc); in npcm_usb_reset()
361 npcm_usb_reset_npcm8xx(rc); in npcm_usb_reset()
378 struct npcm_rc_data *rc; in npcm_rc_probe() local
381 rc = devm_kzalloc(&pdev->dev, sizeof(*rc), GFP_KERNEL); in npcm_rc_probe()
382 if (!rc) in npcm_rc_probe()
385 rc->base = devm_platform_ioremap_resource(pdev, 0); in npcm_rc_probe()
386 if (IS_ERR(rc->base)) in npcm_rc_probe()
387 return PTR_ERR(rc->base); in npcm_rc_probe()
389 spin_lock_init(&rc->lock); in npcm_rc_probe()
391 rc->rcdev.owner = THIS_MODULE; in npcm_rc_probe()
392 rc->rcdev.ops = &npcm_rc_ops; in npcm_rc_probe()
393 rc->rcdev.of_node = pdev->dev.of_node; in npcm_rc_probe()
394 rc->rcdev.of_reset_n_cells = 2; in npcm_rc_probe()
395 rc->rcdev.of_xlate = npcm_reset_xlate; in npcm_rc_probe()
397 ret = devm_reset_controller_register(&pdev->dev, &rc->rcdev); in npcm_rc_probe()
403 if (npcm_usb_reset(pdev, rc)) in npcm_rc_probe()
407 &rc->sw_reset_number)) { in npcm_rc_probe()
408 if (rc->sw_reset_number && rc->sw_reset_number < 5) { in npcm_rc_probe()
409 rc->restart_nb.priority = 192, in npcm_rc_probe()
410 rc->restart_nb.notifier_call = npcm_rc_restart, in npcm_rc_probe()
411 ret = register_restart_handler(&rc->restart_nb); in npcm_rc_probe()