diff options
Diffstat (limited to 'arch/arm/mach-cns3xxx/pm.c')
| -rw-r--r-- | arch/arm/mach-cns3xxx/pm.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/arch/arm/mach-cns3xxx/pm.c b/arch/arm/mach-cns3xxx/pm.c index 725e1a4fc23..38e44706fea 100644 --- a/arch/arm/mach-cns3xxx/pm.c +++ b/arch/arm/mach-cns3xxx/pm.c | |||
| @@ -6,18 +6,25 @@ | |||
| 6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/io.h> | ||
| 9 | #include <linux/delay.h> | 10 | #include <linux/delay.h> |
| 10 | #include <mach/system.h> | 11 | #include <mach/system.h> |
| 11 | #include <mach/cns3xxx.h> | 12 | #include <mach/cns3xxx.h> |
| 12 | 13 | ||
| 13 | void cns3xxx_pwr_clk_en(unsigned int block) | 14 | void cns3xxx_pwr_clk_en(unsigned int block) |
| 14 | { | 15 | { |
| 15 | PM_CLK_GATE_REG |= (block & PM_CLK_GATE_REG_MASK); | 16 | u32 reg = __raw_readl(PM_CLK_GATE_REG); |
| 17 | |||
| 18 | reg |= (block & PM_CLK_GATE_REG_MASK); | ||
| 19 | __raw_writel(reg, PM_CLK_GATE_REG); | ||
| 16 | } | 20 | } |
| 17 | 21 | ||
| 18 | void cns3xxx_pwr_power_up(unsigned int block) | 22 | void cns3xxx_pwr_power_up(unsigned int block) |
| 19 | { | 23 | { |
| 20 | PM_PLL_HM_PD_CTRL_REG &= ~(block & CNS3XXX_PWR_PLL_ALL); | 24 | u32 reg = __raw_readl(PM_PLL_HM_PD_CTRL_REG); |
| 25 | |||
| 26 | reg &= ~(block & CNS3XXX_PWR_PLL_ALL); | ||
| 27 | __raw_writel(reg, PM_PLL_HM_PD_CTRL_REG); | ||
| 21 | 28 | ||
| 22 | /* Wait for 300us for the PLL output clock locked. */ | 29 | /* Wait for 300us for the PLL output clock locked. */ |
| 23 | udelay(300); | 30 | udelay(300); |
| @@ -25,22 +32,29 @@ void cns3xxx_pwr_power_up(unsigned int block) | |||
| 25 | 32 | ||
| 26 | void cns3xxx_pwr_power_down(unsigned int block) | 33 | void cns3xxx_pwr_power_down(unsigned int block) |
| 27 | { | 34 | { |
| 35 | u32 reg = __raw_readl(PM_PLL_HM_PD_CTRL_REG); | ||
| 36 | |||
| 28 | /* write '1' to power down */ | 37 | /* write '1' to power down */ |
| 29 | PM_PLL_HM_PD_CTRL_REG |= (block & CNS3XXX_PWR_PLL_ALL); | 38 | reg |= (block & CNS3XXX_PWR_PLL_ALL); |
| 39 | __raw_writel(reg, PM_PLL_HM_PD_CTRL_REG); | ||
| 30 | }; | 40 | }; |
| 31 | 41 | ||
| 32 | static void cns3xxx_pwr_soft_rst_force(unsigned int block) | 42 | static void cns3xxx_pwr_soft_rst_force(unsigned int block) |
| 33 | { | 43 | { |
| 44 | u32 reg = __raw_readl(PM_SOFT_RST_REG); | ||
| 45 | |||
| 34 | /* | 46 | /* |
| 35 | * bit 0, 28, 29 => program low to reset, | 47 | * bit 0, 28, 29 => program low to reset, |
| 36 | * the other else program low and then high | 48 | * the other else program low and then high |
| 37 | */ | 49 | */ |
| 38 | if (block & 0x30000001) { | 50 | if (block & 0x30000001) { |
| 39 | PM_SOFT_RST_REG &= ~(block & PM_SOFT_RST_REG_MASK); | 51 | reg &= ~(block & PM_SOFT_RST_REG_MASK); |
| 40 | } else { | 52 | } else { |
| 41 | PM_SOFT_RST_REG &= ~(block & PM_SOFT_RST_REG_MASK); | 53 | reg &= ~(block & PM_SOFT_RST_REG_MASK); |
| 42 | PM_SOFT_RST_REG |= (block & PM_SOFT_RST_REG_MASK); | 54 | reg |= (block & PM_SOFT_RST_REG_MASK); |
| 43 | } | 55 | } |
| 56 | |||
| 57 | __raw_writel(reg, PM_SOFT_RST_REG); | ||
| 44 | } | 58 | } |
| 45 | 59 | ||
| 46 | void cns3xxx_pwr_soft_rst(unsigned int block) | 60 | void cns3xxx_pwr_soft_rst(unsigned int block) |
| @@ -73,12 +87,13 @@ void arch_reset(char mode, const char *cmd) | |||
| 73 | */ | 87 | */ |
| 74 | int cns3xxx_cpu_clock(void) | 88 | int cns3xxx_cpu_clock(void) |
| 75 | { | 89 | { |
| 90 | u32 reg = __raw_readl(PM_CLK_CTRL_REG); | ||
| 76 | int cpu; | 91 | int cpu; |
| 77 | int cpu_sel; | 92 | int cpu_sel; |
| 78 | int div_sel; | 93 | int div_sel; |
| 79 | 94 | ||
| 80 | cpu_sel = (PM_CLK_CTRL_REG >> PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL) & 0xf; | 95 | cpu_sel = (reg >> PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL) & 0xf; |
| 81 | div_sel = (PM_CLK_CTRL_REG >> PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV) & 0x3; | 96 | div_sel = (reg >> PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV) & 0x3; |
| 82 | 97 | ||
| 83 | cpu = (300 + ((cpu_sel / 3) * 100) + ((cpu_sel % 3) * 33)) >> div_sel; | 98 | cpu = (300 + ((cpu_sel / 3) * 100) + ((cpu_sel % 3) * 33)) >> div_sel; |
| 84 | 99 | ||
