blob: 6a14ace24137ad377763e4fe2f08dfda58a4d68a [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>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070024#include "devices.h"
Matt Wagantall44f672e2011-09-07 20:31:16 -070025#include "acpuclock.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070026
Harini Jayaramaneba52672011-09-08 15:13:00 -060027/* Address of GSBI blocks */
28#define MSM_GSBI1_PHYS 0x16000000
29#define MSM_GSBI2_PHYS 0x16100000
30#define MSM_GSBI3_PHYS 0x16200000
Rohit Vaswani09666872011-08-23 17:41:54 -070031#define MSM_GSBI4_PHYS 0x16300000
Harini Jayaramaneba52672011-09-08 15:13:00 -060032#define MSM_GSBI5_PHYS 0x16400000
33
Rohit Vaswani09666872011-08-23 17:41:54 -070034#define MSM_UART4DM_PHYS (MSM_GSBI4_PHYS + 0x40000)
35
Harini Jayaramaneba52672011-09-08 15:13:00 -060036/* GSBI QUP devices */
37#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
38#define MSM_GSBI2_QUP_PHYS (MSM_GSBI2_PHYS + 0x80000)
39#define MSM_GSBI3_QUP_PHYS (MSM_GSBI3_PHYS + 0x80000)
40#define MSM_GSBI4_QUP_PHYS (MSM_GSBI4_PHYS + 0x80000)
41#define MSM_GSBI5_QUP_PHYS (MSM_GSBI5_PHYS + 0x80000)
42#define MSM_QUP_SIZE SZ_4K
43
Rohit Vaswani09666872011-08-23 17:41:54 -070044static struct resource resources_uart_gsbi4[] = {
45 {
46 .start = GSBI4_UARTDM_IRQ,
47 .end = GSBI4_UARTDM_IRQ,
48 .flags = IORESOURCE_IRQ,
49 },
50 {
51 .start = MSM_UART4DM_PHYS,
52 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
53 .name = "uartdm_resource",
54 .flags = IORESOURCE_MEM,
55 },
56 {
57 .start = MSM_GSBI4_PHYS,
58 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
59 .name = "gsbi_resource",
60 .flags = IORESOURCE_MEM,
61 },
62};
63
64struct platform_device msm9615_device_uart_gsbi4 = {
65 .name = "msm_serial_hsl",
66 .id = 0,
67 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
68 .resource = resources_uart_gsbi4,
69};
70
Harini Jayaramaneba52672011-09-08 15:13:00 -060071static struct resource resources_qup_i2c_gsbi5[] = {
72 {
73 .name = "gsbi_qup_i2c_addr",
74 .start = MSM_GSBI5_PHYS,
75 .end = MSM_GSBI5_PHYS + MSM_QUP_SIZE - 1,
76 .flags = IORESOURCE_MEM,
77 },
78 {
79 .name = "qup_phys_addr",
80 .start = MSM_GSBI5_QUP_PHYS,
81 .end = MSM_GSBI5_QUP_PHYS + 4 - 1,
82 .flags = IORESOURCE_MEM,
83 },
84 {
85 .name = "qup_err_intr",
86 .start = GSBI5_QUP_IRQ,
87 .end = GSBI5_QUP_IRQ,
88 .flags = IORESOURCE_IRQ,
89 },
90};
91
92struct platform_device msm9615_device_qup_i2c_gsbi5 = {
93 .name = "qup_i2c",
94 .id = 0,
95 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
96 .resource = resources_qup_i2c_gsbi5,
97};
98
Harini Jayaraman738c9312011-09-08 15:22:38 -060099static struct resource resources_qup_spi_gsbi3[] = {
100 {
101 .name = "spi_base",
102 .start = MSM_GSBI3_QUP_PHYS,
103 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
104 .flags = IORESOURCE_MEM,
105 },
106 {
107 .name = "gsbi_base",
108 .start = MSM_GSBI3_PHYS,
109 .end = MSM_GSBI3_PHYS + 4 - 1,
110 .flags = IORESOURCE_MEM,
111 },
112 {
113 .name = "spi_irq_in",
114 .start = GSBI3_QUP_IRQ,
115 .end = GSBI3_QUP_IRQ,
116 .flags = IORESOURCE_IRQ,
117 },
118};
119
120struct platform_device msm9615_device_qup_spi_gsbi3 = {
121 .name = "spi_qsd",
122 .id = 0,
123 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
124 .resource = resources_qup_spi_gsbi3,
125};
126
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700127#ifdef CONFIG_CACHE_L2X0
128static int __init l2x0_cache_init(void)
129{
130 int aux_ctrl = 0;
131
132 /* Way Size 010(0x2) 32KB */
133 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
134 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
135 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
136
137 /* L2 Latency setting required by hardware. Default is 0x20
138 which is no good.
139 */
140 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
141 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
142
143 return 0;
144}
145#else
146static int __init l2x0_cache_init(void){ return 0; }
147#endif
148
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700149void __init msm9615_device_init(void)
150{
151 if (socinfo_init() < 0)
152 pr_err("socinfo_init() failed!\n");
153
Vikram Mulukutla489e39e2011-08-31 18:04:05 -0700154 msm_clock_init(&msm9615_clock_init_data);
Matt Wagantall44f672e2011-09-07 20:31:16 -0700155 acpuclk_init(&acpuclk_9615_soc_data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700156}
157
158void __init msm9615_map_io(void)
159{
160 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700161 l2x0_cache_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700162}
163
164void __init msm9615_init_irq(void)
165{
166 unsigned int i;
167 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
168 (void *)MSM_QGIC_CPU_BASE);
169
170 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
171 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
172
173 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
174 mb();
175
176 /*
177 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
178 * as they are configured as level, which does not play nice with
179 * handle_percpu_irq.
180 */
181 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
182 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
183 irq_set_handler(i, handle_percpu_irq);
184 }
185}