Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1 | /* |
| 2 | * TI DA850/OMAP-L138 EVM board |
| 3 | * |
| 4 | * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ |
| 5 | * |
| 6 | * Derived from: arch/arm/mach-davinci/board-da830-evm.c |
| 7 | * Original Copyrights follow: |
| 8 | * |
| 9 | * 2007, 2009 (c) MontaVista Software, Inc. This file is licensed under |
| 10 | * the terms of the GNU General Public License version 2. This program |
| 11 | * is licensed "as is" without any warranty of any kind, whether express |
| 12 | * or implied. |
| 13 | */ |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/module.h> |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/console.h> |
| 18 | #include <linux/i2c.h> |
| 19 | #include <linux/i2c/at24.h> |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 20 | #include <linux/i2c/pca953x.h> |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 21 | #include <linux/gpio.h> |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 22 | #include <linux/platform_device.h> |
| 23 | #include <linux/mtd/mtd.h> |
| 24 | #include <linux/mtd/nand.h> |
| 25 | #include <linux/mtd/partitions.h> |
Sudhakar Rajashekhara | 7c5ec60 | 2009-08-13 17:36:25 -0400 | [diff] [blame] | 26 | #include <linux/mtd/physmap.h> |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 27 | #include <linux/regulator/machine.h> |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 28 | |
| 29 | #include <asm/mach-types.h> |
| 30 | #include <asm/mach/arch.h> |
| 31 | |
| 32 | #include <mach/common.h> |
| 33 | #include <mach/irqs.h> |
| 34 | #include <mach/cp_intc.h> |
| 35 | #include <mach/da8xx.h> |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 36 | #include <mach/nand.h> |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 37 | #include <mach/mux.h> |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 38 | |
Sudhakar Rajashekhara | 5a4b131 | 2009-07-17 04:47:10 -0400 | [diff] [blame] | 39 | #define DA850_EVM_PHY_MASK 0x1 |
| 40 | #define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ |
| 41 | |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 42 | #define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8) |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 43 | #define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15) |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 44 | |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 45 | #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0) |
| 46 | #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1) |
| 47 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame^] | 48 | #define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6) |
| 49 | |
Sudhakar Rajashekhara | 7c5ec60 | 2009-08-13 17:36:25 -0400 | [diff] [blame] | 50 | static struct mtd_partition da850_evm_norflash_partition[] = { |
| 51 | { |
| 52 | .name = "NOR filesystem", |
| 53 | .offset = 0, |
| 54 | .size = MTDPART_SIZ_FULL, |
| 55 | .mask_flags = 0, |
| 56 | }, |
| 57 | }; |
| 58 | |
| 59 | static struct physmap_flash_data da850_evm_norflash_data = { |
| 60 | .width = 2, |
| 61 | .parts = da850_evm_norflash_partition, |
| 62 | .nr_parts = ARRAY_SIZE(da850_evm_norflash_partition), |
| 63 | }; |
| 64 | |
| 65 | static struct resource da850_evm_norflash_resource[] = { |
| 66 | { |
| 67 | .start = DA8XX_AEMIF_CS2_BASE, |
| 68 | .end = DA8XX_AEMIF_CS2_BASE + SZ_32M - 1, |
| 69 | .flags = IORESOURCE_MEM, |
| 70 | }, |
| 71 | }; |
| 72 | |
| 73 | static struct platform_device da850_evm_norflash_device = { |
| 74 | .name = "physmap-flash", |
| 75 | .id = 0, |
| 76 | .dev = { |
| 77 | .platform_data = &da850_evm_norflash_data, |
| 78 | }, |
| 79 | .num_resources = 1, |
| 80 | .resource = da850_evm_norflash_resource, |
| 81 | }; |
| 82 | |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 83 | /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash |
| 84 | * (128K blocks). It may be used instead of the (default) SPI flash |
| 85 | * to boot, using TI's tools to install the secondary boot loader |
| 86 | * (UBL) and U-Boot. |
| 87 | */ |
| 88 | struct mtd_partition da850_evm_nandflash_partition[] = { |
| 89 | { |
| 90 | .name = "u-boot env", |
| 91 | .offset = 0, |
| 92 | .size = SZ_128K, |
| 93 | .mask_flags = MTD_WRITEABLE, |
| 94 | }, |
| 95 | { |
| 96 | .name = "UBL", |
| 97 | .offset = MTDPART_OFS_APPEND, |
| 98 | .size = SZ_128K, |
| 99 | .mask_flags = MTD_WRITEABLE, |
| 100 | }, |
| 101 | { |
| 102 | .name = "u-boot", |
| 103 | .offset = MTDPART_OFS_APPEND, |
| 104 | .size = 4 * SZ_128K, |
| 105 | .mask_flags = MTD_WRITEABLE, |
| 106 | }, |
| 107 | { |
| 108 | .name = "kernel", |
| 109 | .offset = 0x200000, |
| 110 | .size = SZ_2M, |
| 111 | .mask_flags = 0, |
| 112 | }, |
| 113 | { |
| 114 | .name = "filesystem", |
| 115 | .offset = MTDPART_OFS_APPEND, |
| 116 | .size = MTDPART_SIZ_FULL, |
| 117 | .mask_flags = 0, |
| 118 | }, |
| 119 | }; |
| 120 | |
| 121 | static struct davinci_nand_pdata da850_evm_nandflash_data = { |
| 122 | .parts = da850_evm_nandflash_partition, |
| 123 | .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition), |
| 124 | .ecc_mode = NAND_ECC_HW, |
| 125 | .options = NAND_USE_FLASH_BBT, |
| 126 | }; |
| 127 | |
| 128 | static struct resource da850_evm_nandflash_resource[] = { |
| 129 | { |
| 130 | .start = DA8XX_AEMIF_CS3_BASE, |
| 131 | .end = DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1, |
| 132 | .flags = IORESOURCE_MEM, |
| 133 | }, |
| 134 | { |
| 135 | .start = DA8XX_AEMIF_CTL_BASE, |
| 136 | .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1, |
| 137 | .flags = IORESOURCE_MEM, |
| 138 | }, |
| 139 | }; |
| 140 | |
| 141 | static struct platform_device da850_evm_nandflash_device = { |
| 142 | .name = "davinci_nand", |
| 143 | .id = 1, |
| 144 | .dev = { |
| 145 | .platform_data = &da850_evm_nandflash_data, |
| 146 | }, |
| 147 | .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource), |
| 148 | .resource = da850_evm_nandflash_resource, |
| 149 | }; |
| 150 | |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 151 | static u32 ui_card_detected; |
| 152 | static void da850_evm_setup_nor_nand(void); |
| 153 | |
| 154 | static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, |
| 155 | unsigned ngpio, void *c) |
| 156 | { |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame^] | 157 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 158 | int sel_a, sel_b, sel_c, ret; |
| 159 | |
| 160 | sel_a = gpio + 7; |
| 161 | sel_b = gpio + 6; |
| 162 | sel_c = gpio + 5; |
| 163 | |
| 164 | ret = gpio_request(sel_a, "sel_a"); |
| 165 | if (ret) { |
| 166 | pr_warning("Cannot open UI expander pin %d\n", sel_a); |
| 167 | goto exp_setup_sela_fail; |
| 168 | } |
| 169 | |
| 170 | ret = gpio_request(sel_b, "sel_b"); |
| 171 | if (ret) { |
| 172 | pr_warning("Cannot open UI expander pin %d\n", sel_b); |
| 173 | goto exp_setup_selb_fail; |
| 174 | } |
| 175 | |
| 176 | ret = gpio_request(sel_c, "sel_c"); |
| 177 | if (ret) { |
| 178 | pr_warning("Cannot open UI expander pin %d\n", sel_c); |
| 179 | goto exp_setup_selc_fail; |
| 180 | } |
| 181 | |
| 182 | /* deselect all functionalities */ |
| 183 | gpio_direction_output(sel_a, 1); |
| 184 | gpio_direction_output(sel_b, 1); |
| 185 | gpio_direction_output(sel_c, 1); |
| 186 | |
| 187 | ui_card_detected = 1; |
| 188 | pr_info("DA850/OMAP-L138 EVM UI card detected\n"); |
| 189 | |
| 190 | da850_evm_setup_nor_nand(); |
| 191 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame^] | 192 | if (soc_info->emac_pdata->rmii_en) |
| 193 | /* enable RMII */ |
| 194 | gpio_set_value(sel_a, 0); |
| 195 | |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 196 | return 0; |
| 197 | |
| 198 | exp_setup_selc_fail: |
| 199 | gpio_free(sel_b); |
| 200 | exp_setup_selb_fail: |
| 201 | gpio_free(sel_a); |
| 202 | exp_setup_sela_fail: |
| 203 | return ret; |
| 204 | } |
| 205 | |
| 206 | static int da850_evm_ui_expander_teardown(struct i2c_client *client, |
| 207 | unsigned gpio, unsigned ngpio, void *c) |
| 208 | { |
| 209 | /* deselect all functionalities */ |
| 210 | gpio_set_value(gpio + 5, 1); |
| 211 | gpio_set_value(gpio + 6, 1); |
| 212 | gpio_set_value(gpio + 7, 1); |
| 213 | |
| 214 | gpio_free(gpio + 5); |
| 215 | gpio_free(gpio + 6); |
| 216 | gpio_free(gpio + 7); |
| 217 | |
| 218 | return 0; |
| 219 | } |
| 220 | |
| 221 | static struct pca953x_platform_data da850_evm_ui_expander_info = { |
| 222 | .gpio_base = DAVINCI_N_GPIO, |
| 223 | .setup = da850_evm_ui_expander_setup, |
| 224 | .teardown = da850_evm_ui_expander_teardown, |
| 225 | }; |
| 226 | |
Chaithrika U S | 1a7ff8f | 2009-08-25 15:20:05 +0300 | [diff] [blame] | 227 | static struct i2c_board_info __initdata da850_evm_i2c_devices[] = { |
| 228 | { |
| 229 | I2C_BOARD_INFO("tlv320aic3x", 0x18), |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 230 | }, |
| 231 | { |
| 232 | I2C_BOARD_INFO("tca6416", 0x20), |
| 233 | .platform_data = &da850_evm_ui_expander_info, |
| 234 | }, |
Chaithrika U S | 1a7ff8f | 2009-08-25 15:20:05 +0300 | [diff] [blame] | 235 | }; |
| 236 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 237 | static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { |
| 238 | .bus_freq = 100, /* kHz */ |
| 239 | .bus_delay = 0, /* usec */ |
| 240 | }; |
| 241 | |
| 242 | static struct davinci_uart_config da850_evm_uart_config __initdata = { |
| 243 | .enabled_uarts = 0x7, |
| 244 | }; |
| 245 | |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 246 | static struct platform_device *da850_evm_devices[] __initdata = { |
| 247 | &da850_evm_nandflash_device, |
Sudhakar Rajashekhara | 7c5ec60 | 2009-08-13 17:36:25 -0400 | [diff] [blame] | 248 | &da850_evm_norflash_device, |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 249 | }; |
| 250 | |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 251 | /* davinci da850 evm audio machine driver */ |
| 252 | static u8 da850_iis_serializer_direction[] = { |
| 253 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, |
| 254 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, |
| 255 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, TX_MODE, |
| 256 | RX_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, |
| 257 | }; |
| 258 | |
| 259 | static struct snd_platform_data da850_evm_snd_data = { |
| 260 | .tx_dma_offset = 0x2000, |
| 261 | .rx_dma_offset = 0x2000, |
| 262 | .op_mode = DAVINCI_MCASP_IIS_MODE, |
| 263 | .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction), |
| 264 | .tdm_slots = 2, |
| 265 | .serial_dir = da850_iis_serializer_direction, |
| 266 | .eventq_no = EVENTQ_1, |
| 267 | .version = MCASP_VERSION_2, |
| 268 | .txnumevt = 1, |
| 269 | .rxnumevt = 1, |
| 270 | }; |
| 271 | |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 272 | static int da850_evm_mmc_get_ro(int index) |
| 273 | { |
| 274 | return gpio_get_value(DA850_MMCSD_WP_PIN); |
| 275 | } |
| 276 | |
| 277 | static int da850_evm_mmc_get_cd(int index) |
| 278 | { |
| 279 | return !gpio_get_value(DA850_MMCSD_CD_PIN); |
| 280 | } |
| 281 | |
| 282 | static struct davinci_mmc_config da850_mmc_config = { |
| 283 | .get_ro = da850_evm_mmc_get_ro, |
| 284 | .get_cd = da850_evm_mmc_get_cd, |
| 285 | .wires = 4, |
| 286 | .version = MMC_CTLR_VERSION_2, |
| 287 | }; |
| 288 | |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 289 | static int da850_lcd_hw_init(void) |
| 290 | { |
| 291 | int status; |
| 292 | |
| 293 | status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n"); |
| 294 | if (status < 0) |
| 295 | return status; |
| 296 | |
| 297 | status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n"); |
| 298 | if (status < 0) { |
| 299 | gpio_free(DA850_LCD_BL_PIN); |
| 300 | return status; |
| 301 | } |
| 302 | |
| 303 | gpio_direction_output(DA850_LCD_BL_PIN, 0); |
| 304 | gpio_direction_output(DA850_LCD_PWR_PIN, 0); |
| 305 | |
| 306 | /* disable lcd backlight */ |
| 307 | gpio_set_value(DA850_LCD_BL_PIN, 0); |
| 308 | |
| 309 | /* disable lcd power */ |
| 310 | gpio_set_value(DA850_LCD_PWR_PIN, 0); |
| 311 | |
| 312 | /* enable lcd power */ |
| 313 | gpio_set_value(DA850_LCD_PWR_PIN, 1); |
| 314 | |
| 315 | /* enable lcd backlight */ |
| 316 | gpio_set_value(DA850_LCD_BL_PIN, 1); |
| 317 | |
| 318 | return 0; |
| 319 | } |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 320 | |
Sudhakar Rajashekhara | 7c5ec60 | 2009-08-13 17:36:25 -0400 | [diff] [blame] | 321 | #define DA8XX_AEMIF_CE2CFG_OFFSET 0x10 |
| 322 | #define DA8XX_AEMIF_ASIZE_16BIT 0x1 |
| 323 | |
| 324 | static void __init da850_evm_init_nor(void) |
| 325 | { |
| 326 | void __iomem *aemif_addr; |
| 327 | |
| 328 | aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K); |
| 329 | |
| 330 | /* Configure data bus width of CS2 to 16 bit */ |
| 331 | writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) | |
| 332 | DA8XX_AEMIF_ASIZE_16BIT, |
| 333 | aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET); |
| 334 | |
| 335 | iounmap(aemif_addr); |
| 336 | } |
| 337 | |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 338 | /* TPS65070 voltage regulator support */ |
| 339 | |
| 340 | /* 3.3V */ |
| 341 | struct regulator_consumer_supply tps65070_dcdc1_consumers[] = { |
| 342 | { |
| 343 | .supply = "usb0_vdda33", |
| 344 | }, |
| 345 | { |
| 346 | .supply = "usb1_vdda33", |
| 347 | }, |
| 348 | }; |
| 349 | |
| 350 | /* 3.3V or 1.8V */ |
| 351 | struct regulator_consumer_supply tps65070_dcdc2_consumers[] = { |
| 352 | { |
| 353 | .supply = "dvdd3318_a", |
| 354 | }, |
| 355 | { |
| 356 | .supply = "dvdd3318_b", |
| 357 | }, |
| 358 | { |
| 359 | .supply = "dvdd3318_c", |
| 360 | }, |
| 361 | }; |
| 362 | |
| 363 | /* 1.2V */ |
| 364 | struct regulator_consumer_supply tps65070_dcdc3_consumers[] = { |
| 365 | { |
| 366 | .supply = "cvdd", |
| 367 | }, |
| 368 | }; |
| 369 | |
| 370 | /* 1.8V LDO */ |
| 371 | struct regulator_consumer_supply tps65070_ldo1_consumers[] = { |
| 372 | { |
| 373 | .supply = "sata_vddr", |
| 374 | }, |
| 375 | { |
| 376 | .supply = "usb0_vdda18", |
| 377 | }, |
| 378 | { |
| 379 | .supply = "usb1_vdda18", |
| 380 | }, |
| 381 | { |
| 382 | .supply = "ddr_dvdd18", |
| 383 | }, |
| 384 | }; |
| 385 | |
| 386 | /* 1.2V LDO */ |
| 387 | struct regulator_consumer_supply tps65070_ldo2_consumers[] = { |
| 388 | { |
| 389 | .supply = "sata_vdd", |
| 390 | }, |
| 391 | { |
| 392 | .supply = "pll0_vdda", |
| 393 | }, |
| 394 | { |
| 395 | .supply = "pll1_vdda", |
| 396 | }, |
| 397 | { |
| 398 | .supply = "usbs_cvdd", |
| 399 | }, |
| 400 | { |
| 401 | .supply = "vddarnwa1", |
| 402 | }, |
| 403 | }; |
| 404 | |
| 405 | struct regulator_init_data tps65070_regulator_data[] = { |
| 406 | /* dcdc1 */ |
| 407 | { |
| 408 | .constraints = { |
| 409 | .min_uV = 3150000, |
| 410 | .max_uV = 3450000, |
| 411 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 412 | REGULATOR_CHANGE_STATUS), |
| 413 | .boot_on = 1, |
| 414 | }, |
| 415 | .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc1_consumers), |
| 416 | .consumer_supplies = tps65070_dcdc1_consumers, |
| 417 | }, |
| 418 | |
| 419 | /* dcdc2 */ |
| 420 | { |
| 421 | .constraints = { |
| 422 | .min_uV = 1710000, |
| 423 | .max_uV = 3450000, |
| 424 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 425 | REGULATOR_CHANGE_STATUS), |
| 426 | .boot_on = 1, |
| 427 | }, |
| 428 | .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers), |
| 429 | .consumer_supplies = tps65070_dcdc2_consumers, |
| 430 | }, |
| 431 | |
| 432 | /* dcdc3 */ |
| 433 | { |
| 434 | .constraints = { |
| 435 | .min_uV = 950000, |
| 436 | .max_uV = 1320000, |
| 437 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 438 | REGULATOR_CHANGE_STATUS), |
| 439 | .boot_on = 1, |
| 440 | }, |
| 441 | .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers), |
| 442 | .consumer_supplies = tps65070_dcdc3_consumers, |
| 443 | }, |
| 444 | |
| 445 | /* ldo1 */ |
| 446 | { |
| 447 | .constraints = { |
| 448 | .min_uV = 1710000, |
| 449 | .max_uV = 1890000, |
| 450 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 451 | REGULATOR_CHANGE_STATUS), |
| 452 | .boot_on = 1, |
| 453 | }, |
| 454 | .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo1_consumers), |
| 455 | .consumer_supplies = tps65070_ldo1_consumers, |
| 456 | }, |
| 457 | |
| 458 | /* ldo2 */ |
| 459 | { |
| 460 | .constraints = { |
| 461 | .min_uV = 1140000, |
| 462 | .max_uV = 1320000, |
| 463 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 464 | REGULATOR_CHANGE_STATUS), |
| 465 | .boot_on = 1, |
| 466 | }, |
| 467 | .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo2_consumers), |
| 468 | .consumer_supplies = tps65070_ldo2_consumers, |
| 469 | }, |
| 470 | }; |
| 471 | |
| 472 | static struct i2c_board_info __initdata da850evm_tps65070_info[] = { |
| 473 | { |
| 474 | I2C_BOARD_INFO("tps6507x", 0x48), |
| 475 | .platform_data = &tps65070_regulator_data[0], |
| 476 | }, |
| 477 | }; |
| 478 | |
| 479 | static int __init pmic_tps65070_init(void) |
| 480 | { |
| 481 | return i2c_register_board_info(1, da850evm_tps65070_info, |
| 482 | ARRAY_SIZE(da850evm_tps65070_info)); |
| 483 | } |
| 484 | |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 485 | #if defined(CONFIG_MMC_DAVINCI) || \ |
| 486 | defined(CONFIG_MMC_DAVINCI_MODULE) |
| 487 | #define HAS_MMC 1 |
| 488 | #else |
| 489 | #define HAS_MMC 0 |
| 490 | #endif |
| 491 | |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 492 | static void da850_evm_setup_nor_nand(void) |
| 493 | { |
| 494 | int ret = 0; |
| 495 | |
| 496 | if (ui_card_detected & !HAS_MMC) { |
| 497 | ret = da8xx_pinmux_setup(da850_nand_pins); |
| 498 | if (ret) |
| 499 | pr_warning("da850_evm_init: nand mux setup failed: " |
| 500 | "%d\n", ret); |
| 501 | |
| 502 | ret = da8xx_pinmux_setup(da850_nor_pins); |
| 503 | if (ret) |
| 504 | pr_warning("da850_evm_init: nor mux setup failed: %d\n", |
| 505 | ret); |
| 506 | |
| 507 | da850_evm_init_nor(); |
| 508 | |
| 509 | platform_add_devices(da850_evm_devices, |
| 510 | ARRAY_SIZE(da850_evm_devices)); |
| 511 | } |
| 512 | } |
| 513 | |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 514 | static const short da850_evm_lcdc_pins[] = { |
| 515 | DA850_GPIO2_8, DA850_GPIO2_15, |
| 516 | -1 |
| 517 | }; |
| 518 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame^] | 519 | static int __init da850_evm_config_emac(u8 rmii_en) |
| 520 | { |
| 521 | void __iomem *cfg_chip3_base; |
| 522 | int ret; |
| 523 | u32 val; |
| 524 | |
| 525 | cfg_chip3_base = DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP3_REG); |
| 526 | |
| 527 | /* configure the CFGCHIP3 register for RMII or MII */ |
| 528 | val = __raw_readl(cfg_chip3_base); |
| 529 | if (rmii_en) |
| 530 | val |= BIT(8); |
| 531 | else |
| 532 | val &= ~BIT(8); |
| 533 | |
| 534 | __raw_writel(val, cfg_chip3_base); |
| 535 | |
| 536 | if (!rmii_en) |
| 537 | ret = da8xx_pinmux_setup(da850_cpgmac_pins); |
| 538 | else |
| 539 | ret = da8xx_pinmux_setup(da850_rmii_pins); |
| 540 | if (ret) |
| 541 | pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n", |
| 542 | ret); |
| 543 | |
| 544 | ret = davinci_cfg_reg(DA850_GPIO2_6); |
| 545 | if (ret) |
| 546 | pr_warning("da850_evm_init:GPIO(2,6) mux setup " |
| 547 | "failed\n"); |
| 548 | |
| 549 | ret = gpio_request(DA850_MII_MDIO_CLKEN_PIN, "mdio_clk_en"); |
| 550 | if (ret) { |
| 551 | pr_warning("Cannot open GPIO %d\n", |
| 552 | DA850_MII_MDIO_CLKEN_PIN); |
| 553 | return ret; |
| 554 | } |
| 555 | |
| 556 | if (rmii_en) { |
| 557 | /* Disable MII MDIO clock */ |
| 558 | gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, 1); |
| 559 | pr_info("EMAC: RMII PHY configured, MII PHY will not be" |
| 560 | " functional\n"); |
| 561 | } else { |
| 562 | /* Enable MII MDIO clock */ |
| 563 | gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, 0); |
| 564 | pr_info("EMAC: MII PHY configured, RMII PHY will not be" |
| 565 | " functional\n"); |
| 566 | } |
| 567 | |
| 568 | return 0; |
| 569 | } |
| 570 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 571 | static __init void da850_evm_init(void) |
| 572 | { |
Sudhakar Rajashekhara | 5a4b131 | 2009-07-17 04:47:10 -0400 | [diff] [blame] | 573 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 574 | int ret; |
| 575 | |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 576 | ret = pmic_tps65070_init(); |
| 577 | if (ret) |
| 578 | pr_warning("da850_evm_init: TPS65070 PMIC init failed: %d\n", |
| 579 | ret); |
| 580 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 581 | ret = da8xx_register_edma(); |
| 582 | if (ret) |
| 583 | pr_warning("da850_evm_init: edma registration failed: %d\n", |
| 584 | ret); |
| 585 | |
| 586 | ret = da8xx_pinmux_setup(da850_i2c0_pins); |
| 587 | if (ret) |
| 588 | pr_warning("da850_evm_init: i2c0 mux setup failed: %d\n", |
| 589 | ret); |
| 590 | |
| 591 | ret = da8xx_register_i2c(0, &da850_evm_i2c_0_pdata); |
| 592 | if (ret) |
| 593 | pr_warning("da850_evm_init: i2c0 registration failed: %d\n", |
| 594 | ret); |
| 595 | |
Sudhakar Rajashekhara | 5a4b131 | 2009-07-17 04:47:10 -0400 | [diff] [blame] | 596 | soc_info->emac_pdata->phy_mask = DA850_EVM_PHY_MASK; |
| 597 | soc_info->emac_pdata->mdio_max_freq = DA850_EVM_MDIO_FREQUENCY; |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame^] | 598 | #ifdef CONFIG_DA850_UI_RMII |
| 599 | soc_info->emac_pdata->rmii_en = 1; |
| 600 | #else |
Sudhakar Rajashekhara | 5a4b131 | 2009-07-17 04:47:10 -0400 | [diff] [blame] | 601 | soc_info->emac_pdata->rmii_en = 0; |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame^] | 602 | #endif |
Sudhakar Rajashekhara | 5a4b131 | 2009-07-17 04:47:10 -0400 | [diff] [blame] | 603 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame^] | 604 | ret = da850_evm_config_emac(soc_info->emac_pdata->rmii_en); |
Sudhakar Rajashekhara | 5a4b131 | 2009-07-17 04:47:10 -0400 | [diff] [blame] | 605 | if (ret) |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame^] | 606 | pr_warning("da850_evm_init: emac setup failed: %d\n", ret); |
Sudhakar Rajashekhara | 5a4b131 | 2009-07-17 04:47:10 -0400 | [diff] [blame] | 607 | |
| 608 | ret = da8xx_register_emac(); |
| 609 | if (ret) |
| 610 | pr_warning("da850_evm_init: emac registration failed: %d\n", |
| 611 | ret); |
| 612 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 613 | ret = da8xx_register_watchdog(); |
| 614 | if (ret) |
| 615 | pr_warning("da830_evm_init: watchdog registration failed: %d\n", |
| 616 | ret); |
| 617 | |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 618 | if (HAS_MMC) { |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 619 | ret = da8xx_pinmux_setup(da850_mmcsd0_pins); |
| 620 | if (ret) |
| 621 | pr_warning("da850_evm_init: mmcsd0 mux setup failed:" |
| 622 | " %d\n", ret); |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 623 | |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 624 | ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n"); |
| 625 | if (ret) |
| 626 | pr_warning("da850_evm_init: can not open GPIO %d\n", |
| 627 | DA850_MMCSD_CD_PIN); |
| 628 | gpio_direction_input(DA850_MMCSD_CD_PIN); |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 629 | |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 630 | ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n"); |
| 631 | if (ret) |
| 632 | pr_warning("da850_evm_init: can not open GPIO %d\n", |
| 633 | DA850_MMCSD_WP_PIN); |
| 634 | gpio_direction_input(DA850_MMCSD_WP_PIN); |
| 635 | |
| 636 | ret = da8xx_register_mmcsd0(&da850_mmc_config); |
| 637 | if (ret) |
| 638 | pr_warning("da850_evm_init: mmcsd0 registration failed:" |
| 639 | " %d\n", ret); |
| 640 | } |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 641 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 642 | davinci_serial_init(&da850_evm_uart_config); |
| 643 | |
Chaithrika U S | 1a7ff8f | 2009-08-25 15:20:05 +0300 | [diff] [blame] | 644 | i2c_register_board_info(1, da850_evm_i2c_devices, |
| 645 | ARRAY_SIZE(da850_evm_i2c_devices)); |
| 646 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 647 | /* |
| 648 | * shut down uart 0 and 1; they are not used on the board and |
| 649 | * accessing them causes endless "too much work in irq53" messages |
| 650 | * with arago fs |
| 651 | */ |
| 652 | __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30); |
| 653 | __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30); |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 654 | |
| 655 | ret = da8xx_pinmux_setup(da850_mcasp_pins); |
| 656 | if (ret) |
| 657 | pr_warning("da850_evm_init: mcasp mux setup failed: %d\n", |
| 658 | ret); |
| 659 | |
Mark A. Greer | b8864aa | 2009-08-28 15:05:02 -0700 | [diff] [blame] | 660 | da8xx_register_mcasp(0, &da850_evm_snd_data); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 661 | |
| 662 | ret = da8xx_pinmux_setup(da850_lcdcntl_pins); |
| 663 | if (ret) |
| 664 | pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n", |
| 665 | ret); |
| 666 | |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 667 | /* Handle board specific muxing for LCD here */ |
| 668 | ret = da8xx_pinmux_setup(da850_evm_lcdc_pins); |
| 669 | if (ret) |
| 670 | pr_warning("da850_evm_init: evm specific lcd mux setup " |
| 671 | "failed: %d\n", ret); |
| 672 | |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 673 | ret = da850_lcd_hw_init(); |
| 674 | if (ret) |
| 675 | pr_warning("da850_evm_init: lcd initialization failed: %d\n", |
| 676 | ret); |
| 677 | |
Mark A. Greer | b9e6342 | 2009-09-15 18:14:19 -0700 | [diff] [blame] | 678 | ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 679 | if (ret) |
| 680 | pr_warning("da850_evm_init: lcdc registration failed: %d\n", |
| 681 | ret); |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 682 | |
| 683 | ret = da8xx_register_rtc(); |
| 684 | if (ret) |
| 685 | pr_warning("da850_evm_init: rtc setup failed: %d\n", ret); |
Sekhar Nori | 09dc2d4 | 2009-09-22 21:14:03 +0530 | [diff] [blame] | 686 | |
| 687 | ret = da850_register_cpufreq(); |
| 688 | if (ret) |
| 689 | pr_warning("da850_evm_init: cpufreq registration failed: %d\n", |
| 690 | ret); |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 691 | } |
| 692 | |
| 693 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
| 694 | static int __init da850_evm_console_init(void) |
| 695 | { |
| 696 | return add_preferred_console("ttyS", 2, "115200"); |
| 697 | } |
| 698 | console_initcall(da850_evm_console_init); |
| 699 | #endif |
| 700 | |
| 701 | static __init void da850_evm_irq_init(void) |
| 702 | { |
| 703 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
| 704 | |
| 705 | cp_intc_init((void __iomem *)DA8XX_CP_INTC_VIRT, DA850_N_CP_INTC_IRQ, |
| 706 | soc_info->intc_irq_prios); |
| 707 | } |
| 708 | |
| 709 | static void __init da850_evm_map_io(void) |
| 710 | { |
| 711 | da850_init(); |
| 712 | } |
| 713 | |
| 714 | MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138 EVM") |
| 715 | .phys_io = IO_PHYS, |
| 716 | .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc, |
| 717 | .boot_params = (DA8XX_DDR_BASE + 0x100), |
| 718 | .map_io = da850_evm_map_io, |
| 719 | .init_irq = da850_evm_irq_init, |
| 720 | .timer = &davinci_timer, |
| 721 | .init_machine = da850_evm_init, |
| 722 | MACHINE_END |