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