board-dm644x-evm.c 17 KB

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