blob: 154cf337c0c7983dfa5f0aa47be8a7d944729e09 [file] [log] [blame]
Aaro Koskinen2d200662010-12-17 15:13:47 -08001/*
Aaro Koskinen63fc5f32012-03-05 11:08:37 -08002 * Board support file for Nokia RM-680/696.
Aaro Koskinen2d200662010-12-17 15:13:47 -08003 *
4 * Copyright (C) 2010 Nokia
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/io.h>
12#include <linux/i2c.h>
13#include <linux/gpio.h>
14#include <linux/init.h>
15#include <linux/i2c/twl.h>
16#include <linux/platform_device.h>
17#include <linux/regulator/fixed.h>
18#include <linux/regulator/machine.h>
19#include <linux/regulator/consumer.h>
Arnd Bergmann22037472012-08-24 15:21:06 +020020#include <linux/platform_data/mtd-onenand-omap2.h>
Aaro Koskinen2d200662010-12-17 15:13:47 -080021
22#include <asm/mach/arch.h>
23#include <asm/mach-types.h>
24
25#include <plat/i2c.h>
26#include <plat/mmc.h>
27#include <plat/usb.h>
28#include <plat/gpmc.h>
Tony Lindgren4e653312011-11-10 22:45:17 +010029#include "common.h"
Tony Lindgren7d7e1eb2012-08-27 17:43:01 -070030#include <plat/serial.h>
Aaro Koskinen2d200662010-12-17 15:13:47 -080031
32#include "mux.h"
33#include "hsmmc.h"
34#include "sdram-nokia.h"
Mike Rapoportfbd80712011-04-25 01:09:06 +030035#include "common-board-devices.h"
Afzal Mohammedb6ab13e2012-09-29 10:32:42 +053036#include "gpmc-onenand.h"
Aaro Koskinen2d200662010-12-17 15:13:47 -080037
38static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
Kishore Kadiyala0005ae72011-02-28 20:48:05 +053039 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
Aaro Koskinen2d200662010-12-17 15:13:47 -080040};
41
42/* Fixed regulator for internal eMMC */
43static struct regulator_init_data rm680_vemmc = {
44 .constraints = {
45 .name = "rm680_vemmc",
Aaro Koskinen2d200662010-12-17 15:13:47 -080046 .valid_modes_mask = REGULATOR_MODE_NORMAL
47 | REGULATOR_MODE_STANDBY,
48 .valid_ops_mask = REGULATOR_CHANGE_STATUS
49 | REGULATOR_CHANGE_MODE,
50 },
51 .num_consumer_supplies = ARRAY_SIZE(rm680_vemmc_consumers),
52 .consumer_supplies = rm680_vemmc_consumers,
53};
54
55static struct fixed_voltage_config rm680_vemmc_config = {
56 .supply_name = "VEMMC",
57 .microvolts = 2900000,
58 .gpio = 157,
59 .startup_delay = 150,
60 .enable_high = 1,
61 .init_data = &rm680_vemmc,
62};
63
64static struct platform_device rm680_vemmc_device = {
65 .name = "reg-fixed-voltage",
66 .dev = {
67 .platform_data = &rm680_vemmc_config,
68 },
69};
70
71static struct platform_device *rm680_peripherals_devices[] __initdata = {
72 &rm680_vemmc_device,
73};
74
75/* TWL */
76static struct twl4030_gpio_platform_data rm680_gpio_data = {
Aaro Koskinen2d200662010-12-17 15:13:47 -080077 .pullups = BIT(0),
78 .pulldowns = BIT(1) | BIT(2) | BIT(8) | BIT(15),
79};
80
Aaro Koskinen2d200662010-12-17 15:13:47 -080081static struct twl4030_platform_data rm680_twl_data = {
Aaro Koskinen2d200662010-12-17 15:13:47 -080082 .gpio = &rm680_gpio_data,
Aaro Koskinen2d200662010-12-17 15:13:47 -080083 /* add rest of the children here */
84};
85
Aaro Koskinen2d200662010-12-17 15:13:47 -080086static void __init rm680_i2c_init(void)
87{
Peter Ujfalusi827ed9a2011-06-07 10:28:54 +030088 omap3_pmic_get_config(&rm680_twl_data, TWL_COMMON_PDATA_USB, 0);
Tony Lindgren7d7e1eb2012-08-27 17:43:01 -070089 omap_pmic_init(1, 2900, "twl5031", 7 + OMAP_INTC_START, &rm680_twl_data);
Aaro Koskinen2d200662010-12-17 15:13:47 -080090 omap_register_i2c_bus(2, 400, NULL, 0);
91 omap_register_i2c_bus(3, 400, NULL, 0);
92}
93
94#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
95 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
96static struct omap_onenand_platform_data board_onenand_data[] = {
97 {
98 .gpio_irq = 65,
99 .flags = ONENAND_SYNC_READWRITE,
100 }
101};
102#endif
103
104/* eMMC */
105static struct omap2_hsmmc_info mmc[] __initdata = {
106 {
107 .name = "internal",
108 .mmc = 2,
109 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED,
110 .gpio_cd = -EINVAL,
111 .gpio_wp = -EINVAL,
112 },
113 { /* Terminator */ }
114};
115
116static void __init rm680_peripherals_init(void)
117{
118 platform_add_devices(rm680_peripherals_devices,
119 ARRAY_SIZE(rm680_peripherals_devices));
120 rm680_i2c_init();
121 gpmc_onenand_init(board_onenand_data);
Tony Lindgren3b972bf2012-02-20 09:43:29 -0800122 omap_hsmmc_init(mmc);
Aaro Koskinen2d200662010-12-17 15:13:47 -0800123}
124
Aaro Koskinen2d200662010-12-17 15:13:47 -0800125#ifdef CONFIG_OMAP_MUX
126static struct omap_board_mux board_mux[] __initdata = {
127 { .reg_offset = OMAP_MUX_TERMINATOR },
128};
129#endif
130
Aaro Koskinen2d200662010-12-17 15:13:47 -0800131static void __init rm680_init(void)
132{
Tony Lindgrena4ca9db2011-08-22 23:57:23 -0700133 struct omap_sdrc_params *sdrc_params;
134
Aaro Koskinen2d200662010-12-17 15:13:47 -0800135 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
136 omap_serial_init();
Tony Lindgrena4ca9db2011-08-22 23:57:23 -0700137
138 sdrc_params = nokia_get_sdram_timings();
139 omap_sdrc_init(sdrc_params, sdrc_params);
140
Mike Rapoport9e186302011-04-27 11:56:12 +0300141 usb_musb_init(NULL);
Aaro Koskinen2d200662010-12-17 15:13:47 -0800142 rm680_peripherals_init();
143}
144
Aaro Koskinen2d200662010-12-17 15:13:47 -0800145MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
Nicolas Pitre5e52b432011-07-05 22:38:15 -0400146 .atag_offset = 0x100,
Aaro Koskinen2d200662010-12-17 15:13:47 -0800147 .reserve = omap_reserve,
Tony Lindgrene990a402011-09-26 14:52:55 -0700148 .map_io = omap3_map_io,
Tony Lindgren8f5b5a42011-08-22 23:57:24 -0700149 .init_early = omap3630_init_early,
Tony Lindgren741e3a82011-05-17 03:51:26 -0700150 .init_irq = omap3_init_irq,
Marc Zyngier6b2f55d2011-09-06 10:23:45 +0100151 .handle_irq = omap3_intc_handle_irq,
Aaro Koskinen2d200662010-12-17 15:13:47 -0800152 .init_machine = rm680_init,
Shawn Guobbd707a2012-04-26 16:06:50 +0800153 .init_late = omap3630_init_late,
Tony Lindgrene74984e2011-03-29 15:54:48 -0700154 .timer = &omap3_timer,
Russell Kingbaa95882011-11-05 17:06:28 +0000155 .restart = omap_prcm_restart,
Aaro Koskinen2d200662010-12-17 15:13:47 -0800156MACHINE_END
Aaro Koskinen63fc5f32012-03-05 11:08:37 -0800157
158MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
159 .atag_offset = 0x100,
160 .reserve = omap_reserve,
161 .map_io = omap3_map_io,
162 .init_early = omap3630_init_early,
163 .init_irq = omap3_init_irq,
164 .handle_irq = omap3_intc_handle_irq,
165 .init_machine = rm680_init,
Shawn Guobbd707a2012-04-26 16:06:50 +0800166 .init_late = omap3630_init_late,
Aaro Koskinen63fc5f32012-03-05 11:08:37 -0800167 .timer = &omap3_timer,
168 .restart = omap_prcm_restart,
169MACHINE_END