Lines Matching +full:twl4030 +full:- +full:rtc

3  * Handle TWL4030 Power initialization
9 * Peter De Schrijver <peter.de-schrijver@nokia.com>
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #include <asm/mach-types.h>
50 #define STARTON_RTC BIT(3) /* Start on RTC */
57 #define PHY_TO_OFF_PM_MASTER(p) (p - 0x36)
58 #define PHY_TO_OFF_PM_RECEIVER(p) (p - 0x5b)
60 /* resource - hfclk */
222 int err = -EINVAL; in twl4030_write_script()
224 for (; len; len--, address++, script++) { in twl4030_write_script()
227 script->pmb_message, in twl4030_write_script()
228 script->delay, in twl4030_write_script()
234 script->pmb_message, in twl4030_write_script()
235 script->delay, in twl4030_write_script()
262 pr_err("TWL4030 wakeup sequence for P3 config error\n"); in twl4030_config_wakeup3_sequence()
297 if (pdata->ac_charger_quirk || machine_is_omap_3430sdp() || in twl4030_config_wakeup12_sequence()
299 /* Disabling AC charger effect on sleep-active transitions */ in twl4030_config_wakeup12_sequence()
313 pr_err("TWL4030 wakeup sequence for P1 and P2" \ in twl4030_config_wakeup12_sequence()
326 pr_err("TWL4030 sleep sequence config error\n"); in twl4030_config_sleep_sequence()
368 pr_err("TWL4030 warmreset seq config error\n"); in twl4030_config_warmreset_sequence()
380 if (rconfig->resource > TOTAL_RESOURCES) { in twl4030_configure_resource()
381 pr_err("TWL4030 Resource %d does not exist\n", in twl4030_configure_resource()
382 rconfig->resource); in twl4030_configure_resource()
383 return -EINVAL; in twl4030_configure_resource()
386 rconfig_addr = res_config_addrs[rconfig->resource]; in twl4030_configure_resource()
392 pr_err("TWL4030 Resource %d group could not be read\n", in twl4030_configure_resource()
393 rconfig->resource); in twl4030_configure_resource()
397 if (rconfig->devgroup != TWL4030_RESCONFIG_UNDEF) { in twl4030_configure_resource()
399 grp |= rconfig->devgroup << DEV_GRP_SHIFT; in twl4030_configure_resource()
403 pr_err("TWL4030 failed to program devgroup\n"); in twl4030_configure_resource()
412 pr_err("TWL4030 Resource %d type could not be read\n", in twl4030_configure_resource()
413 rconfig->resource); in twl4030_configure_resource()
417 if (rconfig->type != TWL4030_RESCONFIG_UNDEF) { in twl4030_configure_resource()
419 type |= rconfig->type << TYPE_SHIFT; in twl4030_configure_resource()
422 if (rconfig->type2 != TWL4030_RESCONFIG_UNDEF) { in twl4030_configure_resource()
424 type |= rconfig->type2 << TYPE2_SHIFT; in twl4030_configure_resource()
430 pr_err("TWL4030 failed to program resource type\n"); in twl4030_configure_resource()
438 pr_err("TWL4030 Resource %d remap could not be read\n", in twl4030_configure_resource()
439 rconfig->resource); in twl4030_configure_resource()
443 if (rconfig->remap_off != TWL4030_RESCONFIG_UNDEF) { in twl4030_configure_resource()
445 remap |= rconfig->remap_off << OFF_STATE_SHIFT; in twl4030_configure_resource()
448 if (rconfig->remap_sleep != TWL4030_RESCONFIG_UNDEF) { in twl4030_configure_resource()
450 remap |= rconfig->remap_sleep << SLEEP_STATE_SHIFT; in twl4030_configure_resource()
457 pr_err("TWL4030 failed to program remap\n"); in twl4030_configure_resource()
472 if ((address + tscript->size) > END_OF_SCRIPT) { in load_twl4030_script()
473 pr_err("TWL4030 scripts too big error\n"); in load_twl4030_script()
474 return -EINVAL; in load_twl4030_script()
477 err = twl4030_write_script(address, tscript->script, tscript->size); in load_twl4030_script()
481 if (tscript->flags & TWL4030_WRST_SCRIPT) { in load_twl4030_script()
486 if (tscript->flags & TWL4030_WAKEUP12_SCRIPT) { in load_twl4030_script()
498 if (tscript->flags & TWL4030_WAKEUP3_SCRIPT) { in load_twl4030_script()
503 if (tscript->flags & TWL4030_SLEEP_SCRIPT) { in load_twl4030_script()
505 …pr_warn("TWL4030: Bad order of scripts (sleep script before wakeup) Leads to boot failure on some … in load_twl4030_script()
519 pr_err("twl4030: unable to unlock PROTECT_KEY\n"); in twl4030_remove_script()
526 pr_err("twl4030: unable to unlock PROTECT_KEY\n"); in twl4030_remove_script()
558 pr_err("TWL4030 Unable to relock registers\n"); in twl4030_remove_script()
570 for (i = 0; i < pdata->num; i++) { in twl4030_power_configure_scripts()
571 err = load_twl4030_script(pdata, pdata->scripts[i], address); in twl4030_power_configure_scripts()
574 address += pdata->scripts[i]->size; in twl4030_power_configure_scripts()
583 while (common->resource) { in twl4030_patch_rconfig()
586 while (b->resource) { in twl4030_patch_rconfig()
587 if (b->resource == common->resource) { in twl4030_patch_rconfig()
600 struct twl4030_resconfig *resconfig = pdata->resource_config; in twl4030_power_configure_resources()
601 struct twl4030_resconfig *boardconf = pdata->board_config; in twl4030_power_configure_resources()
608 while (resconfig->resource) { in twl4030_power_configure_resources()
650 pr_err("TWL4030 Register access failed: %i\n", err); in twl4030_starton_mask_and_set()
669 pr_err("TWL4030 Unable to configure start-up\n"); in twl4030_power_off()
674 pr_err("TWL4030 Unable to power off\n"); in twl4030_power_off()
680 if (pdata && pdata->use_poweroff) in twl4030_power_use_poweroff()
683 if (of_property_read_bool(node, "ti,system-power-controller")) in twl4030_power_use_poweroff()
689 if (of_device_is_system_power_controller(node->parent)) in twl4030_power_use_poweroff()
723 TWL_REMAP_SLEEP(RES_HFCLKOUT, DEV_GRP_P3, -1, -1),
724 TWL_REMAP_SLEEP(RES_VDD1, DEV_GRP_P1, -1, -1),
725 TWL_REMAP_SLEEP(RES_VDD2, DEV_GRP_P1, -1, -1),
735 /* Recommended generic default idle configuration for off-idle */
854 .compatible = "ti,twl4030-power",
857 .compatible = "ti,twl4030-power-reset",
861 .compatible = "ti,twl4030-power-idle",
865 .compatible = "ti,twl4030-power-idle-osc-off",
869 .compatible = "ti,twl4030-power-omap3-sdp",
873 .compatible = "ti,twl4030-power-omap3-ldp",
877 .compatible = "ti,twl4030-power-omap3-evm",
887 const struct twl4030_power_data *pdata = dev_get_platdata(&pdev->dev); in twl4030_power_probe()
888 struct device_node *node = pdev->dev.of_node; in twl4030_power_probe()
894 dev_err(&pdev->dev, "Platform data is missing\n"); in twl4030_power_probe()
895 return -EINVAL; in twl4030_power_probe()
905 pr_err("TWL4030 Unable to unlock registers\n"); in twl4030_power_probe()
910 pdata = device_get_match_data(&pdev->dev); in twl4030_power_probe()
915 pr_err("TWL4030 failed to load scripts\n"); in twl4030_power_probe()
920 pr_err("TWL4030 failed to configure resource\n"); in twl4030_power_probe()
931 pr_warn("TWL4030 Unable to read registers\n"); in twl4030_power_probe()
937 pr_err("TWL4030 Unable to setup SEQ_OFFSYNC\n"); in twl4030_power_probe()
949 pr_err("TWL4030 Unable to relock registers\n"); in twl4030_power_probe()
968 MODULE_DESCRIPTION("Power management for TWL4030");