board-dm644x-evm.c 17 KB

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