Commit | Line | Data |
---|---|---|
614ad981 DW |
1 | /* linux/arch/arm/mach-msm/board-sapphire.c |
2 | * Copyright (C) 2007-2009 HTC Corporation. | |
3 | * Author: Thomas Tsai <thomas_tsai@htc.com> | |
4 | * | |
5 | * This software is licensed under the terms of the GNU General Public | |
6 | * License version 2, as published by the Free Software Foundation, and | |
7 | * may be copied, distributed, and modified under those terms. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | */ | |
2f8163ba | 14 | #include <linux/gpio.h> |
614ad981 DW |
15 | #include <linux/kernel.h> |
16 | #include <linux/init.h> | |
17 | #include <linux/platform_device.h> | |
18 | #include <linux/input.h> | |
19 | #include <linux/interrupt.h> | |
20 | #include <linux/irq.h> | |
edbaa603 | 21 | #include <linux/device.h> |
614ad981 DW |
22 | |
23 | #include <linux/delay.h> | |
24 | ||
614ad981 DW |
25 | #include <mach/hardware.h> |
26 | #include <asm/mach-types.h> | |
27 | #include <asm/mach/arch.h> | |
28 | #include <asm/mach/map.h> | |
29 | #include <asm/mach/flash.h> | |
614ad981 | 30 | #include <mach/vreg.h> |
614ad981 DW |
31 | |
32 | #include <asm/io.h> | |
33 | #include <asm/delay.h> | |
34 | #include <asm/setup.h> | |
35 | ||
36 | #include <linux/mtd/nand.h> | |
37 | #include <linux/mtd/partitions.h> | |
1c2f87c2 | 38 | #include <linux/memblock.h> |
614ad981 DW |
39 | |
40 | #include "gpio_chip.h" | |
41 | #include "board-sapphire.h" | |
42 | #include "proc_comm.h" | |
43 | #include "devices.h" | |
ebea60be | 44 | #include "common.h" |
614ad981 DW |
45 | |
46 | void msm_init_irq(void); | |
47 | void msm_init_gpio(void); | |
48 | ||
49 | static struct platform_device *devices[] __initdata = { | |
50 | &msm_device_smd, | |
51 | &msm_device_dmov, | |
52 | &msm_device_nand, | |
53 | &msm_device_uart1, | |
54 | &msm_device_uart3, | |
55 | }; | |
56 | ||
6bb27d73 | 57 | void msm_timer_init(void); |
614ad981 DW |
58 | |
59 | static void __init sapphire_init_irq(void) | |
60 | { | |
61 | msm_init_irq(); | |
62 | } | |
63 | ||
64 | static void __init sapphire_init(void) | |
65 | { | |
66 | platform_add_devices(devices, ARRAY_SIZE(devices)); | |
67 | } | |
68 | ||
69 | static struct map_desc sapphire_io_desc[] __initdata = { | |
70 | { | |
71 | .virtual = SAPPHIRE_CPLD_BASE, | |
72 | .pfn = __phys_to_pfn(SAPPHIRE_CPLD_START), | |
73 | .length = SAPPHIRE_CPLD_SIZE, | |
74 | .type = MT_DEVICE_NONSHARED | |
75 | } | |
76 | }; | |
77 | ||
1c2f87c2 | 78 | static void __init sapphire_fixup(struct tag *tags, char **cmdline) |
614ad981 DW |
79 | { |
80 | int smi_sz = parse_tag_smi((const struct tag *)tags); | |
81 | ||
614ad981 | 82 | if (smi_sz == 32) { |
1c2f87c2 | 83 | memblock_add(PHYS_OFFSET, 84*SZ_1M); |
614ad981 | 84 | } else if (smi_sz == 64) { |
1c2f87c2 | 85 | memblock_add(PHYS_OFFSET, 101*SZ_1M); |
614ad981 | 86 | } else { |
1c2f87c2 | 87 | memblock_add(PHYS_OFFSET, 101*SZ_1M); |
614ad981 DW |
88 | /* Give a default value when not get smi size */ |
89 | smi_sz = 64; | |
614ad981 DW |
90 | } |
91 | } | |
92 | ||
93 | static void __init sapphire_map_io(void) | |
94 | { | |
95 | msm_map_common_io(); | |
96 | iotable_init(sapphire_io_desc, ARRAY_SIZE(sapphire_io_desc)); | |
97 | msm_clock_init(); | |
98 | } | |
99 | ||
c633c531 SG |
100 | static void __init sapphire_init_late(void) |
101 | { | |
102 | smd_debugfs_init(); | |
103 | } | |
104 | ||
614ad981 DW |
105 | MACHINE_START(SAPPHIRE, "sapphire") |
106 | /* Maintainer: Brian Swetland <swetland@google.com> */ | |
f631dd41 | 107 | .atag_offset = 0x100, |
614ad981 DW |
108 | .fixup = sapphire_fixup, |
109 | .map_io = sapphire_map_io, | |
110 | .init_irq = sapphire_init_irq, | |
111 | .init_machine = sapphire_init, | |
c633c531 | 112 | .init_late = sapphire_init_late, |
6bb27d73 | 113 | .init_time = msm_timer_init, |
614ad981 | 114 | MACHINE_END |