board-dm644x-evm.c 17 KB

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