blob: 3bc950e54c394abae4b839baebdd3003473b20fe [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
Rohit Vaswani09666872011-08-23 17:41:54 -070026#define MSM_GSBI4_PHYS 0x16300000
27#define MSM_UART4DM_PHYS (MSM_GSBI4_PHYS + 0x40000)
28
29static struct resource resources_uart_gsbi4[] = {
30 {
31 .start = GSBI4_UARTDM_IRQ,
32 .end = GSBI4_UARTDM_IRQ,
33 .flags = IORESOURCE_IRQ,
34 },
35 {
36 .start = MSM_UART4DM_PHYS,
37 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
38 .name = "uartdm_resource",
39 .flags = IORESOURCE_MEM,
40 },
41 {
42 .start = MSM_GSBI4_PHYS,
43 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
44 .name = "gsbi_resource",
45 .flags = IORESOURCE_MEM,
46 },
47};
48
49struct platform_device msm9615_device_uart_gsbi4 = {
50 .name = "msm_serial_hsl",
51 .id = 0,
52 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
53 .resource = resources_uart_gsbi4,
54};
55
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -070056#ifdef CONFIG_CACHE_L2X0
57static int __init l2x0_cache_init(void)
58{
59 int aux_ctrl = 0;
60
61 /* Way Size 010(0x2) 32KB */
62 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
63 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
64 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
65
66 /* L2 Latency setting required by hardware. Default is 0x20
67 which is no good.
68 */
69 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
70 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
71
72 return 0;
73}
74#else
75static int __init l2x0_cache_init(void){ return 0; }
76#endif
77
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070078void __init msm9615_device_init(void)
79{
80 if (socinfo_init() < 0)
81 pr_err("socinfo_init() failed!\n");
82
Vikram Mulukutla489e39e2011-08-31 18:04:05 -070083 msm_clock_init(&msm9615_clock_init_data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070084}
85
86void __init msm9615_map_io(void)
87{
88 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -070089 l2x0_cache_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070090}
91
92void __init msm9615_init_irq(void)
93{
94 unsigned int i;
95 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
96 (void *)MSM_QGIC_CPU_BASE);
97
98 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
99 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
100
101 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
102 mb();
103
104 /*
105 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
106 * as they are configured as level, which does not play nice with
107 * handle_percpu_irq.
108 */
109 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
110 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
111 irq_set_handler(i, handle_percpu_irq);
112 }
113}