Merge remote-tracking branches 'asoc/fix/atmel', 'asoc/fix/fsl', 'asoc/fix/tegra...
[linux-drm-fsl-dcu.git] / arch / arm / mach-omap2 / board-rx51.c
1 /*
2  * Board support file for Nokia N900 (aka RX-51).
3  *
4  * Copyright (C) 2007, 2008 Nokia
5  * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg>
6  * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/delay.h>
17 #include <linux/err.h>
18 #include <linux/clk.h>
19 #include <linux/io.h>
20 #include <linux/gpio.h>
21 #include <linux/leds.h>
22 #include <linux/usb/phy.h>
23 #include <linux/usb/musb.h>
24 #include <linux/platform_data/spi-omap2-mcspi.h>
25
26 #include <asm/mach-types.h>
27 #include <asm/mach/arch.h>
28 #include <asm/mach/map.h>
29
30 #include <linux/omap-dma.h>
31
32 #include "common.h"
33 #include "mux.h"
34 #include "gpmc.h"
35 #include "pm.h"
36 #include "soc.h"
37 #include "sdram-nokia.h"
38 #include "omap-secure.h"
39
40 #define RX51_GPIO_SLEEP_IND 162
41
42 static struct gpio_led gpio_leds[] = {
43         {
44                 .name   = "sleep_ind",
45                 .gpio   = RX51_GPIO_SLEEP_IND,
46         },
47 };
48
49 static struct gpio_led_platform_data gpio_led_info = {
50         .leds           = gpio_leds,
51         .num_leds       = ARRAY_SIZE(gpio_leds),
52 };
53
54 static struct platform_device leds_gpio = {
55         .name   = "leds-gpio",
56         .id     = -1,
57         .dev    = {
58                 .platform_data  = &gpio_led_info,
59         },
60 };
61
62 /*
63  * cpuidle C-states definition for rx51.
64  *
65  * The 'exit_latency' field is the sum of sleep
66  * and wake-up latencies.
67
68     ---------------------------------------------
69    | state |  exit_latency  |  target_residency  |
70     ---------------------------------------------
71    |  C1   |    110 + 162   |            5       |
72    |  C2   |    106 + 180   |          309       |
73    |  C3   |    107 + 410   |        46057       |
74    |  C4   |    121 + 3374  |        46057       |
75    |  C5   |    855 + 1146  |        46057       |
76    |  C6   |   7580 + 4134  |       484329       |
77    |  C7   |   7505 + 15274 |       484329       |
78     ---------------------------------------------
79
80 */
81
82 extern void __init rx51_peripherals_init(void);
83
84 #ifdef CONFIG_OMAP_MUX
85 static struct omap_board_mux board_mux[] __initdata = {
86         { .reg_offset = OMAP_MUX_TERMINATOR },
87 };
88 #endif
89
90 static struct omap_musb_board_data musb_board_data = {
91         .interface_type         = MUSB_INTERFACE_ULPI,
92         .mode                   = MUSB_OTG,
93         .power                  = 0,
94 };
95
96 static void __init rx51_init(void)
97 {
98         struct omap_sdrc_params *sdrc_params;
99
100         omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
101         omap_serial_init();
102
103         sdrc_params = nokia_get_sdram_timings();
104         omap_sdrc_init(sdrc_params, sdrc_params);
105
106         usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
107         usb_musb_init(&musb_board_data);
108         rx51_peripherals_init();
109
110         if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
111 #ifdef CONFIG_ARM_ERRATA_430973
112                 pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
113                 /* set IBE to 1 */
114                 rx51_secure_update_aux_cr(BIT(6), 0);
115 #endif
116         }
117
118         /* Ensure SDRC pins are mux'd for self-refresh */
119         omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
120         omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
121
122         platform_device_register(&leds_gpio);
123 }
124
125 static void __init rx51_reserve(void)
126 {
127         omap_reserve();
128 }
129
130 MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
131         /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */
132         .atag_offset    = 0x100,
133         .reserve        = rx51_reserve,
134         .map_io         = omap3_map_io,
135         .init_early     = omap3430_init_early,
136         .init_irq       = omap3_init_irq,
137         .handle_irq     = omap3_intc_handle_irq,
138         .init_machine   = rx51_init,
139         .init_late      = omap3430_init_late,
140         .init_time      = omap3_sync32k_timer_init,
141         .restart        = omap3xxx_restart,
142 MACHINE_END