diff options
author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2017-02-01 17:35:18 -0500 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2017-03-31 14:36:08 -0400 |
commit | 13f16017d3e3febdceba86e8634cf4d06d5c500c (patch) | |
tree | e07ed52a537140a858774cb0639e36dd940d432c | |
parent | aab02d611f814c8f129860d87719a90a4d88b386 (diff) |
ARM: at91: pm: Tie the USB clock mask to the pmc
The USB clocks mask (uhp_udp_mask) depends on the pmc. Tie it to the pmc id
instead of the SoC.
Acked-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r-- | arch/arm/mach-at91/pm.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index ddf62a006635..a7c047f0d21f 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -442,31 +442,46 @@ static void __init at91_pm_sram_init(void) | |||
442 | &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); | 442 | &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); |
443 | } | 443 | } |
444 | 444 | ||
445 | struct pmc_info { | ||
446 | unsigned long uhp_udp_mask; | ||
447 | }; | ||
448 | |||
449 | static const struct pmc_info pmc_infos[] __initconst = { | ||
450 | { .uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP }, | ||
451 | { .uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP }, | ||
452 | { .uhp_udp_mask = AT91SAM926x_PMC_UHP }, | ||
453 | }; | ||
454 | |||
445 | static const struct of_device_id atmel_pmc_ids[] __initconst = { | 455 | static const struct of_device_id atmel_pmc_ids[] __initconst = { |
446 | { .compatible = "atmel,at91rm9200-pmc" }, | 456 | { .compatible = "atmel,at91rm9200-pmc", .data = &pmc_infos[0] }, |
447 | { .compatible = "atmel,at91sam9260-pmc" }, | 457 | { .compatible = "atmel,at91sam9260-pmc", .data = &pmc_infos[1] }, |
448 | { .compatible = "atmel,at91sam9g45-pmc" }, | 458 | { .compatible = "atmel,at91sam9g45-pmc", .data = &pmc_infos[2] }, |
449 | { .compatible = "atmel,at91sam9n12-pmc" }, | 459 | { .compatible = "atmel,at91sam9n12-pmc", .data = &pmc_infos[1] }, |
450 | { .compatible = "atmel,at91sam9x5-pmc" }, | 460 | { .compatible = "atmel,at91sam9x5-pmc", .data = &pmc_infos[1] }, |
451 | { .compatible = "atmel,sama5d3-pmc" }, | 461 | { .compatible = "atmel,sama5d3-pmc", .data = &pmc_infos[1] }, |
452 | { .compatible = "atmel,sama5d2-pmc" }, | 462 | { .compatible = "atmel,sama5d2-pmc", .data = &pmc_infos[1] }, |
453 | { /* sentinel */ }, | 463 | { /* sentinel */ }, |
454 | }; | 464 | }; |
455 | 465 | ||
456 | static void __init at91_pm_init(void (*pm_idle)(void)) | 466 | static void __init at91_pm_init(void (*pm_idle)(void)) |
457 | { | 467 | { |
458 | struct device_node *pmc_np; | 468 | struct device_node *pmc_np; |
469 | const struct of_device_id *of_id; | ||
470 | const struct pmc_info *pmc; | ||
459 | 471 | ||
460 | if (at91_cpuidle_device.dev.platform_data) | 472 | if (at91_cpuidle_device.dev.platform_data) |
461 | platform_device_register(&at91_cpuidle_device); | 473 | platform_device_register(&at91_cpuidle_device); |
462 | 474 | ||
463 | pmc_np = of_find_matching_node(NULL, atmel_pmc_ids); | 475 | pmc_np = of_find_matching_node_and_match(NULL, atmel_pmc_ids, &of_id); |
464 | pm_data.pmc = of_iomap(pmc_np, 0); | 476 | pm_data.pmc = of_iomap(pmc_np, 0); |
465 | if (!pm_data.pmc) { | 477 | if (!pm_data.pmc) { |
466 | pr_err("AT91: PM not supported, PMC not found\n"); | 478 | pr_err("AT91: PM not supported, PMC not found\n"); |
467 | return; | 479 | return; |
468 | } | 480 | } |
469 | 481 | ||
482 | pmc = of_id->data; | ||
483 | pm_data.uhp_udp_mask = pmc->uhp_udp_mask; | ||
484 | |||
470 | if (pm_idle) | 485 | if (pm_idle) |
471 | arm_pm_idle = pm_idle; | 486 | arm_pm_idle = pm_idle; |
472 | 487 | ||
@@ -487,35 +502,29 @@ void __init at91rm9200_pm_init(void) | |||
487 | */ | 502 | */ |
488 | at91_ramc_write(0, AT91_MC_SDRAMC_LPR, 0); | 503 | at91_ramc_write(0, AT91_MC_SDRAMC_LPR, 0); |
489 | 504 | ||
490 | pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP; | ||
491 | |||
492 | at91_pm_init(at91rm9200_idle); | 505 | at91_pm_init(at91rm9200_idle); |
493 | } | 506 | } |
494 | 507 | ||
495 | void __init at91sam9260_pm_init(void) | 508 | void __init at91sam9260_pm_init(void) |
496 | { | 509 | { |
497 | at91_dt_ramc(); | 510 | at91_dt_ramc(); |
498 | pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; | ||
499 | at91_pm_init(at91sam9_idle); | 511 | at91_pm_init(at91sam9_idle); |
500 | } | 512 | } |
501 | 513 | ||
502 | void __init at91sam9g45_pm_init(void) | 514 | void __init at91sam9g45_pm_init(void) |
503 | { | 515 | { |
504 | at91_dt_ramc(); | 516 | at91_dt_ramc(); |
505 | pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP; | ||
506 | at91_pm_init(at91sam9_idle); | 517 | at91_pm_init(at91sam9_idle); |
507 | } | 518 | } |
508 | 519 | ||
509 | void __init at91sam9x5_pm_init(void) | 520 | void __init at91sam9x5_pm_init(void) |
510 | { | 521 | { |
511 | at91_dt_ramc(); | 522 | at91_dt_ramc(); |
512 | pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; | ||
513 | at91_pm_init(at91sam9_idle); | 523 | at91_pm_init(at91sam9_idle); |
514 | } | 524 | } |
515 | 525 | ||
516 | void __init sama5_pm_init(void) | 526 | void __init sama5_pm_init(void) |
517 | { | 527 | { |
518 | at91_dt_ramc(); | 528 | at91_dt_ramc(); |
519 | pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; | ||
520 | at91_pm_init(NULL); | 529 | at91_pm_init(NULL); |
521 | } | 530 | } |