| 1 | /* |
| 2 | * OMAP3 voltage domain data |
| 3 | * |
| 4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. |
| 5 | * Rajendra Nayak <rnayak@ti.com> |
| 6 | * Lesly A M <x0080970@ti.com> |
| 7 | * Thara Gopinath <thara@ti.com> |
| 8 | * |
| 9 | * Copyright (C) 2008, 2011 Nokia Corporation |
| 10 | * Kalle Jokiniemi |
| 11 | * Paul Walmsley |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License version 2 as |
| 15 | * published by the Free Software Foundation. |
| 16 | */ |
| 17 | #include <linux/kernel.h> |
| 18 | #include <linux/err.h> |
| 19 | #include <linux/init.h> |
| 20 | |
| 21 | #include "soc.h" |
| 22 | #include "common.h" |
| 23 | #include "prm-regbits-34xx.h" |
| 24 | #include "omap_opp_data.h" |
| 25 | #include "voltage.h" |
| 26 | #include "vc.h" |
| 27 | #include "vp.h" |
| 28 | |
| 29 | /* |
| 30 | * VDD data |
| 31 | */ |
| 32 | |
| 33 | /* OMAP3-common voltagedomain data */ |
| 34 | |
| 35 | static struct voltagedomain omap3_voltdm_wkup = { |
| 36 | .name = "wakeup", |
| 37 | }; |
| 38 | |
| 39 | /* 34xx/36xx voltagedomain data */ |
| 40 | |
| 41 | static const struct omap_vfsm_instance omap3_vdd1_vfsm = { |
| 42 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, |
| 43 | .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK, |
| 44 | }; |
| 45 | |
| 46 | static const struct omap_vfsm_instance omap3_vdd2_vfsm = { |
| 47 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, |
| 48 | .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK, |
| 49 | }; |
| 50 | |
| 51 | static struct voltagedomain omap3_voltdm_mpu = { |
| 52 | .name = "mpu_iva", |
| 53 | .scalable = true, |
| 54 | .read = omap3_prm_vcvp_read, |
| 55 | .write = omap3_prm_vcvp_write, |
| 56 | .rmw = omap3_prm_vcvp_rmw, |
| 57 | .vc = &omap3_vc_mpu, |
| 58 | .vfsm = &omap3_vdd1_vfsm, |
| 59 | .vp = &omap3_vp_mpu, |
| 60 | }; |
| 61 | |
| 62 | static struct voltagedomain omap3_voltdm_core = { |
| 63 | .name = "core", |
| 64 | .scalable = true, |
| 65 | .read = omap3_prm_vcvp_read, |
| 66 | .write = omap3_prm_vcvp_write, |
| 67 | .rmw = omap3_prm_vcvp_rmw, |
| 68 | .vc = &omap3_vc_core, |
| 69 | .vfsm = &omap3_vdd2_vfsm, |
| 70 | .vp = &omap3_vp_core, |
| 71 | }; |
| 72 | |
| 73 | static struct voltagedomain *voltagedomains_omap3[] __initdata = { |
| 74 | &omap3_voltdm_mpu, |
| 75 | &omap3_voltdm_core, |
| 76 | &omap3_voltdm_wkup, |
| 77 | NULL, |
| 78 | }; |
| 79 | |
| 80 | /* AM35xx voltagedomain data */ |
| 81 | |
| 82 | static struct voltagedomain am35xx_voltdm_mpu = { |
| 83 | .name = "mpu_iva", |
| 84 | }; |
| 85 | |
| 86 | static struct voltagedomain am35xx_voltdm_core = { |
| 87 | .name = "core", |
| 88 | }; |
| 89 | |
| 90 | static struct voltagedomain *voltagedomains_am35xx[] __initdata = { |
| 91 | &am35xx_voltdm_mpu, |
| 92 | &am35xx_voltdm_core, |
| 93 | &omap3_voltdm_wkup, |
| 94 | NULL, |
| 95 | }; |
| 96 | |
| 97 | |
| 98 | static const char *sys_clk_name __initdata = "sys_ck"; |
| 99 | |
| 100 | void __init omap3xxx_voltagedomains_init(void) |
| 101 | { |
| 102 | struct voltagedomain *voltdm; |
| 103 | struct voltagedomain **voltdms; |
| 104 | int i; |
| 105 | |
| 106 | /* |
| 107 | * XXX Will depend on the process, validation, and binning |
| 108 | * for the currently-running IC |
| 109 | */ |
| 110 | #ifdef CONFIG_PM_OPP |
| 111 | if (cpu_is_omap3630()) { |
| 112 | omap3_voltdm_mpu.volt_data = omap36xx_vddmpu_volt_data; |
| 113 | omap3_voltdm_core.volt_data = omap36xx_vddcore_volt_data; |
| 114 | } else { |
| 115 | omap3_voltdm_mpu.volt_data = omap34xx_vddmpu_volt_data; |
| 116 | omap3_voltdm_core.volt_data = omap34xx_vddcore_volt_data; |
| 117 | } |
| 118 | #endif |
| 119 | |
| 120 | omap3_voltdm_mpu.vp_param = &omap3_mpu_vp_data; |
| 121 | omap3_voltdm_core.vp_param = &omap3_core_vp_data; |
| 122 | omap3_voltdm_mpu.vc_param = &omap3_mpu_vc_data; |
| 123 | omap3_voltdm_core.vc_param = &omap3_core_vc_data; |
| 124 | |
| 125 | if (soc_is_am35xx()) |
| 126 | voltdms = voltagedomains_am35xx; |
| 127 | else |
| 128 | voltdms = voltagedomains_omap3; |
| 129 | |
| 130 | for (i = 0; voltdm = voltdms[i], voltdm; i++) |
| 131 | voltdm->sys_clk.name = sys_clk_name; |
| 132 | |
| 133 | voltdm_init(voltdms); |
| 134 | }; |