Merge branch 'upstream/core' into upstream/xen
[sfrench/cifs-2.6.git] / arch / arm / mach-mmp / jasper.c
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/gpio.h>
18 #include <linux/regulator/machine.h>
19 #include <linux/regulator/max8649.h>
20 #include <linux/mfd/max8925.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 #include <mach/irqs.h>
28
29 #include "common.h"
30
31 static unsigned long jasper_pin_config[] __initdata = {
32         /* UART1 */
33         GPIO29_UART1_RXD,
34         GPIO30_UART1_TXD,
35
36         /* UART3 */
37         GPIO51_UART3_RXD,
38         GPIO52_UART3_TXD,
39
40         /* DFI */
41         GPIO168_DFI_D0,
42         GPIO167_DFI_D1,
43         GPIO166_DFI_D2,
44         GPIO165_DFI_D3,
45         GPIO107_DFI_D4,
46         GPIO106_DFI_D5,
47         GPIO105_DFI_D6,
48         GPIO104_DFI_D7,
49         GPIO111_DFI_D8,
50         GPIO164_DFI_D9,
51         GPIO163_DFI_D10,
52         GPIO162_DFI_D11,
53         GPIO161_DFI_D12,
54         GPIO110_DFI_D13,
55         GPIO109_DFI_D14,
56         GPIO108_DFI_D15,
57         GPIO143_ND_nCS0,
58         GPIO144_ND_nCS1,
59         GPIO147_ND_nWE,
60         GPIO148_ND_nRE,
61         GPIO150_ND_ALE,
62         GPIO149_ND_CLE,
63         GPIO112_ND_RDY0,
64         GPIO160_ND_RDY1,
65
66         /* PMIC */
67         PMIC_PMIC_INT | MFP_LPM_EDGE_FALL,
68 };
69
70 static struct regulator_consumer_supply max8649_supply[] = {
71         REGULATOR_SUPPLY("vcc_core", NULL),
72 };
73
74 static struct regulator_init_data max8649_init_data = {
75         .constraints    = {
76                 .name           = "vcc_core range",
77                 .min_uV         = 1150000,
78                 .max_uV         = 1280000,
79                 .always_on      = 1,
80                 .boot_on        = 1,
81                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
82         },
83         .num_consumer_supplies  = 1,
84         .consumer_supplies      = &max8649_supply[0],
85 };
86
87 static struct max8649_platform_data jasper_max8649_info = {
88         .mode           = 2,    /* VID1 = 1, VID0 = 0 */
89         .extclk         = 0,
90         .ramp_timing    = MAX8649_RAMP_32MV,
91         .regulator      = &max8649_init_data,
92 };
93
94 static struct max8925_backlight_pdata jasper_backlight_data = {
95         .dual_string    = 0,
96 };
97
98 static struct max8925_power_pdata jasper_power_data = {
99         .batt_detect            = 0,    /* can't detect battery by ID pin */
100         .topoff_threshold       = MAX8925_TOPOFF_THR_10PER,
101         .fast_charge            = MAX8925_FCHG_1000MA,
102 };
103
104 static struct max8925_platform_data jasper_max8925_info = {
105         .backlight              = &jasper_backlight_data,
106         .power                  = &jasper_power_data,
107         .irq_base               = IRQ_BOARD_START,
108 };
109
110 static struct i2c_board_info jasper_twsi1_info[] = {
111         [0] = {
112                 .type           = "max8649",
113                 .addr           = 0x60,
114                 .platform_data  = &jasper_max8649_info,
115         },
116         [1] = {
117                 .type           = "max8925",
118                 .addr           = 0x3c,
119                 .irq            = IRQ_MMP2_PMIC,
120                 .platform_data  = &jasper_max8925_info,
121         },
122 };
123
124 static void __init jasper_init(void)
125 {
126         mfp_config(ARRAY_AND_SIZE(jasper_pin_config));
127
128         /* on-chip devices */
129         mmp2_add_uart(1);
130         mmp2_add_uart(3);
131         mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info));
132
133         regulator_has_full_constraints();
134 }
135
136 MACHINE_START(MARVELL_JASPER, "Jasper Development Platform")
137         .phys_io        = APB_PHYS_BASE,
138         .boot_params    = 0x00000100,
139         .io_pg_offst    = (APB_VIRT_BASE >> 18) & 0xfffc,
140         .map_io         = pxa_map_io,
141         .init_irq       = mmp2_init_irq,
142         .timer          = &mmp2_timer,
143         .init_machine   = jasper_init,
144 MACHINE_END