board-dm644x-evm.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. /*
  2. * TI DaVinci EVM board support
  3. *
  4. * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
  5. *
  6. * 2007 (c) MontaVista Software, Inc. This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/module.h>
  13. #include <linux/init.h>
  14. #include <linux/dma-mapping.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/gpio.h>
  17. #include <linux/leds.h>
  18. #include <linux/memory.h>
  19. #include <linux/i2c.h>
  20. #include <linux/i2c/pcf857x.h>
  21. #include <linux/i2c/at24.h>
  22. #include <linux/etherdevice.h>
  23. #include <linux/mtd/mtd.h>
  24. #include <linux/mtd/nand.h>
  25. #include <linux/mtd/partitions.h>
  26. #include <linux/mtd/physmap.h>
  27. #include <linux/io.h>
  28. #include <linux/phy.h>
  29. #include <linux/clk.h>
  30. #include <asm/setup.h>
  31. #include <asm/mach-types.h>
  32. #include <asm/mach/arch.h>
  33. #include <asm/mach/map.h>
  34. #include <asm/mach/flash.h>
  35. #include <mach/dm644x.h>
  36. #include <mach/common.h>
  37. #include <mach/i2c.h>
  38. #include <mach/serial.h>
  39. #include <mach/mux.h>
  40. #include <mach/psc.h>
  41. #include <mach/nand.h>
  42. #include <mach/mmc.h>
  43. #include <mach/emac.h>
  44. #include <mach/common.h>
  45. #define DM644X_EVM_PHY_MASK (0x2)
  46. #define DM644X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
  47. #define DAVINCI_CFC_ATA_BASE 0x01C66000
  48. #define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x01e00000
  49. #define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
  50. #define DAVINCI_ASYNC_EMIF_DATA_CE1_BASE 0x04000000
  51. #define DAVINCI_ASYNC_EMIF_DATA_CE2_BASE 0x06000000
  52. #define DAVINCI_ASYNC_EMIF_DATA_CE3_BASE 0x08000000
  53. #define LXT971_PHY_ID (0x001378e2)
  54. #define LXT971_PHY_MASK (0xfffffff0)
  55. static struct mtd_partition davinci_evm_norflash_partitions[] = {
  56. /* bootloader (UBL, U-Boot, etc) in first 5 sectors */
  57. {
  58. .name = "bootloader",
  59. .offset = 0,
  60. .size = 5 * SZ_64K,
  61. .mask_flags = MTD_WRITEABLE, /* force read-only */
  62. },
  63. /* bootloader params in the next 1 sectors */
  64. {
  65. .name = "params",
  66. .offset = MTDPART_OFS_APPEND,
  67. .size = SZ_64K,
  68. .mask_flags = 0,
  69. },
  70. /* kernel */
  71. {
  72. .name = "kernel",
  73. .offset = MTDPART_OFS_APPEND,
  74. .size = SZ_2M,
  75. .mask_flags = 0
  76. },
  77. /* file system */
  78. {
  79. .name = "filesystem",
  80. .offset = MTDPART_OFS_APPEND,
  81. .size = MTDPART_SIZ_FULL,
  82. .mask_flags = 0
  83. }
  84. };
  85. static struct physmap_flash_data davinci_evm_norflash_data = {
  86. .width = 2,
  87. .parts = davinci_evm_norflash_partitions,
  88. .nr_parts = ARRAY_SIZE(davinci_evm_norflash_partitions),
  89. };
  90. /* NOTE: CFI probe will correctly detect flash part as 32M, but EMIF
  91. * limits addresses to 16M, so using addresses past 16M will wrap */
  92. static struct resource davinci_evm_norflash_resource = {
  93. .start = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE,
  94. .end = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1,
  95. .flags = IORESOURCE_MEM,
  96. };
  97. static struct platform_device davinci_evm_norflash_device = {
  98. .name = "physmap-flash",
  99. .id = 0,
  100. .dev = {
  101. .platform_data = &davinci_evm_norflash_data,
  102. },
  103. .num_resources = 1,
  104. .resource = &davinci_evm_norflash_resource,
  105. };
  106. /* DM644x EVM includes a 64 MByte small-page NAND flash (16K blocks).
  107. * It may used instead of the (default) NOR chip to boot, using TI's
  108. * tools to install the secondary boot loader (UBL) and U-Boot.
  109. */
  110. struct mtd_partition davinci_evm_nandflash_partition[] = {
  111. /* Bootloader layout depends on whose u-boot is installed, but we
  112. * can hide all the details.
  113. * - block 0 for u-boot environment ... in mainline u-boot
  114. * - block 1 for UBL (plus up to four backup copies in blocks 2..5)
  115. * - blocks 6...? for u-boot
  116. * - blocks 16..23 for u-boot environment ... in TI's u-boot
  117. */
  118. {
  119. .name = "bootloader",
  120. .offset = 0,
  121. .size = SZ_256K + SZ_128K,
  122. .mask_flags = MTD_WRITEABLE, /* force read-only */
  123. },
  124. /* Kernel */
  125. {
  126. .name = "kernel",
  127. .offset = MTDPART_OFS_APPEND,
  128. .size = SZ_4M,
  129. .mask_flags = 0,
  130. },
  131. /* File system (older GIT kernels started this on the 5MB mark) */
  132. {
  133. .name = "filesystem",
  134. .offset = MTDPART_OFS_APPEND,
  135. .size = MTDPART_SIZ_FULL,
  136. .mask_flags = 0,
  137. }
  138. /* A few blocks at end hold a flash BBT ... created by TI's CCS
  139. * using flashwriter_nand.out, but ignored by TI's versions of
  140. * Linux and u-boot. We boot faster by using them.
  141. */
  142. };
  143. static struct davinci_nand_pdata davinci_evm_nandflash_data = {
  144. .parts = davinci_evm_nandflash_partition,
  145. .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition),
  146. .ecc_mode = NAND_ECC_HW,
  147. .options = NAND_USE_FLASH_BBT,
  148. };
  149. static struct resource davinci_evm_nandflash_resource[] = {
  150. {
  151. .start = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE,
  152. .end = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1,
  153. .flags = IORESOURCE_MEM,
  154. }, {
  155. .start = DAVINCI_ASYNC_EMIF_CONTROL_BASE,
  156. .end = DAVINCI_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1,
  157. .flags = IORESOURCE_MEM,
  158. },
  159. };
  160. static struct platform_device davinci_evm_nandflash_device = {
  161. .name = "davinci_nand",
  162. .id = 0,
  163. .dev = {
  164. .platform_data = &davinci_evm_nandflash_data,
  165. },
  166. .num_resources = ARRAY_SIZE(davinci_evm_nandflash_resource),
  167. .resource = davinci_evm_nandflash_resource,
  168. };
  169. static u64 davinci_fb_dma_mask = DMA_BIT_MASK(32);
  170. static struct platform_device davinci_fb_device = {
  171. .name = "davincifb",
  172. .id = -1,
  173. .dev = {
  174. .dma_mask = &davinci_fb_dma_mask,
  175. .coherent_dma_mask = DMA_BIT_MASK(32),
  176. },
  177. .num_resources = 0,
  178. };
  179. static struct platform_device rtc_dev = {
  180. .name = "rtc_davinci_evm",
  181. .id = -1,
  182. };
  183. static struct resource ide_resources[] = {
  184. {
  185. .start = DAVINCI_CFC_ATA_BASE,
  186. .end = DAVINCI_CFC_ATA_BASE + 0x7ff,
  187. .flags = IORESOURCE_MEM,
  188. },
  189. {
  190. .start = IRQ_IDE,
  191. .end = IRQ_IDE,
  192. .flags = IORESOURCE_IRQ,
  193. },
  194. };
  195. static u64 ide_dma_mask = DMA_BIT_MASK(32);
  196. static struct platform_device ide_dev = {
  197. .name = "palm_bk3710",
  198. .id = -1,
  199. .resource = ide_resources,
  200. .num_resources = ARRAY_SIZE(ide_resources),
  201. .dev = {
  202. .dma_mask = &ide_dma_mask,
  203. .coherent_dma_mask = DMA_BIT_MASK(32),
  204. },
  205. };
  206. /*----------------------------------------------------------------------*/
  207. /*
  208. * I2C GPIO expanders
  209. */
  210. #define PCF_Uxx_BASE(x) (DAVINCI_N_GPIO + ((x) * 8))
  211. /* U2 -- LEDs */
  212. static struct gpio_led evm_leds[] = {
  213. { .name = "DS8", .active_low = 1,
  214. .default_trigger = "heartbeat", },
  215. { .name = "DS7", .active_low = 1, },
  216. { .name = "DS6", .active_low = 1, },
  217. { .name = "DS5", .active_low = 1, },
  218. { .name = "DS4", .active_low = 1, },
  219. { .name = "DS3", .active_low = 1, },
  220. { .name = "DS2", .active_low = 1,
  221. .default_trigger = "mmc0", },
  222. { .name = "DS1", .active_low = 1,
  223. .default_trigger = "ide-disk", },
  224. };
  225. static const struct gpio_led_platform_data evm_led_data = {
  226. .num_leds = ARRAY_SIZE(evm_leds),
  227. .leds = evm_leds,
  228. };
  229. static struct platform_device *evm_led_dev;
  230. static int
  231. evm_led_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
  232. {
  233. struct gpio_led *leds = evm_leds;
  234. int status;
  235. while (ngpio--) {
  236. leds->gpio = gpio++;
  237. leds++;
  238. }
  239. /* what an extremely annoying way to be forced to handle
  240. * device unregistration ...
  241. */
  242. evm_led_dev = platform_device_alloc("leds-gpio", 0);
  243. platform_device_add_data(evm_led_dev,
  244. &evm_led_data, sizeof evm_led_data);
  245. evm_led_dev->dev.parent = &client->dev;
  246. status = platform_device_add(evm_led_dev);
  247. if (status < 0) {
  248. platform_device_put(evm_led_dev);
  249. evm_led_dev = NULL;
  250. }
  251. return status;
  252. }
  253. static int
  254. evm_led_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
  255. {
  256. if (evm_led_dev) {
  257. platform_device_unregister(evm_led_dev);
  258. evm_led_dev = NULL;
  259. }
  260. return 0;
  261. }
  262. static struct pcf857x_platform_data pcf_data_u2 = {
  263. .gpio_base = PCF_Uxx_BASE(0),
  264. .setup = evm_led_setup,
  265. .teardown = evm_led_teardown,
  266. };
  267. /* U18 - A/V clock generator and user switch */
  268. static int sw_gpio;
  269. static ssize_t
  270. sw_show(struct device *d, struct device_attribute *a, char *buf)
  271. {
  272. char *s = gpio_get_value_cansleep(sw_gpio) ? "on\n" : "off\n";
  273. strcpy(buf, s);
  274. return strlen(s);
  275. }
  276. static DEVICE_ATTR(user_sw, S_IRUGO, sw_show, NULL);
  277. static int
  278. evm_u18_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
  279. {
  280. int status;
  281. /* export dip switch option */
  282. sw_gpio = gpio + 7;
  283. status = gpio_request(sw_gpio, "user_sw");
  284. if (status == 0)
  285. status = gpio_direction_input(sw_gpio);
  286. if (status == 0)
  287. status = device_create_file(&client->dev, &dev_attr_user_sw);
  288. else
  289. gpio_free(sw_gpio);
  290. if (status != 0)
  291. sw_gpio = -EINVAL;
  292. /* audio PLL: 48 kHz (vs 44.1 or 32), single rate (vs double) */
  293. gpio_request(gpio + 3, "pll_fs2");
  294. gpio_direction_output(gpio + 3, 0);
  295. gpio_request(gpio + 2, "pll_fs1");
  296. gpio_direction_output(gpio + 2, 0);
  297. gpio_request(gpio + 1, "pll_sr");
  298. gpio_direction_output(gpio + 1, 0);
  299. return 0;
  300. }
  301. static int
  302. evm_u18_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
  303. {
  304. gpio_free(gpio + 1);
  305. gpio_free(gpio + 2);
  306. gpio_free(gpio + 3);
  307. if (sw_gpio > 0) {
  308. device_remove_file(&client->dev, &dev_attr_user_sw);
  309. gpio_free(sw_gpio);
  310. }
  311. return 0;
  312. }
  313. static struct pcf857x_platform_data pcf_data_u18 = {
  314. .gpio_base = PCF_Uxx_BASE(1),
  315. .n_latch = (1 << 3) | (1 << 2) | (1 << 1),
  316. .setup = evm_u18_setup,
  317. .teardown = evm_u18_teardown,
  318. };
  319. /* U35 - various I/O signals used to manage USB, CF, ATA, etc */
  320. static int
  321. evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
  322. {
  323. /* p0 = nDRV_VBUS (initial: don't supply it) */
  324. gpio_request(gpio + 0, "nDRV_VBUS");
  325. gpio_direction_output(gpio + 0, 1);
  326. /* p1 = VDDIMX_EN */
  327. gpio_request(gpio + 1, "VDDIMX_EN");
  328. gpio_direction_output(gpio + 1, 1);
  329. /* p2 = VLYNQ_EN */
  330. gpio_request(gpio + 2, "VLYNQ_EN");
  331. gpio_direction_output(gpio + 2, 1);
  332. /* p3 = n3V3_CF_RESET (initial: stay in reset) */
  333. gpio_request(gpio + 3, "nCF_RESET");
  334. gpio_direction_output(gpio + 3, 0);
  335. /* (p4 unused) */
  336. /* p5 = 1V8_WLAN_RESET (initial: stay in reset) */
  337. gpio_request(gpio + 5, "WLAN_RESET");
  338. gpio_direction_output(gpio + 5, 1);
  339. /* p6 = nATA_SEL (initial: select) */
  340. gpio_request(gpio + 6, "nATA_SEL");
  341. gpio_direction_output(gpio + 6, 0);
  342. /* p7 = nCF_SEL (initial: deselect) */
  343. gpio_request(gpio + 7, "nCF_SEL");
  344. gpio_direction_output(gpio + 7, 1);
  345. /* irlml6401 switches over 1A, in under 8 msec;
  346. * now it can be managed by nDRV_VBUS ...
  347. */
  348. setup_usb(500, 8);
  349. return 0;
  350. }
  351. static int
  352. evm_u35_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
  353. {
  354. gpio_free(gpio + 7);
  355. gpio_free(gpio + 6);
  356. gpio_free(gpio + 5);
  357. gpio_free(gpio + 3);
  358. gpio_free(gpio + 2);
  359. gpio_free(gpio + 1);
  360. gpio_free(gpio + 0);
  361. return 0;
  362. }
  363. static struct pcf857x_platform_data pcf_data_u35 = {
  364. .gpio_base = PCF_Uxx_BASE(2),
  365. .setup = evm_u35_setup,
  366. .teardown = evm_u35_teardown,
  367. };
  368. /*----------------------------------------------------------------------*/
  369. /* Most of this EEPROM is unused, but U-Boot uses some data:
  370. * - 0x7f00, 6 bytes Ethernet Address
  371. * - 0x0039, 1 byte NTSC vs PAL (bit 0x80 == PAL)
  372. * - ... newer boards may have more
  373. */
  374. static struct at24_platform_data eeprom_info = {
  375. .byte_len = (256*1024) / 8,
  376. .page_size = 64,
  377. .flags = AT24_FLAG_ADDR16,
  378. .setup = davinci_get_mac_addr,
  379. .context = (void *)0x7f00,
  380. };
  381. /*
  382. * MSP430 supports RTC, card detection, input from IR remote, and
  383. * a bit more. It triggers interrupts on GPIO(7) from pressing
  384. * buttons on the IR remote, and for card detect switches.
  385. */
  386. static struct i2c_client *dm6446evm_msp;
  387. static int dm6446evm_msp_probe(struct i2c_client *client,
  388. const struct i2c_device_id *id)
  389. {
  390. dm6446evm_msp = client;
  391. return 0;
  392. }
  393. static int dm6446evm_msp_remove(struct i2c_client *client)
  394. {
  395. dm6446evm_msp = NULL;
  396. return 0;
  397. }
  398. static const struct i2c_device_id dm6446evm_msp_ids[] = {
  399. { "dm6446evm_msp", 0, },
  400. { /* end of list */ },
  401. };
  402. static struct i2c_driver dm6446evm_msp_driver = {
  403. .driver.name = "dm6446evm_msp",
  404. .id_table = dm6446evm_msp_ids,
  405. .probe = dm6446evm_msp_probe,
  406. .remove = dm6446evm_msp_remove,
  407. };
  408. static int dm6444evm_msp430_get_pins(void)
  409. {
  410. static const char txbuf[2] = { 2, 4, };
  411. char buf[4];
  412. struct i2c_msg msg[2] = {
  413. {
  414. .addr = dm6446evm_msp->addr,
  415. .flags = 0,
  416. .len = 2,
  417. .buf = (void __force *)txbuf,
  418. },
  419. {
  420. .addr = dm6446evm_msp->addr,
  421. .flags = I2C_M_RD,
  422. .len = 4,
  423. .buf = buf,
  424. },
  425. };
  426. int status;
  427. if (!dm6446evm_msp)
  428. return -ENXIO;
  429. /* Command 4 == get input state, returns port 2 and port3 data
  430. * S Addr W [A] len=2 [A] cmd=4 [A]
  431. * RS Addr R [A] [len=4] A [cmd=4] A [port2] A [port3] N P
  432. */
  433. status = i2c_transfer(dm6446evm_msp->adapter, msg, 2);
  434. if (status < 0)
  435. return status;
  436. dev_dbg(&dm6446evm_msp->dev,
  437. "PINS: %02x %02x %02x %02x\n",
  438. buf[0], buf[1], buf[2], buf[3]);
  439. return (buf[3] << 8) | buf[2];
  440. }
  441. static int dm6444evm_mmc_get_cd(int module)
  442. {
  443. int status = dm6444evm_msp430_get_pins();
  444. return (status < 0) ? status : !(status & BIT(1));
  445. }
  446. static int dm6444evm_mmc_get_ro(int module)
  447. {
  448. int status = dm6444evm_msp430_get_pins();
  449. return (status < 0) ? status : status & BIT(6 + 8);
  450. }
  451. static struct davinci_mmc_config dm6446evm_mmc_config = {
  452. .get_cd = dm6444evm_mmc_get_cd,
  453. .get_ro = dm6444evm_mmc_get_ro,
  454. .wires = 4,
  455. .version = MMC_CTLR_VERSION_1
  456. };
  457. static struct i2c_board_info __initdata i2c_info[] = {
  458. {
  459. I2C_BOARD_INFO("dm6446evm_msp", 0x23),
  460. },
  461. {
  462. I2C_BOARD_INFO("pcf8574", 0x38),
  463. .platform_data = &pcf_data_u2,
  464. },
  465. {
  466. I2C_BOARD_INFO("pcf8574", 0x39),
  467. .platform_data = &pcf_data_u18,
  468. },
  469. {
  470. I2C_BOARD_INFO("pcf8574", 0x3a),
  471. .platform_data = &pcf_data_u35,
  472. },
  473. {
  474. I2C_BOARD_INFO("24c256", 0x50),
  475. .platform_data = &eeprom_info,
  476. },
  477. /* ALSO:
  478. * - tvl320aic33 audio codec (0x1b)
  479. * - tvp5146 video decoder (0x5d)
  480. */
  481. };
  482. /* The msp430 uses a slow bitbanged I2C implementation (ergo 20 KHz),
  483. * which requires 100 usec of idle bus after i2c writes sent to it.
  484. */
  485. static struct davinci_i2c_platform_data i2c_pdata = {
  486. .bus_freq = 20 /* kHz */,
  487. .bus_delay = 100 /* usec */,
  488. };
  489. static void __init evm_init_i2c(void)
  490. {
  491. davinci_init_i2c(&i2c_pdata);
  492. i2c_add_driver(&dm6446evm_msp_driver);
  493. i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
  494. }
  495. static struct platform_device *davinci_evm_devices[] __initdata = {
  496. &davinci_fb_device,
  497. &rtc_dev,
  498. };
  499. static struct davinci_uart_config uart_config __initdata = {
  500. .enabled_uarts = (1 << 0),
  501. };
  502. static void __init
  503. davinci_evm_map_io(void)
  504. {
  505. dm644x_init();
  506. }
  507. static int davinci_phy_fixup(struct phy_device *phydev)
  508. {
  509. unsigned int control;
  510. /* CRITICAL: Fix for increasing PHY signal drive strength for
  511. * TX lockup issue. On DaVinci EVM, the Intel LXT971 PHY
  512. * signal strength was low causing TX to fail randomly. The
  513. * fix is to Set bit 11 (Increased MII drive strength) of PHY
  514. * register 26 (Digital Config register) on this phy. */
  515. control = phy_read(phydev, 26);
  516. phy_write(phydev, 26, (control | 0x800));
  517. return 0;
  518. }
  519. #if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
  520. defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
  521. #define HAS_ATA 1
  522. #else
  523. #define HAS_ATA 0
  524. #endif
  525. #if defined(CONFIG_MTD_PHYSMAP) || \
  526. defined(CONFIG_MTD_PHYSMAP_MODULE)
  527. #define HAS_NOR 1
  528. #else
  529. #define HAS_NOR 0
  530. #endif
  531. #if defined(CONFIG_MTD_NAND_DAVINCI) || \
  532. defined(CONFIG_MTD_NAND_DAVINCI_MODULE)
  533. #define HAS_NAND 1
  534. #else
  535. #define HAS_NAND 0
  536. #endif
  537. static __init void davinci_evm_init(void)
  538. {
  539. struct clk *aemif_clk;
  540. struct davinci_soc_info *soc_info = &davinci_soc_info;
  541. aemif_clk = clk_get(NULL, "aemif");
  542. clk_enable(aemif_clk);
  543. if (HAS_ATA) {
  544. if (HAS_NAND || HAS_NOR)
  545. pr_warning("WARNING: both IDE and Flash are "
  546. "enabled, but they share AEMIF pins.\n"
  547. "\tDisable IDE for NAND/NOR support.\n");
  548. davinci_cfg_reg(DM644X_HPIEN_DISABLE);
  549. davinci_cfg_reg(DM644X_ATAEN);
  550. davinci_cfg_reg(DM644X_HDIREN);
  551. platform_device_register(&ide_dev);
  552. } else if (HAS_NAND || HAS_NOR) {
  553. davinci_cfg_reg(DM644X_HPIEN_DISABLE);
  554. davinci_cfg_reg(DM644X_ATAEN_DISABLE);
  555. /* only one device will be jumpered and detected */
  556. if (HAS_NAND) {
  557. platform_device_register(&davinci_evm_nandflash_device);
  558. evm_leds[7].default_trigger = "nand-disk";
  559. if (HAS_NOR)
  560. pr_warning("WARNING: both NAND and NOR flash "
  561. "are enabled; disable one of them.\n");
  562. } else if (HAS_NOR)
  563. platform_device_register(&davinci_evm_norflash_device);
  564. }
  565. platform_add_devices(davinci_evm_devices,
  566. ARRAY_SIZE(davinci_evm_devices));
  567. evm_init_i2c();
  568. davinci_setup_mmc(0, &dm6446evm_mmc_config);
  569. davinci_serial_init(&uart_config);
  570. soc_info->emac_pdata->phy_mask = DM644X_EVM_PHY_MASK;
  571. soc_info->emac_pdata->mdio_max_freq = DM644X_EVM_MDIO_FREQUENCY;
  572. /* Register the fixup for PHY on DaVinci */
  573. phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK,
  574. davinci_phy_fixup);
  575. }
  576. static __init void davinci_evm_irq_init(void)
  577. {
  578. davinci_irq_init();
  579. }
  580. MACHINE_START(DAVINCI_EVM, "DaVinci DM644x EVM")
  581. /* Maintainer: MontaVista Software <source@mvista.com> */
  582. .phys_io = IO_PHYS,
  583. .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
  584. .boot_params = (DAVINCI_DDR_BASE + 0x100),
  585. .map_io = davinci_evm_map_io,
  586. .init_irq = davinci_evm_irq_init,
  587. .timer = &davinci_timer,
  588. .init_machine = davinci_evm_init,
  589. MACHINE_END