1 /*
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>
17 #include <linux/regulator/machine.h>
18 #include <linux/regulator/max8649.h>
19 #include <linux/mfd/max8925.h>
20 #include <linux/interrupt.h>
21 
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <mach/addr-map.h>
25 #include <mach/mfp-mmp2.h>
26 #include <mach/mmp2.h>
27 
28 #include "common.h"
29 
30 #define JASPER_NR_IRQS		(IRQ_BOARD_START + 48)
31 
32 static unsigned long jasper_pin_config[] __initdata = {
33 	/* UART1 */
34 	GPIO29_UART1_RXD,
35 	GPIO30_UART1_TXD,
36 
37 	/* UART3 */
38 	GPIO51_UART3_RXD,
39 	GPIO52_UART3_TXD,
40 
41 	/* DFI */
42 	GPIO168_DFI_D0,
43 	GPIO167_DFI_D1,
44 	GPIO166_DFI_D2,
45 	GPIO165_DFI_D3,
46 	GPIO107_DFI_D4,
47 	GPIO106_DFI_D5,
48 	GPIO105_DFI_D6,
49 	GPIO104_DFI_D7,
50 	GPIO111_DFI_D8,
51 	GPIO164_DFI_D9,
52 	GPIO163_DFI_D10,
53 	GPIO162_DFI_D11,
54 	GPIO161_DFI_D12,
55 	GPIO110_DFI_D13,
56 	GPIO109_DFI_D14,
57 	GPIO108_DFI_D15,
58 	GPIO143_ND_nCS0,
59 	GPIO144_ND_nCS1,
60 	GPIO147_ND_nWE,
61 	GPIO148_ND_nRE,
62 	GPIO150_ND_ALE,
63 	GPIO149_ND_CLE,
64 	GPIO112_ND_RDY0,
65 	GPIO160_ND_RDY1,
66 
67 	/* PMIC */
68 	PMIC_PMIC_INT | MFP_LPM_EDGE_FALL,
69 
70 	/* MMC1 */
71 	GPIO131_MMC1_DAT3,
72 	GPIO132_MMC1_DAT2,
73 	GPIO133_MMC1_DAT1,
74 	GPIO134_MMC1_DAT0,
75 	GPIO136_MMC1_CMD,
76 	GPIO139_MMC1_CLK,
77 	GPIO140_MMC1_CD,
78 	GPIO141_MMC1_WP,
79 
80 	/* MMC2 */
81 	GPIO37_MMC2_DAT3,
82 	GPIO38_MMC2_DAT2,
83 	GPIO39_MMC2_DAT1,
84 	GPIO40_MMC2_DAT0,
85 	GPIO41_MMC2_CMD,
86 	GPIO42_MMC2_CLK,
87 
88 	/* MMC3 */
89 	GPIO165_MMC3_DAT7,
90 	GPIO162_MMC3_DAT6,
91 	GPIO166_MMC3_DAT5,
92 	GPIO163_MMC3_DAT4,
93 	GPIO167_MMC3_DAT3,
94 	GPIO164_MMC3_DAT2,
95 	GPIO168_MMC3_DAT1,
96 	GPIO111_MMC3_DAT0,
97 	GPIO112_MMC3_CMD,
98 	GPIO151_MMC3_CLK,
99 };
100 
101 static struct regulator_consumer_supply max8649_supply[] = {
102 	REGULATOR_SUPPLY("vcc_core", NULL),
103 };
104 
105 static struct regulator_init_data max8649_init_data = {
106 	.constraints	= {
107 		.name		= "vcc_core range",
108 		.min_uV		= 1150000,
109 		.max_uV		= 1280000,
110 		.always_on	= 1,
111 		.boot_on	= 1,
112 		.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE,
113 	},
114 	.num_consumer_supplies	= 1,
115 	.consumer_supplies	= &max8649_supply[0],
116 };
117 
118 static struct max8649_platform_data jasper_max8649_info = {
119 	.mode		= 2,	/* VID1 = 1, VID0 = 0 */
120 	.extclk		= 0,
121 	.ramp_timing	= MAX8649_RAMP_32MV,
122 	.regulator	= &max8649_init_data,
123 };
124 
125 static struct max8925_backlight_pdata jasper_backlight_data = {
126 	.dual_string	= 0,
127 };
128 
129 static struct max8925_power_pdata jasper_power_data = {
130 	.batt_detect		= 0,	/* can't detect battery by ID pin */
131 	.topoff_threshold	= MAX8925_TOPOFF_THR_10PER,
132 	.fast_charge		= MAX8925_FCHG_1000MA,
133 };
134 
135 static struct max8925_platform_data jasper_max8925_info = {
136 	.backlight		= &jasper_backlight_data,
137 	.power			= &jasper_power_data,
138 	.irq_base		= IRQ_BOARD_START,
139 };
140 
141 static struct i2c_board_info jasper_twsi1_info[] = {
142 	[0] = {
143 		.type		= "max8649",
144 		.addr		= 0x60,
145 		.platform_data	= &jasper_max8649_info,
146 	},
147 	[1] = {
148 		.type		= "max8925",
149 		.addr		= 0x3c,
150 		.irq		= IRQ_MMP2_PMIC,
151 		.platform_data	= &jasper_max8925_info,
152 	},
153 };
154 
155 static struct sdhci_pxa_platdata mmp2_sdh_platdata_mmc0 = {
156 	.clk_delay_cycles = 0x1f,
157 };
158 
jasper_init(void)159 static void __init jasper_init(void)
160 {
161 	mfp_config(ARRAY_AND_SIZE(jasper_pin_config));
162 
163 	/* on-chip devices */
164 	mmp2_add_uart(1);
165 	mmp2_add_uart(3);
166 	mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info));
167 	mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
168 
169 	regulator_has_full_constraints();
170 }
171 
172 MACHINE_START(MARVELL_JASPER, "Jasper Development Platform")
173 	.map_io		= mmp_map_io,
174 	.nr_irqs	= JASPER_NR_IRQS,
175 	.init_irq       = mmp2_init_irq,
176 	.timer          = &mmp2_timer,
177 	.init_machine   = jasper_init,
178 	.restart	= mmp_restart,
179 MACHINE_END
180