blob: 6ba11b247194895fecb1094a1045d431bedd8447 [file] [log] [blame]
Matt Wagantalle9b715a2012-01-04 18:16:14 -08001/*
Matt Wagantall2dd3f972013-01-08 12:03:43 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Matt Wagantalle9b715a2012-01-04 18:16:14 -08003 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
Steve Mucklef132c6c2012-06-06 18:30:57 -070014#include <linux/module.h>
Matt Wagantalle9b715a2012-01-04 18:16:14 -080015#include <linux/platform_device.h>
16#include <linux/of.h>
Matt Wagantalld591bf22012-06-29 11:20:53 -070017#include <mach/rpm-regulator-smd.h>
Matt Wagantalle9b715a2012-01-04 18:16:14 -080018#include <mach/msm_bus_board.h>
19#include <mach/msm_bus.h>
20#include <mach/socinfo.h>
21
22#include "acpuclock.h"
23#include "acpuclock-krait.h"
24
25/* Corner type vreg VDD values */
Matt Wagantallf06e3572012-07-27 12:45:24 -070026#define LVL_NONE RPM_REGULATOR_CORNER_NONE
Matt Wagantalld591bf22012-06-29 11:20:53 -070027#define LVL_LOW RPM_REGULATOR_CORNER_SVS_SOC
28#define LVL_NOM RPM_REGULATOR_CORNER_NORMAL
29#define LVL_HIGH RPM_REGULATOR_CORNER_SUPER_TURBO
Matt Wagantalle9b715a2012-01-04 18:16:14 -080030
Matt Wagantall1f3762d2012-06-08 19:08:48 -070031static struct hfpll_data hfpll_data __initdata = {
Matt Wagantalle9b715a2012-01-04 18:16:14 -080032 .mode_offset = 0x00,
33 .l_offset = 0x04,
34 .m_offset = 0x08,
35 .n_offset = 0x0C,
Matt Wagantalla77b7f32012-07-18 16:32:01 -070036 .has_user_reg = true,
37 .user_offset = 0x10,
Matt Wagantalle9b715a2012-01-04 18:16:14 -080038 .config_offset = 0x14,
Matt Wagantalla77b7f32012-07-18 16:32:01 -070039 .user_val = 0x8,
Matt Wagantall0f6e7b22012-09-26 23:36:18 -070040 .user_vco_mask = BIT(20),
Matt Wagantalla77b7f32012-07-18 16:32:01 -070041 .config_val = 0x04D0405D,
42 .low_vco_l_max = 65,
Matt Wagantalle9b715a2012-01-04 18:16:14 -080043 .low_vdd_l_max = 52,
Matt Wagantall87465f52012-07-23 22:03:06 -070044 .nom_vdd_l_max = 104,
Matt Wagantalle9b715a2012-01-04 18:16:14 -080045 .vdd[HFPLL_VDD_NONE] = LVL_NONE,
46 .vdd[HFPLL_VDD_LOW] = LVL_LOW,
47 .vdd[HFPLL_VDD_NOM] = LVL_NOM,
Matt Wagantall87465f52012-07-23 22:03:06 -070048 .vdd[HFPLL_VDD_HIGH] = LVL_HIGH,
Matt Wagantalle9b715a2012-01-04 18:16:14 -080049};
50
Matt Wagantall1f3762d2012-06-08 19:08:48 -070051static struct scalable scalable[] __initdata = {
Matt Wagantalle9b715a2012-01-04 18:16:14 -080052 [CPU0] = {
53 .hfpll_phys_base = 0xF908A000,
Matt Wagantalle9b715a2012-01-04 18:16:14 -080054 .l2cpmr_iaddr = 0x4501,
Matt Wagantall6cd5d752012-09-27 19:56:57 -070055 .sec_clk_sel = 2,
Matt Wagantall6d9c4162012-07-16 18:58:16 -070056 .vreg[VREG_CORE] = { "krait0", 1050000 },
Matt Wagantall75473eb2012-05-31 15:23:22 -070057 .vreg[VREG_MEM] = { "krait0_mem", 1050000 },
Matt Wagantalld591bf22012-06-29 11:20:53 -070058 .vreg[VREG_DIG] = { "krait0_dig", LVL_HIGH },
David Collinsaba4b9b2012-11-28 17:18:24 -080059 .vreg[VREG_HFPLL_A] = { "krait0_hfpll", 1800000 },
Matt Wagantalle9b715a2012-01-04 18:16:14 -080060 },
61 [CPU1] = {
62 .hfpll_phys_base = 0xF909A000,
Matt Wagantalle9b715a2012-01-04 18:16:14 -080063 .l2cpmr_iaddr = 0x5501,
Matt Wagantall6cd5d752012-09-27 19:56:57 -070064 .sec_clk_sel = 2,
Matt Wagantall6d9c4162012-07-16 18:58:16 -070065 .vreg[VREG_CORE] = { "krait1", 1050000 },
Matt Wagantall75473eb2012-05-31 15:23:22 -070066 .vreg[VREG_MEM] = { "krait1_mem", 1050000 },
Matt Wagantalld591bf22012-06-29 11:20:53 -070067 .vreg[VREG_DIG] = { "krait1_dig", LVL_HIGH },
David Collinsaba4b9b2012-11-28 17:18:24 -080068 .vreg[VREG_HFPLL_A] = { "krait1_hfpll", 1800000 },
Matt Wagantalle9b715a2012-01-04 18:16:14 -080069 },
70 [CPU2] = {
71 .hfpll_phys_base = 0xF90AA000,
Matt Wagantalle9b715a2012-01-04 18:16:14 -080072 .l2cpmr_iaddr = 0x6501,
Matt Wagantall6cd5d752012-09-27 19:56:57 -070073 .sec_clk_sel = 2,
Matt Wagantall6d9c4162012-07-16 18:58:16 -070074 .vreg[VREG_CORE] = { "krait2", 1050000 },
Matt Wagantall75473eb2012-05-31 15:23:22 -070075 .vreg[VREG_MEM] = { "krait2_mem", 1050000 },
Matt Wagantalld591bf22012-06-29 11:20:53 -070076 .vreg[VREG_DIG] = { "krait2_dig", LVL_HIGH },
David Collinsaba4b9b2012-11-28 17:18:24 -080077 .vreg[VREG_HFPLL_A] = { "krait2_hfpll", 1800000 },
Matt Wagantalle9b715a2012-01-04 18:16:14 -080078 },
79 [CPU3] = {
80 .hfpll_phys_base = 0xF90BA000,
Matt Wagantalle9b715a2012-01-04 18:16:14 -080081 .l2cpmr_iaddr = 0x7501,
Matt Wagantall6cd5d752012-09-27 19:56:57 -070082 .sec_clk_sel = 2,
Matt Wagantall6d9c4162012-07-16 18:58:16 -070083 .vreg[VREG_CORE] = { "krait3", 1050000 },
Matt Wagantall75473eb2012-05-31 15:23:22 -070084 .vreg[VREG_MEM] = { "krait3_mem", 1050000 },
Matt Wagantalld591bf22012-06-29 11:20:53 -070085 .vreg[VREG_DIG] = { "krait3_dig", LVL_HIGH },
David Collinsaba4b9b2012-11-28 17:18:24 -080086 .vreg[VREG_HFPLL_A] = { "krait3_hfpll", 1800000 },
Matt Wagantalle9b715a2012-01-04 18:16:14 -080087 },
88 [L2] = {
89 .hfpll_phys_base = 0xF9016000,
Matt Wagantalle9b715a2012-01-04 18:16:14 -080090 .l2cpmr_iaddr = 0x0500,
Matt Wagantall6cd5d752012-09-27 19:56:57 -070091 .sec_clk_sel = 2,
David Collinsaba4b9b2012-11-28 17:18:24 -080092 .vreg[VREG_HFPLL_A] = { "l2_hfpll", 1800000 },
Matt Wagantalle9b715a2012-01-04 18:16:14 -080093 },
94};
95
Matt Wagantall1f3762d2012-06-08 19:08:48 -070096static struct msm_bus_paths bw_level_tbl[] __initdata = {
Matt Wagantall545cd3e2012-12-07 13:07:16 -080097 [0] = BW_MBPS(600), /* At least 75 MHz on bus. */
98 [1] = BW_MBPS(800), /* At least 100 MHz on bus. */
99 [2] = BW_MBPS(1200), /* At least 150 MHz on bus. */
100 [3] = BW_MBPS(1600), /* At least 200 MHz on bus. */
101 [4] = BW_MBPS(2224), /* At least 278 MHz on bus. */
102 [5] = BW_MBPS(3200), /* At least 400 MHz on bus. */
103 [6] = BW_MBPS(4448), /* At least 556 MHz on bus. */
104 [7] = BW_MBPS(6400), /* At least 800 MHz on bus. */
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800105};
106
Matt Wagantall1f3762d2012-06-08 19:08:48 -0700107static struct msm_bus_scale_pdata bus_scale_data __initdata = {
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800108 .usecase = bw_level_tbl,
109 .num_usecases = ARRAY_SIZE(bw_level_tbl),
110 .active_only = 1,
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700111 .name = "acpuclk-8974",
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800112};
113
Matt Wagantall1f3762d2012-06-08 19:08:48 -0700114static struct l2_level l2_freq_tbl[] __initdata = {
Matt Wagantall2dd3f972013-01-08 12:03:43 -0800115 [0] = { { 300000, PLL_0, 0, 0 }, LVL_LOW, 950000, 0 },
116 [1] = { { 345600, HFPLL, 2, 36 }, LVL_NOM, 950000, 1 },
117 [2] = { { 422400, HFPLL, 2, 44 }, LVL_NOM, 950000, 1 },
118 [3] = { { 499200, HFPLL, 2, 52 }, LVL_NOM, 950000, 2 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800119 [4] = { { 576000, HFPLL, 1, 30 }, LVL_NOM, 950000, 3 },
Matt Wagantall2dd3f972013-01-08 12:03:43 -0800120 [5] = { { 652800, HFPLL, 1, 34 }, LVL_NOM, 950000, 3 },
121 [6] = { { 729600, HFPLL, 1, 38 }, LVL_NOM, 950000, 3 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800122 [7] = { { 806400, HFPLL, 1, 42 }, LVL_HIGH, 1050000, 4 },
Matt Wagantall545cd3e2012-12-07 13:07:16 -0800123 [8] = { { 883200, HFPLL, 1, 46 }, LVL_HIGH, 1050000, 4 },
124 [9] = { { 960000, HFPLL, 1, 50 }, LVL_HIGH, 1050000, 4 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800125 [10] = { { 1036800, HFPLL, 1, 54 }, LVL_HIGH, 1050000, 5 },
Matt Wagantall545cd3e2012-12-07 13:07:16 -0800126 [11] = { { 1113600, HFPLL, 1, 58 }, LVL_HIGH, 1050000, 5 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800127 [12] = { { 1190400, HFPLL, 1, 62 }, LVL_HIGH, 1050000, 6 },
Matt Wagantall545cd3e2012-12-07 13:07:16 -0800128 [13] = { { 1267200, HFPLL, 1, 66 }, LVL_HIGH, 1050000, 6 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800129 [14] = { { 1344000, HFPLL, 1, 70 }, LVL_HIGH, 1050000, 7 },
Matt Wagantall545cd3e2012-12-07 13:07:16 -0800130 [15] = { { 1420800, HFPLL, 1, 74 }, LVL_HIGH, 1050000, 7 },
131 [16] = { { 1497600, HFPLL, 1, 78 }, LVL_HIGH, 1050000, 7 },
Stephen Boyd791bca92012-09-11 21:08:13 -0700132 { }
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800133};
134
Matt Wagantall7b14d282013-01-15 14:49:34 -0800135static struct acpu_level acpu_freq_tbl_pvs0[] __initdata = {
136 { 1, { 300000, PLL_0, 0, 0 }, L2(0), 825000, 400000 },
137 { 0, { 345600, HFPLL, 2, 36 }, L2(3), 825000, 3200000 },
138 { 1, { 422400, HFPLL, 2, 44 }, L2(3), 825000, 3200000 },
139 { 0, { 499200, HFPLL, 2, 52 }, L2(6), 825000, 3200000 },
140 { 1, { 576000, HFPLL, 1, 30 }, L2(6), 825000, 3200000 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800141 { 1, { 652800, HFPLL, 1, 34 }, L2(7), 825000, 3200000 },
142 { 1, { 729600, HFPLL, 1, 38 }, L2(7), 825000, 3200000 },
143 { 0, { 806400, HFPLL, 1, 42 }, L2(10), 835000, 3200000 },
144 { 1, { 883200, HFPLL, 1, 46 }, L2(10), 845000, 3200000 },
145 { 0, { 960000, HFPLL, 1, 50 }, L2(10), 860000, 3200000 },
146 { 1, { 1036800, HFPLL, 1, 54 }, L2(10), 880000, 3200000 },
147 { 0, { 1113600, HFPLL, 1, 58 }, L2(12), 905000, 3200000 },
148 { 0, { 1190400, HFPLL, 1, 62 }, L2(12), 920000, 3200000 },
149 { 0, { 1267200, HFPLL, 1, 66 }, L2(12), 940000, 3200000 },
Matt Wagantall7b14d282013-01-15 14:49:34 -0800150 { 1, { 1344000, HFPLL, 1, 70 }, L2(12), 960000, 3200000 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800151 { 0, { 1420800, HFPLL, 1, 74 }, L2(16), 980000, 3200000 },
152 { 0, { 1497600, HFPLL, 1, 78 }, L2(16), 995000, 3200000 },
153 { 0, { 1574400, HFPLL, 1, 82 }, L2(16), 1015000, 3200000 },
154 { 0, { 1651200, HFPLL, 1, 86 }, L2(16), 1030000, 3200000 },
Michael Bohanb0138512012-12-13 10:51:45 -0800155 { 1, { 1728000, HFPLL, 1, 90 }, L2(16), 1050000, 3200000 },
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800156 { 0, { 0 } }
157};
158
Matt Wagantall7b14d282013-01-15 14:49:34 -0800159static struct acpu_level acpu_freq_tbl_pvs1[] __initdata = {
160 { 1, { 300000, PLL_0, 0, 0 }, L2(0), 825000, 400000 },
161 { 0, { 345600, HFPLL, 2, 36 }, L2(3), 825000, 3200000 },
162 { 1, { 422400, HFPLL, 2, 44 }, L2(3), 825000, 3200000 },
163 { 0, { 499200, HFPLL, 2, 52 }, L2(6), 825000, 3200000 },
164 { 1, { 576000, HFPLL, 1, 30 }, L2(6), 825000, 3200000 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800165 { 1, { 652800, HFPLL, 1, 34 }, L2(7), 825000, 3200000 },
166 { 1, { 729600, HFPLL, 1, 38 }, L2(7), 825000, 3200000 },
167 { 0, { 806400, HFPLL, 1, 42 }, L2(10), 835000, 3200000 },
168 { 1, { 883200, HFPLL, 1, 46 }, L2(10), 845000, 3200000 },
169 { 0, { 960000, HFPLL, 1, 50 }, L2(10), 860000, 3200000 },
170 { 1, { 1036800, HFPLL, 1, 54 }, L2(10), 880000, 3200000 },
171 { 0, { 1113600, HFPLL, 1, 58 }, L2(12), 905000, 3200000 },
172 { 0, { 1190400, HFPLL, 1, 62 }, L2(12), 920000, 3200000 },
173 { 0, { 1267200, HFPLL, 1, 66 }, L2(12), 940000, 3200000 },
Matt Wagantall7b14d282013-01-15 14:49:34 -0800174 { 1, { 1344000, HFPLL, 1, 70 }, L2(12), 960000, 3200000 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800175 { 0, { 1420800, HFPLL, 1, 74 }, L2(16), 980000, 3200000 },
176 { 0, { 1497600, HFPLL, 1, 78 }, L2(16), 995000, 3200000 },
177 { 0, { 1574400, HFPLL, 1, 82 }, L2(16), 1015000, 3200000 },
178 { 0, { 1651200, HFPLL, 1, 86 }, L2(16), 1030000, 3200000 },
Matt Wagantall7b14d282013-01-15 14:49:34 -0800179 { 1, { 1728000, HFPLL, 1, 90 }, L2(16), 1050000, 3200000 },
180 { 0, { 0 } }
181};
182
183static struct acpu_level acpu_freq_tbl_pvs2[] __initdata = {
184 { 1, { 300000, PLL_0, 0, 0 }, L2(0), 825000, 400000 },
185 { 0, { 345600, HFPLL, 2, 36 }, L2(3), 825000, 3200000 },
186 { 1, { 422400, HFPLL, 2, 44 }, L2(3), 825000, 3200000 },
187 { 0, { 499200, HFPLL, 2, 52 }, L2(6), 825000, 3200000 },
188 { 1, { 576000, HFPLL, 1, 30 }, L2(6), 825000, 3200000 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800189 { 1, { 652800, HFPLL, 1, 34 }, L2(7), 825000, 3200000 },
190 { 1, { 729600, HFPLL, 1, 38 }, L2(7), 825000, 3200000 },
191 { 0, { 806400, HFPLL, 1, 42 }, L2(10), 825000, 3200000 },
192 { 1, { 883200, HFPLL, 1, 46 }, L2(10), 825000, 3200000 },
193 { 0, { 960000, HFPLL, 1, 50 }, L2(10), 835000, 3200000 },
194 { 1, { 1036800, HFPLL, 1, 54 }, L2(10), 855000, 3200000 },
195 { 0, { 1113600, HFPLL, 1, 58 }, L2(12), 875000, 3200000 },
196 { 0, { 1190400, HFPLL, 1, 62 }, L2(12), 895000, 3200000 },
197 { 0, { 1267200, HFPLL, 1, 66 }, L2(12), 915000, 3200000 },
Matt Wagantall7b14d282013-01-15 14:49:34 -0800198 { 1, { 1344000, HFPLL, 1, 70 }, L2(12), 930000, 3200000 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800199 { 0, { 1420800, HFPLL, 1, 74 }, L2(16), 945000, 3200000 },
200 { 0, { 1497600, HFPLL, 1, 78 }, L2(16), 960000, 3200000 },
201 { 0, { 1574400, HFPLL, 1, 82 }, L2(16), 975000, 3200000 },
202 { 0, { 1651200, HFPLL, 1, 86 }, L2(16), 990000, 3200000 },
Matt Wagantall7b14d282013-01-15 14:49:34 -0800203 { 1, { 1728000, HFPLL, 1, 90 }, L2(16), 1000000, 3200000 },
204 { 0, { 0 } }
205};
206
207static struct acpu_level acpu_freq_tbl_pvs3[] __initdata = {
208 { 1, { 300000, PLL_0, 0, 0 }, L2(0), 825000, 400000 },
209 { 0, { 345600, HFPLL, 2, 36 }, L2(3), 825000, 3200000 },
210 { 1, { 422400, HFPLL, 2, 44 }, L2(3), 825000, 3200000 },
211 { 0, { 499200, HFPLL, 2, 52 }, L2(6), 825000, 3200000 },
212 { 1, { 576000, HFPLL, 1, 30 }, L2(6), 825000, 3200000 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800213 { 1, { 652800, HFPLL, 1, 34 }, L2(7), 825000, 3200000 },
214 { 1, { 729600, HFPLL, 1, 38 }, L2(7), 825000, 3200000 },
215 { 0, { 806400, HFPLL, 1, 42 }, L2(10), 825000, 3200000 },
216 { 1, { 883200, HFPLL, 1, 46 }, L2(10), 825000, 3200000 },
217 { 0, { 960000, HFPLL, 1, 50 }, L2(10), 835000, 3200000 },
218 { 1, { 1036800, HFPLL, 1, 54 }, L2(10), 855000, 3200000 },
219 { 0, { 1113600, HFPLL, 1, 58 }, L2(12), 875000, 3200000 },
220 { 0, { 1190400, HFPLL, 1, 62 }, L2(12), 895000, 3200000 },
221 { 0, { 1267200, HFPLL, 1, 66 }, L2(12), 915000, 3200000 },
Matt Wagantall7b14d282013-01-15 14:49:34 -0800222 { 1, { 1344000, HFPLL, 1, 70 }, L2(12), 930000, 3200000 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800223 { 0, { 1420800, HFPLL, 1, 74 }, L2(16), 945000, 3200000 },
224 { 0, { 1497600, HFPLL, 1, 78 }, L2(16), 960000, 3200000 },
225 { 0, { 1574400, HFPLL, 1, 82 }, L2(16), 975000, 3200000 },
226 { 0, { 1651200, HFPLL, 1, 86 }, L2(16), 990000, 3200000 },
Matt Wagantall7b14d282013-01-15 14:49:34 -0800227 { 1, { 1728000, HFPLL, 1, 90 }, L2(16), 1000000, 3200000 },
228 { 0, { 0 } }
229};
230
231static struct acpu_level acpu_freq_tbl_pvs4[] __initdata = {
232 { 1, { 300000, PLL_0, 0, 0 }, L2(0), 825000, 400000 },
233 { 0, { 345600, HFPLL, 2, 36 }, L2(3), 825000, 3200000 },
234 { 1, { 422400, HFPLL, 2, 44 }, L2(3), 825000, 3200000 },
235 { 0, { 499200, HFPLL, 2, 52 }, L2(6), 825000, 3200000 },
236 { 1, { 576000, HFPLL, 1, 30 }, L2(6), 825000, 3200000 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800237 { 1, { 652800, HFPLL, 1, 34 }, L2(7), 825000, 3200000 },
238 { 1, { 729600, HFPLL, 1, 38 }, L2(7), 825000, 3200000 },
239 { 0, { 806400, HFPLL, 1, 42 }, L2(10), 825000, 3200000 },
240 { 1, { 883200, HFPLL, 1, 46 }, L2(10), 825000, 3200000 },
241 { 0, { 960000, HFPLL, 1, 50 }, L2(10), 825000, 3200000 },
242 { 1, { 1036800, HFPLL, 1, 54 }, L2(10), 825000, 3200000 },
243 { 0, { 1113600, HFPLL, 1, 58 }, L2(12), 835000, 3200000 },
244 { 0, { 1190400, HFPLL, 1, 62 }, L2(12), 855000, 3200000 },
245 { 0, { 1267200, HFPLL, 1, 66 }, L2(12), 870000, 3200000 },
Matt Wagantall7b14d282013-01-15 14:49:34 -0800246 { 1, { 1344000, HFPLL, 1, 70 }, L2(12), 885000, 3200000 },
Matt Wagantalld20d0942013-01-30 14:09:53 -0800247 { 0, { 1420800, HFPLL, 1, 74 }, L2(16), 900000, 3200000 },
248 { 0, { 1497600, HFPLL, 1, 78 }, L2(16), 910000, 3200000 },
249 { 0, { 1574400, HFPLL, 1, 82 }, L2(16), 925000, 3200000 },
250 { 0, { 1651200, HFPLL, 1, 86 }, L2(16), 940000, 3200000 },
Matt Wagantall7b14d282013-01-15 14:49:34 -0800251 { 1, { 1728000, HFPLL, 1, 90 }, L2(16), 950000, 3200000 },
252 { 0, { 0 } }
253};
254
255static struct pvs_table pvs_tables[NUM_SPEED_BINS][NUM_PVS] __initdata = {
256 [0][0] = { acpu_freq_tbl_pvs0, sizeof(acpu_freq_tbl_pvs0) },
257 [0][1] = { acpu_freq_tbl_pvs1, sizeof(acpu_freq_tbl_pvs1) },
258 [0][2] = { acpu_freq_tbl_pvs2, sizeof(acpu_freq_tbl_pvs2) },
259 [0][3] = { acpu_freq_tbl_pvs3, sizeof(acpu_freq_tbl_pvs3) },
260 [0][4] = { acpu_freq_tbl_pvs4, sizeof(acpu_freq_tbl_pvs4) },
Matt Wagantallea320582013-02-16 10:18:54 -0800261 [1][0] = { acpu_freq_tbl_pvs0, sizeof(acpu_freq_tbl_pvs0) },
262 [1][1] = { acpu_freq_tbl_pvs1, sizeof(acpu_freq_tbl_pvs1) },
263 [1][2] = { acpu_freq_tbl_pvs2, sizeof(acpu_freq_tbl_pvs2) },
264 [1][3] = { acpu_freq_tbl_pvs3, sizeof(acpu_freq_tbl_pvs3) },
265 [1][4] = { acpu_freq_tbl_pvs4, sizeof(acpu_freq_tbl_pvs4) },
Matt Wagantall1f3762d2012-06-08 19:08:48 -0700266};
267
268static struct acpuclk_krait_params acpuclk_8974_params __initdata = {
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800269 .scalable = scalable,
Matt Wagantall1f3762d2012-06-08 19:08:48 -0700270 .scalable_size = sizeof(scalable),
271 .hfpll_data = &hfpll_data,
272 .pvs_tables = pvs_tables,
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800273 .l2_freq_tbl = l2_freq_tbl,
Matt Wagantall1f3762d2012-06-08 19:08:48 -0700274 .l2_freq_tbl_size = sizeof(l2_freq_tbl),
275 .bus_scale = &bus_scale_data,
Matt Wagantallee2b4372012-09-17 17:51:06 -0700276 .pte_efuse_phys = 0xFC4B80B0,
Matt Wagantallf9a4d322013-01-14 18:01:24 -0800277 .get_bin_info = get_krait_bin_format_b,
Matt Wagantallb7c231b2012-07-24 18:40:17 -0700278 .stby_khz = 300000,
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800279};
280
Matt Wagantall2dd3f972013-01-08 12:03:43 -0800281static void __init apply_l2_workaround(void)
282{
283 static struct l2_level resticted_l2_tbl[] __initdata = {
284 [0] = { { 300000, PLL_0, 0, 0 }, LVL_LOW, 1050000, 0 },
285 [1] = { { 1497600, HFPLL, 1, 78 }, LVL_HIGH, 1050000, 7 },
286 { }
287 };
288 struct acpu_level *l;
289 int s, p;
290
291 for (s = 0; s < NUM_SPEED_BINS; s++)
292 for (p = 0; p < NUM_PVS; p++)
293 for (l = pvs_tables[s][p].table; l && l->speed.khz; l++)
294 l->l2_level = l->l2_level > 5 ? 1 : 0;
295
296 acpuclk_8974_params.l2_freq_tbl = resticted_l2_tbl;
297 acpuclk_8974_params.l2_freq_tbl_size = sizeof(resticted_l2_tbl);
298}
299
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700300static int __init acpuclk_8974_probe(struct platform_device *pdev)
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800301{
Matt Wagantall2dd3f972013-01-08 12:03:43 -0800302 /*
303 * 8974 hardware revisions older than v1.2 may experience L2 parity
304 * errors when running at some performance points between 300MHz
305 * and 1497.6MHz (non-inclusive), or when vdd_mx is less than 1.05V.
306 * Restrict L2 operation to safe performance points on these devices.
307 */
308 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) < 2 &&
309 SOCINFO_VERSION_MINOR(socinfo_get_version()) < 2)
310 apply_l2_workaround();
311
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700312 return acpuclk_krait_init(&pdev->dev, &acpuclk_8974_params);
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800313}
314
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700315static struct of_device_id acpuclk_8974_match_table[] = {
316 { .compatible = "qcom,acpuclk-8974" },
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800317 {}
318};
319
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700320static struct platform_driver acpuclk_8974_driver = {
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800321 .driver = {
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700322 .name = "acpuclk-8974",
323 .of_match_table = acpuclk_8974_match_table,
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800324 .owner = THIS_MODULE,
325 },
326};
327
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700328static int __init acpuclk_8974_init(void)
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800329{
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700330 return platform_driver_probe(&acpuclk_8974_driver,
331 acpuclk_8974_probe);
Matt Wagantalle9b715a2012-01-04 18:16:14 -0800332}
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700333device_initcall(acpuclk_8974_init);