aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2014-07-07 10:25:26 -0400
committerNicolas Ferre <nicolas.ferre@atmel.com>2014-08-25 10:24:25 -0400
commit5c0593db802c8a9da15216615e466fd4e729df6f (patch)
treeac95b1950b51d6c09fbc0a6f347610a70a92e474
parent99d63fa1c8fe8853540116a6deaedc1ba1fc0468 (diff)
ARM: at91: Remove poweroff DT probing
Now that the poweroff code is a driver of its own, remove the DT probing in mach-at91 and let the usual DT code do its job. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
-rw-r--r--arch/arm/mach-at91/setup.c77
1 files changed, 0 insertions, 77 deletions
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 25196d5096be..6fe03f31d3d2 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -389,82 +389,6 @@ static void at91_dt_ramc(void)
389 at91_pm_set_standby(of_id->data); 389 at91_pm_set_standby(of_id->data);
390} 390}
391 391
392static struct of_device_id shdwc_ids[] = {
393 { .compatible = "atmel,at91sam9260-shdwc", },
394 { .compatible = "atmel,at91sam9rl-shdwc", },
395 { .compatible = "atmel,at91sam9x5-shdwc", },
396 { /*sentinel*/ }
397};
398
399static const char *shdwc_wakeup_modes[] = {
400 [AT91_SHDW_WKMODE0_NONE] = "none",
401 [AT91_SHDW_WKMODE0_HIGH] = "high",
402 [AT91_SHDW_WKMODE0_LOW] = "low",
403 [AT91_SHDW_WKMODE0_ANYLEVEL] = "any",
404};
405
406const int at91_dtget_shdwc_wakeup_mode(struct device_node *np)
407{
408 const char *pm;
409 int err, i;
410
411 err = of_property_read_string(np, "atmel,wakeup-mode", &pm);
412 if (err < 0)
413 return AT91_SHDW_WKMODE0_ANYLEVEL;
414
415 for (i = 0; i < ARRAY_SIZE(shdwc_wakeup_modes); i++)
416 if (!strcasecmp(pm, shdwc_wakeup_modes[i]))
417 return i;
418
419 return -ENODEV;
420}
421
422static void at91_dt_shdwc(void)
423{
424 struct device_node *np;
425 int wakeup_mode;
426 u32 reg;
427 u32 mode = 0;
428
429 np = of_find_matching_node(NULL, shdwc_ids);
430 if (!np) {
431 pr_debug("unable to find compatible shutdown (shdwc) controller node in dtb\n");
432 return;
433 }
434
435 at91_shdwc_base = of_iomap(np, 0);
436 if (!at91_shdwc_base)
437 panic(pr_fmt("unable to map shdwc cpu registers\n"));
438
439 wakeup_mode = at91_dtget_shdwc_wakeup_mode(np);
440 if (wakeup_mode < 0) {
441 pr_warn("shdwc unknown wakeup mode\n");
442 goto end;
443 }
444
445 if (!of_property_read_u32(np, "atmel,wakeup-counter", &reg)) {
446 if (reg > AT91_SHDW_CPTWK0_MAX) {
447 pr_warn("shdwc wakeup counter 0x%x > 0x%x reduce it to 0x%x\n",
448 reg, AT91_SHDW_CPTWK0_MAX, AT91_SHDW_CPTWK0_MAX);
449 reg = AT91_SHDW_CPTWK0_MAX;
450 }
451 mode |= AT91_SHDW_CPTWK0_(reg);
452 }
453
454 if (of_property_read_bool(np, "atmel,wakeup-rtc-timer"))
455 mode |= AT91_SHDW_RTCWKEN;
456
457 if (of_property_read_bool(np, "atmel,wakeup-rtt-timer"))
458 mode |= AT91_SHDW_RTTWKEN;
459
460 at91_shdwc_write(AT91_SHDW_MR, wakeup_mode | mode);
461
462end:
463 pm_power_off = at91sam9_poweroff;
464
465 of_node_put(np);
466}
467
468void __init at91rm9200_dt_initialize(void) 392void __init at91rm9200_dt_initialize(void)
469{ 393{
470 at91_dt_ramc(); 394 at91_dt_ramc();
@@ -482,7 +406,6 @@ void __init at91rm9200_dt_initialize(void)
482void __init at91_dt_initialize(void) 406void __init at91_dt_initialize(void)
483{ 407{
484 at91_dt_ramc(); 408 at91_dt_ramc();
485 at91_dt_shdwc();
486 409
487 /* Init clock subsystem */ 410 /* Init clock subsystem */
488 at91_dt_clock_init(); 411 at91_dt_clock_init();