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> |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 20 | #include <linux/mfd/tps6507x.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> |
Sekhar Nori | 8b24599 | 2010-07-12 17:56:21 +0530 | [diff] [blame] | 28 | #include <linux/regulator/tps6507x.h> |
Todd Fischer | da1e368 | 2010-04-05 17:53:13 -0600 | [diff] [blame] | 29 | #include <linux/mfd/tps6507x.h> |
| 30 | #include <linux/input/tps6507x-ts.h> |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 31 | |
| 32 | #include <asm/mach-types.h> |
| 33 | #include <asm/mach/arch.h> |
| 34 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 35 | #include <mach/cp_intc.h> |
| 36 | #include <mach/da8xx.h> |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 37 | #include <mach/nand.h> |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 38 | #include <mach/mux.h> |
Sekhar Nori | 18a8505 | 2010-08-09 15:46:39 +0530 | [diff] [blame] | 39 | #include <mach/aemif.h> |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 40 | |
Sudhakar Rajashekhara | 5a4b131 | 2009-07-17 04:47:10 -0400 | [diff] [blame] | 41 | #define DA850_EVM_PHY_MASK 0x1 |
| 42 | #define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ |
| 43 | |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 44 | #define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8) |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 45 | #define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15) |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 46 | |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 47 | #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0) |
| 48 | #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1) |
| 49 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 50 | #define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6) |
| 51 | |
Sudhakar Rajashekhara | 7c5ec60 | 2009-08-13 17:36:25 -0400 | [diff] [blame] | 52 | static struct mtd_partition da850_evm_norflash_partition[] = { |
| 53 | { |
Sudhakar Rajashekhara | e2abd5a | 2009-11-18 11:48:37 +0530 | [diff] [blame] | 54 | .name = "bootloaders + env", |
Sudhakar Rajashekhara | 7c5ec60 | 2009-08-13 17:36:25 -0400 | [diff] [blame] | 55 | .offset = 0, |
Sudhakar Rajashekhara | e2abd5a | 2009-11-18 11:48:37 +0530 | [diff] [blame] | 56 | .size = SZ_512K, |
| 57 | .mask_flags = MTD_WRITEABLE, |
| 58 | }, |
| 59 | { |
| 60 | .name = "kernel", |
| 61 | .offset = MTDPART_OFS_APPEND, |
| 62 | .size = SZ_2M, |
| 63 | .mask_flags = 0, |
| 64 | }, |
| 65 | { |
| 66 | .name = "filesystem", |
| 67 | .offset = MTDPART_OFS_APPEND, |
Sudhakar Rajashekhara | 7c5ec60 | 2009-08-13 17:36:25 -0400 | [diff] [blame] | 68 | .size = MTDPART_SIZ_FULL, |
| 69 | .mask_flags = 0, |
| 70 | }, |
| 71 | }; |
| 72 | |
| 73 | static struct physmap_flash_data da850_evm_norflash_data = { |
| 74 | .width = 2, |
| 75 | .parts = da850_evm_norflash_partition, |
| 76 | .nr_parts = ARRAY_SIZE(da850_evm_norflash_partition), |
| 77 | }; |
| 78 | |
| 79 | static struct resource da850_evm_norflash_resource[] = { |
| 80 | { |
| 81 | .start = DA8XX_AEMIF_CS2_BASE, |
| 82 | .end = DA8XX_AEMIF_CS2_BASE + SZ_32M - 1, |
| 83 | .flags = IORESOURCE_MEM, |
| 84 | }, |
| 85 | }; |
| 86 | |
| 87 | static struct platform_device da850_evm_norflash_device = { |
| 88 | .name = "physmap-flash", |
| 89 | .id = 0, |
| 90 | .dev = { |
| 91 | .platform_data = &da850_evm_norflash_data, |
| 92 | }, |
| 93 | .num_resources = 1, |
| 94 | .resource = da850_evm_norflash_resource, |
| 95 | }; |
| 96 | |
Sekhar Nori | 6353444 | 2009-12-17 18:29:33 +0530 | [diff] [blame] | 97 | static struct davinci_pm_config da850_pm_pdata = { |
| 98 | .sleepcount = 128, |
| 99 | }; |
| 100 | |
| 101 | static struct platform_device da850_pm_device = { |
| 102 | .name = "pm-davinci", |
| 103 | .dev = { |
| 104 | .platform_data = &da850_pm_pdata, |
| 105 | }, |
| 106 | .id = -1, |
| 107 | }; |
| 108 | |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 109 | /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash |
| 110 | * (128K blocks). It may be used instead of the (default) SPI flash |
| 111 | * to boot, using TI's tools to install the secondary boot loader |
| 112 | * (UBL) and U-Boot. |
| 113 | */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 114 | static struct mtd_partition da850_evm_nandflash_partition[] = { |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 115 | { |
| 116 | .name = "u-boot env", |
| 117 | .offset = 0, |
| 118 | .size = SZ_128K, |
| 119 | .mask_flags = MTD_WRITEABLE, |
| 120 | }, |
| 121 | { |
| 122 | .name = "UBL", |
| 123 | .offset = MTDPART_OFS_APPEND, |
| 124 | .size = SZ_128K, |
| 125 | .mask_flags = MTD_WRITEABLE, |
| 126 | }, |
| 127 | { |
| 128 | .name = "u-boot", |
| 129 | .offset = MTDPART_OFS_APPEND, |
| 130 | .size = 4 * SZ_128K, |
| 131 | .mask_flags = MTD_WRITEABLE, |
| 132 | }, |
| 133 | { |
| 134 | .name = "kernel", |
| 135 | .offset = 0x200000, |
| 136 | .size = SZ_2M, |
| 137 | .mask_flags = 0, |
| 138 | }, |
| 139 | { |
| 140 | .name = "filesystem", |
| 141 | .offset = MTDPART_OFS_APPEND, |
| 142 | .size = MTDPART_SIZ_FULL, |
| 143 | .mask_flags = 0, |
| 144 | }, |
| 145 | }; |
| 146 | |
Sekhar Nori | 18a8505 | 2010-08-09 15:46:39 +0530 | [diff] [blame] | 147 | static struct davinci_aemif_timing da850_evm_nandflash_timing = { |
| 148 | .wsetup = 24, |
| 149 | .wstrobe = 21, |
| 150 | .whold = 14, |
| 151 | .rsetup = 19, |
| 152 | .rstrobe = 50, |
| 153 | .rhold = 0, |
| 154 | .ta = 20, |
| 155 | }; |
| 156 | |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 157 | static struct davinci_nand_pdata da850_evm_nandflash_data = { |
| 158 | .parts = da850_evm_nandflash_partition, |
| 159 | .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition), |
| 160 | .ecc_mode = NAND_ECC_HW, |
Sudhakar Rajashekhara | fc42e33 | 2009-11-18 12:11:41 +0530 | [diff] [blame] | 161 | .ecc_bits = 4, |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 162 | .options = NAND_USE_FLASH_BBT, |
Sekhar Nori | 18a8505 | 2010-08-09 15:46:39 +0530 | [diff] [blame] | 163 | .timing = &da850_evm_nandflash_timing, |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 164 | }; |
| 165 | |
| 166 | static struct resource da850_evm_nandflash_resource[] = { |
| 167 | { |
| 168 | .start = DA8XX_AEMIF_CS3_BASE, |
| 169 | .end = DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1, |
| 170 | .flags = IORESOURCE_MEM, |
| 171 | }, |
| 172 | { |
| 173 | .start = DA8XX_AEMIF_CTL_BASE, |
| 174 | .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1, |
| 175 | .flags = IORESOURCE_MEM, |
| 176 | }, |
| 177 | }; |
| 178 | |
| 179 | static struct platform_device da850_evm_nandflash_device = { |
| 180 | .name = "davinci_nand", |
| 181 | .id = 1, |
| 182 | .dev = { |
| 183 | .platform_data = &da850_evm_nandflash_data, |
| 184 | }, |
| 185 | .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource), |
| 186 | .resource = da850_evm_nandflash_resource, |
| 187 | }; |
| 188 | |
Sudhakar Rajashekhara | 039c5ee | 2009-11-03 11:51:09 +0530 | [diff] [blame] | 189 | static struct platform_device *da850_evm_devices[] __initdata = { |
| 190 | &da850_evm_nandflash_device, |
| 191 | &da850_evm_norflash_device, |
| 192 | }; |
| 193 | |
| 194 | #define DA8XX_AEMIF_CE2CFG_OFFSET 0x10 |
| 195 | #define DA8XX_AEMIF_ASIZE_16BIT 0x1 |
| 196 | |
| 197 | static void __init da850_evm_init_nor(void) |
| 198 | { |
| 199 | void __iomem *aemif_addr; |
| 200 | |
| 201 | aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K); |
| 202 | |
| 203 | /* Configure data bus width of CS2 to 16 bit */ |
| 204 | writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) | |
| 205 | DA8XX_AEMIF_ASIZE_16BIT, |
| 206 | aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET); |
| 207 | |
| 208 | iounmap(aemif_addr); |
| 209 | } |
| 210 | |
Sergei Shtylyov | f48ecc2 | 2010-08-01 21:15:16 +0400 | [diff] [blame] | 211 | static const short da850_evm_nand_pins[] = { |
| 212 | DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3, |
| 213 | DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7, |
| 214 | DA850_EMA_A_1, DA850_EMA_A_2, DA850_NEMA_CS_3, DA850_NEMA_CS_4, |
| 215 | DA850_NEMA_WE, DA850_NEMA_OE, |
| 216 | -1 |
| 217 | }; |
| 218 | |
| 219 | static const short da850_evm_nor_pins[] = { |
| 220 | DA850_EMA_BA_1, DA850_EMA_CLK, DA850_EMA_WAIT_1, DA850_NEMA_CS_2, |
| 221 | DA850_NEMA_WE, DA850_NEMA_OE, DA850_EMA_D_0, DA850_EMA_D_1, |
| 222 | DA850_EMA_D_2, DA850_EMA_D_3, DA850_EMA_D_4, DA850_EMA_D_5, |
| 223 | DA850_EMA_D_6, DA850_EMA_D_7, DA850_EMA_D_8, DA850_EMA_D_9, |
| 224 | DA850_EMA_D_10, DA850_EMA_D_11, DA850_EMA_D_12, DA850_EMA_D_13, |
| 225 | DA850_EMA_D_14, DA850_EMA_D_15, DA850_EMA_A_0, DA850_EMA_A_1, |
| 226 | DA850_EMA_A_2, DA850_EMA_A_3, DA850_EMA_A_4, DA850_EMA_A_5, |
| 227 | DA850_EMA_A_6, DA850_EMA_A_7, DA850_EMA_A_8, DA850_EMA_A_9, |
| 228 | DA850_EMA_A_10, DA850_EMA_A_11, DA850_EMA_A_12, DA850_EMA_A_13, |
| 229 | DA850_EMA_A_14, DA850_EMA_A_15, DA850_EMA_A_16, DA850_EMA_A_17, |
| 230 | DA850_EMA_A_18, DA850_EMA_A_19, DA850_EMA_A_20, DA850_EMA_A_21, |
| 231 | DA850_EMA_A_22, DA850_EMA_A_23, |
| 232 | -1 |
| 233 | }; |
| 234 | |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 235 | static u32 ui_card_detected; |
Sudhakar Rajashekhara | 039c5ee | 2009-11-03 11:51:09 +0530 | [diff] [blame] | 236 | |
| 237 | #if defined(CONFIG_MMC_DAVINCI) || \ |
| 238 | defined(CONFIG_MMC_DAVINCI_MODULE) |
| 239 | #define HAS_MMC 1 |
| 240 | #else |
| 241 | #define HAS_MMC 0 |
| 242 | #endif |
| 243 | |
Sergei Shtylyov | f48ecc2 | 2010-08-01 21:15:16 +0400 | [diff] [blame] | 244 | static inline void da850_evm_setup_nor_nand(void) |
Sudhakar Rajashekhara | 039c5ee | 2009-11-03 11:51:09 +0530 | [diff] [blame] | 245 | { |
| 246 | int ret = 0; |
| 247 | |
| 248 | if (ui_card_detected & !HAS_MMC) { |
Sergei Shtylyov | f48ecc2 | 2010-08-01 21:15:16 +0400 | [diff] [blame] | 249 | ret = davinci_cfg_reg_list(da850_evm_nand_pins); |
Sudhakar Rajashekhara | 039c5ee | 2009-11-03 11:51:09 +0530 | [diff] [blame] | 250 | if (ret) |
| 251 | pr_warning("da850_evm_init: nand mux setup failed: " |
| 252 | "%d\n", ret); |
| 253 | |
Sergei Shtylyov | f48ecc2 | 2010-08-01 21:15:16 +0400 | [diff] [blame] | 254 | ret = davinci_cfg_reg_list(da850_evm_nor_pins); |
Sudhakar Rajashekhara | 039c5ee | 2009-11-03 11:51:09 +0530 | [diff] [blame] | 255 | if (ret) |
| 256 | pr_warning("da850_evm_init: nor mux setup failed: %d\n", |
| 257 | ret); |
| 258 | |
| 259 | da850_evm_init_nor(); |
| 260 | |
| 261 | platform_add_devices(da850_evm_devices, |
| 262 | ARRAY_SIZE(da850_evm_devices)); |
| 263 | } |
| 264 | } |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 265 | |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 266 | #ifdef CONFIG_DA850_UI_RMII |
| 267 | static inline void da850_evm_setup_emac_rmii(int rmii_sel) |
| 268 | { |
| 269 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
| 270 | |
| 271 | soc_info->emac_pdata->rmii_en = 1; |
| 272 | gpio_set_value(rmii_sel, 0); |
| 273 | } |
| 274 | #else |
| 275 | static inline void da850_evm_setup_emac_rmii(int rmii_sel) { } |
| 276 | #endif |
| 277 | |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 278 | static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, |
| 279 | unsigned ngpio, void *c) |
| 280 | { |
| 281 | int sel_a, sel_b, sel_c, ret; |
| 282 | |
| 283 | sel_a = gpio + 7; |
| 284 | sel_b = gpio + 6; |
| 285 | sel_c = gpio + 5; |
| 286 | |
| 287 | ret = gpio_request(sel_a, "sel_a"); |
| 288 | if (ret) { |
| 289 | pr_warning("Cannot open UI expander pin %d\n", sel_a); |
| 290 | goto exp_setup_sela_fail; |
| 291 | } |
| 292 | |
| 293 | ret = gpio_request(sel_b, "sel_b"); |
| 294 | if (ret) { |
| 295 | pr_warning("Cannot open UI expander pin %d\n", sel_b); |
| 296 | goto exp_setup_selb_fail; |
| 297 | } |
| 298 | |
| 299 | ret = gpio_request(sel_c, "sel_c"); |
| 300 | if (ret) { |
| 301 | pr_warning("Cannot open UI expander pin %d\n", sel_c); |
| 302 | goto exp_setup_selc_fail; |
| 303 | } |
| 304 | |
| 305 | /* deselect all functionalities */ |
| 306 | gpio_direction_output(sel_a, 1); |
| 307 | gpio_direction_output(sel_b, 1); |
| 308 | gpio_direction_output(sel_c, 1); |
| 309 | |
| 310 | ui_card_detected = 1; |
| 311 | pr_info("DA850/OMAP-L138 EVM UI card detected\n"); |
| 312 | |
| 313 | da850_evm_setup_nor_nand(); |
| 314 | |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 315 | da850_evm_setup_emac_rmii(sel_a); |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 316 | |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 317 | return 0; |
| 318 | |
| 319 | exp_setup_selc_fail: |
| 320 | gpio_free(sel_b); |
| 321 | exp_setup_selb_fail: |
| 322 | gpio_free(sel_a); |
| 323 | exp_setup_sela_fail: |
| 324 | return ret; |
| 325 | } |
| 326 | |
| 327 | static int da850_evm_ui_expander_teardown(struct i2c_client *client, |
| 328 | unsigned gpio, unsigned ngpio, void *c) |
| 329 | { |
| 330 | /* deselect all functionalities */ |
| 331 | gpio_set_value(gpio + 5, 1); |
| 332 | gpio_set_value(gpio + 6, 1); |
| 333 | gpio_set_value(gpio + 7, 1); |
| 334 | |
| 335 | gpio_free(gpio + 5); |
| 336 | gpio_free(gpio + 6); |
| 337 | gpio_free(gpio + 7); |
| 338 | |
| 339 | return 0; |
| 340 | } |
| 341 | |
| 342 | static struct pca953x_platform_data da850_evm_ui_expander_info = { |
| 343 | .gpio_base = DAVINCI_N_GPIO, |
| 344 | .setup = da850_evm_ui_expander_setup, |
| 345 | .teardown = da850_evm_ui_expander_teardown, |
| 346 | }; |
| 347 | |
Chaithrika U S | 1a7ff8f | 2009-08-25 15:20:05 +0300 | [diff] [blame] | 348 | static struct i2c_board_info __initdata da850_evm_i2c_devices[] = { |
| 349 | { |
| 350 | I2C_BOARD_INFO("tlv320aic3x", 0x18), |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 351 | }, |
| 352 | { |
| 353 | I2C_BOARD_INFO("tca6416", 0x20), |
| 354 | .platform_data = &da850_evm_ui_expander_info, |
| 355 | }, |
Chaithrika U S | 1a7ff8f | 2009-08-25 15:20:05 +0300 | [diff] [blame] | 356 | }; |
| 357 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 358 | static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { |
| 359 | .bus_freq = 100, /* kHz */ |
| 360 | .bus_delay = 0, /* usec */ |
| 361 | }; |
| 362 | |
| 363 | static struct davinci_uart_config da850_evm_uart_config __initdata = { |
| 364 | .enabled_uarts = 0x7, |
| 365 | }; |
| 366 | |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 367 | /* davinci da850 evm audio machine driver */ |
| 368 | static u8 da850_iis_serializer_direction[] = { |
| 369 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, |
| 370 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, |
| 371 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, TX_MODE, |
| 372 | RX_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, |
| 373 | }; |
| 374 | |
| 375 | static struct snd_platform_data da850_evm_snd_data = { |
| 376 | .tx_dma_offset = 0x2000, |
| 377 | .rx_dma_offset = 0x2000, |
| 378 | .op_mode = DAVINCI_MCASP_IIS_MODE, |
| 379 | .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction), |
| 380 | .tdm_slots = 2, |
| 381 | .serial_dir = da850_iis_serializer_direction, |
Sekhar Nori | 48519f0 | 2010-07-19 12:31:16 +0530 | [diff] [blame] | 382 | .asp_chan_q = EVENTQ_1, |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 383 | .version = MCASP_VERSION_2, |
| 384 | .txnumevt = 1, |
| 385 | .rxnumevt = 1, |
| 386 | }; |
| 387 | |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 388 | static int da850_evm_mmc_get_ro(int index) |
| 389 | { |
| 390 | return gpio_get_value(DA850_MMCSD_WP_PIN); |
| 391 | } |
| 392 | |
| 393 | static int da850_evm_mmc_get_cd(int index) |
| 394 | { |
| 395 | return !gpio_get_value(DA850_MMCSD_CD_PIN); |
| 396 | } |
| 397 | |
| 398 | static struct davinci_mmc_config da850_mmc_config = { |
| 399 | .get_ro = da850_evm_mmc_get_ro, |
| 400 | .get_cd = da850_evm_mmc_get_cd, |
| 401 | .wires = 4, |
Chaithrika U S | 0046d0b | 2009-11-03 15:46:14 +0530 | [diff] [blame] | 402 | .max_freq = 50000000, |
| 403 | .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 404 | .version = MMC_CTLR_VERSION_2, |
| 405 | }; |
| 406 | |
Chaithrika U S | d52f235 | 2009-12-15 16:46:46 -0800 | [diff] [blame] | 407 | static void da850_panel_power_ctrl(int val) |
| 408 | { |
| 409 | /* lcd backlight */ |
| 410 | gpio_set_value(DA850_LCD_BL_PIN, val); |
| 411 | |
| 412 | /* lcd power */ |
| 413 | gpio_set_value(DA850_LCD_PWR_PIN, val); |
| 414 | } |
| 415 | |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 416 | static int da850_lcd_hw_init(void) |
| 417 | { |
| 418 | int status; |
| 419 | |
| 420 | status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n"); |
| 421 | if (status < 0) |
| 422 | return status; |
| 423 | |
| 424 | status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n"); |
| 425 | if (status < 0) { |
| 426 | gpio_free(DA850_LCD_BL_PIN); |
| 427 | return status; |
| 428 | } |
| 429 | |
| 430 | gpio_direction_output(DA850_LCD_BL_PIN, 0); |
| 431 | gpio_direction_output(DA850_LCD_PWR_PIN, 0); |
| 432 | |
Chaithrika U S | d52f235 | 2009-12-15 16:46:46 -0800 | [diff] [blame] | 433 | /* Switch off panel power and backlight */ |
| 434 | da850_panel_power_ctrl(0); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 435 | |
Chaithrika U S | d52f235 | 2009-12-15 16:46:46 -0800 | [diff] [blame] | 436 | /* Switch on panel power and backlight */ |
| 437 | da850_panel_power_ctrl(1); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 438 | |
| 439 | return 0; |
| 440 | } |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 441 | |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 442 | /* TPS65070 voltage regulator support */ |
| 443 | |
| 444 | /* 3.3V */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 445 | static struct regulator_consumer_supply tps65070_dcdc1_consumers[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 446 | { |
| 447 | .supply = "usb0_vdda33", |
| 448 | }, |
| 449 | { |
| 450 | .supply = "usb1_vdda33", |
| 451 | }, |
| 452 | }; |
| 453 | |
| 454 | /* 3.3V or 1.8V */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 455 | static struct regulator_consumer_supply tps65070_dcdc2_consumers[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 456 | { |
| 457 | .supply = "dvdd3318_a", |
| 458 | }, |
| 459 | { |
| 460 | .supply = "dvdd3318_b", |
| 461 | }, |
| 462 | { |
| 463 | .supply = "dvdd3318_c", |
| 464 | }, |
| 465 | }; |
| 466 | |
| 467 | /* 1.2V */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 468 | static struct regulator_consumer_supply tps65070_dcdc3_consumers[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 469 | { |
| 470 | .supply = "cvdd", |
| 471 | }, |
| 472 | }; |
| 473 | |
| 474 | /* 1.8V LDO */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 475 | static struct regulator_consumer_supply tps65070_ldo1_consumers[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 476 | { |
| 477 | .supply = "sata_vddr", |
| 478 | }, |
| 479 | { |
| 480 | .supply = "usb0_vdda18", |
| 481 | }, |
| 482 | { |
| 483 | .supply = "usb1_vdda18", |
| 484 | }, |
| 485 | { |
| 486 | .supply = "ddr_dvdd18", |
| 487 | }, |
| 488 | }; |
| 489 | |
| 490 | /* 1.2V LDO */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 491 | static struct regulator_consumer_supply tps65070_ldo2_consumers[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 492 | { |
| 493 | .supply = "sata_vdd", |
| 494 | }, |
| 495 | { |
| 496 | .supply = "pll0_vdda", |
| 497 | }, |
| 498 | { |
| 499 | .supply = "pll1_vdda", |
| 500 | }, |
| 501 | { |
| 502 | .supply = "usbs_cvdd", |
| 503 | }, |
| 504 | { |
| 505 | .supply = "vddarnwa1", |
| 506 | }, |
| 507 | }; |
| 508 | |
Sekhar Nori | 8b24599 | 2010-07-12 17:56:21 +0530 | [diff] [blame] | 509 | /* We take advantage of the fact that both defdcdc{2,3} are tied high */ |
| 510 | static struct tps6507x_reg_platform_data tps6507x_platform_data = { |
| 511 | .defdcdc_default = true, |
| 512 | }; |
| 513 | |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 514 | static struct regulator_init_data tps65070_regulator_data[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 515 | /* dcdc1 */ |
| 516 | { |
| 517 | .constraints = { |
| 518 | .min_uV = 3150000, |
| 519 | .max_uV = 3450000, |
| 520 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 521 | REGULATOR_CHANGE_STATUS), |
| 522 | .boot_on = 1, |
| 523 | }, |
| 524 | .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc1_consumers), |
| 525 | .consumer_supplies = tps65070_dcdc1_consumers, |
| 526 | }, |
| 527 | |
| 528 | /* dcdc2 */ |
| 529 | { |
| 530 | .constraints = { |
| 531 | .min_uV = 1710000, |
| 532 | .max_uV = 3450000, |
| 533 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 534 | REGULATOR_CHANGE_STATUS), |
| 535 | .boot_on = 1, |
| 536 | }, |
| 537 | .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers), |
| 538 | .consumer_supplies = tps65070_dcdc2_consumers, |
Sekhar Nori | 8b24599 | 2010-07-12 17:56:21 +0530 | [diff] [blame] | 539 | .driver_data = &tps6507x_platform_data, |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 540 | }, |
| 541 | |
| 542 | /* dcdc3 */ |
| 543 | { |
| 544 | .constraints = { |
| 545 | .min_uV = 950000, |
| 546 | .max_uV = 1320000, |
| 547 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 548 | REGULATOR_CHANGE_STATUS), |
| 549 | .boot_on = 1, |
| 550 | }, |
| 551 | .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers), |
| 552 | .consumer_supplies = tps65070_dcdc3_consumers, |
Sekhar Nori | 8b24599 | 2010-07-12 17:56:21 +0530 | [diff] [blame] | 553 | .driver_data = &tps6507x_platform_data, |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 554 | }, |
| 555 | |
| 556 | /* ldo1 */ |
| 557 | { |
| 558 | .constraints = { |
| 559 | .min_uV = 1710000, |
| 560 | .max_uV = 1890000, |
| 561 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 562 | REGULATOR_CHANGE_STATUS), |
| 563 | .boot_on = 1, |
| 564 | }, |
| 565 | .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo1_consumers), |
| 566 | .consumer_supplies = tps65070_ldo1_consumers, |
| 567 | }, |
| 568 | |
| 569 | /* ldo2 */ |
| 570 | { |
| 571 | .constraints = { |
| 572 | .min_uV = 1140000, |
| 573 | .max_uV = 1320000, |
| 574 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 575 | REGULATOR_CHANGE_STATUS), |
| 576 | .boot_on = 1, |
| 577 | }, |
| 578 | .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo2_consumers), |
| 579 | .consumer_supplies = tps65070_ldo2_consumers, |
| 580 | }, |
| 581 | }; |
| 582 | |
Todd Fischer | da1e368 | 2010-04-05 17:53:13 -0600 | [diff] [blame] | 583 | static struct touchscreen_init_data tps6507x_touchscreen_data = { |
| 584 | .poll_period = 30, /* ms between touch samples */ |
| 585 | .min_pressure = 0x30, /* minimum pressure to trigger touch */ |
| 586 | .vref = 0, /* turn off vref when not using A/D */ |
| 587 | .vendor = 0, /* /sys/class/input/input?/id/vendor */ |
| 588 | .product = 65070, /* /sys/class/input/input?/id/product */ |
| 589 | .version = 0x100, /* /sys/class/input/input?/id/version */ |
| 590 | }; |
| 591 | |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 592 | static struct tps6507x_board tps_board = { |
| 593 | .tps6507x_pmic_init_data = &tps65070_regulator_data[0], |
Todd Fischer | da1e368 | 2010-04-05 17:53:13 -0600 | [diff] [blame] | 594 | .tps6507x_ts_init_data = &tps6507x_touchscreen_data, |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 595 | }; |
| 596 | |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 597 | static struct i2c_board_info __initdata da850evm_tps65070_info[] = { |
| 598 | { |
| 599 | I2C_BOARD_INFO("tps6507x", 0x48), |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 600 | .platform_data = &tps_board, |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 601 | }, |
| 602 | }; |
| 603 | |
| 604 | static int __init pmic_tps65070_init(void) |
| 605 | { |
| 606 | return i2c_register_board_info(1, da850evm_tps65070_info, |
| 607 | ARRAY_SIZE(da850evm_tps65070_info)); |
| 608 | } |
| 609 | |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 610 | static const short da850_evm_lcdc_pins[] = { |
| 611 | DA850_GPIO2_8, DA850_GPIO2_15, |
| 612 | -1 |
| 613 | }; |
| 614 | |
Sergei Shtylyov | 85b8307 | 2010-08-01 21:17:00 +0400 | [diff] [blame] | 615 | static const short da850_evm_mii_pins[] = { |
| 616 | DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3, |
| 617 | DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER, |
| 618 | DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3, |
| 619 | DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK, |
| 620 | DA850_MDIO_D, |
| 621 | -1 |
| 622 | }; |
| 623 | |
| 624 | static const short da850_evm_rmii_pins[] = { |
| 625 | DA850_RMII_TXD_0, DA850_RMII_TXD_1, DA850_RMII_TXEN, |
| 626 | DA850_RMII_CRS_DV, DA850_RMII_RXD_0, DA850_RMII_RXD_1, |
| 627 | DA850_RMII_RXER, DA850_RMII_MHZ_50_CLK, DA850_MDIO_CLK, |
| 628 | DA850_MDIO_D, |
| 629 | -1 |
| 630 | }; |
| 631 | |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 632 | static int __init da850_evm_config_emac(void) |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 633 | { |
| 634 | void __iomem *cfg_chip3_base; |
| 635 | int ret; |
| 636 | u32 val; |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 637 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
| 638 | u8 rmii_en = soc_info->emac_pdata->rmii_en; |
| 639 | |
| 640 | if (!machine_is_davinci_da850_evm()) |
| 641 | return 0; |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 642 | |
Sekhar Nori | d2de058 | 2009-11-16 17:21:32 +0530 | [diff] [blame] | 643 | cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG); |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 644 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 645 | val = __raw_readl(cfg_chip3_base); |
Sekhar Nori | 17fadd9 | 2009-10-21 21:18:24 +0530 | [diff] [blame] | 646 | |
| 647 | if (rmii_en) { |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 648 | val |= BIT(8); |
Sergei Shtylyov | 85b8307 | 2010-08-01 21:17:00 +0400 | [diff] [blame] | 649 | ret = davinci_cfg_reg_list(da850_evm_rmii_pins); |
Sekhar Nori | 17fadd9 | 2009-10-21 21:18:24 +0530 | [diff] [blame] | 650 | pr_info("EMAC: RMII PHY configured, MII PHY will not be" |
| 651 | " functional\n"); |
| 652 | } else { |
| 653 | val &= ~BIT(8); |
Sergei Shtylyov | 85b8307 | 2010-08-01 21:17:00 +0400 | [diff] [blame] | 654 | ret = davinci_cfg_reg_list(da850_evm_mii_pins); |
Sekhar Nori | 17fadd9 | 2009-10-21 21:18:24 +0530 | [diff] [blame] | 655 | pr_info("EMAC: MII PHY configured, RMII PHY will not be" |
| 656 | " functional\n"); |
| 657 | } |
| 658 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 659 | if (ret) |
| 660 | pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n", |
| 661 | ret); |
| 662 | |
Sekhar Nori | 17fadd9 | 2009-10-21 21:18:24 +0530 | [diff] [blame] | 663 | /* configure the CFGCHIP3 register for RMII or MII */ |
| 664 | __raw_writel(val, cfg_chip3_base); |
| 665 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 666 | ret = davinci_cfg_reg(DA850_GPIO2_6); |
| 667 | if (ret) |
| 668 | pr_warning("da850_evm_init:GPIO(2,6) mux setup " |
| 669 | "failed\n"); |
| 670 | |
| 671 | ret = gpio_request(DA850_MII_MDIO_CLKEN_PIN, "mdio_clk_en"); |
| 672 | if (ret) { |
| 673 | pr_warning("Cannot open GPIO %d\n", |
| 674 | DA850_MII_MDIO_CLKEN_PIN); |
| 675 | return ret; |
| 676 | } |
| 677 | |
Sekhar Nori | 17fadd9 | 2009-10-21 21:18:24 +0530 | [diff] [blame] | 678 | /* Enable/Disable MII MDIO clock */ |
| 679 | gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, rmii_en); |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 680 | |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 681 | soc_info->emac_pdata->phy_mask = DA850_EVM_PHY_MASK; |
| 682 | soc_info->emac_pdata->mdio_max_freq = DA850_EVM_MDIO_FREQUENCY; |
| 683 | |
| 684 | ret = da8xx_register_emac(); |
| 685 | if (ret) |
| 686 | pr_warning("da850_evm_init: emac registration failed: %d\n", |
| 687 | ret); |
| 688 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 689 | return 0; |
| 690 | } |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 691 | device_initcall(da850_evm_config_emac); |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 692 | |
Rajashekhara, Sudhakar | a941c50 | 2010-06-29 11:35:14 +0530 | [diff] [blame] | 693 | /* |
| 694 | * The following EDMA channels/slots are not being used by drivers (for |
| 695 | * example: Timer, GPIO, UART events etc) on da850/omap-l138 EVM, hence |
| 696 | * they are being reserved for codecs on the DSP side. |
| 697 | */ |
| 698 | static const s16 da850_dma0_rsv_chans[][2] = { |
| 699 | /* (offset, number) */ |
| 700 | { 8, 6}, |
| 701 | {24, 4}, |
| 702 | {30, 2}, |
| 703 | {-1, -1} |
| 704 | }; |
| 705 | |
| 706 | static const s16 da850_dma0_rsv_slots[][2] = { |
| 707 | /* (offset, number) */ |
| 708 | { 8, 6}, |
| 709 | {24, 4}, |
| 710 | {30, 50}, |
| 711 | {-1, -1} |
| 712 | }; |
| 713 | |
| 714 | static const s16 da850_dma1_rsv_chans[][2] = { |
| 715 | /* (offset, number) */ |
| 716 | { 0, 28}, |
| 717 | {30, 2}, |
| 718 | {-1, -1} |
| 719 | }; |
| 720 | |
| 721 | static const s16 da850_dma1_rsv_slots[][2] = { |
| 722 | /* (offset, number) */ |
| 723 | { 0, 28}, |
| 724 | {30, 90}, |
| 725 | {-1, -1} |
| 726 | }; |
| 727 | |
| 728 | static struct edma_rsv_info da850_edma_cc0_rsv = { |
| 729 | .rsv_chans = da850_dma0_rsv_chans, |
| 730 | .rsv_slots = da850_dma0_rsv_slots, |
| 731 | }; |
| 732 | |
| 733 | static struct edma_rsv_info da850_edma_cc1_rsv = { |
| 734 | .rsv_chans = da850_dma1_rsv_chans, |
| 735 | .rsv_slots = da850_dma1_rsv_slots, |
| 736 | }; |
| 737 | |
| 738 | static struct edma_rsv_info *da850_edma_rsv[2] = { |
| 739 | &da850_edma_cc0_rsv, |
| 740 | &da850_edma_cc1_rsv, |
| 741 | }; |
| 742 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 743 | static __init void da850_evm_init(void) |
| 744 | { |
| 745 | int ret; |
| 746 | |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 747 | ret = pmic_tps65070_init(); |
| 748 | if (ret) |
| 749 | pr_warning("da850_evm_init: TPS65070 PMIC init failed: %d\n", |
| 750 | ret); |
| 751 | |
Rajashekhara, Sudhakar | a941c50 | 2010-06-29 11:35:14 +0530 | [diff] [blame] | 752 | ret = da850_register_edma(da850_edma_rsv); |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 753 | if (ret) |
| 754 | pr_warning("da850_evm_init: edma registration failed: %d\n", |
| 755 | ret); |
| 756 | |
Cyril Chemparathy | 3821d10 | 2010-03-25 17:43:48 -0400 | [diff] [blame] | 757 | ret = davinci_cfg_reg_list(da850_i2c0_pins); |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 758 | if (ret) |
| 759 | pr_warning("da850_evm_init: i2c0 mux setup failed: %d\n", |
| 760 | ret); |
| 761 | |
| 762 | ret = da8xx_register_i2c(0, &da850_evm_i2c_0_pdata); |
| 763 | if (ret) |
| 764 | pr_warning("da850_evm_init: i2c0 registration failed: %d\n", |
| 765 | ret); |
| 766 | |
Sudhakar Rajashekhara | 5a4b131 | 2009-07-17 04:47:10 -0400 | [diff] [blame] | 767 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 768 | ret = da8xx_register_watchdog(); |
| 769 | if (ret) |
| 770 | pr_warning("da830_evm_init: watchdog registration failed: %d\n", |
| 771 | ret); |
| 772 | |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 773 | if (HAS_MMC) { |
Cyril Chemparathy | 3821d10 | 2010-03-25 17:43:48 -0400 | [diff] [blame] | 774 | ret = davinci_cfg_reg_list(da850_mmcsd0_pins); |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 775 | if (ret) |
| 776 | pr_warning("da850_evm_init: mmcsd0 mux setup failed:" |
| 777 | " %d\n", ret); |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 778 | |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 779 | ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n"); |
| 780 | if (ret) |
| 781 | pr_warning("da850_evm_init: can not open GPIO %d\n", |
| 782 | DA850_MMCSD_CD_PIN); |
| 783 | gpio_direction_input(DA850_MMCSD_CD_PIN); |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 784 | |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 785 | ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n"); |
| 786 | if (ret) |
| 787 | pr_warning("da850_evm_init: can not open GPIO %d\n", |
| 788 | DA850_MMCSD_WP_PIN); |
| 789 | gpio_direction_input(DA850_MMCSD_WP_PIN); |
| 790 | |
| 791 | ret = da8xx_register_mmcsd0(&da850_mmc_config); |
| 792 | if (ret) |
| 793 | pr_warning("da850_evm_init: mmcsd0 registration failed:" |
| 794 | " %d\n", ret); |
| 795 | } |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 796 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 797 | davinci_serial_init(&da850_evm_uart_config); |
| 798 | |
Chaithrika U S | 1a7ff8f | 2009-08-25 15:20:05 +0300 | [diff] [blame] | 799 | i2c_register_board_info(1, da850_evm_i2c_devices, |
| 800 | ARRAY_SIZE(da850_evm_i2c_devices)); |
| 801 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 802 | /* |
| 803 | * shut down uart 0 and 1; they are not used on the board and |
| 804 | * accessing them causes endless "too much work in irq53" messages |
| 805 | * with arago fs |
| 806 | */ |
| 807 | __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30); |
| 808 | __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30); |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 809 | |
Cyril Chemparathy | 3821d10 | 2010-03-25 17:43:48 -0400 | [diff] [blame] | 810 | ret = davinci_cfg_reg_list(da850_mcasp_pins); |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 811 | if (ret) |
| 812 | pr_warning("da850_evm_init: mcasp mux setup failed: %d\n", |
| 813 | ret); |
| 814 | |
Mark A. Greer | b8864aa | 2009-08-28 15:05:02 -0700 | [diff] [blame] | 815 | da8xx_register_mcasp(0, &da850_evm_snd_data); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 816 | |
Cyril Chemparathy | 3821d10 | 2010-03-25 17:43:48 -0400 | [diff] [blame] | 817 | ret = davinci_cfg_reg_list(da850_lcdcntl_pins); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 818 | if (ret) |
| 819 | pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n", |
| 820 | ret); |
| 821 | |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 822 | /* Handle board specific muxing for LCD here */ |
Cyril Chemparathy | 3821d10 | 2010-03-25 17:43:48 -0400 | [diff] [blame] | 823 | ret = davinci_cfg_reg_list(da850_evm_lcdc_pins); |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 824 | if (ret) |
| 825 | pr_warning("da850_evm_init: evm specific lcd mux setup " |
| 826 | "failed: %d\n", ret); |
| 827 | |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 828 | ret = da850_lcd_hw_init(); |
| 829 | if (ret) |
| 830 | pr_warning("da850_evm_init: lcd initialization failed: %d\n", |
| 831 | ret); |
| 832 | |
Chaithrika U S | d52f235 | 2009-12-15 16:46:46 -0800 | [diff] [blame] | 833 | sharp_lk043t1dg01_pdata.panel_power_ctrl = da850_panel_power_ctrl, |
Mark A. Greer | b9e6342 | 2009-09-15 18:14:19 -0700 | [diff] [blame] | 834 | ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 835 | if (ret) |
| 836 | pr_warning("da850_evm_init: lcdc registration failed: %d\n", |
| 837 | ret); |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 838 | |
| 839 | ret = da8xx_register_rtc(); |
| 840 | if (ret) |
| 841 | pr_warning("da850_evm_init: rtc setup failed: %d\n", ret); |
Sekhar Nori | 09dc2d4 | 2009-09-22 21:14:03 +0530 | [diff] [blame] | 842 | |
Sekhar Nori | b987c4b | 2010-07-20 16:46:51 +0530 | [diff] [blame] | 843 | ret = da850_register_cpufreq("pll0_sysclk3"); |
Sekhar Nori | 09dc2d4 | 2009-09-22 21:14:03 +0530 | [diff] [blame] | 844 | if (ret) |
| 845 | pr_warning("da850_evm_init: cpufreq registration failed: %d\n", |
| 846 | ret); |
Sekhar Nori | 5aeb15a | 2009-10-22 15:12:15 +0530 | [diff] [blame] | 847 | |
| 848 | ret = da8xx_register_cpuidle(); |
| 849 | if (ret) |
| 850 | pr_warning("da850_evm_init: cpuidle registration failed: %d\n", |
| 851 | ret); |
Sekhar Nori | 6353444 | 2009-12-17 18:29:33 +0530 | [diff] [blame] | 852 | |
| 853 | ret = da850_register_pm(&da850_pm_device); |
| 854 | if (ret) |
| 855 | pr_warning("da850_evm_init: suspend registration failed: %d\n", |
| 856 | ret); |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 857 | } |
| 858 | |
| 859 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
| 860 | static int __init da850_evm_console_init(void) |
| 861 | { |
Michael Williamson | 1aa5f2a | 2010-08-31 14:30:15 -0400 | [diff] [blame^] | 862 | if (!machine_is_davinci_da850_evm()) |
| 863 | return 0; |
| 864 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 865 | return add_preferred_console("ttyS", 2, "115200"); |
| 866 | } |
| 867 | console_initcall(da850_evm_console_init); |
| 868 | #endif |
| 869 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 870 | static void __init da850_evm_map_io(void) |
| 871 | { |
| 872 | da850_init(); |
| 873 | } |
| 874 | |
Sekhar Nori | 48ea89e | 2010-07-01 19:00:50 +0530 | [diff] [blame] | 875 | MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM") |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 876 | .phys_io = IO_PHYS, |
| 877 | .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc, |
| 878 | .boot_params = (DA8XX_DDR_BASE + 0x100), |
| 879 | .map_io = da850_evm_map_io, |
Cyril Chemparathy | bd80894 | 2010-05-07 17:06:37 -0400 | [diff] [blame] | 880 | .init_irq = cp_intc_init, |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 881 | .timer = &davinci_timer, |
| 882 | .init_machine = da850_evm_init, |
| 883 | MACHINE_END |