Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 1 | /* |
| 2 | * OMAP3/OMAP4 Voltage Management Routines |
| 3 | * |
| 4 | * Author: Thara Gopinath <thara@ti.com> |
| 5 | * |
| 6 | * Copyright (C) 2007 Texas Instruments, Inc. |
| 7 | * Rajendra Nayak <rnayak@ti.com> |
| 8 | * Lesly A M <x0080970@ti.com> |
| 9 | * |
| 10 | * Copyright (C) 2008 Nokia Corporation |
| 11 | * Kalle Jokiniemi |
| 12 | * |
| 13 | * Copyright (C) 2010 Texas Instruments, Inc. |
| 14 | * Thara Gopinath <thara@ti.com> |
| 15 | * |
| 16 | * This program is free software; you can redistribute it and/or modify |
| 17 | * it under the terms of the GNU General Public License version 2 as |
| 18 | * published by the Free Software Foundation. |
| 19 | */ |
| 20 | #include <linux/kernel.h> |
| 21 | #include <linux/err.h> |
| 22 | #include <linux/init.h> |
| 23 | |
Tony Lindgren | 4e65331 | 2011-11-10 22:45:17 +0100 | [diff] [blame] | 24 | #include "common.h" |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 25 | |
| 26 | #include "prm-regbits-44xx.h" |
| 27 | #include "prm44xx.h" |
| 28 | #include "prcm44xx.h" |
| 29 | #include "prminst44xx.h" |
| 30 | #include "voltage.h" |
| 31 | #include "omap_opp_data.h" |
| 32 | #include "vc.h" |
| 33 | #include "vp.h" |
| 34 | |
Kevin Hilman | 5892bb1 | 2011-03-29 14:36:04 -0700 | [diff] [blame] | 35 | static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = { |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 36 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET, |
Tero Kristo | 27c16b7 | 2012-09-25 19:33:37 +0300 | [diff] [blame] | 37 | .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_MPU_OFF_OFFSET, |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
Kevin Hilman | 5892bb1 | 2011-03-29 14:36:04 -0700 | [diff] [blame] | 40 | static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = { |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 41 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET, |
Tero Kristo | 27c16b7 | 2012-09-25 19:33:37 +0300 | [diff] [blame] | 42 | .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_IVA_OFF_OFFSET, |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
Kevin Hilman | 5892bb1 | 2011-03-29 14:36:04 -0700 | [diff] [blame] | 45 | static const struct omap_vfsm_instance omap4_vdd_core_vfsm = { |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 46 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET, |
Tero Kristo | 27c16b7 | 2012-09-25 19:33:37 +0300 | [diff] [blame] | 47 | .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_CORE_OFF_OFFSET, |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 48 | }; |
| 49 | |
Kevin Hilman | 81a6048 | 2011-03-16 14:25:45 -0700 | [diff] [blame] | 50 | static struct voltagedomain omap4_voltdm_mpu = { |
| 51 | .name = "mpu", |
Kevin Hilman | 37efca7 | 2011-03-23 17:00:21 -0700 | [diff] [blame] | 52 | .scalable = true, |
Kevin Hilman | 4bcc475 | 2011-03-28 10:40:15 -0700 | [diff] [blame] | 53 | .read = omap4_prm_vcvp_read, |
| 54 | .write = omap4_prm_vcvp_write, |
| 55 | .rmw = omap4_prm_vcvp_rmw, |
Kevin Hilman | d84adcf | 2011-03-22 16:14:57 -0700 | [diff] [blame] | 56 | .vc = &omap4_vc_mpu, |
Kevin Hilman | 5892bb1 | 2011-03-29 14:36:04 -0700 | [diff] [blame] | 57 | .vfsm = &omap4_vdd_mpu_vfsm, |
Kevin Hilman | b7ea803 | 2011-04-04 15:25:07 -0700 | [diff] [blame] | 58 | .vp = &omap4_vp_mpu, |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
Kevin Hilman | 81a6048 | 2011-03-16 14:25:45 -0700 | [diff] [blame] | 61 | static struct voltagedomain omap4_voltdm_iva = { |
| 62 | .name = "iva", |
Kevin Hilman | 37efca7 | 2011-03-23 17:00:21 -0700 | [diff] [blame] | 63 | .scalable = true, |
Kevin Hilman | 4bcc475 | 2011-03-28 10:40:15 -0700 | [diff] [blame] | 64 | .read = omap4_prm_vcvp_read, |
| 65 | .write = omap4_prm_vcvp_write, |
| 66 | .rmw = omap4_prm_vcvp_rmw, |
Kevin Hilman | d84adcf | 2011-03-22 16:14:57 -0700 | [diff] [blame] | 67 | .vc = &omap4_vc_iva, |
Kevin Hilman | 5892bb1 | 2011-03-29 14:36:04 -0700 | [diff] [blame] | 68 | .vfsm = &omap4_vdd_iva_vfsm, |
Kevin Hilman | b7ea803 | 2011-04-04 15:25:07 -0700 | [diff] [blame] | 69 | .vp = &omap4_vp_iva, |
Kevin Hilman | 81a6048 | 2011-03-16 14:25:45 -0700 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | static struct voltagedomain omap4_voltdm_core = { |
| 73 | .name = "core", |
Kevin Hilman | 37efca7 | 2011-03-23 17:00:21 -0700 | [diff] [blame] | 74 | .scalable = true, |
Kevin Hilman | 4bcc475 | 2011-03-28 10:40:15 -0700 | [diff] [blame] | 75 | .read = omap4_prm_vcvp_read, |
| 76 | .write = omap4_prm_vcvp_write, |
| 77 | .rmw = omap4_prm_vcvp_rmw, |
Kevin Hilman | d84adcf | 2011-03-22 16:14:57 -0700 | [diff] [blame] | 78 | .vc = &omap4_vc_core, |
Kevin Hilman | 5892bb1 | 2011-03-29 14:36:04 -0700 | [diff] [blame] | 79 | .vfsm = &omap4_vdd_core_vfsm, |
Kevin Hilman | b7ea803 | 2011-04-04 15:25:07 -0700 | [diff] [blame] | 80 | .vp = &omap4_vp_core, |
Kevin Hilman | 81a6048 | 2011-03-16 14:25:45 -0700 | [diff] [blame] | 81 | }; |
| 82 | |
Benoit Cousson | 7e1b940 | 2011-03-21 12:11:54 +0100 | [diff] [blame] | 83 | static struct voltagedomain omap4_voltdm_wkup = { |
| 84 | .name = "wakeup", |
| 85 | }; |
| 86 | |
Kevin Hilman | 81a6048 | 2011-03-16 14:25:45 -0700 | [diff] [blame] | 87 | static struct voltagedomain *voltagedomains_omap4[] __initdata = { |
| 88 | &omap4_voltdm_mpu, |
| 89 | &omap4_voltdm_iva, |
| 90 | &omap4_voltdm_core, |
Benoit Cousson | 7e1b940 | 2011-03-21 12:11:54 +0100 | [diff] [blame] | 91 | &omap4_voltdm_wkup, |
Kevin Hilman | 81a6048 | 2011-03-16 14:25:45 -0700 | [diff] [blame] | 92 | NULL, |
| 93 | }; |
| 94 | |
Kevin Hilman | 0e2f3d9 | 2011-04-04 17:22:28 -0700 | [diff] [blame] | 95 | static const char *sys_clk_name __initdata = "sys_clkin_ck"; |
| 96 | |
Kevin Hilman | 81a6048 | 2011-03-16 14:25:45 -0700 | [diff] [blame] | 97 | void __init omap44xx_voltagedomains_init(void) |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 98 | { |
Kevin Hilman | 0e2f3d9 | 2011-04-04 17:22:28 -0700 | [diff] [blame] | 99 | struct voltagedomain *voltdm; |
| 100 | int i; |
| 101 | |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 102 | /* |
| 103 | * XXX Will depend on the process, validation, and binning |
| 104 | * for the currently-running IC |
| 105 | */ |
Russell King | 3ddd4d0 | 2012-02-15 11:28:06 +0000 | [diff] [blame] | 106 | #ifdef CONFIG_PM_OPP |
Kevin Hilman | e327788 | 2011-07-14 11:29:06 -0700 | [diff] [blame] | 107 | omap4_voltdm_mpu.volt_data = omap44xx_vdd_mpu_volt_data; |
| 108 | omap4_voltdm_iva.volt_data = omap44xx_vdd_iva_volt_data; |
| 109 | omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data; |
Russell King | 3ddd4d0 | 2012-02-15 11:28:06 +0000 | [diff] [blame] | 110 | #endif |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 111 | |
Tero Kristo | 8b5d8c0 | 2012-09-25 19:33:35 +0300 | [diff] [blame] | 112 | omap4_voltdm_mpu.vp_param = &omap4_mpu_vp_data; |
| 113 | omap4_voltdm_iva.vp_param = &omap4_iva_vp_data; |
| 114 | omap4_voltdm_core.vp_param = &omap4_core_vp_data; |
| 115 | |
| 116 | omap4_voltdm_mpu.vc_param = &omap4_mpu_vc_data; |
| 117 | omap4_voltdm_iva.vc_param = &omap4_iva_vc_data; |
| 118 | omap4_voltdm_core.vc_param = &omap4_core_vc_data; |
| 119 | |
Kevin Hilman | 0e2f3d9 | 2011-04-04 17:22:28 -0700 | [diff] [blame] | 120 | for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++) |
| 121 | voltdm->sys_clk.name = sys_clk_name; |
| 122 | |
Kevin Hilman | 81a6048 | 2011-03-16 14:25:45 -0700 | [diff] [blame] | 123 | voltdm_init(voltagedomains_omap4); |
Paul Walmsley | c0718df | 2011-03-10 22:17:45 -0700 | [diff] [blame] | 124 | }; |