aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-overo.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/board-overo.c')
-rw-r--r--arch/arm/mach-omap2/board-overo.c137
1 files changed, 135 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 82b3dc557c96..b1f23bea863f 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -37,20 +37,149 @@
37#include <asm/mach/flash.h> 37#include <asm/mach/flash.h>
38#include <asm/mach/map.h> 38#include <asm/mach/map.h>
39 39
40#include <mach/board-overo.h>
41#include <mach/board.h> 40#include <mach/board.h>
42#include <mach/common.h> 41#include <mach/common.h>
43#include <mach/gpio.h> 42#include <mach/gpio.h>
44#include <mach/gpmc.h> 43#include <mach/gpmc.h>
45#include <mach/hardware.h> 44#include <mach/hardware.h>
46#include <mach/nand.h> 45#include <mach/nand.h>
46#include <mach/usb.h>
47 47
48#include "mmc-twl4030.h" 48#include "mmc-twl4030.h"
49 49
50#define OVERO_GPIO_BT_XGATE 15
51#define OVERO_GPIO_W2W_NRESET 16
52#define OVERO_GPIO_BT_NRESET 164
53#define OVERO_GPIO_USBH_CPEN 168
54#define OVERO_GPIO_USBH_NRESET 183
55
50#define NAND_BLOCK_SIZE SZ_128K 56#define NAND_BLOCK_SIZE SZ_128K
51#define GPMC_CS0_BASE 0x60 57#define GPMC_CS0_BASE 0x60
52#define GPMC_CS_SIZE 0x30 58#define GPMC_CS_SIZE 0x30
53 59
60#define OVERO_SMSC911X_CS 5
61#define OVERO_SMSC911X_GPIO 176
62
63#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
64 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
65
66#include <mach/mcspi.h>
67#include <linux/spi/spi.h>
68#include <linux/spi/ads7846.h>
69
70static struct omap2_mcspi_device_config ads7846_mcspi_config = {
71 .turbo_mode = 0,
72 .single_channel = 1, /* 0: slave, 1: master */
73};
74
75static int ads7846_get_pendown_state(void)
76{
77 return !gpio_get_value(OVERO_GPIO_PENDOWN);
78}
79
80static struct ads7846_platform_data ads7846_config = {
81 .x_max = 0x0fff,
82 .y_max = 0x0fff,
83 .x_plate_ohms = 180,
84 .pressure_max = 255,
85 .debounce_max = 10,
86 .debounce_tol = 3,
87 .debounce_rep = 1,
88 .get_pendown_state = ads7846_get_pendown_state,
89 .keep_vref_on = 1,
90};
91
92static struct spi_board_info overo_spi_board_info[] __initdata = {
93 {
94 .modalias = "ads7846",
95 .bus_num = 1,
96 .chip_select = 0,
97 .max_speed_hz = 1500000,
98 .controller_data = &ads7846_mcspi_config,
99 .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
100 .platform_data = &ads7846_config,
101 }
102};
103
104static void __init overo_ads7846_init(void)
105{
106 if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) &&
107 (gpio_direction_input(OVERO_GPIO_PENDOWN) == 0)) {
108 gpio_export(OVERO_GPIO_PENDOWN, 0);
109 } else {
110 printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n");
111 return;
112 }
113
114 spi_register_board_info(overo_spi_board_info,
115 ARRAY_SIZE(overo_spi_board_info));
116}
117
118#else
119static inline void __init overo_ads7846_init(void) { return; }
120#endif
121
122#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
123
124#include <linux/smsc911x.h>
125
126static struct resource overo_smsc911x_resources[] = {
127 {
128 .name = "smsc911x-memory",
129 .flags = IORESOURCE_MEM,
130 },
131 {
132 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
133 },
134};
135
136static struct smsc911x_platform_config overo_smsc911x_config = {
137 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
138 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
139 .flags = SMSC911X_USE_32BIT ,
140 .phy_interface = PHY_INTERFACE_MODE_MII,
141};
142
143static struct platform_device overo_smsc911x_device = {
144 .name = "smsc911x",
145 .id = -1,
146 .num_resources = ARRAY_SIZE(overo_smsc911x_resources),
147 .resource = &overo_smsc911x_resources,
148 .dev = {
149 .platform_data = &overo_smsc911x_config,
150 },
151};
152
153static inline void __init overo_init_smsc911x(void)
154{
155 unsigned long cs_mem_base;
156
157 if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
158 printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n");
159 return;
160 }
161
162 overo_smsc911x_resources[0].start = cs_mem_base + 0x0;
163 overo_smsc911x_resources[0].end = cs_mem_base + 0xff;
164
165 if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
166 (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) {
167 gpio_export(OVERO_SMSC911X_GPIO, 0);
168 } else {
169 printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n");
170 return;
171 }
172
173 overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO);
174 overo_smsc911x_resources[1].end = 0;
175
176 platform_device_register(&overo_smsc911x_device);
177}
178
179#else
180static inline void __init overo_init_smsc911x(void) { return; }
181#endif
182
54static struct mtd_partition overo_nand_partitions[] = { 183static struct mtd_partition overo_nand_partitions[] = {
55 { 184 {
56 .name = "xloader", 185 .name = "xloader",
@@ -174,7 +303,7 @@ static int __init overo_i2c_init(void)
174 303
175static void __init overo_init_irq(void) 304static void __init overo_init_irq(void)
176{ 305{
177 omap2_init_common_hw(); 306 omap2_init_common_hw(NULL);
178 omap_init_irq(); 307 omap_init_irq();
179 omap_gpio_init(); 308 omap_gpio_init();
180} 309}
@@ -209,6 +338,7 @@ static struct twl4030_hsmmc_info mmc[] __initdata = {
209 .wires = 4, 338 .wires = 4,
210 .gpio_cd = -EINVAL, 339 .gpio_cd = -EINVAL,
211 .gpio_wp = -EINVAL, 340 .gpio_wp = -EINVAL,
341 .transceiver = true,
212 }, 342 },
213 {} /* Terminator */ 343 {} /* Terminator */
214}; 344};
@@ -222,6 +352,9 @@ static void __init overo_init(void)
222 omap_serial_init(); 352 omap_serial_init();
223 twl4030_mmc_init(mmc); 353 twl4030_mmc_init(mmc);
224 overo_flash_init(); 354 overo_flash_init();
355 usb_musb_init();
356 overo_ads7846_init();
357 overo_init_smsc911x();
225 358
226 if ((gpio_request(OVERO_GPIO_W2W_NRESET, 359 if ((gpio_request(OVERO_GPIO_W2W_NRESET,
227 "OVERO_GPIO_W2W_NRESET") == 0) && 360 "OVERO_GPIO_W2W_NRESET") == 0) &&