Lines Matching +full:at91sam9263 +full:- +full:can
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * arch/arm/mach-at91/pm.c
35 * struct at91_pm_bu - AT91 power management backup unit data structure
52 * struct at91_pm_sfrbu_regs - registers mapping for SFRBU
65 * enum at91_pm_eth_clk - Ethernet clock indexes
77 * enum at91_pm_eth - Ethernet controller indexes
89 * struct at91_pm_quirk_eth - AT91 PM Ethernet quirks
107 * struct at91_pm_quirks - AT91 PM quirks
115 * struct at91_soc_pm - AT91 SoC power management data structure
137 * enum at91_pm_iomaps - IOs that needs to be mapped for different PM modes
160 { AT91_PM_ULP0_FAST, "ulp0-fast" },
163 { -1, NULL },
203 { .compatible = "atmel,sama5d2-gem", .data = &ws_info[0] },
204 { .compatible = "atmel,sama5d2-rtc", .data = &ws_info[1] },
205 { .compatible = "atmel,sama5d3-udc", .data = &ws_info[2] },
206 { .compatible = "atmel,at91rm9200-ohci", .data = &ws_info[2] },
207 { .compatible = "usb-ohci", .data = &ws_info[2] },
208 { .compatible = "atmel,at91sam9g45-ehci", .data = &ws_info[2] },
209 { .compatible = "usb-ehci", .data = &ws_info[2] },
210 { .compatible = "atmel,sama5d2-sdhci", .data = &ws_info[3] },
215 { .compatible = "microchip,sam9x60-rtc", .data = &ws_info[1] },
216 { .compatible = "atmel,at91rm9200-ohci", .data = &ws_info[2] },
217 { .compatible = "usb-ohci", .data = &ws_info[2] },
218 { .compatible = "atmel,at91sam9g45-ehci", .data = &ws_info[2] },
219 { .compatible = "usb-ehci", .data = &ws_info[2] },
220 { .compatible = "microchip,sam9x60-rtt", .data = &ws_info[4] },
221 { .compatible = "cdns,sam9x60-macb", .data = &ws_info[5] },
226 { .compatible = "microchip,sama7g5-rtc", .data = &ws_info[1] },
227 { .compatible = "microchip,sama7g5-ohci", .data = &ws_info[2] },
228 { .compatible = "usb-ohci", .data = &ws_info[2] },
229 { .compatible = "atmel,at91sam9g45-ehci", .data = &ws_info[2] },
230 { .compatible = "usb-ehci", .data = &ws_info[2] },
231 { .compatible = "microchip,sama7g5-sdhci", .data = &ws_info[3] },
232 { .compatible = "microchip,sama7g5-rtt", .data = &ws_info[4] },
237 { .compatible = "microchip,sam9x7-rtc", .data = &ws_info[1] },
238 { .compatible = "microchip,sam9x7-rtt", .data = &ws_info[4] },
239 { .compatible = "microchip,sam9x7-gem", .data = &ws_info[5] },
255 return -EPERM; in at91_pm_config_ws()
274 if (device_may_wakeup(&pdev->dev)) { in at91_pm_config_ws()
275 wsi = match->data; in at91_pm_config_ws()
278 if (wsi->shdwc_mr_bit && !(val & wsi->shdwc_mr_bit)) in at91_pm_config_ws()
281 mode |= wsi->pmc_fsmr_bit; in at91_pm_config_ws()
282 if (wsi->set_polarity) in at91_pm_config_ws()
283 polarity |= wsi->pmc_fsmr_bit; in at91_pm_config_ws()
287 put_device(&pdev->dev); in at91_pm_config_ws()
297 return mode ? 0 : -EPERM; in at91_pm_config_ws()
333 if (!eth->np) in at91_pm_eth_quirk_is_valid()
337 if (!(eth->modes & BIT(soc_pm.data.mode))) in at91_pm_eth_quirk_is_valid()
340 if (!eth->dev) { in at91_pm_eth_quirk_is_valid()
342 pdev = of_find_device_by_node(eth->np); in at91_pm_eth_quirk_is_valid()
345 /* put_device(eth->dev) is called at the end of suspend. */ in at91_pm_eth_quirk_is_valid()
346 eth->dev = &pdev->dev; in at91_pm_eth_quirk_is_valid()
350 if (!device_may_wakeup(eth->dev)) in at91_pm_eth_quirk_is_valid()
383 if (suspend && eth->dns_modes & BIT(soc_pm.data.mode)) { in at91_pm_config_quirks()
389 if (ws->dev == eth->dev) in at91_pm_config_quirks()
404 ret = -EPERM; in at91_pm_config_quirks()
405 put_device(eth->dev); in at91_pm_config_quirks()
406 eth->dev = NULL; in at91_pm_config_quirks()
408 i--; in at91_pm_config_quirks()
414 clk_bulk_disable_unprepare(AT91_PM_ETH_MAX_CLK, eth->clks); in at91_pm_config_quirks()
417 eth->clks); in at91_pm_config_quirks()
421 * Release the reference to eth->dev taken in in at91_pm_config_quirks()
424 put_device(eth->dev); in at91_pm_config_quirks()
425 eth->dev = NULL; in at91_pm_config_quirks()
437 for (j = i; j >= 0; j--) { in at91_pm_config_quirks()
443 tmp = clk_bulk_prepare_enable(AT91_PM_ETH_MAX_CLK, eth->clks); in at91_pm_config_quirks()
451 * Release the reference to eth->dev taken in in at91_pm_config_quirks()
454 put_device(eth->dev); in at91_pm_config_quirks()
455 eth->dev = NULL; in at91_pm_config_quirks()
478 soc_pm.data.mode = -1; in at91_pm_begin()
486 soc_pm.bu->suspended = 1; in at91_pm_begin()
488 soc_pm.bu->suspended = 0; in at91_pm_begin()
495 * slow-clock mode.
506 pr_err("AT91: PM - Suspend-to-RAM with USB still active\n"); in at91_pm_verify_clocks()
518 pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css); in at91_pm_verify_clocks()
534 * to add one generic API rather than lots of platform-specific ones.
567 /* Store pull-down output impedance select. */ in at91_suspend_finish()
569 soc_pm.bu->ddr_phy_calibration[0] = modified_gray_code[index]; in at91_suspend_finish()
571 /* Store pull-up output impedance select. */ in at91_suspend_finish()
573 soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index]; in at91_suspend_finish()
575 /* Store pull-down on-die termination impedance select. */ in at91_suspend_finish()
577 soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index]; in at91_suspend_finish()
579 /* Store pull-up on-die termination impedance select. */ in at91_suspend_finish()
581 soc_pm.bu->ddr_phy_calibration[0] |= modified_gray_code[index]; in at91_suspend_finish()
589 soc_pm.bu->ddr_phy_calibration[i] = in at91_suspend_finish()
590 *((unsigned int *)soc_pm.memcs + (i - 1)); in at91_suspend_finish()
602 * at91_pm_switch_ba_to_auto() - Configure Backup Unit Power Switch
605 * The Backup Unit Power Switch can be managed either by software or hardware.
611 * required. If it is in software-controlled mode, it is switched to automatic
691 pr_debug("AT91: PM - bogus suspend state %d\n", state); in at91_pm_enter()
717 .name = "cpuidle-at91",
721 * The AT91RM9200 goes into self-refresh mode with this command, and will
722 * terminate self-refresh automatically on the next SDRAM access.
724 * Self-refresh mode is exited as soon as a memory access is made, but we don't
725 * know for sure when that happens. However, we need to restore the low-power
726 * mode if it was enabled before going idle. Restoring low-power mode while
727 * still in self-refresh is "not recommended", but seems to work.
747 /* Those two values allow us to delay self-refresh activation in at91_ddr_standby()
753 /* LPDDR1 --> force DDR2 mode during self-refresh */ in at91_ddr_standby()
777 /* self-refresh mode now */ in at91_ddr_standby()
826 /* self-refresh mode now */ in at91sam9_sdram_standby()
846 * Place RAM into self-refresh after a maximum idle clocks. The maximum in sama7g5_standby()
876 { .compatible = "atmel,at91rm9200-sdramc", .data = &ramc_infos[0] },
877 { .compatible = "atmel,at91sam9260-sdramc", .data = &ramc_infos[1] },
878 { .compatible = "atmel,at91sam9g45-ddramc", .data = &ramc_infos[2] },
879 { .compatible = "atmel,sama5d3-ddramc", .data = &ramc_infos[3] },
880 { .compatible = "microchip,sama7g5-uddrc", .data = &ramc_infos[4], },
885 { .compatible = "microchip,sama7g5-ddr3phy", },
902 ret = -ENOMEM; in at91_dt_ramc()
907 ramc = of_id->data; in at91_dt_ramc()
910 standby = ramc->idle; in at91_dt_ramc()
911 soc_pm.data.memctrl = ramc->memctrl; in at91_dt_ramc()
919 ret = -ENODEV; in at91_dt_ramc()
928 ret = -ENOMEM; in at91_dt_ramc()
936 ret = -ENODEV; in at91_dt_ramc()
951 iounmap(soc_pm.data.ramc[--idx]); in at91_dt_ramc()
960 * re-enabled by an interrupt or by a reset. in at91rm9200_idle()
979 for_each_compatible_node(node, NULL, "mmio-sram") { in at91_pm_sram_init()
992 sram_pool = gen_pool_get(&pdev->dev, NULL); in at91_pm_sram_init()
1018 put_device(&pdev->dev); in at91_pm_sram_init()
1061 int ret = -ENODEV, located = 0; in at91_pm_backup_init()
1065 return -EPERM; in at91_pm_backup_init()
1070 np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-securam"); in at91_pm_backup_init()
1081 sram_pool = gen_pool_get(&pdev->dev, NULL); in at91_pm_backup_init()
1090 ret = -ENOMEM; in at91_pm_backup_init()
1094 soc_pm.bu->suspended = 0; in at91_pm_backup_init()
1095 soc_pm.bu->canary = __pa_symbol(&canary); in at91_pm_backup_init()
1096 soc_pm.bu->resume = __pa_symbol(cpu_resume); in at91_pm_backup_init()
1106 put_device(&pdev->dev); in at91_pm_backup_init()
1132 soc_pm.data.mode = -1; in at91_pm_secure_init()
1143 { .compatible = "atmel,sama5d2-shdwc" },
1144 { .compatible = "microchip,sam9x60-shdwc" },
1145 { .compatible = "microchip,sama7g5-shdwc" },
1150 { .compatible = "atmel,sama5d3-gem" },
1151 { .compatible = "atmel,sama5d2-gem" },
1152 { .compatible = "atmel,sama5d29-gem" },
1153 { .compatible = "microchip,sama7g5-gem" },
1158 { .compatible = "atmel,sama5d3-macb" },
1159 { .compatible = "microchip,sama7g5-emac" },
1265 np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-sfrbu"); in at91_pm_modes_init()
1288 gmac->np = np; in at91_pm_modes_init()
1289 at91_pm_get_eth_clks(np, gmac->clks); in at91_pm_modes_init()
1294 if (at91_pm_eth_clks_empty(gmac->clks)) in at91_pm_modes_init()
1298 emac->np = np; in at91_pm_modes_init()
1299 ret = at91_pm_get_eth_clks(np, emac->clks); in at91_pm_modes_init()
1300 if (ret && at91_pm_eth_clks_empty(gmac->clks)) { in at91_pm_modes_init()
1301 of_node_put(gmac->np); in at91_pm_modes_init()
1302 of_node_put(emac->np); in at91_pm_modes_init()
1303 gmac->np = NULL; in at91_pm_modes_init()
1304 emac->np = NULL; in at91_pm_modes_init()
1368 { .compatible = "atmel,at91rm9200-pmc", .data = &pmc_infos[0] },
1369 { .compatible = "atmel,at91sam9260-pmc", .data = &pmc_infos[1] },
1370 { .compatible = "atmel,at91sam9261-pmc", .data = &pmc_infos[1] },
1371 { .compatible = "atmel,at91sam9263-pmc", .data = &pmc_infos[1] },
1372 { .compatible = "atmel,at91sam9g45-pmc", .data = &pmc_infos[2] },
1373 { .compatible = "atmel,at91sam9n12-pmc", .data = &pmc_infos[1] },
1374 { .compatible = "atmel,at91sam9rl-pmc", .data = &pmc_infos[3] },
1375 { .compatible = "atmel,at91sam9x5-pmc", .data = &pmc_infos[1] },
1376 { .compatible = "atmel,sama5d3-pmc", .data = &pmc_infos[1] },
1377 { .compatible = "atmel,sama5d4-pmc", .data = &pmc_infos[1] },
1378 { .compatible = "atmel,sama5d2-pmc", .data = &pmc_infos[1] },
1379 { .compatible = "microchip,sam9x60-pmc", .data = &pmc_infos[4] },
1380 { .compatible = "microchip,sam9x7-pmc", .data = &pmc_infos[4] },
1381 { .compatible = "microchip,sama7g5-pmc", .data = &pmc_infos[5] },
1447 pmc = of_id->data; in at91_pm_init()
1448 soc_pm.data.uhp_udp_mask = pmc->uhp_udp_mask; in at91_pm_init()
1449 soc_pm.data.pmc_mckr_offset = pmc->mckr; in at91_pm_init()
1450 soc_pm.data.pmc_version = pmc->version; in at91_pm_init()
1487 * AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. in at91rm9200_pm_init()