blob: ae1cd7b790182cb93997dab3138e92462ab8daa8 [file] [log] [blame]
Patrick Daly6578e0c2012-07-19 18:50:02 -07001/*
2 * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
3 *
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
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/platform_device.h>
17#include <mach/rpm-regulator.h>
18#include <mach/msm_bus_board.h>
19#include <mach/msm_bus.h>
20
21#include "acpuclock.h"
22#include "acpuclock-krait.h"
23
24static struct hfpll_data hfpll_data __initdata = {
25 .mode_offset = 0x00,
26 .l_offset = 0x08,
27 .m_offset = 0x0C,
28 .n_offset = 0x10,
29 .config_offset = 0x04,
30 .config_val = 0x7845C665,
31 .has_droop_ctl = true,
32 .droop_offset = 0x14,
33 .droop_val = 0x0108C000,
34 .low_vdd_l_max = 37,
35 .nom_vdd_l_max = 74,
36 .vdd[HFPLL_VDD_NONE] = 0,
37 .vdd[HFPLL_VDD_LOW] = 945000,
38 .vdd[HFPLL_VDD_NOM] = 1050000,
39 .vdd[HFPLL_VDD_HIGH] = 1150000,
40};
41
42static struct scalable scalable[] __initdata = {
43 [CPU0] = {
44 .hfpll_phys_base = 0x00903200,
45 .aux_clk_sel_phys = 0x02088014,
46 .aux_clk_sel = 3,
Matt Wagantall6cd5d752012-09-27 19:56:57 -070047 .sec_clk_sel = 2,
Patrick Daly6578e0c2012-07-19 18:50:02 -070048 .l2cpmr_iaddr = 0x4501,
49 .vreg[VREG_CORE] = { "krait0", 1300000 },
50 .vreg[VREG_MEM] = { "krait0_mem", 1150000 },
51 .vreg[VREG_DIG] = { "krait0_dig", 1150000 },
52 .vreg[VREG_HFPLL_A] = { "krait0_s8", 2050000 },
53 .vreg[VREG_HFPLL_B] = { "krait0_l23", 1800000 },
54 },
55 [CPU1] = {
56 .hfpll_phys_base = 0x00903300,
57 .aux_clk_sel_phys = 0x02098014,
58 .aux_clk_sel = 3,
Matt Wagantall6cd5d752012-09-27 19:56:57 -070059 .sec_clk_sel = 2,
Patrick Daly6578e0c2012-07-19 18:50:02 -070060 .l2cpmr_iaddr = 0x5501,
61 .vreg[VREG_CORE] = { "krait1", 1300000 },
62 .vreg[VREG_MEM] = { "krait1_mem", 1150000 },
63 .vreg[VREG_DIG] = { "krait1_dig", 1150000 },
64 .vreg[VREG_HFPLL_A] = { "krait1_s8", 2050000 },
65 .vreg[VREG_HFPLL_B] = { "krait1_l23", 1800000 },
66 },
67 [L2] = {
68 .hfpll_phys_base = 0x00903400,
69 .aux_clk_sel_phys = 0x02011028,
70 .aux_clk_sel = 3,
Matt Wagantall6cd5d752012-09-27 19:56:57 -070071 .sec_clk_sel = 2,
Patrick Daly6578e0c2012-07-19 18:50:02 -070072 .l2cpmr_iaddr = 0x0500,
73 .vreg[VREG_HFPLL_A] = { "l2_s8", 2050000 },
74 .vreg[VREG_HFPLL_B] = { "l2_l23", 1800000 },
75 },
76};
77
78static struct msm_bus_paths bw_level_tbl[] __initdata = {
79 [0] = BW_MBPS(640), /* At least 80 MHz on bus. */
80 [1] = BW_MBPS(1064), /* At least 133 MHz on bus. */
81 [2] = BW_MBPS(1600), /* At least 200 MHz on bus. */
82 [3] = BW_MBPS(2128), /* At least 266 MHz on bus. */
83 [4] = BW_MBPS(3200), /* At least 400 MHz on bus. */
84 [5] = BW_MBPS(4264), /* At least 533 MHz on bus. */
85};
86
87static struct msm_bus_scale_pdata bus_scale_data __initdata = {
88 .usecase = bw_level_tbl,
89 .num_usecases = ARRAY_SIZE(bw_level_tbl),
90 .active_only = 1,
91 .name = "acpuclk-8960ab",
92};
93
94static struct l2_level l2_freq_tbl[] __initdata = {
Matt Wagantall6cd5d752012-09-27 19:56:57 -070095 [0] = { { 384000, PLL_8, 0, 0x00 }, 1050000, 1050000, 1 },
96 [1] = { { 486000, HFPLL, 2, 0x24 }, 1050000, 1050000, 2 },
97 [2] = { { 594000, HFPLL, 1, 0x16 }, 1050000, 1050000, 2 },
98 [3] = { { 702000, HFPLL, 1, 0x1A }, 1050000, 1050000, 4 },
99 [4] = { { 810000, HFPLL, 1, 0x1E }, 1050000, 1050000, 4 },
100 [5] = { { 918000, HFPLL, 1, 0x22 }, 1150000, 1150000, 5 },
101 [6] = { { 1026000, HFPLL, 1, 0x26 }, 1150000, 1150000, 5 },
102 [7] = { { 1134000, HFPLL, 1, 0x2A }, 1150000, 1150000, 5 },
103 [8] = { { 1242000, HFPLL, 1, 0x2E }, 1150000, 1150000, 5 },
104 [9] = { { 1350000, HFPLL, 1, 0x32 }, 1150000, 1150000, 5 },
Stephen Boyd791bca92012-09-11 21:08:13 -0700105 { }
Patrick Daly6578e0c2012-07-19 18:50:02 -0700106};
107
108static struct acpu_level acpu_freq_tbl_slow[] __initdata = {
Matt Wagantall6cd5d752012-09-27 19:56:57 -0700109 { 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 950000 },
110 { 0, { 432000, HFPLL, 2, 0x20 }, L2(3), 975000 },
111 { 1, { 486000, HFPLL, 2, 0x24 }, L2(3), 975000 },
112 { 0, { 540000, HFPLL, 2, 0x28 }, L2(3), 1000000 },
113 { 1, { 594000, HFPLL, 1, 0x16 }, L2(3), 1000000 },
114 { 0, { 648000, HFPLL, 1, 0x18 }, L2(3), 1025000 },
115 { 1, { 702000, HFPLL, 1, 0x1A }, L2(3), 1025000 },
116 { 0, { 756000, HFPLL, 1, 0x1C }, L2(3), 1075000 },
117 { 1, { 810000, HFPLL, 1, 0x1E }, L2(3), 1075000 },
118 { 0, { 864000, HFPLL, 1, 0x20 }, L2(3), 1100000 },
119 { 1, { 918000, HFPLL, 1, 0x22 }, L2(3), 1100000 },
120 { 0, { 972000, HFPLL, 1, 0x24 }, L2(3), 1125000 },
121 { 1, { 1026000, HFPLL, 1, 0x26 }, L2(3), 1125000 },
122 { 0, { 1080000, HFPLL, 1, 0x28 }, L2(9), 1175000 },
123 { 1, { 1134000, HFPLL, 1, 0x2A }, L2(9), 1175000 },
124 { 0, { 1188000, HFPLL, 1, 0x2C }, L2(9), 1200000 },
125 { 1, { 1242000, HFPLL, 1, 0x2E }, L2(9), 1200000 },
126 { 0, { 1296000, HFPLL, 1, 0x30 }, L2(9), 1225000 },
127 { 1, { 1350000, HFPLL, 1, 0x32 }, L2(9), 1225000 },
128 { 0, { 1404000, HFPLL, 1, 0x34 }, L2(9), 1237500 },
129 { 1, { 1458000, HFPLL, 1, 0x36 }, L2(9), 1237500 },
130 { 1, { 1512000, HFPLL, 1, 0x38 }, L2(9), 1250000 },
131 { 1, { 1566000, HFPLL, 1, 0x3A }, L2(9), 1250000 },
132 { 1, { 1620000, HFPLL, 1, 0x3C }, L2(9), 1250000 },
133 { 1, { 1674000, HFPLL, 1, 0x3E }, L2(9), 1250000 },
134 { 1, { 1728000, HFPLL, 1, 0x40 }, L2(9), 1250000 },
Patrick Daly6578e0c2012-07-19 18:50:02 -0700135 { 0, { 0 } }
136};
137
Patrick Daly18d2d482012-08-24 14:22:06 -0700138static struct pvs_table pvs_tables[NUM_SPEED_BINS][NUM_PVS] __initdata = {
139[0][PVS_SLOW] = { acpu_freq_tbl_slow, sizeof(acpu_freq_tbl_slow), 0 },
140[0][PVS_NOMINAL] = { acpu_freq_tbl_slow, sizeof(acpu_freq_tbl_slow), 0 },
141[0][PVS_FAST] = { acpu_freq_tbl_slow, sizeof(acpu_freq_tbl_slow), 0 },
Patrick Daly6578e0c2012-07-19 18:50:02 -0700142};
143
144static struct acpuclk_krait_params acpuclk_8960ab_params __initdata = {
145 .scalable = scalable,
146 .scalable_size = sizeof(scalable),
147 .hfpll_data = &hfpll_data,
148 .pvs_tables = pvs_tables,
149 .l2_freq_tbl = l2_freq_tbl,
150 .l2_freq_tbl_size = sizeof(l2_freq_tbl),
151 .bus_scale = &bus_scale_data,
Matt Wagantallee2b4372012-09-17 17:51:06 -0700152 .pte_efuse_phys = 0x007000C0,
Patrick Daly05686c32012-08-22 14:23:28 -0700153 .stby_khz = 384000,
Patrick Daly6578e0c2012-07-19 18:50:02 -0700154};
155
156static int __init acpuclk_8960ab_probe(struct platform_device *pdev)
157{
158 return acpuclk_krait_init(&pdev->dev, &acpuclk_8960ab_params);
159}
160
161static struct platform_driver acpuclk_8960ab_driver = {
162 .driver = {
163 .name = "acpuclk-8960ab",
164 .owner = THIS_MODULE,
165 },
166};
167
168static int __init acpuclk_8960ab_init(void)
169{
170 return platform_driver_probe(&acpuclk_8960ab_driver,
171 acpuclk_8960ab_probe);
172}
173device_initcall(acpuclk_8960ab_init);