blob: 89b8a099a68ec74c8d7bfc29bc988a698b7a0e51 [file] [log] [blame]
Jay Chokshi06e444f2012-12-06 20:48:23 -08001/* 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 Chokshi06e444f2012-12-06 20:48:23 -080014#include <linux/init.h>
15#include <linux/io.h>
Jay Chokshi8fd644a2012-12-12 12:05:06 -080016#include <linux/errno.h>
Jay Chokshi06e444f2012-12-06 20:48:23 -080017
18static const phys_addr_t primary_cpu_pwrctl_phys = 0x2088004;
Jay Chokshi06e444f2012-12-06 20:48:23 -080019
20static int __init msm_cpu_pwrctl_init(void)
21{
Jay Chokshi8fd644a2012-12-12 12:05:06 -080022 void *pwrctl_ptr;
23 unsigned int value;
24 int rc = 0;
Jay Chokshi06e444f2012-12-06 20:48:23 -080025
Jay Chokshi8fd644a2012-12-12 12:05:06 -080026 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 Chokshi06e444f2012-12-06 20:48:23 -080032
Jay Chokshi8fd644a2012-12-12 12:05:06 -080033 value = readl_relaxed(pwrctl_ptr);
34 value |= 0x100;
35 writel_relaxed(value, pwrctl_ptr);
36 mb();
37 iounmap(pwrctl_ptr);
38
39done:
40 return rc;
Jay Chokshi06e444f2012-12-06 20:48:23 -080041}
42
43early_initcall(msm_cpu_pwrctl_init);