2010-06-01 21:57:44 +02:00
/*
* i . MX27 Power Management Routines
*
* Based on Freescale ' s BSP
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License .
*/
2020-09-16 21:41:16 -03:00
# include <linux/of_address.h>
2010-06-01 21:57:44 +02:00
# include <linux/kernel.h>
# include <linux/suspend.h>
# include <linux/io.h>
2012-09-14 14:14:45 +08:00
2021-05-08 13:03:19 -03:00
# include "common.h"
2012-09-14 14:14:45 +08:00
# include "hardware.h"
2010-06-01 21:57:44 +02:00
static int mx27_suspend_enter ( suspend_state_t state )
{
2020-09-16 21:41:16 -03:00
void __iomem * ccm_base ;
struct device_node * np ;
2010-06-01 21:57:44 +02:00
u32 cscr ;
2020-09-16 21:41:16 -03:00
np = of_find_compatible_node ( NULL , NULL , " fsl,imx27-ccm " ) ;
ccm_base = of_iomap ( np , 0 ) ;
BUG_ON ( ! ccm_base ) ;
2010-06-01 21:57:44 +02:00
switch ( state ) {
case PM_SUSPEND_MEM :
/* Clear MPEN and SPEN to disable MPLL/SPLL */
2020-09-16 21:41:16 -03:00
cscr = imx_readl ( ccm_base ) ;
2010-06-01 21:57:44 +02:00
cscr & = 0xFFFFFFFC ;
2020-09-16 21:41:16 -03:00
imx_writel ( cscr , ccm_base ) ;
2010-06-01 21:57:44 +02:00
/* Executes WFI */
2011-08-03 11:34:59 -04:00
cpu_do_idle ( ) ;
2010-06-01 21:57:44 +02:00
break ;
default :
return - EINVAL ;
}
return 0 ;
}
2010-11-16 14:14:02 +01:00
static const struct platform_suspend_ops mx27_suspend_ops = {
2010-06-01 21:57:44 +02:00
. enter = mx27_suspend_enter ,
. valid = suspend_valid_only_mem ,
} ;
2016-06-28 10:22:16 +08:00
void __init imx27_pm_init ( void )
2010-06-01 21:57:44 +02:00
{
suspend_set_ops ( & mx27_suspend_ops ) ;
}