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> |
Ben Gardiner | 75929f5 | 2010-12-09 16:51:04 -0500 | [diff] [blame] | 20 | #include <linux/input.h> |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 21 | #include <linux/mfd/tps6507x.h> |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 22 | #include <linux/gpio.h> |
Ben Gardiner | 75929f5 | 2010-12-09 16:51:04 -0500 | [diff] [blame] | 23 | #include <linux/gpio_keys.h> |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 24 | #include <linux/platform_device.h> |
| 25 | #include <linux/mtd/mtd.h> |
| 26 | #include <linux/mtd/nand.h> |
| 27 | #include <linux/mtd/partitions.h> |
Sudhakar Rajashekhara | 7c5ec60 | 2009-08-13 17:36:25 -0400 | [diff] [blame] | 28 | #include <linux/mtd/physmap.h> |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 29 | #include <linux/regulator/machine.h> |
Sekhar Nori | 8b24599 | 2010-07-12 17:56:21 +0530 | [diff] [blame] | 30 | #include <linux/regulator/tps6507x.h> |
Todd Fischer | da1e368 | 2010-04-05 17:53:13 -0600 | [diff] [blame] | 31 | #include <linux/input/tps6507x-ts.h> |
Sekhar Nori | fdce556 | 2011-02-24 10:39:27 +0530 | [diff] [blame] | 32 | #include <linux/spi/spi.h> |
| 33 | #include <linux/spi/flash.h> |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 34 | |
| 35 | #include <asm/mach-types.h> |
| 36 | #include <asm/mach/arch.h> |
| 37 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 38 | #include <mach/cp_intc.h> |
| 39 | #include <mach/da8xx.h> |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 40 | #include <mach/nand.h> |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 41 | #include <mach/mux.h> |
Sekhar Nori | 18a8505 | 2010-08-09 15:46:39 +0530 | [diff] [blame] | 42 | #include <mach/aemif.h> |
Sekhar Nori | fdce556 | 2011-02-24 10:39:27 +0530 | [diff] [blame] | 43 | #include <mach/spi.h> |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 44 | |
Cyril Chemparathy | 782f2d7 | 2010-09-15 10:11:25 -0400 | [diff] [blame] | 45 | #define DA850_EVM_PHY_ID "0:00" |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 46 | #define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8) |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 47 | #define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15) |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 48 | |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 49 | #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0) |
| 50 | #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1) |
| 51 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 52 | #define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6) |
| 53 | |
Sekhar Nori | fdce556 | 2011-02-24 10:39:27 +0530 | [diff] [blame] | 54 | static struct mtd_partition da850evm_spiflash_part[] = { |
| 55 | [0] = { |
| 56 | .name = "UBL", |
| 57 | .offset = 0, |
| 58 | .size = SZ_64K, |
| 59 | .mask_flags = MTD_WRITEABLE, |
| 60 | }, |
| 61 | [1] = { |
| 62 | .name = "U-Boot", |
| 63 | .offset = MTDPART_OFS_APPEND, |
| 64 | .size = SZ_512K, |
| 65 | .mask_flags = MTD_WRITEABLE, |
| 66 | }, |
| 67 | [2] = { |
| 68 | .name = "U-Boot-Env", |
| 69 | .offset = MTDPART_OFS_APPEND, |
| 70 | .size = SZ_64K, |
| 71 | .mask_flags = MTD_WRITEABLE, |
| 72 | }, |
| 73 | [3] = { |
| 74 | .name = "Kernel", |
| 75 | .offset = MTDPART_OFS_APPEND, |
| 76 | .size = SZ_2M + SZ_512K, |
| 77 | .mask_flags = 0, |
| 78 | }, |
| 79 | [4] = { |
| 80 | .name = "Filesystem", |
| 81 | .offset = MTDPART_OFS_APPEND, |
| 82 | .size = SZ_4M, |
| 83 | .mask_flags = 0, |
| 84 | }, |
| 85 | [5] = { |
| 86 | .name = "MAC-Address", |
| 87 | .offset = SZ_8M - SZ_64K, |
| 88 | .size = SZ_64K, |
| 89 | .mask_flags = MTD_WRITEABLE, |
| 90 | }, |
| 91 | }; |
| 92 | |
| 93 | static struct flash_platform_data da850evm_spiflash_data = { |
| 94 | .name = "m25p80", |
| 95 | .parts = da850evm_spiflash_part, |
| 96 | .nr_parts = ARRAY_SIZE(da850evm_spiflash_part), |
| 97 | .type = "m25p64", |
| 98 | }; |
| 99 | |
| 100 | static struct davinci_spi_config da850evm_spiflash_cfg = { |
| 101 | .io_type = SPI_IO_TYPE_DMA, |
| 102 | .c2tdelay = 8, |
| 103 | .t2cdelay = 8, |
| 104 | }; |
| 105 | |
| 106 | static struct spi_board_info da850evm_spi_info[] = { |
| 107 | { |
| 108 | .modalias = "m25p80", |
| 109 | .platform_data = &da850evm_spiflash_data, |
| 110 | .controller_data = &da850evm_spiflash_cfg, |
| 111 | .mode = SPI_MODE_0, |
| 112 | .max_speed_hz = 30000000, |
| 113 | .bus_num = 1, |
| 114 | .chip_select = 0, |
| 115 | }, |
| 116 | }; |
| 117 | |
Sudhakar Rajashekhara | 7c5ec60 | 2009-08-13 17:36:25 -0400 | [diff] [blame] | 118 | static struct mtd_partition da850_evm_norflash_partition[] = { |
| 119 | { |
Sudhakar Rajashekhara | e2abd5a | 2009-11-18 11:48:37 +0530 | [diff] [blame] | 120 | .name = "bootloaders + env", |
Sudhakar Rajashekhara | 7c5ec60 | 2009-08-13 17:36:25 -0400 | [diff] [blame] | 121 | .offset = 0, |
Sudhakar Rajashekhara | e2abd5a | 2009-11-18 11:48:37 +0530 | [diff] [blame] | 122 | .size = SZ_512K, |
| 123 | .mask_flags = MTD_WRITEABLE, |
| 124 | }, |
| 125 | { |
| 126 | .name = "kernel", |
| 127 | .offset = MTDPART_OFS_APPEND, |
| 128 | .size = SZ_2M, |
| 129 | .mask_flags = 0, |
| 130 | }, |
| 131 | { |
| 132 | .name = "filesystem", |
| 133 | .offset = MTDPART_OFS_APPEND, |
Sudhakar Rajashekhara | 7c5ec60 | 2009-08-13 17:36:25 -0400 | [diff] [blame] | 134 | .size = MTDPART_SIZ_FULL, |
| 135 | .mask_flags = 0, |
| 136 | }, |
| 137 | }; |
| 138 | |
| 139 | static struct physmap_flash_data da850_evm_norflash_data = { |
| 140 | .width = 2, |
| 141 | .parts = da850_evm_norflash_partition, |
| 142 | .nr_parts = ARRAY_SIZE(da850_evm_norflash_partition), |
| 143 | }; |
| 144 | |
| 145 | static struct resource da850_evm_norflash_resource[] = { |
| 146 | { |
| 147 | .start = DA8XX_AEMIF_CS2_BASE, |
| 148 | .end = DA8XX_AEMIF_CS2_BASE + SZ_32M - 1, |
| 149 | .flags = IORESOURCE_MEM, |
| 150 | }, |
| 151 | }; |
| 152 | |
| 153 | static struct platform_device da850_evm_norflash_device = { |
| 154 | .name = "physmap-flash", |
| 155 | .id = 0, |
| 156 | .dev = { |
| 157 | .platform_data = &da850_evm_norflash_data, |
| 158 | }, |
| 159 | .num_resources = 1, |
| 160 | .resource = da850_evm_norflash_resource, |
| 161 | }; |
| 162 | |
Sekhar Nori | 6353444 | 2009-12-17 18:29:33 +0530 | [diff] [blame] | 163 | static struct davinci_pm_config da850_pm_pdata = { |
| 164 | .sleepcount = 128, |
| 165 | }; |
| 166 | |
| 167 | static struct platform_device da850_pm_device = { |
| 168 | .name = "pm-davinci", |
| 169 | .dev = { |
| 170 | .platform_data = &da850_pm_pdata, |
| 171 | }, |
| 172 | .id = -1, |
| 173 | }; |
| 174 | |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 175 | /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash |
| 176 | * (128K blocks). It may be used instead of the (default) SPI flash |
| 177 | * to boot, using TI's tools to install the secondary boot loader |
| 178 | * (UBL) and U-Boot. |
| 179 | */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 180 | static struct mtd_partition da850_evm_nandflash_partition[] = { |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 181 | { |
| 182 | .name = "u-boot env", |
| 183 | .offset = 0, |
| 184 | .size = SZ_128K, |
| 185 | .mask_flags = MTD_WRITEABLE, |
| 186 | }, |
| 187 | { |
| 188 | .name = "UBL", |
| 189 | .offset = MTDPART_OFS_APPEND, |
| 190 | .size = SZ_128K, |
| 191 | .mask_flags = MTD_WRITEABLE, |
| 192 | }, |
| 193 | { |
| 194 | .name = "u-boot", |
| 195 | .offset = MTDPART_OFS_APPEND, |
| 196 | .size = 4 * SZ_128K, |
| 197 | .mask_flags = MTD_WRITEABLE, |
| 198 | }, |
| 199 | { |
| 200 | .name = "kernel", |
| 201 | .offset = 0x200000, |
| 202 | .size = SZ_2M, |
| 203 | .mask_flags = 0, |
| 204 | }, |
| 205 | { |
| 206 | .name = "filesystem", |
| 207 | .offset = MTDPART_OFS_APPEND, |
| 208 | .size = MTDPART_SIZ_FULL, |
| 209 | .mask_flags = 0, |
| 210 | }, |
| 211 | }; |
| 212 | |
Sekhar Nori | 18a8505 | 2010-08-09 15:46:39 +0530 | [diff] [blame] | 213 | static struct davinci_aemif_timing da850_evm_nandflash_timing = { |
| 214 | .wsetup = 24, |
| 215 | .wstrobe = 21, |
| 216 | .whold = 14, |
| 217 | .rsetup = 19, |
| 218 | .rstrobe = 50, |
| 219 | .rhold = 0, |
| 220 | .ta = 20, |
| 221 | }; |
| 222 | |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 223 | static struct davinci_nand_pdata da850_evm_nandflash_data = { |
| 224 | .parts = da850_evm_nandflash_partition, |
| 225 | .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition), |
| 226 | .ecc_mode = NAND_ECC_HW, |
Sudhakar Rajashekhara | fc42e33 | 2009-11-18 12:11:41 +0530 | [diff] [blame] | 227 | .ecc_bits = 4, |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 228 | .options = NAND_USE_FLASH_BBT, |
Sekhar Nori | 18a8505 | 2010-08-09 15:46:39 +0530 | [diff] [blame] | 229 | .timing = &da850_evm_nandflash_timing, |
Sudhakar Rajashekhara | 38beb92 | 2009-08-13 16:21:11 -0400 | [diff] [blame] | 230 | }; |
| 231 | |
| 232 | static struct resource da850_evm_nandflash_resource[] = { |
| 233 | { |
| 234 | .start = DA8XX_AEMIF_CS3_BASE, |
| 235 | .end = DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1, |
| 236 | .flags = IORESOURCE_MEM, |
| 237 | }, |
| 238 | { |
| 239 | .start = DA8XX_AEMIF_CTL_BASE, |
| 240 | .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1, |
| 241 | .flags = IORESOURCE_MEM, |
| 242 | }, |
| 243 | }; |
| 244 | |
| 245 | static struct platform_device da850_evm_nandflash_device = { |
| 246 | .name = "davinci_nand", |
| 247 | .id = 1, |
| 248 | .dev = { |
| 249 | .platform_data = &da850_evm_nandflash_data, |
| 250 | }, |
| 251 | .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource), |
| 252 | .resource = da850_evm_nandflash_resource, |
| 253 | }; |
| 254 | |
Sudhakar Rajashekhara | 039c5ee | 2009-11-03 11:51:09 +0530 | [diff] [blame] | 255 | static struct platform_device *da850_evm_devices[] __initdata = { |
| 256 | &da850_evm_nandflash_device, |
| 257 | &da850_evm_norflash_device, |
| 258 | }; |
| 259 | |
| 260 | #define DA8XX_AEMIF_CE2CFG_OFFSET 0x10 |
| 261 | #define DA8XX_AEMIF_ASIZE_16BIT 0x1 |
| 262 | |
| 263 | static void __init da850_evm_init_nor(void) |
| 264 | { |
| 265 | void __iomem *aemif_addr; |
| 266 | |
| 267 | aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K); |
| 268 | |
| 269 | /* Configure data bus width of CS2 to 16 bit */ |
| 270 | writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) | |
| 271 | DA8XX_AEMIF_ASIZE_16BIT, |
| 272 | aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET); |
| 273 | |
| 274 | iounmap(aemif_addr); |
| 275 | } |
| 276 | |
Sergei Shtylyov | f48ecc2 | 2010-08-01 21:15:16 +0400 | [diff] [blame] | 277 | static const short da850_evm_nand_pins[] = { |
| 278 | DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3, |
| 279 | DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7, |
| 280 | DA850_EMA_A_1, DA850_EMA_A_2, DA850_NEMA_CS_3, DA850_NEMA_CS_4, |
| 281 | DA850_NEMA_WE, DA850_NEMA_OE, |
| 282 | -1 |
| 283 | }; |
| 284 | |
| 285 | static const short da850_evm_nor_pins[] = { |
| 286 | DA850_EMA_BA_1, DA850_EMA_CLK, DA850_EMA_WAIT_1, DA850_NEMA_CS_2, |
| 287 | DA850_NEMA_WE, DA850_NEMA_OE, DA850_EMA_D_0, DA850_EMA_D_1, |
| 288 | DA850_EMA_D_2, DA850_EMA_D_3, DA850_EMA_D_4, DA850_EMA_D_5, |
| 289 | DA850_EMA_D_6, DA850_EMA_D_7, DA850_EMA_D_8, DA850_EMA_D_9, |
| 290 | DA850_EMA_D_10, DA850_EMA_D_11, DA850_EMA_D_12, DA850_EMA_D_13, |
| 291 | DA850_EMA_D_14, DA850_EMA_D_15, DA850_EMA_A_0, DA850_EMA_A_1, |
| 292 | DA850_EMA_A_2, DA850_EMA_A_3, DA850_EMA_A_4, DA850_EMA_A_5, |
| 293 | DA850_EMA_A_6, DA850_EMA_A_7, DA850_EMA_A_8, DA850_EMA_A_9, |
| 294 | DA850_EMA_A_10, DA850_EMA_A_11, DA850_EMA_A_12, DA850_EMA_A_13, |
| 295 | DA850_EMA_A_14, DA850_EMA_A_15, DA850_EMA_A_16, DA850_EMA_A_17, |
| 296 | DA850_EMA_A_18, DA850_EMA_A_19, DA850_EMA_A_20, DA850_EMA_A_21, |
| 297 | DA850_EMA_A_22, DA850_EMA_A_23, |
| 298 | -1 |
| 299 | }; |
| 300 | |
Sudhakar Rajashekhara | 039c5ee | 2009-11-03 11:51:09 +0530 | [diff] [blame] | 301 | #if defined(CONFIG_MMC_DAVINCI) || \ |
| 302 | defined(CONFIG_MMC_DAVINCI_MODULE) |
| 303 | #define HAS_MMC 1 |
| 304 | #else |
| 305 | #define HAS_MMC 0 |
| 306 | #endif |
| 307 | |
Sergei Shtylyov | f48ecc2 | 2010-08-01 21:15:16 +0400 | [diff] [blame] | 308 | static inline void da850_evm_setup_nor_nand(void) |
Sudhakar Rajashekhara | 039c5ee | 2009-11-03 11:51:09 +0530 | [diff] [blame] | 309 | { |
| 310 | int ret = 0; |
| 311 | |
Sergei Shtylyov | b688c2f | 2011-02-25 12:26:36 +0530 | [diff] [blame] | 312 | if (!HAS_MMC) { |
Sergei Shtylyov | f48ecc2 | 2010-08-01 21:15:16 +0400 | [diff] [blame] | 313 | ret = davinci_cfg_reg_list(da850_evm_nand_pins); |
Sudhakar Rajashekhara | 039c5ee | 2009-11-03 11:51:09 +0530 | [diff] [blame] | 314 | if (ret) |
| 315 | pr_warning("da850_evm_init: nand mux setup failed: " |
| 316 | "%d\n", ret); |
| 317 | |
Sergei Shtylyov | f48ecc2 | 2010-08-01 21:15:16 +0400 | [diff] [blame] | 318 | ret = davinci_cfg_reg_list(da850_evm_nor_pins); |
Sudhakar Rajashekhara | 039c5ee | 2009-11-03 11:51:09 +0530 | [diff] [blame] | 319 | if (ret) |
| 320 | pr_warning("da850_evm_init: nor mux setup failed: %d\n", |
| 321 | ret); |
| 322 | |
| 323 | da850_evm_init_nor(); |
| 324 | |
| 325 | platform_add_devices(da850_evm_devices, |
| 326 | ARRAY_SIZE(da850_evm_devices)); |
| 327 | } |
| 328 | } |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 329 | |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 330 | #ifdef CONFIG_DA850_UI_RMII |
| 331 | static inline void da850_evm_setup_emac_rmii(int rmii_sel) |
| 332 | { |
| 333 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
| 334 | |
| 335 | soc_info->emac_pdata->rmii_en = 1; |
Ben Gardiner | 47e7cb1 | 2010-11-15 09:42:52 -0500 | [diff] [blame] | 336 | gpio_set_value_cansleep(rmii_sel, 0); |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 337 | } |
| 338 | #else |
| 339 | static inline void da850_evm_setup_emac_rmii(int rmii_sel) { } |
| 340 | #endif |
| 341 | |
Ben Gardiner | 75929f5 | 2010-12-09 16:51:04 -0500 | [diff] [blame] | 342 | |
| 343 | #define DA850_KEYS_DEBOUNCE_MS 10 |
| 344 | /* |
| 345 | * At 200ms polling interval it is possible to miss an |
| 346 | * event by tapping very lightly on the push button but most |
| 347 | * pushes do result in an event; longer intervals require the |
| 348 | * user to hold the button whereas shorter intervals require |
| 349 | * more CPU time for polling. |
| 350 | */ |
| 351 | #define DA850_GPIO_KEYS_POLL_MS 200 |
| 352 | |
| 353 | enum da850_evm_ui_exp_pins { |
| 354 | DA850_EVM_UI_EXP_SEL_C = 5, |
| 355 | DA850_EVM_UI_EXP_SEL_B, |
| 356 | DA850_EVM_UI_EXP_SEL_A, |
| 357 | DA850_EVM_UI_EXP_PB8, |
| 358 | DA850_EVM_UI_EXP_PB7, |
| 359 | DA850_EVM_UI_EXP_PB6, |
| 360 | DA850_EVM_UI_EXP_PB5, |
| 361 | DA850_EVM_UI_EXP_PB4, |
| 362 | DA850_EVM_UI_EXP_PB3, |
| 363 | DA850_EVM_UI_EXP_PB2, |
| 364 | DA850_EVM_UI_EXP_PB1, |
| 365 | }; |
| 366 | |
| 367 | static const char const *da850_evm_ui_exp[] = { |
| 368 | [DA850_EVM_UI_EXP_SEL_C] = "sel_c", |
| 369 | [DA850_EVM_UI_EXP_SEL_B] = "sel_b", |
| 370 | [DA850_EVM_UI_EXP_SEL_A] = "sel_a", |
| 371 | [DA850_EVM_UI_EXP_PB8] = "pb8", |
| 372 | [DA850_EVM_UI_EXP_PB7] = "pb7", |
| 373 | [DA850_EVM_UI_EXP_PB6] = "pb6", |
| 374 | [DA850_EVM_UI_EXP_PB5] = "pb5", |
| 375 | [DA850_EVM_UI_EXP_PB4] = "pb4", |
| 376 | [DA850_EVM_UI_EXP_PB3] = "pb3", |
| 377 | [DA850_EVM_UI_EXP_PB2] = "pb2", |
| 378 | [DA850_EVM_UI_EXP_PB1] = "pb1", |
| 379 | }; |
| 380 | |
| 381 | #define DA850_N_UI_PB 8 |
| 382 | |
| 383 | static struct gpio_keys_button da850_evm_ui_keys[] = { |
| 384 | [0 ... DA850_N_UI_PB - 1] = { |
| 385 | .type = EV_KEY, |
| 386 | .active_low = 1, |
| 387 | .wakeup = 0, |
| 388 | .debounce_interval = DA850_KEYS_DEBOUNCE_MS, |
| 389 | .code = -1, /* assigned at runtime */ |
| 390 | .gpio = -1, /* assigned at runtime */ |
| 391 | .desc = NULL, /* assigned at runtime */ |
| 392 | }, |
| 393 | }; |
| 394 | |
| 395 | static struct gpio_keys_platform_data da850_evm_ui_keys_pdata = { |
| 396 | .buttons = da850_evm_ui_keys, |
| 397 | .nbuttons = ARRAY_SIZE(da850_evm_ui_keys), |
| 398 | .poll_interval = DA850_GPIO_KEYS_POLL_MS, |
| 399 | }; |
| 400 | |
| 401 | static struct platform_device da850_evm_ui_keys_device = { |
| 402 | .name = "gpio-keys-polled", |
| 403 | .id = 0, |
| 404 | .dev = { |
| 405 | .platform_data = &da850_evm_ui_keys_pdata |
| 406 | }, |
| 407 | }; |
| 408 | |
| 409 | static void da850_evm_ui_keys_init(unsigned gpio) |
| 410 | { |
| 411 | int i; |
| 412 | struct gpio_keys_button *button; |
| 413 | |
| 414 | for (i = 0; i < DA850_N_UI_PB; i++) { |
| 415 | button = &da850_evm_ui_keys[i]; |
| 416 | button->code = KEY_F8 - i; |
| 417 | button->desc = (char *) |
| 418 | da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i]; |
| 419 | button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i; |
| 420 | } |
| 421 | } |
| 422 | |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 423 | static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, |
| 424 | unsigned ngpio, void *c) |
| 425 | { |
| 426 | int sel_a, sel_b, sel_c, ret; |
| 427 | |
Ben Gardiner | 53c2897 | 2010-12-09 16:51:05 -0500 | [diff] [blame] | 428 | sel_a = gpio + DA850_EVM_UI_EXP_SEL_A; |
| 429 | sel_b = gpio + DA850_EVM_UI_EXP_SEL_B; |
| 430 | sel_c = gpio + DA850_EVM_UI_EXP_SEL_C; |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 431 | |
Ben Gardiner | 53c2897 | 2010-12-09 16:51:05 -0500 | [diff] [blame] | 432 | ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]); |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 433 | if (ret) { |
| 434 | pr_warning("Cannot open UI expander pin %d\n", sel_a); |
| 435 | goto exp_setup_sela_fail; |
| 436 | } |
| 437 | |
Ben Gardiner | 53c2897 | 2010-12-09 16:51:05 -0500 | [diff] [blame] | 438 | ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]); |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 439 | if (ret) { |
| 440 | pr_warning("Cannot open UI expander pin %d\n", sel_b); |
| 441 | goto exp_setup_selb_fail; |
| 442 | } |
| 443 | |
Ben Gardiner | 53c2897 | 2010-12-09 16:51:05 -0500 | [diff] [blame] | 444 | ret = gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]); |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 445 | if (ret) { |
| 446 | pr_warning("Cannot open UI expander pin %d\n", sel_c); |
| 447 | goto exp_setup_selc_fail; |
| 448 | } |
| 449 | |
| 450 | /* deselect all functionalities */ |
| 451 | gpio_direction_output(sel_a, 1); |
| 452 | gpio_direction_output(sel_b, 1); |
| 453 | gpio_direction_output(sel_c, 1); |
| 454 | |
Ben Gardiner | 75929f5 | 2010-12-09 16:51:04 -0500 | [diff] [blame] | 455 | da850_evm_ui_keys_init(gpio); |
| 456 | ret = platform_device_register(&da850_evm_ui_keys_device); |
| 457 | if (ret) { |
| 458 | pr_warning("Could not register UI GPIO expander push-buttons"); |
| 459 | goto exp_setup_keys_fail; |
| 460 | } |
| 461 | |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 462 | pr_info("DA850/OMAP-L138 EVM UI card detected\n"); |
| 463 | |
| 464 | da850_evm_setup_nor_nand(); |
| 465 | |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 466 | da850_evm_setup_emac_rmii(sel_a); |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 467 | |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 468 | return 0; |
| 469 | |
Ben Gardiner | 75929f5 | 2010-12-09 16:51:04 -0500 | [diff] [blame] | 470 | exp_setup_keys_fail: |
| 471 | gpio_free(sel_c); |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 472 | exp_setup_selc_fail: |
| 473 | gpio_free(sel_b); |
| 474 | exp_setup_selb_fail: |
| 475 | gpio_free(sel_a); |
| 476 | exp_setup_sela_fail: |
| 477 | return ret; |
| 478 | } |
| 479 | |
| 480 | static int da850_evm_ui_expander_teardown(struct i2c_client *client, |
| 481 | unsigned gpio, unsigned ngpio, void *c) |
| 482 | { |
Ben Gardiner | 75929f5 | 2010-12-09 16:51:04 -0500 | [diff] [blame] | 483 | platform_device_unregister(&da850_evm_ui_keys_device); |
| 484 | |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 485 | /* deselect all functionalities */ |
Ben Gardiner | 53c2897 | 2010-12-09 16:51:05 -0500 | [diff] [blame] | 486 | gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_C, 1); |
| 487 | gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_B, 1); |
| 488 | gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_A, 1); |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 489 | |
Ben Gardiner | 53c2897 | 2010-12-09 16:51:05 -0500 | [diff] [blame] | 490 | gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C); |
| 491 | gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B); |
| 492 | gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A); |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 493 | |
| 494 | return 0; |
| 495 | } |
| 496 | |
Ben Gardiner | 70b3093 | 2010-12-09 16:51:06 -0500 | [diff] [blame] | 497 | /* assign the baseboard expander's GPIOs after the UI board's */ |
| 498 | #define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp) |
| 499 | #define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS) |
| 500 | |
| 501 | enum da850_evm_bb_exp_pins { |
| 502 | DA850_EVM_BB_EXP_DEEP_SLEEP_EN = 0, |
| 503 | DA850_EVM_BB_EXP_SW_RST, |
| 504 | DA850_EVM_BB_EXP_TP_23, |
| 505 | DA850_EVM_BB_EXP_TP_22, |
| 506 | DA850_EVM_BB_EXP_TP_21, |
| 507 | DA850_EVM_BB_EXP_USER_PB1, |
| 508 | DA850_EVM_BB_EXP_USER_LED2, |
| 509 | DA850_EVM_BB_EXP_USER_LED1, |
| 510 | DA850_EVM_BB_EXP_USER_SW1, |
| 511 | DA850_EVM_BB_EXP_USER_SW2, |
| 512 | DA850_EVM_BB_EXP_USER_SW3, |
| 513 | DA850_EVM_BB_EXP_USER_SW4, |
| 514 | DA850_EVM_BB_EXP_USER_SW5, |
| 515 | DA850_EVM_BB_EXP_USER_SW6, |
| 516 | DA850_EVM_BB_EXP_USER_SW7, |
| 517 | DA850_EVM_BB_EXP_USER_SW8 |
| 518 | }; |
| 519 | |
| 520 | static const char const *da850_evm_bb_exp[] = { |
| 521 | [DA850_EVM_BB_EXP_DEEP_SLEEP_EN] = "deep_sleep_en", |
| 522 | [DA850_EVM_BB_EXP_SW_RST] = "sw_rst", |
| 523 | [DA850_EVM_BB_EXP_TP_23] = "tp_23", |
| 524 | [DA850_EVM_BB_EXP_TP_22] = "tp_22", |
| 525 | [DA850_EVM_BB_EXP_TP_21] = "tp_21", |
| 526 | [DA850_EVM_BB_EXP_USER_PB1] = "user_pb1", |
| 527 | [DA850_EVM_BB_EXP_USER_LED2] = "user_led2", |
| 528 | [DA850_EVM_BB_EXP_USER_LED1] = "user_led1", |
| 529 | [DA850_EVM_BB_EXP_USER_SW1] = "user_sw1", |
| 530 | [DA850_EVM_BB_EXP_USER_SW2] = "user_sw2", |
| 531 | [DA850_EVM_BB_EXP_USER_SW3] = "user_sw3", |
| 532 | [DA850_EVM_BB_EXP_USER_SW4] = "user_sw4", |
| 533 | [DA850_EVM_BB_EXP_USER_SW5] = "user_sw5", |
| 534 | [DA850_EVM_BB_EXP_USER_SW6] = "user_sw6", |
| 535 | [DA850_EVM_BB_EXP_USER_SW7] = "user_sw7", |
| 536 | [DA850_EVM_BB_EXP_USER_SW8] = "user_sw8", |
| 537 | }; |
| 538 | |
| 539 | #define DA850_N_BB_USER_SW 8 |
| 540 | |
| 541 | static struct gpio_keys_button da850_evm_bb_keys[] = { |
| 542 | [0] = { |
| 543 | .type = EV_KEY, |
| 544 | .active_low = 1, |
| 545 | .wakeup = 0, |
| 546 | .debounce_interval = DA850_KEYS_DEBOUNCE_MS, |
| 547 | .code = KEY_PROG1, |
| 548 | .desc = NULL, /* assigned at runtime */ |
| 549 | .gpio = -1, /* assigned at runtime */ |
| 550 | }, |
| 551 | [1 ... DA850_N_BB_USER_SW] = { |
| 552 | .type = EV_SW, |
| 553 | .active_low = 1, |
| 554 | .wakeup = 0, |
| 555 | .debounce_interval = DA850_KEYS_DEBOUNCE_MS, |
| 556 | .code = -1, /* assigned at runtime */ |
| 557 | .desc = NULL, /* assigned at runtime */ |
| 558 | .gpio = -1, /* assigned at runtime */ |
| 559 | }, |
| 560 | }; |
| 561 | |
| 562 | static struct gpio_keys_platform_data da850_evm_bb_keys_pdata = { |
| 563 | .buttons = da850_evm_bb_keys, |
| 564 | .nbuttons = ARRAY_SIZE(da850_evm_bb_keys), |
| 565 | .poll_interval = DA850_GPIO_KEYS_POLL_MS, |
| 566 | }; |
| 567 | |
| 568 | static struct platform_device da850_evm_bb_keys_device = { |
| 569 | .name = "gpio-keys-polled", |
| 570 | .id = 1, |
| 571 | .dev = { |
| 572 | .platform_data = &da850_evm_bb_keys_pdata |
| 573 | }, |
| 574 | }; |
| 575 | |
| 576 | static void da850_evm_bb_keys_init(unsigned gpio) |
| 577 | { |
| 578 | int i; |
| 579 | struct gpio_keys_button *button; |
| 580 | |
| 581 | button = &da850_evm_bb_keys[0]; |
| 582 | button->desc = (char *) |
| 583 | da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1]; |
| 584 | button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1; |
| 585 | |
| 586 | for (i = 0; i < DA850_N_BB_USER_SW; i++) { |
| 587 | button = &da850_evm_bb_keys[i + 1]; |
| 588 | button->code = SW_LID + i; |
| 589 | button->desc = (char *) |
| 590 | da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i]; |
| 591 | button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i; |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | #define DA850_N_BB_USER_LED 2 |
| 596 | |
| 597 | static struct gpio_led da850_evm_bb_leds[] = { |
| 598 | [0 ... DA850_N_BB_USER_LED - 1] = { |
| 599 | .active_low = 1, |
| 600 | .gpio = -1, /* assigned at runtime */ |
| 601 | .name = NULL, /* assigned at runtime */ |
| 602 | }, |
| 603 | }; |
| 604 | |
| 605 | static struct gpio_led_platform_data da850_evm_bb_leds_pdata = { |
| 606 | .leds = da850_evm_bb_leds, |
| 607 | .num_leds = ARRAY_SIZE(da850_evm_bb_leds), |
| 608 | }; |
| 609 | |
| 610 | static struct platform_device da850_evm_bb_leds_device = { |
| 611 | .name = "leds-gpio", |
| 612 | .id = -1, |
| 613 | .dev = { |
| 614 | .platform_data = &da850_evm_bb_leds_pdata |
| 615 | } |
| 616 | }; |
| 617 | |
| 618 | static void da850_evm_bb_leds_init(unsigned gpio) |
| 619 | { |
| 620 | int i; |
| 621 | struct gpio_led *led; |
| 622 | |
| 623 | for (i = 0; i < DA850_N_BB_USER_LED; i++) { |
| 624 | led = &da850_evm_bb_leds[i]; |
| 625 | |
| 626 | led->gpio = gpio + DA850_EVM_BB_EXP_USER_LED2 + i; |
| 627 | led->name = |
| 628 | da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_LED2 + i]; |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | static int da850_evm_bb_expander_setup(struct i2c_client *client, |
| 633 | unsigned gpio, unsigned ngpio, |
| 634 | void *c) |
| 635 | { |
| 636 | int ret; |
| 637 | |
| 638 | /* |
| 639 | * Register the switches and pushbutton on the baseboard as a gpio-keys |
| 640 | * device. |
| 641 | */ |
| 642 | da850_evm_bb_keys_init(gpio); |
| 643 | ret = platform_device_register(&da850_evm_bb_keys_device); |
| 644 | if (ret) { |
| 645 | pr_warning("Could not register baseboard GPIO expander keys"); |
| 646 | goto io_exp_setup_sw_fail; |
| 647 | } |
| 648 | |
| 649 | da850_evm_bb_leds_init(gpio); |
| 650 | ret = platform_device_register(&da850_evm_bb_leds_device); |
| 651 | if (ret) { |
| 652 | pr_warning("Could not register baseboard GPIO expander LEDS"); |
| 653 | goto io_exp_setup_leds_fail; |
| 654 | } |
| 655 | |
| 656 | return 0; |
| 657 | |
| 658 | io_exp_setup_leds_fail: |
| 659 | platform_device_unregister(&da850_evm_bb_keys_device); |
| 660 | io_exp_setup_sw_fail: |
| 661 | return ret; |
| 662 | } |
| 663 | |
| 664 | static int da850_evm_bb_expander_teardown(struct i2c_client *client, |
| 665 | unsigned gpio, unsigned ngpio, void *c) |
| 666 | { |
| 667 | platform_device_unregister(&da850_evm_bb_leds_device); |
| 668 | platform_device_unregister(&da850_evm_bb_keys_device); |
| 669 | |
| 670 | return 0; |
| 671 | } |
| 672 | |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 673 | static struct pca953x_platform_data da850_evm_ui_expander_info = { |
| 674 | .gpio_base = DAVINCI_N_GPIO, |
| 675 | .setup = da850_evm_ui_expander_setup, |
| 676 | .teardown = da850_evm_ui_expander_teardown, |
Ben Gardiner | 75929f5 | 2010-12-09 16:51:04 -0500 | [diff] [blame] | 677 | .names = da850_evm_ui_exp, |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 678 | }; |
| 679 | |
Ben Gardiner | 70b3093 | 2010-12-09 16:51:06 -0500 | [diff] [blame] | 680 | static struct pca953x_platform_data da850_evm_bb_expander_info = { |
| 681 | .gpio_base = DA850_BB_EXPANDER_GPIO_BASE, |
| 682 | .setup = da850_evm_bb_expander_setup, |
| 683 | .teardown = da850_evm_bb_expander_teardown, |
| 684 | .names = da850_evm_bb_exp, |
| 685 | }; |
| 686 | |
Chaithrika U S | 1a7ff8f | 2009-08-25 15:20:05 +0300 | [diff] [blame] | 687 | static struct i2c_board_info __initdata da850_evm_i2c_devices[] = { |
| 688 | { |
| 689 | I2C_BOARD_INFO("tlv320aic3x", 0x18), |
Chaithrika U S | 75e2ea6 | 2009-09-30 17:00:28 -0400 | [diff] [blame] | 690 | }, |
| 691 | { |
| 692 | I2C_BOARD_INFO("tca6416", 0x20), |
| 693 | .platform_data = &da850_evm_ui_expander_info, |
| 694 | }, |
Ben Gardiner | 70b3093 | 2010-12-09 16:51:06 -0500 | [diff] [blame] | 695 | { |
| 696 | I2C_BOARD_INFO("tca6416", 0x21), |
| 697 | .platform_data = &da850_evm_bb_expander_info, |
| 698 | }, |
Chaithrika U S | 1a7ff8f | 2009-08-25 15:20:05 +0300 | [diff] [blame] | 699 | }; |
| 700 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 701 | static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { |
| 702 | .bus_freq = 100, /* kHz */ |
| 703 | .bus_delay = 0, /* usec */ |
| 704 | }; |
| 705 | |
| 706 | static struct davinci_uart_config da850_evm_uart_config __initdata = { |
| 707 | .enabled_uarts = 0x7, |
| 708 | }; |
| 709 | |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 710 | /* davinci da850 evm audio machine driver */ |
| 711 | static u8 da850_iis_serializer_direction[] = { |
| 712 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, |
| 713 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, |
| 714 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, TX_MODE, |
| 715 | RX_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, |
| 716 | }; |
| 717 | |
| 718 | static struct snd_platform_data da850_evm_snd_data = { |
| 719 | .tx_dma_offset = 0x2000, |
| 720 | .rx_dma_offset = 0x2000, |
| 721 | .op_mode = DAVINCI_MCASP_IIS_MODE, |
| 722 | .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction), |
| 723 | .tdm_slots = 2, |
| 724 | .serial_dir = da850_iis_serializer_direction, |
Sekhar Nori | 48519f0 | 2010-07-19 12:31:16 +0530 | [diff] [blame] | 725 | .asp_chan_q = EVENTQ_1, |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 726 | .version = MCASP_VERSION_2, |
| 727 | .txnumevt = 1, |
| 728 | .rxnumevt = 1, |
| 729 | }; |
| 730 | |
Michael Williamson | c840fc7 | 2011-01-18 12:21:44 -0500 | [diff] [blame] | 731 | static const short da850_evm_mcasp_pins[] __initconst = { |
| 732 | DA850_AHCLKX, DA850_ACLKX, DA850_AFSX, |
| 733 | DA850_AHCLKR, DA850_ACLKR, DA850_AFSR, DA850_AMUTE, |
| 734 | DA850_AXR_11, DA850_AXR_12, |
| 735 | -1 |
| 736 | }; |
| 737 | |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 738 | static int da850_evm_mmc_get_ro(int index) |
| 739 | { |
| 740 | return gpio_get_value(DA850_MMCSD_WP_PIN); |
| 741 | } |
| 742 | |
| 743 | static int da850_evm_mmc_get_cd(int index) |
| 744 | { |
| 745 | return !gpio_get_value(DA850_MMCSD_CD_PIN); |
| 746 | } |
| 747 | |
| 748 | static struct davinci_mmc_config da850_mmc_config = { |
| 749 | .get_ro = da850_evm_mmc_get_ro, |
| 750 | .get_cd = da850_evm_mmc_get_cd, |
| 751 | .wires = 4, |
Chaithrika U S | 0046d0b | 2009-11-03 15:46:14 +0530 | [diff] [blame] | 752 | .max_freq = 50000000, |
| 753 | .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 754 | .version = MMC_CTLR_VERSION_2, |
| 755 | }; |
| 756 | |
Michael Williamson | 5a0d80ea | 2011-01-18 12:21:45 -0500 | [diff] [blame] | 757 | static const short da850_evm_mmcsd0_pins[] __initconst = { |
| 758 | DA850_MMCSD0_DAT_0, DA850_MMCSD0_DAT_1, DA850_MMCSD0_DAT_2, |
| 759 | DA850_MMCSD0_DAT_3, DA850_MMCSD0_CLK, DA850_MMCSD0_CMD, |
| 760 | DA850_GPIO4_0, DA850_GPIO4_1, |
| 761 | -1 |
| 762 | }; |
| 763 | |
Chaithrika U S | d52f235 | 2009-12-15 16:46:46 -0800 | [diff] [blame] | 764 | static void da850_panel_power_ctrl(int val) |
| 765 | { |
| 766 | /* lcd backlight */ |
| 767 | gpio_set_value(DA850_LCD_BL_PIN, val); |
| 768 | |
| 769 | /* lcd power */ |
| 770 | gpio_set_value(DA850_LCD_PWR_PIN, val); |
| 771 | } |
| 772 | |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 773 | static int da850_lcd_hw_init(void) |
| 774 | { |
| 775 | int status; |
| 776 | |
| 777 | status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n"); |
| 778 | if (status < 0) |
| 779 | return status; |
| 780 | |
| 781 | status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n"); |
| 782 | if (status < 0) { |
| 783 | gpio_free(DA850_LCD_BL_PIN); |
| 784 | return status; |
| 785 | } |
| 786 | |
| 787 | gpio_direction_output(DA850_LCD_BL_PIN, 0); |
| 788 | gpio_direction_output(DA850_LCD_PWR_PIN, 0); |
| 789 | |
Chaithrika U S | d52f235 | 2009-12-15 16:46:46 -0800 | [diff] [blame] | 790 | /* Switch off panel power and backlight */ |
| 791 | da850_panel_power_ctrl(0); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 792 | |
Chaithrika U S | d52f235 | 2009-12-15 16:46:46 -0800 | [diff] [blame] | 793 | /* Switch on panel power and backlight */ |
| 794 | da850_panel_power_ctrl(1); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 795 | |
| 796 | return 0; |
| 797 | } |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 798 | |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 799 | /* TPS65070 voltage regulator support */ |
| 800 | |
| 801 | /* 3.3V */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 802 | static struct regulator_consumer_supply tps65070_dcdc1_consumers[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 803 | { |
| 804 | .supply = "usb0_vdda33", |
| 805 | }, |
| 806 | { |
| 807 | .supply = "usb1_vdda33", |
| 808 | }, |
| 809 | }; |
| 810 | |
| 811 | /* 3.3V or 1.8V */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 812 | static struct regulator_consumer_supply tps65070_dcdc2_consumers[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 813 | { |
| 814 | .supply = "dvdd3318_a", |
| 815 | }, |
| 816 | { |
| 817 | .supply = "dvdd3318_b", |
| 818 | }, |
| 819 | { |
| 820 | .supply = "dvdd3318_c", |
| 821 | }, |
| 822 | }; |
| 823 | |
| 824 | /* 1.2V */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 825 | static struct regulator_consumer_supply tps65070_dcdc3_consumers[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 826 | { |
| 827 | .supply = "cvdd", |
| 828 | }, |
| 829 | }; |
| 830 | |
| 831 | /* 1.8V LDO */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 832 | static struct regulator_consumer_supply tps65070_ldo1_consumers[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 833 | { |
| 834 | .supply = "sata_vddr", |
| 835 | }, |
| 836 | { |
| 837 | .supply = "usb0_vdda18", |
| 838 | }, |
| 839 | { |
| 840 | .supply = "usb1_vdda18", |
| 841 | }, |
| 842 | { |
| 843 | .supply = "ddr_dvdd18", |
| 844 | }, |
| 845 | }; |
| 846 | |
| 847 | /* 1.2V LDO */ |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 848 | static struct regulator_consumer_supply tps65070_ldo2_consumers[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 849 | { |
| 850 | .supply = "sata_vdd", |
| 851 | }, |
| 852 | { |
| 853 | .supply = "pll0_vdda", |
| 854 | }, |
| 855 | { |
| 856 | .supply = "pll1_vdda", |
| 857 | }, |
| 858 | { |
| 859 | .supply = "usbs_cvdd", |
| 860 | }, |
| 861 | { |
| 862 | .supply = "vddarnwa1", |
| 863 | }, |
| 864 | }; |
| 865 | |
Sekhar Nori | 8b24599 | 2010-07-12 17:56:21 +0530 | [diff] [blame] | 866 | /* We take advantage of the fact that both defdcdc{2,3} are tied high */ |
| 867 | static struct tps6507x_reg_platform_data tps6507x_platform_data = { |
| 868 | .defdcdc_default = true, |
| 869 | }; |
| 870 | |
Sekhar Nori | db549d2 | 2010-06-28 17:16:38 +0530 | [diff] [blame] | 871 | static struct regulator_init_data tps65070_regulator_data[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 872 | /* dcdc1 */ |
| 873 | { |
| 874 | .constraints = { |
| 875 | .min_uV = 3150000, |
| 876 | .max_uV = 3450000, |
| 877 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 878 | REGULATOR_CHANGE_STATUS), |
| 879 | .boot_on = 1, |
| 880 | }, |
| 881 | .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc1_consumers), |
| 882 | .consumer_supplies = tps65070_dcdc1_consumers, |
| 883 | }, |
| 884 | |
| 885 | /* dcdc2 */ |
| 886 | { |
| 887 | .constraints = { |
| 888 | .min_uV = 1710000, |
| 889 | .max_uV = 3450000, |
| 890 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 891 | REGULATOR_CHANGE_STATUS), |
| 892 | .boot_on = 1, |
| 893 | }, |
| 894 | .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers), |
| 895 | .consumer_supplies = tps65070_dcdc2_consumers, |
Sekhar Nori | 8b24599 | 2010-07-12 17:56:21 +0530 | [diff] [blame] | 896 | .driver_data = &tps6507x_platform_data, |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 897 | }, |
| 898 | |
| 899 | /* dcdc3 */ |
| 900 | { |
| 901 | .constraints = { |
| 902 | .min_uV = 950000, |
Sekhar Nori | 28bd2c3 | 2010-12-20 21:31:34 +0530 | [diff] [blame] | 903 | .max_uV = 1350000, |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 904 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 905 | REGULATOR_CHANGE_STATUS), |
| 906 | .boot_on = 1, |
| 907 | }, |
| 908 | .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers), |
| 909 | .consumer_supplies = tps65070_dcdc3_consumers, |
Sekhar Nori | 8b24599 | 2010-07-12 17:56:21 +0530 | [diff] [blame] | 910 | .driver_data = &tps6507x_platform_data, |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 911 | }, |
| 912 | |
| 913 | /* ldo1 */ |
| 914 | { |
| 915 | .constraints = { |
| 916 | .min_uV = 1710000, |
| 917 | .max_uV = 1890000, |
| 918 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 919 | REGULATOR_CHANGE_STATUS), |
| 920 | .boot_on = 1, |
| 921 | }, |
| 922 | .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo1_consumers), |
| 923 | .consumer_supplies = tps65070_ldo1_consumers, |
| 924 | }, |
| 925 | |
| 926 | /* ldo2 */ |
| 927 | { |
| 928 | .constraints = { |
| 929 | .min_uV = 1140000, |
| 930 | .max_uV = 1320000, |
| 931 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 932 | REGULATOR_CHANGE_STATUS), |
| 933 | .boot_on = 1, |
| 934 | }, |
| 935 | .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo2_consumers), |
| 936 | .consumer_supplies = tps65070_ldo2_consumers, |
| 937 | }, |
| 938 | }; |
| 939 | |
Todd Fischer | da1e368 | 2010-04-05 17:53:13 -0600 | [diff] [blame] | 940 | static struct touchscreen_init_data tps6507x_touchscreen_data = { |
| 941 | .poll_period = 30, /* ms between touch samples */ |
| 942 | .min_pressure = 0x30, /* minimum pressure to trigger touch */ |
| 943 | .vref = 0, /* turn off vref when not using A/D */ |
| 944 | .vendor = 0, /* /sys/class/input/input?/id/vendor */ |
| 945 | .product = 65070, /* /sys/class/input/input?/id/product */ |
| 946 | .version = 0x100, /* /sys/class/input/input?/id/version */ |
| 947 | }; |
| 948 | |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 949 | static struct tps6507x_board tps_board = { |
| 950 | .tps6507x_pmic_init_data = &tps65070_regulator_data[0], |
Todd Fischer | da1e368 | 2010-04-05 17:53:13 -0600 | [diff] [blame] | 951 | .tps6507x_ts_init_data = &tps6507x_touchscreen_data, |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 952 | }; |
| 953 | |
Ben Gardiner | 3506f27 | 2010-11-19 16:43:04 -0500 | [diff] [blame] | 954 | static struct i2c_board_info __initdata da850_evm_tps65070_info[] = { |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 955 | { |
| 956 | I2C_BOARD_INFO("tps6507x", 0x48), |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 957 | .platform_data = &tps_board, |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 958 | }, |
| 959 | }; |
| 960 | |
| 961 | static int __init pmic_tps65070_init(void) |
| 962 | { |
Ben Gardiner | 3506f27 | 2010-11-19 16:43:04 -0500 | [diff] [blame] | 963 | return i2c_register_board_info(1, da850_evm_tps65070_info, |
| 964 | ARRAY_SIZE(da850_evm_tps65070_info)); |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 965 | } |
| 966 | |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 967 | static const short da850_evm_lcdc_pins[] = { |
| 968 | DA850_GPIO2_8, DA850_GPIO2_15, |
| 969 | -1 |
| 970 | }; |
| 971 | |
Sergei Shtylyov | 85b8307 | 2010-08-01 21:17:00 +0400 | [diff] [blame] | 972 | static const short da850_evm_mii_pins[] = { |
| 973 | DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3, |
| 974 | DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER, |
| 975 | DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3, |
| 976 | DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK, |
| 977 | DA850_MDIO_D, |
| 978 | -1 |
| 979 | }; |
| 980 | |
| 981 | static const short da850_evm_rmii_pins[] = { |
| 982 | DA850_RMII_TXD_0, DA850_RMII_TXD_1, DA850_RMII_TXEN, |
| 983 | DA850_RMII_CRS_DV, DA850_RMII_RXD_0, DA850_RMII_RXD_1, |
| 984 | DA850_RMII_RXER, DA850_RMII_MHZ_50_CLK, DA850_MDIO_CLK, |
| 985 | DA850_MDIO_D, |
| 986 | -1 |
| 987 | }; |
| 988 | |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 989 | static int __init da850_evm_config_emac(void) |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 990 | { |
| 991 | void __iomem *cfg_chip3_base; |
| 992 | int ret; |
| 993 | u32 val; |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 994 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
| 995 | u8 rmii_en = soc_info->emac_pdata->rmii_en; |
| 996 | |
| 997 | if (!machine_is_davinci_da850_evm()) |
| 998 | return 0; |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 999 | |
Sekhar Nori | d2de058 | 2009-11-16 17:21:32 +0530 | [diff] [blame] | 1000 | cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG); |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 1001 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 1002 | val = __raw_readl(cfg_chip3_base); |
Sekhar Nori | 17fadd9 | 2009-10-21 21:18:24 +0530 | [diff] [blame] | 1003 | |
| 1004 | if (rmii_en) { |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 1005 | val |= BIT(8); |
Sergei Shtylyov | 85b8307 | 2010-08-01 21:17:00 +0400 | [diff] [blame] | 1006 | ret = davinci_cfg_reg_list(da850_evm_rmii_pins); |
Sekhar Nori | 17fadd9 | 2009-10-21 21:18:24 +0530 | [diff] [blame] | 1007 | pr_info("EMAC: RMII PHY configured, MII PHY will not be" |
| 1008 | " functional\n"); |
| 1009 | } else { |
| 1010 | val &= ~BIT(8); |
Sergei Shtylyov | 85b8307 | 2010-08-01 21:17:00 +0400 | [diff] [blame] | 1011 | ret = davinci_cfg_reg_list(da850_evm_mii_pins); |
Sekhar Nori | 17fadd9 | 2009-10-21 21:18:24 +0530 | [diff] [blame] | 1012 | pr_info("EMAC: MII PHY configured, RMII PHY will not be" |
| 1013 | " functional\n"); |
| 1014 | } |
| 1015 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 1016 | if (ret) |
| 1017 | pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n", |
| 1018 | ret); |
| 1019 | |
Sekhar Nori | 17fadd9 | 2009-10-21 21:18:24 +0530 | [diff] [blame] | 1020 | /* configure the CFGCHIP3 register for RMII or MII */ |
| 1021 | __raw_writel(val, cfg_chip3_base); |
| 1022 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 1023 | ret = davinci_cfg_reg(DA850_GPIO2_6); |
| 1024 | if (ret) |
| 1025 | pr_warning("da850_evm_init:GPIO(2,6) mux setup " |
| 1026 | "failed\n"); |
| 1027 | |
| 1028 | ret = gpio_request(DA850_MII_MDIO_CLKEN_PIN, "mdio_clk_en"); |
| 1029 | if (ret) { |
| 1030 | pr_warning("Cannot open GPIO %d\n", |
| 1031 | DA850_MII_MDIO_CLKEN_PIN); |
| 1032 | return ret; |
| 1033 | } |
| 1034 | |
Sekhar Nori | 17fadd9 | 2009-10-21 21:18:24 +0530 | [diff] [blame] | 1035 | /* Enable/Disable MII MDIO clock */ |
| 1036 | gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, rmii_en); |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 1037 | |
Cyril Chemparathy | 782f2d7 | 2010-09-15 10:11:25 -0400 | [diff] [blame] | 1038 | soc_info->emac_pdata->phy_id = DA850_EVM_PHY_ID; |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 1039 | |
| 1040 | ret = da8xx_register_emac(); |
| 1041 | if (ret) |
| 1042 | pr_warning("da850_evm_init: emac registration failed: %d\n", |
| 1043 | ret); |
| 1044 | |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 1045 | return 0; |
| 1046 | } |
Sekhar Nori | bae1058 | 2009-10-21 21:18:22 +0530 | [diff] [blame] | 1047 | device_initcall(da850_evm_config_emac); |
Chaithrika U S | 2206771 | 2009-09-30 17:00:53 -0400 | [diff] [blame] | 1048 | |
Rajashekhara, Sudhakar | a941c50 | 2010-06-29 11:35:14 +0530 | [diff] [blame] | 1049 | /* |
| 1050 | * The following EDMA channels/slots are not being used by drivers (for |
| 1051 | * example: Timer, GPIO, UART events etc) on da850/omap-l138 EVM, hence |
| 1052 | * they are being reserved for codecs on the DSP side. |
| 1053 | */ |
| 1054 | static const s16 da850_dma0_rsv_chans[][2] = { |
| 1055 | /* (offset, number) */ |
| 1056 | { 8, 6}, |
| 1057 | {24, 4}, |
| 1058 | {30, 2}, |
| 1059 | {-1, -1} |
| 1060 | }; |
| 1061 | |
| 1062 | static const s16 da850_dma0_rsv_slots[][2] = { |
| 1063 | /* (offset, number) */ |
| 1064 | { 8, 6}, |
| 1065 | {24, 4}, |
| 1066 | {30, 50}, |
| 1067 | {-1, -1} |
| 1068 | }; |
| 1069 | |
| 1070 | static const s16 da850_dma1_rsv_chans[][2] = { |
| 1071 | /* (offset, number) */ |
| 1072 | { 0, 28}, |
| 1073 | {30, 2}, |
| 1074 | {-1, -1} |
| 1075 | }; |
| 1076 | |
| 1077 | static const s16 da850_dma1_rsv_slots[][2] = { |
| 1078 | /* (offset, number) */ |
| 1079 | { 0, 28}, |
| 1080 | {30, 90}, |
| 1081 | {-1, -1} |
| 1082 | }; |
| 1083 | |
| 1084 | static struct edma_rsv_info da850_edma_cc0_rsv = { |
| 1085 | .rsv_chans = da850_dma0_rsv_chans, |
| 1086 | .rsv_slots = da850_dma0_rsv_slots, |
| 1087 | }; |
| 1088 | |
| 1089 | static struct edma_rsv_info da850_edma_cc1_rsv = { |
| 1090 | .rsv_chans = da850_dma1_rsv_chans, |
| 1091 | .rsv_slots = da850_dma1_rsv_slots, |
| 1092 | }; |
| 1093 | |
| 1094 | static struct edma_rsv_info *da850_edma_rsv[2] = { |
| 1095 | &da850_edma_cc0_rsv, |
| 1096 | &da850_edma_cc1_rsv, |
| 1097 | }; |
| 1098 | |
Sekhar Nori | 28bd2c3 | 2010-12-20 21:31:34 +0530 | [diff] [blame] | 1099 | #ifdef CONFIG_CPU_FREQ |
| 1100 | static __init int da850_evm_init_cpufreq(void) |
| 1101 | { |
| 1102 | switch (system_rev & 0xF) { |
| 1103 | case 3: |
| 1104 | da850_max_speed = 456000; |
| 1105 | break; |
| 1106 | case 2: |
| 1107 | da850_max_speed = 408000; |
| 1108 | break; |
| 1109 | case 1: |
| 1110 | da850_max_speed = 372000; |
| 1111 | break; |
| 1112 | } |
| 1113 | |
| 1114 | return da850_register_cpufreq("pll0_sysclk3"); |
| 1115 | } |
| 1116 | #else |
| 1117 | static __init int da850_evm_init_cpufreq(void) { return 0; } |
| 1118 | #endif |
| 1119 | |
Sekhar Nori | 8bb2c48 | 2011-07-06 06:01:24 +0000 | [diff] [blame] | 1120 | #define DA850EVM_SATA_REFCLKPN_RATE (100 * 1000 * 1000) |
| 1121 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1122 | static __init void da850_evm_init(void) |
| 1123 | { |
| 1124 | int ret; |
| 1125 | |
Sekhar Nori | a9eb1f6 | 2009-09-22 21:14:04 +0530 | [diff] [blame] | 1126 | ret = pmic_tps65070_init(); |
| 1127 | if (ret) |
| 1128 | pr_warning("da850_evm_init: TPS65070 PMIC init failed: %d\n", |
| 1129 | ret); |
| 1130 | |
Rajashekhara, Sudhakar | a941c50 | 2010-06-29 11:35:14 +0530 | [diff] [blame] | 1131 | ret = da850_register_edma(da850_edma_rsv); |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1132 | if (ret) |
| 1133 | pr_warning("da850_evm_init: edma registration failed: %d\n", |
| 1134 | ret); |
| 1135 | |
Cyril Chemparathy | 3821d10 | 2010-03-25 17:43:48 -0400 | [diff] [blame] | 1136 | ret = davinci_cfg_reg_list(da850_i2c0_pins); |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1137 | if (ret) |
| 1138 | pr_warning("da850_evm_init: i2c0 mux setup failed: %d\n", |
| 1139 | ret); |
| 1140 | |
| 1141 | ret = da8xx_register_i2c(0, &da850_evm_i2c_0_pdata); |
| 1142 | if (ret) |
| 1143 | pr_warning("da850_evm_init: i2c0 registration failed: %d\n", |
| 1144 | ret); |
| 1145 | |
Sudhakar Rajashekhara | 5a4b131 | 2009-07-17 04:47:10 -0400 | [diff] [blame] | 1146 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1147 | ret = da8xx_register_watchdog(); |
| 1148 | if (ret) |
| 1149 | pr_warning("da830_evm_init: watchdog registration failed: %d\n", |
| 1150 | ret); |
| 1151 | |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 1152 | if (HAS_MMC) { |
Michael Williamson | 5a0d80ea | 2011-01-18 12:21:45 -0500 | [diff] [blame] | 1153 | ret = davinci_cfg_reg_list(da850_evm_mmcsd0_pins); |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 1154 | if (ret) |
| 1155 | pr_warning("da850_evm_init: mmcsd0 mux setup failed:" |
| 1156 | " %d\n", ret); |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 1157 | |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 1158 | ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n"); |
| 1159 | if (ret) |
| 1160 | pr_warning("da850_evm_init: can not open GPIO %d\n", |
| 1161 | DA850_MMCSD_CD_PIN); |
| 1162 | gpio_direction_input(DA850_MMCSD_CD_PIN); |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 1163 | |
Sudhakar Rajashekhara | 820c4fe | 2009-08-13 18:16:28 -0400 | [diff] [blame] | 1164 | ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n"); |
| 1165 | if (ret) |
| 1166 | pr_warning("da850_evm_init: can not open GPIO %d\n", |
| 1167 | DA850_MMCSD_WP_PIN); |
| 1168 | gpio_direction_input(DA850_MMCSD_WP_PIN); |
| 1169 | |
| 1170 | ret = da8xx_register_mmcsd0(&da850_mmc_config); |
| 1171 | if (ret) |
| 1172 | pr_warning("da850_evm_init: mmcsd0 registration failed:" |
| 1173 | " %d\n", ret); |
| 1174 | } |
Sudhakar Rajashekhara | 700691f | 2009-08-13 15:16:23 -0400 | [diff] [blame] | 1175 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1176 | davinci_serial_init(&da850_evm_uart_config); |
| 1177 | |
Chaithrika U S | 1a7ff8f | 2009-08-25 15:20:05 +0300 | [diff] [blame] | 1178 | i2c_register_board_info(1, da850_evm_i2c_devices, |
| 1179 | ARRAY_SIZE(da850_evm_i2c_devices)); |
| 1180 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1181 | /* |
| 1182 | * shut down uart 0 and 1; they are not used on the board and |
| 1183 | * accessing them causes endless "too much work in irq53" messages |
| 1184 | * with arago fs |
| 1185 | */ |
| 1186 | __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30); |
| 1187 | __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30); |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 1188 | |
Michael Williamson | c840fc7 | 2011-01-18 12:21:44 -0500 | [diff] [blame] | 1189 | ret = davinci_cfg_reg_list(da850_evm_mcasp_pins); |
Chaithrika U S | 491214e | 2009-08-11 17:03:25 -0400 | [diff] [blame] | 1190 | if (ret) |
| 1191 | pr_warning("da850_evm_init: mcasp mux setup failed: %d\n", |
| 1192 | ret); |
| 1193 | |
Mark A. Greer | b8864aa | 2009-08-28 15:05:02 -0700 | [diff] [blame] | 1194 | da8xx_register_mcasp(0, &da850_evm_snd_data); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 1195 | |
Cyril Chemparathy | 3821d10 | 2010-03-25 17:43:48 -0400 | [diff] [blame] | 1196 | ret = davinci_cfg_reg_list(da850_lcdcntl_pins); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 1197 | if (ret) |
| 1198 | pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n", |
| 1199 | ret); |
| 1200 | |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 1201 | /* Handle board specific muxing for LCD here */ |
Cyril Chemparathy | 3821d10 | 2010-03-25 17:43:48 -0400 | [diff] [blame] | 1202 | ret = davinci_cfg_reg_list(da850_evm_lcdc_pins); |
Sudhakar Rajashekhara | 7761ef6 | 2009-09-15 17:46:14 -0400 | [diff] [blame] | 1203 | if (ret) |
| 1204 | pr_warning("da850_evm_init: evm specific lcd mux setup " |
| 1205 | "failed: %d\n", ret); |
| 1206 | |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 1207 | ret = da850_lcd_hw_init(); |
| 1208 | if (ret) |
| 1209 | pr_warning("da850_evm_init: lcd initialization failed: %d\n", |
| 1210 | ret); |
| 1211 | |
Chaithrika U S | d52f235 | 2009-12-15 16:46:46 -0800 | [diff] [blame] | 1212 | sharp_lk043t1dg01_pdata.panel_power_ctrl = da850_panel_power_ctrl, |
Mark A. Greer | b9e6342 | 2009-09-15 18:14:19 -0700 | [diff] [blame] | 1213 | ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata); |
Sudhakar Rajashekhara | 5cbdf27 | 2009-08-13 14:33:14 -0400 | [diff] [blame] | 1214 | if (ret) |
| 1215 | pr_warning("da850_evm_init: lcdc registration failed: %d\n", |
| 1216 | ret); |
Mark A. Greer | c51df70 | 2009-09-15 18:15:54 -0700 | [diff] [blame] | 1217 | |
| 1218 | ret = da8xx_register_rtc(); |
| 1219 | if (ret) |
| 1220 | pr_warning("da850_evm_init: rtc setup failed: %d\n", ret); |
Sekhar Nori | 09dc2d4 | 2009-09-22 21:14:03 +0530 | [diff] [blame] | 1221 | |
Sekhar Nori | 28bd2c3 | 2010-12-20 21:31:34 +0530 | [diff] [blame] | 1222 | ret = da850_evm_init_cpufreq(); |
Sekhar Nori | 09dc2d4 | 2009-09-22 21:14:03 +0530 | [diff] [blame] | 1223 | if (ret) |
| 1224 | pr_warning("da850_evm_init: cpufreq registration failed: %d\n", |
| 1225 | ret); |
Sekhar Nori | 5aeb15a | 2009-10-22 15:12:15 +0530 | [diff] [blame] | 1226 | |
| 1227 | ret = da8xx_register_cpuidle(); |
| 1228 | if (ret) |
| 1229 | pr_warning("da850_evm_init: cpuidle registration failed: %d\n", |
| 1230 | ret); |
Sekhar Nori | 6353444 | 2009-12-17 18:29:33 +0530 | [diff] [blame] | 1231 | |
| 1232 | ret = da850_register_pm(&da850_pm_device); |
| 1233 | if (ret) |
| 1234 | pr_warning("da850_evm_init: suspend registration failed: %d\n", |
| 1235 | ret); |
Sekhar Nori | fdce556 | 2011-02-24 10:39:27 +0530 | [diff] [blame] | 1236 | |
| 1237 | ret = da8xx_register_spi(1, da850evm_spi_info, |
| 1238 | ARRAY_SIZE(da850evm_spi_info)); |
| 1239 | if (ret) |
| 1240 | pr_warning("da850_evm_init: spi 1 registration failed: %d\n", |
| 1241 | ret); |
Sekhar Nori | 8bb2c48 | 2011-07-06 06:01:24 +0000 | [diff] [blame] | 1242 | |
| 1243 | ret = da850_register_sata(DA850EVM_SATA_REFCLKPN_RATE); |
| 1244 | if (ret) |
| 1245 | pr_warning("da850_evm_init: sata registration failed: %d\n", |
| 1246 | ret); |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1247 | } |
| 1248 | |
| 1249 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
| 1250 | static int __init da850_evm_console_init(void) |
| 1251 | { |
Michael Williamson | 1aa5f2a | 2010-08-31 14:30:15 -0400 | [diff] [blame] | 1252 | if (!machine_is_davinci_da850_evm()) |
| 1253 | return 0; |
| 1254 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1255 | return add_preferred_console("ttyS", 2, "115200"); |
| 1256 | } |
| 1257 | console_initcall(da850_evm_console_init); |
| 1258 | #endif |
| 1259 | |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1260 | static void __init da850_evm_map_io(void) |
| 1261 | { |
| 1262 | da850_init(); |
| 1263 | } |
| 1264 | |
Sekhar Nori | 48ea89e | 2010-07-01 19:00:50 +0530 | [diff] [blame] | 1265 | MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM") |
Nicolas Pitre | e7e5601 | 2011-07-05 22:38:11 -0400 | [diff] [blame] | 1266 | .atag_offset = 0x100, |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1267 | .map_io = da850_evm_map_io, |
Cyril Chemparathy | bd80894 | 2010-05-07 17:06:37 -0400 | [diff] [blame] | 1268 | .init_irq = cp_intc_init, |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1269 | .timer = &davinci_timer, |
| 1270 | .init_machine = da850_evm_init, |
Nicolas Pitre | f68deab | 2011-07-05 22:28:08 -0400 | [diff] [blame] | 1271 | .dma_zone_size = SZ_128M, |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 1272 | MACHINE_END |