Jay Chokshi | 06e444f | 2012-12-06 20:48:23 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
Jay Chokshi | 06e444f | 2012-12-06 20:48:23 -0800 | [diff] [blame] | 14 | #include <linux/init.h> |
| 15 | #include <linux/io.h> |
Jay Chokshi | 8fd644a | 2012-12-12 12:05:06 -0800 | [diff] [blame] | 16 | #include <linux/errno.h> |
Jay Chokshi | 06e444f | 2012-12-06 20:48:23 -0800 | [diff] [blame] | 17 | |
| 18 | static const phys_addr_t primary_cpu_pwrctl_phys = 0x2088004; |
Jay Chokshi | 06e444f | 2012-12-06 20:48:23 -0800 | [diff] [blame] | 19 | |
| 20 | static int __init msm_cpu_pwrctl_init(void) |
| 21 | { |
Jay Chokshi | 8fd644a | 2012-12-12 12:05:06 -0800 | [diff] [blame] | 22 | void *pwrctl_ptr; |
| 23 | unsigned int value; |
| 24 | int rc = 0; |
Jay Chokshi | 06e444f | 2012-12-06 20:48:23 -0800 | [diff] [blame] | 25 | |
Jay Chokshi | 8fd644a | 2012-12-12 12:05:06 -0800 | [diff] [blame] | 26 | pwrctl_ptr = ioremap_nocache(primary_cpu_pwrctl_phys, SZ_4K); |
| 27 | if (unlikely(!pwrctl_ptr)) { |
| 28 | pr_err("Failed to remap APCS_CPU_PWR_CTL register for CPU0\n"); |
| 29 | rc = -EINVAL; |
| 30 | goto done; |
| 31 | } |
Jay Chokshi | 06e444f | 2012-12-06 20:48:23 -0800 | [diff] [blame] | 32 | |
Jay Chokshi | 8fd644a | 2012-12-12 12:05:06 -0800 | [diff] [blame] | 33 | value = readl_relaxed(pwrctl_ptr); |
| 34 | value |= 0x100; |
| 35 | writel_relaxed(value, pwrctl_ptr); |
| 36 | mb(); |
| 37 | iounmap(pwrctl_ptr); |
| 38 | |
| 39 | done: |
| 40 | return rc; |
Jay Chokshi | 06e444f | 2012-12-06 20:48:23 -0800 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | early_initcall(msm_cpu_pwrctl_init); |