blob: eaa741ae72011bbc12a0d8daf515363708c263db [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"
25
Harini Jayaramaneba52672011-09-08 15:13:00 -060026/* Address of GSBI blocks */
27#define MSM_GSBI1_PHYS 0x16000000
28#define MSM_GSBI2_PHYS 0x16100000
29#define MSM_GSBI3_PHYS 0x16200000
Rohit Vaswani09666872011-08-23 17:41:54 -070030#define MSM_GSBI4_PHYS 0x16300000
Harini Jayaramaneba52672011-09-08 15:13:00 -060031#define MSM_GSBI5_PHYS 0x16400000
32
Rohit Vaswani09666872011-08-23 17:41:54 -070033#define MSM_UART4DM_PHYS (MSM_GSBI4_PHYS + 0x40000)
34
Harini Jayaramaneba52672011-09-08 15:13:00 -060035/* GSBI QUP devices */
36#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
37#define MSM_GSBI2_QUP_PHYS (MSM_GSBI2_PHYS + 0x80000)
38#define MSM_GSBI3_QUP_PHYS (MSM_GSBI3_PHYS + 0x80000)
39#define MSM_GSBI4_QUP_PHYS (MSM_GSBI4_PHYS + 0x80000)
40#define MSM_GSBI5_QUP_PHYS (MSM_GSBI5_PHYS + 0x80000)
41#define MSM_QUP_SIZE SZ_4K
42
Rohit Vaswani09666872011-08-23 17:41:54 -070043static struct resource resources_uart_gsbi4[] = {
44 {
45 .start = GSBI4_UARTDM_IRQ,
46 .end = GSBI4_UARTDM_IRQ,
47 .flags = IORESOURCE_IRQ,
48 },
49 {
50 .start = MSM_UART4DM_PHYS,
51 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
52 .name = "uartdm_resource",
53 .flags = IORESOURCE_MEM,
54 },
55 {
56 .start = MSM_GSBI4_PHYS,
57 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
58 .name = "gsbi_resource",
59 .flags = IORESOURCE_MEM,
60 },
61};
62
63struct platform_device msm9615_device_uart_gsbi4 = {
64 .name = "msm_serial_hsl",
65 .id = 0,
66 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
67 .resource = resources_uart_gsbi4,
68};
69
Harini Jayaramaneba52672011-09-08 15:13:00 -060070static struct resource resources_qup_i2c_gsbi5[] = {
71 {
72 .name = "gsbi_qup_i2c_addr",
73 .start = MSM_GSBI5_PHYS,
74 .end = MSM_GSBI5_PHYS + MSM_QUP_SIZE - 1,
75 .flags = IORESOURCE_MEM,
76 },
77 {
78 .name = "qup_phys_addr",
79 .start = MSM_GSBI5_QUP_PHYS,
80 .end = MSM_GSBI5_QUP_PHYS + 4 - 1,
81 .flags = IORESOURCE_MEM,
82 },
83 {
84 .name = "qup_err_intr",
85 .start = GSBI5_QUP_IRQ,
86 .end = GSBI5_QUP_IRQ,
87 .flags = IORESOURCE_IRQ,
88 },
89};
90
91struct platform_device msm9615_device_qup_i2c_gsbi5 = {
92 .name = "qup_i2c",
93 .id = 0,
94 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
95 .resource = resources_qup_i2c_gsbi5,
96};
97
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -070098#ifdef CONFIG_CACHE_L2X0
99static int __init l2x0_cache_init(void)
100{
101 int aux_ctrl = 0;
102
103 /* Way Size 010(0x2) 32KB */
104 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
105 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
106 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
107
108 /* L2 Latency setting required by hardware. Default is 0x20
109 which is no good.
110 */
111 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
112 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
113
114 return 0;
115}
116#else
117static int __init l2x0_cache_init(void){ return 0; }
118#endif
119
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700120void __init msm9615_device_init(void)
121{
122 if (socinfo_init() < 0)
123 pr_err("socinfo_init() failed!\n");
124
Vikram Mulukutla489e39e2011-08-31 18:04:05 -0700125 msm_clock_init(&msm9615_clock_init_data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700126}
127
128void __init msm9615_map_io(void)
129{
130 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700131 l2x0_cache_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700132}
133
134void __init msm9615_init_irq(void)
135{
136 unsigned int i;
137 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
138 (void *)MSM_QGIC_CPU_BASE);
139
140 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
141 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
142
143 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
144 mb();
145
146 /*
147 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
148 * as they are configured as level, which does not play nice with
149 * handle_percpu_irq.
150 */
151 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
152 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
153 irq_set_handler(i, handle_percpu_irq);
154 }
155}