Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 1 | /* |
| 2 | * board-overo.c (Gumstix Overo) |
| 3 | * |
| 4 | * Initial code: Steve Sakoman <steve@sakoman.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * version 2 as published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 18 | * 02110-1301 USA |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #include <linux/clk.h> |
| 23 | #include <linux/delay.h> |
| 24 | #include <linux/err.h> |
| 25 | #include <linux/init.h> |
| 26 | #include <linux/io.h> |
| 27 | #include <linux/kernel.h> |
| 28 | #include <linux/platform_device.h> |
Santosh Shilimkar | b07682b | 2009-12-13 20:05:51 +0100 | [diff] [blame] | 29 | #include <linux/i2c/twl.h> |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 30 | #include <linux/regulator/machine.h> |
Steve Sakoman | 7b12d7b | 2011-03-05 07:58:39 -0600 | [diff] [blame^] | 31 | #include <linux/spi/spi.h> |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 32 | |
| 33 | #include <linux/mtd/mtd.h> |
| 34 | #include <linux/mtd/nand.h> |
| 35 | #include <linux/mtd/partitions.h> |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 36 | #include <linux/mmc/host.h> |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 37 | |
| 38 | #include <asm/mach-types.h> |
| 39 | #include <asm/mach/arch.h> |
| 40 | #include <asm/mach/flash.h> |
| 41 | #include <asm/mach/map.h> |
| 42 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 43 | #include <plat/board.h> |
| 44 | #include <plat/common.h> |
Steve Sakoman | 7b12d7b | 2011-03-05 07:58:39 -0600 | [diff] [blame^] | 45 | #include <plat/display.h> |
| 46 | #include <plat/panel-generic-dpi.h> |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 47 | #include <mach/gpio.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 48 | #include <plat/gpmc.h> |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 49 | #include <mach/hardware.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 50 | #include <plat/nand.h> |
Steve Sakoman | 7b12d7b | 2011-03-05 07:58:39 -0600 | [diff] [blame^] | 51 | #include <plat/mcspi.h> |
| 52 | #include <plat/mux.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 53 | #include <plat/usb.h> |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 54 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 55 | #include "mux.h" |
Paul Walmsley | 2e12bd7 | 2009-05-28 14:03:59 -0700 | [diff] [blame] | 56 | #include "sdram-micron-mt46h32m32lf-6.h" |
Adrian Hunter | d02a900 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 57 | #include "hsmmc.h" |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 58 | |
Tony Lindgren | 0d4d9ab | 2009-03-23 18:07:38 -0700 | [diff] [blame] | 59 | #define OVERO_GPIO_BT_XGATE 15 |
| 60 | #define OVERO_GPIO_W2W_NRESET 16 |
Kevin Hilman | 6fd210a | 2009-07-20 09:09:23 -0700 | [diff] [blame] | 61 | #define OVERO_GPIO_PENDOWN 114 |
Tony Lindgren | 0d4d9ab | 2009-03-23 18:07:38 -0700 | [diff] [blame] | 62 | #define OVERO_GPIO_BT_NRESET 164 |
| 63 | #define OVERO_GPIO_USBH_CPEN 168 |
| 64 | #define OVERO_GPIO_USBH_NRESET 183 |
| 65 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 66 | #define NAND_BLOCK_SIZE SZ_128K |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 67 | |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 68 | #define OVERO_SMSC911X_CS 5 |
| 69 | #define OVERO_SMSC911X_GPIO 176 |
Steve Sakoman | 5c9a29e | 2010-05-10 14:29:18 -0700 | [diff] [blame] | 70 | #define OVERO_SMSC911X2_CS 4 |
| 71 | #define OVERO_SMSC911X2_GPIO 65 |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 72 | |
Steve Sakoman | c6a8131 | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 73 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ |
| 74 | defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) |
| 75 | |
Steve Sakoman | c6a8131 | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 76 | #include <linux/spi/ads7846.h> |
| 77 | |
| 78 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { |
| 79 | .turbo_mode = 0, |
| 80 | .single_channel = 1, /* 0: slave, 1: master */ |
| 81 | }; |
| 82 | |
| 83 | static int ads7846_get_pendown_state(void) |
| 84 | { |
| 85 | return !gpio_get_value(OVERO_GPIO_PENDOWN); |
| 86 | } |
| 87 | |
| 88 | static struct ads7846_platform_data ads7846_config = { |
| 89 | .x_max = 0x0fff, |
| 90 | .y_max = 0x0fff, |
| 91 | .x_plate_ohms = 180, |
| 92 | .pressure_max = 255, |
| 93 | .debounce_max = 10, |
| 94 | .debounce_tol = 3, |
| 95 | .debounce_rep = 1, |
| 96 | .get_pendown_state = ads7846_get_pendown_state, |
| 97 | .keep_vref_on = 1, |
| 98 | }; |
| 99 | |
Steve Sakoman | c6a8131 | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 100 | static void __init overo_ads7846_init(void) |
| 101 | { |
| 102 | if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) && |
| 103 | (gpio_direction_input(OVERO_GPIO_PENDOWN) == 0)) { |
| 104 | gpio_export(OVERO_GPIO_PENDOWN, 0); |
| 105 | } else { |
| 106 | printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n"); |
| 107 | return; |
| 108 | } |
Steve Sakoman | c6a8131 | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | #else |
| 112 | static inline void __init overo_ads7846_init(void) { return; } |
| 113 | #endif |
| 114 | |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 115 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 116 | |
| 117 | #include <linux/smsc911x.h> |
| 118 | |
| 119 | static struct resource overo_smsc911x_resources[] = { |
| 120 | { |
| 121 | .name = "smsc911x-memory", |
| 122 | .flags = IORESOURCE_MEM, |
| 123 | }, |
| 124 | { |
| 125 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 126 | }, |
| 127 | }; |
| 128 | |
Steve Sakoman | 5c9a29e | 2010-05-10 14:29:18 -0700 | [diff] [blame] | 129 | static struct resource overo_smsc911x2_resources[] = { |
| 130 | { |
| 131 | .name = "smsc911x2-memory", |
| 132 | .flags = IORESOURCE_MEM, |
| 133 | }, |
| 134 | { |
| 135 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 136 | }, |
| 137 | }; |
| 138 | |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 139 | static struct smsc911x_platform_config overo_smsc911x_config = { |
| 140 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 141 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, |
| 142 | .flags = SMSC911X_USE_32BIT , |
| 143 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 144 | }; |
| 145 | |
| 146 | static struct platform_device overo_smsc911x_device = { |
| 147 | .name = "smsc911x", |
Steve Sakoman | 5c9a29e | 2010-05-10 14:29:18 -0700 | [diff] [blame] | 148 | .id = 0, |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 149 | .num_resources = ARRAY_SIZE(overo_smsc911x_resources), |
Sergio Aguirre | 5032902 | 2009-08-10 14:49:50 +0300 | [diff] [blame] | 150 | .resource = overo_smsc911x_resources, |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 151 | .dev = { |
| 152 | .platform_data = &overo_smsc911x_config, |
| 153 | }, |
| 154 | }; |
| 155 | |
Steve Sakoman | a5ba7ae | 2010-08-02 14:21:39 +0300 | [diff] [blame] | 156 | static struct platform_device overo_smsc911x2_device = { |
| 157 | .name = "smsc911x", |
| 158 | .id = 1, |
| 159 | .num_resources = ARRAY_SIZE(overo_smsc911x2_resources), |
| 160 | .resource = overo_smsc911x2_resources, |
| 161 | .dev = { |
| 162 | .platform_data = &overo_smsc911x_config, |
| 163 | }, |
| 164 | }; |
| 165 | |
| 166 | static struct platform_device *smsc911x_devices[] = { |
| 167 | &overo_smsc911x_device, |
| 168 | &overo_smsc911x2_device, |
| 169 | }; |
| 170 | |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 171 | static inline void __init overo_init_smsc911x(void) |
| 172 | { |
Steve Sakoman | a5ba7ae | 2010-08-02 14:21:39 +0300 | [diff] [blame] | 173 | unsigned long cs_mem_base, cs_mem_base2; |
| 174 | |
| 175 | /* set up first smsc911x chip */ |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 176 | |
| 177 | if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { |
| 178 | printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n"); |
| 179 | return; |
| 180 | } |
| 181 | |
| 182 | overo_smsc911x_resources[0].start = cs_mem_base + 0x0; |
| 183 | overo_smsc911x_resources[0].end = cs_mem_base + 0xff; |
| 184 | |
| 185 | if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) && |
| 186 | (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) { |
| 187 | gpio_export(OVERO_SMSC911X_GPIO, 0); |
| 188 | } else { |
| 189 | printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n"); |
| 190 | return; |
| 191 | } |
| 192 | |
| 193 | overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO); |
| 194 | overo_smsc911x_resources[1].end = 0; |
| 195 | |
Steve Sakoman | a5ba7ae | 2010-08-02 14:21:39 +0300 | [diff] [blame] | 196 | /* set up second smsc911x chip */ |
| 197 | |
| 198 | if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) { |
| 199 | printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n"); |
| 200 | return; |
| 201 | } |
| 202 | |
| 203 | overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0; |
| 204 | overo_smsc911x2_resources[0].end = cs_mem_base2 + 0xff; |
| 205 | |
| 206 | if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) && |
| 207 | (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) { |
| 208 | gpio_export(OVERO_SMSC911X2_GPIO, 0); |
| 209 | } else { |
| 210 | printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n"); |
| 211 | return; |
| 212 | } |
| 213 | |
| 214 | overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO); |
| 215 | overo_smsc911x2_resources[1].end = 0; |
| 216 | |
| 217 | platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices)); |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | #else |
| 221 | static inline void __init overo_init_smsc911x(void) { return; } |
| 222 | #endif |
| 223 | |
Steve Sakoman | 7b12d7b | 2011-03-05 07:58:39 -0600 | [diff] [blame^] | 224 | /* DSS */ |
| 225 | static int lcd_enabled; |
| 226 | static int dvi_enabled; |
| 227 | |
| 228 | #define OVERO_GPIO_LCD_EN 144 |
| 229 | #define OVERO_GPIO_LCD_BL 145 |
| 230 | |
| 231 | static void __init overo_display_init(void) |
| 232 | { |
| 233 | if ((gpio_request(OVERO_GPIO_LCD_EN, "OVERO_GPIO_LCD_EN") == 0) && |
| 234 | (gpio_direction_output(OVERO_GPIO_LCD_EN, 1) == 0)) |
| 235 | gpio_export(OVERO_GPIO_LCD_EN, 0); |
| 236 | else |
| 237 | printk(KERN_ERR "could not obtain gpio for " |
| 238 | "OVERO_GPIO_LCD_EN\n"); |
| 239 | |
| 240 | if ((gpio_request(OVERO_GPIO_LCD_BL, "OVERO_GPIO_LCD_BL") == 0) && |
| 241 | (gpio_direction_output(OVERO_GPIO_LCD_BL, 1) == 0)) |
| 242 | gpio_export(OVERO_GPIO_LCD_BL, 0); |
| 243 | else |
| 244 | printk(KERN_ERR "could not obtain gpio for " |
| 245 | "OVERO_GPIO_LCD_BL\n"); |
| 246 | } |
| 247 | |
| 248 | static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) |
| 249 | { |
| 250 | if (lcd_enabled) { |
| 251 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); |
| 252 | return -EINVAL; |
| 253 | } |
| 254 | dvi_enabled = 1; |
| 255 | |
| 256 | return 0; |
| 257 | } |
| 258 | |
| 259 | static void overo_panel_disable_dvi(struct omap_dss_device *dssdev) |
| 260 | { |
| 261 | dvi_enabled = 0; |
| 262 | } |
| 263 | |
| 264 | static struct panel_generic_dpi_data dvi_panel = { |
| 265 | .name = "generic", |
| 266 | .platform_enable = overo_panel_enable_dvi, |
| 267 | .platform_disable = overo_panel_disable_dvi, |
| 268 | }; |
| 269 | |
| 270 | static struct omap_dss_device overo_dvi_device = { |
| 271 | .name = "dvi", |
| 272 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 273 | .driver_name = "generic_dpi_panel", |
| 274 | .data = &dvi_panel, |
| 275 | .phy.dpi.data_lines = 24, |
| 276 | }; |
| 277 | |
| 278 | static struct omap_dss_device overo_tv_device = { |
| 279 | .name = "tv", |
| 280 | .driver_name = "venc", |
| 281 | .type = OMAP_DISPLAY_TYPE_VENC, |
| 282 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, |
| 283 | }; |
| 284 | |
| 285 | static int overo_panel_enable_lcd(struct omap_dss_device *dssdev) |
| 286 | { |
| 287 | if (dvi_enabled) { |
| 288 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); |
| 289 | return -EINVAL; |
| 290 | } |
| 291 | |
| 292 | gpio_set_value(OVERO_GPIO_LCD_EN, 1); |
| 293 | gpio_set_value(OVERO_GPIO_LCD_BL, 1); |
| 294 | lcd_enabled = 1; |
| 295 | return 0; |
| 296 | } |
| 297 | |
| 298 | static void overo_panel_disable_lcd(struct omap_dss_device *dssdev) |
| 299 | { |
| 300 | gpio_set_value(OVERO_GPIO_LCD_EN, 0); |
| 301 | gpio_set_value(OVERO_GPIO_LCD_BL, 0); |
| 302 | lcd_enabled = 0; |
| 303 | } |
| 304 | |
| 305 | static struct panel_generic_dpi_data lcd43_panel = { |
| 306 | .name = "samsung_lte430wq_f0c", |
| 307 | .platform_enable = overo_panel_enable_lcd, |
| 308 | .platform_disable = overo_panel_disable_lcd, |
| 309 | }; |
| 310 | |
| 311 | static struct omap_dss_device overo_lcd43_device = { |
| 312 | .name = "lcd43", |
| 313 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 314 | .driver_name = "generic_dpi_panel", |
| 315 | .data = &lcd43_panel, |
| 316 | .phy.dpi.data_lines = 24, |
| 317 | }; |
| 318 | |
| 319 | #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ |
| 320 | defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) |
| 321 | static struct omap_dss_device overo_lcd35_device = { |
| 322 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 323 | .name = "lcd35", |
| 324 | .driver_name = "lgphilips_lb035q02_panel", |
| 325 | .phy.dpi.data_lines = 24, |
| 326 | .platform_enable = overo_panel_enable_lcd, |
| 327 | .platform_disable = overo_panel_disable_lcd, |
| 328 | }; |
| 329 | #endif |
| 330 | |
| 331 | static struct omap_dss_device *overo_dss_devices[] = { |
| 332 | &overo_dvi_device, |
| 333 | &overo_tv_device, |
| 334 | #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ |
| 335 | defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) |
| 336 | &overo_lcd35_device, |
| 337 | #endif |
| 338 | &overo_lcd43_device, |
| 339 | }; |
| 340 | |
| 341 | static struct omap_dss_board_info overo_dss_data = { |
| 342 | .num_devices = ARRAY_SIZE(overo_dss_devices), |
| 343 | .devices = overo_dss_devices, |
| 344 | .default_device = &overo_dvi_device, |
| 345 | }; |
| 346 | |
| 347 | static struct regulator_consumer_supply overo_vdda_dac_supply = |
| 348 | REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"); |
| 349 | |
| 350 | static struct regulator_consumer_supply overo_vdds_dsi_supply[] = { |
| 351 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"), |
| 352 | REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"), |
| 353 | }; |
| 354 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 355 | static struct mtd_partition overo_nand_partitions[] = { |
| 356 | { |
| 357 | .name = "xloader", |
| 358 | .offset = 0, /* Offset = 0x00000 */ |
| 359 | .size = 4 * NAND_BLOCK_SIZE, |
| 360 | .mask_flags = MTD_WRITEABLE |
| 361 | }, |
| 362 | { |
| 363 | .name = "uboot", |
| 364 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */ |
| 365 | .size = 14 * NAND_BLOCK_SIZE, |
| 366 | }, |
| 367 | { |
| 368 | .name = "uboot environment", |
| 369 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x240000 */ |
| 370 | .size = 2 * NAND_BLOCK_SIZE, |
| 371 | }, |
| 372 | { |
| 373 | .name = "linux", |
| 374 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */ |
| 375 | .size = 32 * NAND_BLOCK_SIZE, |
| 376 | }, |
| 377 | { |
| 378 | .name = "rootfs", |
| 379 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ |
| 380 | .size = MTDPART_SIZ_FULL, |
| 381 | }, |
| 382 | }; |
| 383 | |
| 384 | static struct omap_nand_platform_data overo_nand_data = { |
| 385 | .parts = overo_nand_partitions, |
| 386 | .nr_parts = ARRAY_SIZE(overo_nand_partitions), |
| 387 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ |
| 388 | }; |
| 389 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 390 | static void __init overo_flash_init(void) |
| 391 | { |
| 392 | u8 cs = 0; |
| 393 | u8 nandcs = GPMC_CS_NUM + 1; |
| 394 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 395 | /* find out the chip-select on which NAND exists */ |
| 396 | while (cs < GPMC_CS_NUM) { |
| 397 | u32 ret = 0; |
| 398 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); |
| 399 | |
| 400 | if ((ret & 0xC00) == 0x800) { |
| 401 | printk(KERN_INFO "Found NAND on CS%d\n", cs); |
| 402 | if (nandcs > GPMC_CS_NUM) |
| 403 | nandcs = cs; |
| 404 | } |
| 405 | cs++; |
| 406 | } |
| 407 | |
| 408 | if (nandcs > GPMC_CS_NUM) { |
| 409 | printk(KERN_INFO "NAND: Unable to find configuration " |
| 410 | "in GPMC\n "); |
| 411 | return; |
| 412 | } |
| 413 | |
| 414 | if (nandcs < GPMC_CS_NUM) { |
| 415 | overo_nand_data.cs = nandcs; |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 416 | |
| 417 | printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); |
Sukumar Ghorai | f450d86 | 2010-07-09 09:14:46 +0000 | [diff] [blame] | 418 | if (gpmc_nand_init(&overo_nand_data) < 0) |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 419 | printk(KERN_ERR "Unable to register NAND device\n"); |
| 420 | } |
| 421 | } |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 422 | |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 423 | static struct omap2_hsmmc_info mmc[] = { |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 424 | { |
| 425 | .mmc = 1, |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 426 | .caps = MMC_CAP_4_BIT_DATA, |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 427 | .gpio_cd = -EINVAL, |
| 428 | .gpio_wp = -EINVAL, |
| 429 | }, |
| 430 | { |
| 431 | .mmc = 2, |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 432 | .caps = MMC_CAP_4_BIT_DATA, |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 433 | .gpio_cd = -EINVAL, |
| 434 | .gpio_wp = -EINVAL, |
| 435 | .transceiver = true, |
| 436 | .ocr_mask = 0x00100000, /* 3.3V */ |
| 437 | }, |
| 438 | {} /* Terminator */ |
| 439 | }; |
| 440 | |
| 441 | static struct regulator_consumer_supply overo_vmmc1_supply = { |
| 442 | .supply = "vmmc", |
| 443 | }; |
| 444 | |
| 445 | static int overo_twl_gpio_setup(struct device *dev, |
| 446 | unsigned gpio, unsigned ngpio) |
| 447 | { |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 448 | omap2_hsmmc_init(mmc); |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 449 | |
| 450 | overo_vmmc1_supply.dev = mmc[0].dev; |
| 451 | |
| 452 | return 0; |
| 453 | } |
| 454 | |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 455 | static struct twl4030_gpio_platform_data overo_gpio_data = { |
| 456 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 457 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 458 | .irq_end = TWL4030_GPIO_IRQ_END, |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 459 | .setup = overo_twl_gpio_setup, |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 460 | }; |
| 461 | |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 462 | static struct twl4030_usb_data overo_usb_data = { |
| 463 | .usb_mode = T2_USB_MODE_ULPI, |
| 464 | }; |
| 465 | |
| 466 | static struct regulator_init_data overo_vmmc1 = { |
| 467 | .constraints = { |
| 468 | .min_uV = 1850000, |
| 469 | .max_uV = 3150000, |
| 470 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 471 | | REGULATOR_MODE_STANDBY, |
| 472 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 473 | | REGULATOR_CHANGE_MODE |
| 474 | | REGULATOR_CHANGE_STATUS, |
| 475 | }, |
| 476 | .num_consumer_supplies = 1, |
| 477 | .consumer_supplies = &overo_vmmc1_supply, |
| 478 | }; |
| 479 | |
Steve Sakoman | 7b12d7b | 2011-03-05 07:58:39 -0600 | [diff] [blame^] | 480 | /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */ |
| 481 | static struct regulator_init_data overo_vdac = { |
| 482 | .constraints = { |
| 483 | .min_uV = 1800000, |
| 484 | .max_uV = 1800000, |
| 485 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 486 | | REGULATOR_MODE_STANDBY, |
| 487 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 488 | | REGULATOR_CHANGE_STATUS, |
| 489 | }, |
| 490 | .num_consumer_supplies = 1, |
| 491 | .consumer_supplies = &overo_vdda_dac_supply, |
| 492 | }; |
| 493 | |
| 494 | /* VPLL2 for digital video outputs */ |
| 495 | static struct regulator_init_data overo_vpll2 = { |
| 496 | .constraints = { |
| 497 | .name = "VDVI", |
| 498 | .min_uV = 1800000, |
| 499 | .max_uV = 1800000, |
| 500 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 501 | | REGULATOR_MODE_STANDBY, |
| 502 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 503 | | REGULATOR_CHANGE_STATUS, |
| 504 | }, |
| 505 | .num_consumer_supplies = ARRAY_SIZE(overo_vdds_dsi_supply), |
| 506 | .consumer_supplies = overo_vdds_dsi_supply, |
| 507 | }; |
| 508 | |
Ilkka Koskinen | 6a58baf | 2011-03-02 13:24:05 +0000 | [diff] [blame] | 509 | static struct twl4030_codec_audio_data overo_audio_data; |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 510 | |
| 511 | static struct twl4030_codec_data overo_codec_data = { |
Peter Ujfalusi | 6df74ef | 2009-11-04 09:58:18 +0200 | [diff] [blame] | 512 | .audio_mclk = 26000000, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 513 | .audio = &overo_audio_data, |
| 514 | }; |
| 515 | |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 516 | static struct twl4030_platform_data overo_twldata = { |
| 517 | .irq_base = TWL4030_IRQ_BASE, |
| 518 | .irq_end = TWL4030_IRQ_END, |
| 519 | .gpio = &overo_gpio_data, |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 520 | .usb = &overo_usb_data, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 521 | .codec = &overo_codec_data, |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 522 | .vmmc1 = &overo_vmmc1, |
Steve Sakoman | 7b12d7b | 2011-03-05 07:58:39 -0600 | [diff] [blame^] | 523 | .vdac = &overo_vdac, |
| 524 | .vpll2 = &overo_vpll2, |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 525 | }; |
| 526 | |
| 527 | static struct i2c_board_info __initdata overo_i2c_boardinfo[] = { |
| 528 | { |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 529 | I2C_BOARD_INFO("tps65950", 0x48), |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 530 | .flags = I2C_CLIENT_WAKE, |
| 531 | .irq = INT_34XX_SYS_NIRQ, |
| 532 | .platform_data = &overo_twldata, |
| 533 | }, |
| 534 | }; |
| 535 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 536 | static int __init overo_i2c_init(void) |
| 537 | { |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 538 | omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo, |
| 539 | ARRAY_SIZE(overo_i2c_boardinfo)); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 540 | /* i2c2 pins are used for gpio */ |
| 541 | omap_register_i2c_bus(3, 400, NULL, 0); |
| 542 | return 0; |
| 543 | } |
| 544 | |
Steve Sakoman | 7b12d7b | 2011-03-05 07:58:39 -0600 | [diff] [blame^] | 545 | static struct spi_board_info overo_spi_board_info[] __initdata = { |
| 546 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ |
| 547 | defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) |
| 548 | { |
| 549 | .modalias = "ads7846", |
| 550 | .bus_num = 1, |
| 551 | .chip_select = 0, |
| 552 | .max_speed_hz = 1500000, |
| 553 | .controller_data = &ads7846_mcspi_config, |
| 554 | .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN), |
| 555 | .platform_data = &ads7846_config, |
| 556 | }, |
| 557 | #endif |
| 558 | #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ |
| 559 | defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) |
| 560 | { |
| 561 | .modalias = "lgphilips_lb035q02_panel-spi", |
| 562 | .bus_num = 1, |
| 563 | .chip_select = 1, |
| 564 | .max_speed_hz = 500000, |
| 565 | .mode = SPI_MODE_3, |
| 566 | }, |
| 567 | #endif |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 568 | }; |
| 569 | |
Steve Sakoman | 7b12d7b | 2011-03-05 07:58:39 -0600 | [diff] [blame^] | 570 | static int __init overo_spi_init(void) |
| 571 | { |
| 572 | overo_ads7846_init(); |
| 573 | spi_register_board_info(overo_spi_board_info, |
| 574 | ARRAY_SIZE(overo_spi_board_info)); |
| 575 | return 0; |
| 576 | } |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 577 | |
Russell King - ARM Linux | 3dc3bad | 2011-02-14 15:40:20 -0800 | [diff] [blame] | 578 | static void __init overo_init_early(void) |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 579 | { |
Paul Walmsley | 4805734 | 2010-12-21 15:25:10 -0700 | [diff] [blame] | 580 | omap2_init_common_infrastructure(); |
| 581 | omap2_init_common_devices(mt46h32m32lf6_sdrc_params, |
| 582 | mt46h32m32lf6_sdrc_params); |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 583 | } |
| 584 | |
Felipe Balbi | 6f69a18 | 2010-03-04 09:45:53 +0200 | [diff] [blame] | 585 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 586 | .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 587 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, |
| 588 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 589 | |
| 590 | .phy_reset = true, |
| 591 | .reset_gpio_port[0] = -EINVAL, |
| 592 | .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET, |
| 593 | .reset_gpio_port[2] = -EINVAL |
| 594 | }; |
| 595 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 596 | #ifdef CONFIG_OMAP_MUX |
| 597 | static struct omap_board_mux board_mux[] __initdata = { |
| 598 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 599 | }; |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 600 | #endif |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 601 | |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 602 | static struct omap_musb_board_data musb_board_data = { |
| 603 | .interface_type = MUSB_INTERFACE_ULPI, |
| 604 | .mode = MUSB_OTG, |
| 605 | .power = 100, |
| 606 | }; |
| 607 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 608 | static void __init overo_init(void) |
| 609 | { |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 610 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 611 | overo_i2c_init(); |
Steve Sakoman | 7b12d7b | 2011-03-05 07:58:39 -0600 | [diff] [blame^] | 612 | omap_display_init(&overo_dss_data); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 613 | omap_serial_init(); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 614 | overo_flash_init(); |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 615 | usb_musb_init(&musb_board_data); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 616 | usb_ehci_init(&ehci_pdata); |
Steve Sakoman | 7b12d7b | 2011-03-05 07:58:39 -0600 | [diff] [blame^] | 617 | overo_spi_init(); |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 618 | overo_init_smsc911x(); |
Steve Sakoman | 7b12d7b | 2011-03-05 07:58:39 -0600 | [diff] [blame^] | 619 | overo_display_init(); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 620 | |
Jean Pihet | 9fb9741 | 2009-07-24 19:43:25 -0600 | [diff] [blame] | 621 | /* Ensure SDRC pins are mux'd for self-refresh */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 622 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
| 623 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); |
Jean Pihet | 9fb9741 | 2009-07-24 19:43:25 -0600 | [diff] [blame] | 624 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 625 | if ((gpio_request(OVERO_GPIO_W2W_NRESET, |
| 626 | "OVERO_GPIO_W2W_NRESET") == 0) && |
| 627 | (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) { |
| 628 | gpio_export(OVERO_GPIO_W2W_NRESET, 0); |
| 629 | gpio_set_value(OVERO_GPIO_W2W_NRESET, 0); |
| 630 | udelay(10); |
| 631 | gpio_set_value(OVERO_GPIO_W2W_NRESET, 1); |
| 632 | } else { |
| 633 | printk(KERN_ERR "could not obtain gpio for " |
| 634 | "OVERO_GPIO_W2W_NRESET\n"); |
| 635 | } |
| 636 | |
| 637 | if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) && |
| 638 | (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0)) |
| 639 | gpio_export(OVERO_GPIO_BT_XGATE, 0); |
| 640 | else |
| 641 | printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n"); |
| 642 | |
| 643 | if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) && |
| 644 | (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) { |
| 645 | gpio_export(OVERO_GPIO_BT_NRESET, 0); |
| 646 | gpio_set_value(OVERO_GPIO_BT_NRESET, 0); |
| 647 | mdelay(6); |
| 648 | gpio_set_value(OVERO_GPIO_BT_NRESET, 1); |
| 649 | } else { |
| 650 | printk(KERN_ERR "could not obtain gpio for " |
| 651 | "OVERO_GPIO_BT_NRESET\n"); |
| 652 | } |
| 653 | |
| 654 | if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) && |
| 655 | (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0)) |
| 656 | gpio_export(OVERO_GPIO_USBH_CPEN, 0); |
| 657 | else |
| 658 | printk(KERN_ERR "could not obtain gpio for " |
| 659 | "OVERO_GPIO_USBH_CPEN\n"); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 660 | } |
| 661 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 662 | MACHINE_START(OVERO, "Gumstix Overo") |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 663 | .boot_params = 0x80000100, |
Russell King | 71ee7da | 2010-05-23 10:18:16 +0100 | [diff] [blame] | 664 | .reserve = omap_reserve, |
Russell King - ARM Linux | 3dc3bad | 2011-02-14 15:40:20 -0800 | [diff] [blame] | 665 | .map_io = omap3_map_io, |
| 666 | .init_early = overo_init_early, |
| 667 | .init_irq = omap_init_irq, |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 668 | .init_machine = overo_init, |
| 669 | .timer = &omap_timer, |
| 670 | MACHINE_END |