Lines Matching +full:timer +full:- +full:cannot +full:- +full:wake +full:- +full:cpu
2 * Atmel SAMA5D2-Compatible Shutdown Controller (SHDWC) driver.
8 * Evolved from driver at91-poweroff.c.
15 * - addition to status of other wake-up inputs [1 - 15]
16 * - Analog Comparator wake-up alarm
17 * - Serial RX wake-up alarm
18 * - low power debouncer
50 #define AT91_SHDW_WUIR 0x0c /* Shutdown Wake-up Inputs Register */
58 #define SHDW_WK_PIN(reg, cfg) ((reg) & AT91_SHDW_WKUPIS((cfg)->wkup_pin_input))
59 #define SHDW_RTCWK(reg, cfg) (((reg) >> ((cfg)->sr_rtcwk_shift)) & 0x1)
60 #define SHDW_RTTWK(reg, cfg) (((reg) >> ((cfg)->sr_rttwk_shift)) & 0x1)
61 #define SHDW_RTCWKEN(cfg) (1 << ((cfg)->mr_rtcwk_shift))
62 #define SHDW_RTTWKEN(cfg) (1 << ((cfg)->mr_rttwk_shift))
101 * Hold configuration here, cannot be more than one instance of the driver
113 const struct reg_config *rcfg = shdw->rcfg; in at91_wakeup_status()
117 reg = readl(shdw->shdwc_base + AT91_SHDW_SR); in at91_wakeup_status()
119 dev_dbg(&pdev->dev, "%s: status = %#x\n", __func__, reg); in at91_wakeup_status()
121 /* Simple power-on, just bail out */ in at91_wakeup_status()
125 if (SHDW_WK_PIN(reg, &rcfg->shdwc)) in at91_wakeup_status()
127 else if (SHDW_RTCWK(reg, &rcfg->shdwc)) in at91_wakeup_status()
129 else if (SHDW_RTTWK(reg, &rcfg->shdwc)) in at91_wakeup_status()
132 pr_info("AT91: Wake-Up source: %s\n", reason); in at91_wakeup_status()
158 /* Shutdown CPU */ in at91_poweroff()
163 : "r" (at91_shdwc->mpddrc_base), in at91_poweroff()
165 "r" (at91_shdwc->shdwc_base), in at91_poweroff()
167 "r" (at91_shdwc->pmc_base), in at91_poweroff()
168 "r" (at91_shdwc->rcfg->pmc.mckr) in at91_poweroff()
176 int max_idx = ARRAY_SIZE(sdwc_dbc_period) - 1; in at91_shdwc_debouncer_value()
181 dev_warn(&pdev->dev, in at91_shdwc_debouncer_value()
187 for (i = max_idx - 1; i > 0; i--) { in at91_shdwc_debouncer_value()
189 dev_dbg(&pdev->dev, "%s: ref[%d] = %llu\n", in at91_shdwc_debouncer_value()
208 dev_warn(&pdev->dev, "reg property is missing for %pOF\n", in at91_shdwc_get_wakeup_input()
215 dev_warn(&pdev->dev, in at91_shdwc_get_wakeup_input()
216 "wake-up input %d out of bounds ignore\n", in at91_shdwc_get_wakeup_input()
222 if (of_property_read_bool(cnp, "atmel,wakeup-active-high")) in at91_shdwc_get_wakeup_input()
225 dev_dbg(&pdev->dev, "%s: (child %d) wuir = %#x\n", in at91_shdwc_get_wakeup_input()
235 const struct reg_config *rcfg = shdw->rcfg; in at91_shdwc_dt_configure()
236 struct device_node *np = pdev->dev.of_node; in at91_shdwc_dt_configure()
240 dev_err(&pdev->dev, "device node not found\n"); in at91_shdwc_dt_configure()
244 if (!of_property_read_u32(np, "debounce-delay-us", &tmp)) in at91_shdwc_dt_configure()
247 if (of_property_read_bool(np, "atmel,wakeup-rtc-timer")) in at91_shdwc_dt_configure()
248 mode |= SHDW_RTCWKEN(&rcfg->shdwc); in at91_shdwc_dt_configure()
250 if (of_property_read_bool(np, "atmel,wakeup-rtt-timer")) in at91_shdwc_dt_configure()
251 mode |= SHDW_RTTWKEN(&rcfg->shdwc); in at91_shdwc_dt_configure()
253 dev_dbg(&pdev->dev, "%s: mode = %#x\n", __func__, mode); in at91_shdwc_dt_configure()
254 writel(mode, shdw->shdwc_base + AT91_SHDW_MR); in at91_shdwc_dt_configure()
257 writel(input, shdw->shdwc_base + AT91_SHDW_WUIR); in at91_shdwc_dt_configure()
309 .compatible = "atmel,sama5d2-shdwc",
313 .compatible = "microchip,sam9x60-shdwc",
317 .compatible = "microchip,sama7g5-shdwc",
326 { .compatible = "atmel,sama5d2-pmc" },
327 { .compatible = "microchip,sam9x60-pmc" },
328 { .compatible = "microchip,sama7g5-pmc" },
339 if (!pdev->dev.of_node) in at91_shdwc_probe()
340 return -ENODEV; in at91_shdwc_probe()
343 return -EBUSY; in at91_shdwc_probe()
345 at91_shdwc = devm_kzalloc(&pdev->dev, sizeof(*at91_shdwc), GFP_KERNEL); in at91_shdwc_probe()
347 return -ENOMEM; in at91_shdwc_probe()
351 at91_shdwc->shdwc_base = devm_platform_ioremap_resource(pdev, 0); in at91_shdwc_probe()
352 if (IS_ERR(at91_shdwc->shdwc_base)) in at91_shdwc_probe()
353 return PTR_ERR(at91_shdwc->shdwc_base); in at91_shdwc_probe()
355 match = of_match_node(at91_shdwc_of_match, pdev->dev.of_node); in at91_shdwc_probe()
356 at91_shdwc->rcfg = match->data; in at91_shdwc_probe()
358 at91_shdwc->sclk = devm_clk_get(&pdev->dev, NULL); in at91_shdwc_probe()
359 if (IS_ERR(at91_shdwc->sclk)) in at91_shdwc_probe()
360 return PTR_ERR(at91_shdwc->sclk); in at91_shdwc_probe()
362 ret = clk_prepare_enable(at91_shdwc->sclk); in at91_shdwc_probe()
364 dev_err(&pdev->dev, "Could not enable slow clock\n"); in at91_shdwc_probe()
374 ret = -ENODEV; in at91_shdwc_probe()
378 at91_shdwc->pmc_base = of_iomap(np, 0); in at91_shdwc_probe()
381 if (!at91_shdwc->pmc_base) { in at91_shdwc_probe()
382 ret = -ENOMEM; in at91_shdwc_probe()
386 if (at91_shdwc->rcfg->ddrc.type_mask) { in at91_shdwc_probe()
388 "atmel,sama5d3-ddramc"); in at91_shdwc_probe()
390 ret = -ENODEV; in at91_shdwc_probe()
394 at91_shdwc->mpddrc_base = of_iomap(np, 0); in at91_shdwc_probe()
397 if (!at91_shdwc->mpddrc_base) { in at91_shdwc_probe()
398 ret = -ENOMEM; in at91_shdwc_probe()
402 ddr_type = readl(at91_shdwc->mpddrc_base + in at91_shdwc_probe()
403 at91_shdwc->rcfg->ddrc.type_offset) & in at91_shdwc_probe()
404 at91_shdwc->rcfg->ddrc.type_mask; in at91_shdwc_probe()
407 iounmap(at91_shdwc->mpddrc_base); in at91_shdwc_probe()
408 at91_shdwc->mpddrc_base = NULL; in at91_shdwc_probe()
417 iounmap(at91_shdwc->pmc_base); in at91_shdwc_probe()
419 clk_disable_unprepare(at91_shdwc->sclk); in at91_shdwc_probe()
431 /* Reset values to disable wake-up features */ in at91_shdwc_remove()
432 writel(0, shdw->shdwc_base + AT91_SHDW_MR); in at91_shdwc_remove()
433 writel(0, shdw->shdwc_base + AT91_SHDW_WUIR); in at91_shdwc_remove()
435 if (shdw->mpddrc_base) in at91_shdwc_remove()
436 iounmap(shdw->mpddrc_base); in at91_shdwc_remove()
437 iounmap(shdw->pmc_base); in at91_shdwc_remove()
439 clk_disable_unprepare(shdw->sclk); in at91_shdwc_remove()
446 .name = "at91-shdwc",