Merge branch 'fortglx/3.15/time' of git://git.linaro.org/people/john.stultz/linux...
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-msm / board-trout.c
1 /* linux/arch/arm/mach-msm/board-trout.c
2  *
3  * Copyright (C) 2009 Google, Inc.
4  * Author: Brian Swetland <swetland@google.com>
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  */
16 #define pr_fmt(fmt) "%s: " fmt, __func__
17
18 #include <linux/kernel.h>
19 #include <linux/init.h>
20 #include <linux/platform_device.h>
21 #include <linux/clkdev.h>
22
23 #include <asm/system_info.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
27 #include <asm/setup.h>
28
29 #include <mach/hardware.h>
30 #include <mach/msm_iomap.h>
31
32 #include "devices.h"
33 #include "board-trout.h"
34 #include "common.h"
35
36 extern int trout_init_mmc(unsigned int);
37
38 static struct platform_device *devices[] __initdata = {
39         &msm_clock_7x01a,
40         &msm_device_gpio_7201,
41         &msm_device_uart3,
42         &msm_device_smd,
43         &msm_device_nand,
44         &msm_device_hsusb,
45         &msm_device_i2c,
46 };
47
48 static void __init trout_init_early(void)
49 {
50         arch_ioremap_caller = __msm_ioremap_caller;
51 }
52
53 static void __init trout_init_irq(void)
54 {
55         msm_init_irq();
56 }
57
58 static void __init trout_fixup(struct tag *tags, char **cmdline,
59                                struct meminfo *mi)
60 {
61         mi->nr_banks = 1;
62         mi->bank[0].start = PHYS_OFFSET;
63         mi->bank[0].size = (101*1024*1024);
64 }
65
66 static void __init trout_init(void)
67 {
68         int rc;
69
70         platform_add_devices(devices, ARRAY_SIZE(devices));
71
72         if (IS_ENABLED(CONFIG_MMC)) {
73                 rc = trout_init_mmc(system_rev);
74                 if (rc)
75                         pr_crit("MMC init failure (%d)\n", rc);
76         }
77 }
78
79 static struct map_desc trout_io_desc[] __initdata = {
80         {
81                 .virtual = TROUT_CPLD_BASE,
82                 .pfn     = __phys_to_pfn(TROUT_CPLD_START),
83                 .length  = TROUT_CPLD_SIZE,
84                 .type    = MT_DEVICE_NONSHARED
85         }
86 };
87
88 static void __init trout_map_io(void)
89 {
90         msm_map_common_io();
91         iotable_init(trout_io_desc, ARRAY_SIZE(trout_io_desc));
92
93 #ifdef CONFIG_MSM_DEBUG_UART3
94         /* route UART3 to the "H2W" extended usb connector */
95         writeb(0x80, TROUT_CPLD_BASE + 0x00);
96 #endif
97 }
98
99 static void __init trout_init_late(void)
100 {
101         smd_debugfs_init();
102 }
103
104 MACHINE_START(TROUT, "HTC Dream")
105         .atag_offset    = 0x100,
106         .fixup          = trout_fixup,
107         .map_io         = trout_map_io,
108         .init_early     = trout_init_early,
109         .init_irq       = trout_init_irq,
110         .init_machine   = trout_init,
111         .init_late      = trout_init_late,
112         .init_time      = msm7x01_timer_init,
113 MACHINE_END