blob: 0277f280bde56433bce77e7d81e26888304fd1ec [file] [log] [blame]
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001/* Copyright (c) 2011, Code Aurora Forum. 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
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/irq.h>
17#include <linux/io.h>
18#include <asm/hardware/gic.h>
19#include <mach/board.h>
20#include <mach/msm_iomap.h>
21#include <mach/irqs.h>
22#include <mach/socinfo.h>
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -070023#include <asm/hardware/cache-l2x0.h>
Yan He092b7272011-09-21 15:25:03 -070024#include <mach/msm_sps.h>
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070025#include <mach/dma.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070026#include "devices.h"
Matt Wagantall44f672e2011-09-07 20:31:16 -070027#include "acpuclock.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070028
Harini Jayaramaneba52672011-09-08 15:13:00 -060029/* Address of GSBI blocks */
30#define MSM_GSBI1_PHYS 0x16000000
31#define MSM_GSBI2_PHYS 0x16100000
32#define MSM_GSBI3_PHYS 0x16200000
Rohit Vaswani09666872011-08-23 17:41:54 -070033#define MSM_GSBI4_PHYS 0x16300000
Harini Jayaramaneba52672011-09-08 15:13:00 -060034#define MSM_GSBI5_PHYS 0x16400000
35
Rohit Vaswani09666872011-08-23 17:41:54 -070036#define MSM_UART4DM_PHYS (MSM_GSBI4_PHYS + 0x40000)
37
Harini Jayaramaneba52672011-09-08 15:13:00 -060038/* GSBI QUP devices */
39#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
40#define MSM_GSBI2_QUP_PHYS (MSM_GSBI2_PHYS + 0x80000)
41#define MSM_GSBI3_QUP_PHYS (MSM_GSBI3_PHYS + 0x80000)
42#define MSM_GSBI4_QUP_PHYS (MSM_GSBI4_PHYS + 0x80000)
43#define MSM_GSBI5_QUP_PHYS (MSM_GSBI5_PHYS + 0x80000)
44#define MSM_QUP_SIZE SZ_4K
45
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070046/* Address of SSBI CMD */
47#define MSM_PMIC1_SSBI_CMD_PHYS 0x00500000
48#define MSM_PMIC_SSBI_SIZE SZ_4K
49
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070050static struct resource msm_dmov_resource[] = {
51 {
52 .start = ADM_0_SCSS_1_IRQ,
53 .end = (resource_size_t)MSM_DMOV_BASE,
54 .flags = IORESOURCE_IRQ,
55 },
56};
57
58struct platform_device msm9615_device_dmov = {
59 .name = "msm_dmov",
60 .id = -1,
61 .resource = msm_dmov_resource,
62 .num_resources = ARRAY_SIZE(msm_dmov_resource),
63};
64
Rohit Vaswani09666872011-08-23 17:41:54 -070065static struct resource resources_uart_gsbi4[] = {
66 {
67 .start = GSBI4_UARTDM_IRQ,
68 .end = GSBI4_UARTDM_IRQ,
69 .flags = IORESOURCE_IRQ,
70 },
71 {
72 .start = MSM_UART4DM_PHYS,
73 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
74 .name = "uartdm_resource",
75 .flags = IORESOURCE_MEM,
76 },
77 {
78 .start = MSM_GSBI4_PHYS,
79 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
80 .name = "gsbi_resource",
81 .flags = IORESOURCE_MEM,
82 },
83};
84
85struct platform_device msm9615_device_uart_gsbi4 = {
86 .name = "msm_serial_hsl",
87 .id = 0,
88 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
89 .resource = resources_uart_gsbi4,
90};
91
Harini Jayaramaneba52672011-09-08 15:13:00 -060092static struct resource resources_qup_i2c_gsbi5[] = {
93 {
94 .name = "gsbi_qup_i2c_addr",
95 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -060096 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -060097 .flags = IORESOURCE_MEM,
98 },
99 {
100 .name = "qup_phys_addr",
101 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600102 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600103 .flags = IORESOURCE_MEM,
104 },
105 {
106 .name = "qup_err_intr",
107 .start = GSBI5_QUP_IRQ,
108 .end = GSBI5_QUP_IRQ,
109 .flags = IORESOURCE_IRQ,
110 },
111};
112
113struct platform_device msm9615_device_qup_i2c_gsbi5 = {
114 .name = "qup_i2c",
115 .id = 0,
116 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
117 .resource = resources_qup_i2c_gsbi5,
118};
119
Harini Jayaraman738c9312011-09-08 15:22:38 -0600120static struct resource resources_qup_spi_gsbi3[] = {
121 {
122 .name = "spi_base",
123 .start = MSM_GSBI3_QUP_PHYS,
124 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
125 .flags = IORESOURCE_MEM,
126 },
127 {
128 .name = "gsbi_base",
129 .start = MSM_GSBI3_PHYS,
130 .end = MSM_GSBI3_PHYS + 4 - 1,
131 .flags = IORESOURCE_MEM,
132 },
133 {
134 .name = "spi_irq_in",
135 .start = GSBI3_QUP_IRQ,
136 .end = GSBI3_QUP_IRQ,
137 .flags = IORESOURCE_IRQ,
138 },
139};
140
141struct platform_device msm9615_device_qup_spi_gsbi3 = {
142 .name = "spi_qsd",
143 .id = 0,
144 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
145 .resource = resources_qup_spi_gsbi3,
146};
147
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700148static struct resource resources_ssbi_pmic1[] = {
149 {
150 .start = MSM_PMIC1_SSBI_CMD_PHYS,
151 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
152 .flags = IORESOURCE_MEM,
153 },
154};
155
156struct platform_device msm9615_device_ssbi_pmic1 = {
157 .name = "msm_ssbi",
158 .id = 0,
159 .resource = resources_ssbi_pmic1,
160 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
161};
162
Yan He092b7272011-09-21 15:25:03 -0700163static struct resource resources_sps[] = {
164 {
165 .name = "pipe_mem",
166 .start = 0x12800000,
167 .end = 0x12800000 + 0x4000 - 1,
168 .flags = IORESOURCE_MEM,
169 },
170 {
171 .name = "bamdma_dma",
172 .start = 0x12240000,
173 .end = 0x12240000 + 0x1000 - 1,
174 .flags = IORESOURCE_MEM,
175 },
176 {
177 .name = "bamdma_bam",
178 .start = 0x12244000,
179 .end = 0x12244000 + 0x4000 - 1,
180 .flags = IORESOURCE_MEM,
181 },
182 {
183 .name = "bamdma_irq",
184 .start = SPS_BAM_DMA_IRQ,
185 .end = SPS_BAM_DMA_IRQ,
186 .flags = IORESOURCE_IRQ,
187 },
188};
189
190struct msm_sps_platform_data msm_sps_pdata = {
191 .bamdma_restricted_pipes = 0x06,
192};
193
194struct platform_device msm_device_sps = {
195 .name = "msm_sps",
196 .id = -1,
197 .num_resources = ARRAY_SIZE(resources_sps),
198 .resource = resources_sps,
199 .dev.platform_data = &msm_sps_pdata,
200};
201
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700202#ifdef CONFIG_CACHE_L2X0
203static int __init l2x0_cache_init(void)
204{
205 int aux_ctrl = 0;
206
207 /* Way Size 010(0x2) 32KB */
208 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
209 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
210 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
211
212 /* L2 Latency setting required by hardware. Default is 0x20
213 which is no good.
214 */
215 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
216 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
217
218 return 0;
219}
220#else
221static int __init l2x0_cache_init(void){ return 0; }
222#endif
223
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700224void __init msm9615_device_init(void)
225{
226 if (socinfo_init() < 0)
227 pr_err("socinfo_init() failed!\n");
228
Vikram Mulukutla489e39e2011-08-31 18:04:05 -0700229 msm_clock_init(&msm9615_clock_init_data);
Matt Wagantall44f672e2011-09-07 20:31:16 -0700230 acpuclk_init(&acpuclk_9615_soc_data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700231}
232
233void __init msm9615_map_io(void)
234{
235 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700236 l2x0_cache_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700237}
238
239void __init msm9615_init_irq(void)
240{
241 unsigned int i;
242 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
243 (void *)MSM_QGIC_CPU_BASE);
244
245 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
246 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
247
248 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
249 mb();
250
251 /*
252 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
253 * as they are configured as level, which does not play nice with
254 * handle_percpu_irq.
255 */
256 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
257 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
258 irq_set_handler(i, handle_percpu_irq);
259 }
260}