blob: ff73249884d031bb165b89d905411ffb65cd067c [file] [log] [blame]
Haojian Zhuange1cb7db2010-01-06 09:07:15 -05001/*
2 * linux/arch/arm/mach-mmp/jasper.c
3 *
4 * Support for the Marvell Jasper Development Platform.
5 *
6 * Copyright (C) 2009-2010 Marvell International Ltd.
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 * publishhed by the Free Software Foundation.
11 */
12
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
Haojian Zhuang25039912010-04-28 15:43:21 -040017#include <linux/regulator/machine.h>
18#include <linux/regulator/max8649.h>
19#include <linux/mfd/max8925.h>
Haojian Zhuang0bd86962010-09-08 09:42:42 -040020#include <linux/interrupt.h>
Haojian Zhuange1cb7db2010-01-06 09:07:15 -050021
Rob Herring8661fb92012-01-03 16:50:40 -060022#include <mach/irqs.h>
Haojian Zhuange1cb7db2010-01-06 09:07:15 -050023#include <asm/mach-types.h>
24#include <asm/mach/arch.h>
25#include <mach/addr-map.h>
26#include <mach/mfp-mmp2.h>
27#include <mach/mmp2.h>
28
29#include "common.h"
30
Rob Herring8661fb92012-01-03 16:50:40 -060031#define JASPER_NR_IRQS (MMP_NR_IRQS + 48)
Haojian Zhuang0bd86962010-09-08 09:42:42 -040032
Haojian Zhuange1cb7db2010-01-06 09:07:15 -050033static unsigned long jasper_pin_config[] __initdata = {
34 /* UART1 */
35 GPIO29_UART1_RXD,
36 GPIO30_UART1_TXD,
37
38 /* UART3 */
39 GPIO51_UART3_RXD,
40 GPIO52_UART3_TXD,
41
42 /* DFI */
43 GPIO168_DFI_D0,
44 GPIO167_DFI_D1,
45 GPIO166_DFI_D2,
46 GPIO165_DFI_D3,
47 GPIO107_DFI_D4,
48 GPIO106_DFI_D5,
49 GPIO105_DFI_D6,
50 GPIO104_DFI_D7,
51 GPIO111_DFI_D8,
52 GPIO164_DFI_D9,
53 GPIO163_DFI_D10,
54 GPIO162_DFI_D11,
55 GPIO161_DFI_D12,
56 GPIO110_DFI_D13,
57 GPIO109_DFI_D14,
58 GPIO108_DFI_D15,
59 GPIO143_ND_nCS0,
60 GPIO144_ND_nCS1,
61 GPIO147_ND_nWE,
62 GPIO148_ND_nRE,
63 GPIO150_ND_ALE,
64 GPIO149_ND_CLE,
65 GPIO112_ND_RDY0,
66 GPIO160_ND_RDY1,
Haojian Zhuang25039912010-04-28 15:43:21 -040067
68 /* PMIC */
69 PMIC_PMIC_INT | MFP_LPM_EDGE_FALL,
Zhangfei Gaofe805982010-11-03 01:15:32 -040070
71 /* MMC1 */
72 GPIO131_MMC1_DAT3,
73 GPIO132_MMC1_DAT2,
74 GPIO133_MMC1_DAT1,
75 GPIO134_MMC1_DAT0,
76 GPIO136_MMC1_CMD,
77 GPIO139_MMC1_CLK,
78 GPIO140_MMC1_CD,
79 GPIO141_MMC1_WP,
80
81 /* MMC2 */
82 GPIO37_MMC2_DAT3,
83 GPIO38_MMC2_DAT2,
84 GPIO39_MMC2_DAT1,
85 GPIO40_MMC2_DAT0,
86 GPIO41_MMC2_CMD,
87 GPIO42_MMC2_CLK,
88
89 /* MMC3 */
90 GPIO165_MMC3_DAT7,
91 GPIO162_MMC3_DAT6,
92 GPIO166_MMC3_DAT5,
93 GPIO163_MMC3_DAT4,
94 GPIO167_MMC3_DAT3,
95 GPIO164_MMC3_DAT2,
96 GPIO168_MMC3_DAT1,
97 GPIO111_MMC3_DAT0,
98 GPIO112_MMC3_CMD,
99 GPIO151_MMC3_CLK,
Haojian Zhuang25039912010-04-28 15:43:21 -0400100};
101
102static struct regulator_consumer_supply max8649_supply[] = {
103 REGULATOR_SUPPLY("vcc_core", NULL),
104};
105
106static struct regulator_init_data max8649_init_data = {
107 .constraints = {
108 .name = "vcc_core range",
109 .min_uV = 1150000,
110 .max_uV = 1280000,
111 .always_on = 1,
112 .boot_on = 1,
113 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
114 },
115 .num_consumer_supplies = 1,
116 .consumer_supplies = &max8649_supply[0],
117};
118
119static struct max8649_platform_data jasper_max8649_info = {
120 .mode = 2, /* VID1 = 1, VID0 = 0 */
121 .extclk = 0,
122 .ramp_timing = MAX8649_RAMP_32MV,
123 .regulator = &max8649_init_data,
124};
125
126static struct max8925_backlight_pdata jasper_backlight_data = {
127 .dual_string = 0,
128};
129
130static struct max8925_power_pdata jasper_power_data = {
131 .batt_detect = 0, /* can't detect battery by ID pin */
132 .topoff_threshold = MAX8925_TOPOFF_THR_10PER,
133 .fast_charge = MAX8925_FCHG_1000MA,
134};
135
136static struct max8925_platform_data jasper_max8925_info = {
137 .backlight = &jasper_backlight_data,
138 .power = &jasper_power_data,
Rob Herring8661fb92012-01-03 16:50:40 -0600139 .irq_base = MMP_NR_IRQS,
Haojian Zhuang25039912010-04-28 15:43:21 -0400140};
141
142static struct i2c_board_info jasper_twsi1_info[] = {
143 [0] = {
144 .type = "max8649",
145 .addr = 0x60,
146 .platform_data = &jasper_max8649_info,
147 },
148 [1] = {
149 .type = "max8925",
150 .addr = 0x3c,
151 .irq = IRQ_MMP2_PMIC,
152 .platform_data = &jasper_max8925_info,
153 },
Haojian Zhuange1cb7db2010-01-06 09:07:15 -0500154};
155
Zhangfei Gaofe805982010-11-03 01:15:32 -0400156static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc0 = {
Zhangfei Gao6f984f32011-06-08 17:41:59 +0800157 .clk_delay_cycles = 0x1f,
Zhangfei Gaofe805982010-11-03 01:15:32 -0400158};
159
Haojian Zhuange1cb7db2010-01-06 09:07:15 -0500160static void __init jasper_init(void)
161{
162 mfp_config(ARRAY_AND_SIZE(jasper_pin_config));
163
164 /* on-chip devices */
165 mmp2_add_uart(1);
166 mmp2_add_uart(3);
Haojian Zhuang25039912010-04-28 15:43:21 -0400167 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info));
Zhangfei Gaofe805982010-11-03 01:15:32 -0400168 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
Haojian Zhuang25039912010-04-28 15:43:21 -0400169
170 regulator_has_full_constraints();
Haojian Zhuange1cb7db2010-01-06 09:07:15 -0500171}
172
173MACHINE_START(MARVELL_JASPER, "Jasper Development Platform")
Eric Miao80228872010-07-15 17:50:13 +0800174 .map_io = mmp_map_io,
Haojian Zhuang0bd86962010-09-08 09:42:42 -0400175 .nr_irqs = JASPER_NR_IRQS,
Haojian Zhuange1cb7db2010-01-06 09:07:15 -0500176 .init_irq = mmp2_init_irq,
177 .timer = &mmp2_timer,
178 .init_machine = jasper_init,
Russell King9854a382011-11-05 15:40:09 +0000179 .restart = mmp_restart,
Haojian Zhuange1cb7db2010-01-06 09:07:15 -0500180MACHINE_END