cm_bf527.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  1. /*
  2. * File: arch/blackfin/mach-bf527/boards/cm-bf527.c
  3. * Based on: arch/blackfin/mach-bf537/boards/stamp.c
  4. * Author: Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Created:
  7. * Description:
  8. *
  9. * Modified:
  10. * Copyright 2005 National ICT Australia (NICTA)
  11. * Copyright 2004-2008 Analog Devices Inc.
  12. *
  13. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, see the file COPYING, or write
  27. * to the Free Software Foundation, Inc.,
  28. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  29. */
  30. #include <linux/device.h>
  31. #include <linux/platform_device.h>
  32. #include <linux/mtd/mtd.h>
  33. #include <linux/mtd/partitions.h>
  34. #include <linux/mtd/physmap.h>
  35. #include <linux/spi/spi.h>
  36. #include <linux/spi/flash.h>
  37. #include <linux/etherdevice.h>
  38. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  39. #include <linux/usb/isp1362.h>
  40. #endif
  41. #include <linux/i2c.h>
  42. #include <linux/irq.h>
  43. #include <linux/interrupt.h>
  44. #include <linux/usb/sl811.h>
  45. #include <linux/usb/musb.h>
  46. #include <asm/dma.h>
  47. #include <asm/bfin5xx_spi.h>
  48. #include <asm/reboot.h>
  49. #include <asm/nand.h>
  50. #include <asm/portmux.h>
  51. #include <asm/dpmc.h>
  52. #include <linux/spi/ad7877.h>
  53. /*
  54. * Name the Board for the /proc/cpuinfo
  55. */
  56. const char bfin_board_name[] = "Bluetechnix CM-BF527";
  57. /*
  58. * Driver needs to know address, irq and flag pin.
  59. */
  60. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  61. #include <linux/usb/isp1760.h>
  62. static struct resource bfin_isp1760_resources[] = {
  63. [0] = {
  64. .start = 0x203C0000,
  65. .end = 0x203C0000 + 0x000fffff,
  66. .flags = IORESOURCE_MEM,
  67. },
  68. [1] = {
  69. .start = IRQ_PF7,
  70. .end = IRQ_PF7,
  71. .flags = IORESOURCE_IRQ,
  72. },
  73. };
  74. static struct isp1760_platform_data isp1760_priv = {
  75. .is_isp1761 = 0,
  76. .bus_width_16 = 1,
  77. .port1_otg = 0,
  78. .analog_oc = 0,
  79. .dack_polarity_high = 0,
  80. .dreq_polarity_high = 0,
  81. };
  82. static struct platform_device bfin_isp1760_device = {
  83. .name = "isp1760-hcd",
  84. .id = 0,
  85. .dev = {
  86. .platform_data = &isp1760_priv,
  87. },
  88. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  89. .resource = bfin_isp1760_resources,
  90. };
  91. #endif
  92. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  93. static struct resource musb_resources[] = {
  94. [0] = {
  95. .start = 0xffc03800,
  96. .end = 0xffc03cff,
  97. .flags = IORESOURCE_MEM,
  98. },
  99. [1] = { /* general IRQ */
  100. .start = IRQ_USB_INT0,
  101. .end = IRQ_USB_INT0,
  102. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  103. },
  104. [2] = { /* DMA IRQ */
  105. .start = IRQ_USB_DMA,
  106. .end = IRQ_USB_DMA,
  107. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  108. },
  109. };
  110. static struct musb_hdrc_config musb_config = {
  111. .multipoint = 0,
  112. .dyn_fifo = 0,
  113. .soft_con = 1,
  114. .dma = 1,
  115. .num_eps = 8,
  116. .dma_channels = 8,
  117. .gpio_vrsel = GPIO_PF11,
  118. };
  119. static struct musb_hdrc_platform_data musb_plat = {
  120. #if defined(CONFIG_USB_MUSB_OTG)
  121. .mode = MUSB_OTG,
  122. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  123. .mode = MUSB_HOST,
  124. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  125. .mode = MUSB_PERIPHERAL,
  126. #endif
  127. .config = &musb_config,
  128. };
  129. static u64 musb_dmamask = ~(u32)0;
  130. static struct platform_device musb_device = {
  131. .name = "musb_hdrc",
  132. .id = 0,
  133. .dev = {
  134. .dma_mask = &musb_dmamask,
  135. .coherent_dma_mask = 0xffffffff,
  136. .platform_data = &musb_plat,
  137. },
  138. .num_resources = ARRAY_SIZE(musb_resources),
  139. .resource = musb_resources,
  140. };
  141. #endif
  142. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  143. static struct mtd_partition partition_info[] = {
  144. {
  145. .name = "linux kernel(nand)",
  146. .offset = 0,
  147. .size = 4 * 1024 * 1024,
  148. },
  149. {
  150. .name = "file system(nand)",
  151. .offset = MTDPART_OFS_APPEND,
  152. .size = MTDPART_SIZ_FULL,
  153. },
  154. };
  155. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  156. .page_size = NFC_PG_SIZE_256,
  157. .data_width = NFC_NWIDTH_8,
  158. .partitions = partition_info,
  159. .nr_partitions = ARRAY_SIZE(partition_info),
  160. .rd_dly = 3,
  161. .wr_dly = 3,
  162. };
  163. static struct resource bf5xx_nand_resources[] = {
  164. {
  165. .start = NFC_CTL,
  166. .end = NFC_DATA_RD + 2,
  167. .flags = IORESOURCE_MEM,
  168. },
  169. {
  170. .start = CH_NFC,
  171. .end = CH_NFC,
  172. .flags = IORESOURCE_IRQ,
  173. },
  174. };
  175. static struct platform_device bf5xx_nand_device = {
  176. .name = "bf5xx-nand",
  177. .id = 0,
  178. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  179. .resource = bf5xx_nand_resources,
  180. .dev = {
  181. .platform_data = &bf5xx_nand_platform,
  182. },
  183. };
  184. #endif
  185. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  186. static struct resource bfin_pcmcia_cf_resources[] = {
  187. {
  188. .start = 0x20310000, /* IO PORT */
  189. .end = 0x20312000,
  190. .flags = IORESOURCE_MEM,
  191. }, {
  192. .start = 0x20311000, /* Attribute Memory */
  193. .end = 0x20311FFF,
  194. .flags = IORESOURCE_MEM,
  195. }, {
  196. .start = IRQ_PF4,
  197. .end = IRQ_PF4,
  198. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  199. }, {
  200. .start = 6, /* Card Detect PF6 */
  201. .end = 6,
  202. .flags = IORESOURCE_IRQ,
  203. },
  204. };
  205. static struct platform_device bfin_pcmcia_cf_device = {
  206. .name = "bfin_cf_pcmcia",
  207. .id = -1,
  208. .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
  209. .resource = bfin_pcmcia_cf_resources,
  210. };
  211. #endif
  212. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  213. static struct platform_device rtc_device = {
  214. .name = "rtc-bfin",
  215. .id = -1,
  216. };
  217. #endif
  218. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  219. #include <linux/smc91x.h>
  220. static struct smc91x_platdata smc91x_info = {
  221. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  222. .leda = RPC_LED_100_10,
  223. .ledb = RPC_LED_TX_RX,
  224. };
  225. static struct resource smc91x_resources[] = {
  226. {
  227. .name = "smc91x-regs",
  228. .start = 0x20300300,
  229. .end = 0x20300300 + 16,
  230. .flags = IORESOURCE_MEM,
  231. }, {
  232. .start = IRQ_PF7,
  233. .end = IRQ_PF7,
  234. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  235. },
  236. };
  237. static struct platform_device smc91x_device = {
  238. .name = "smc91x",
  239. .id = 0,
  240. .num_resources = ARRAY_SIZE(smc91x_resources),
  241. .resource = smc91x_resources,
  242. .dev = {
  243. .platform_data = &smc91x_info,
  244. },
  245. };
  246. #endif
  247. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  248. static struct resource dm9000_resources[] = {
  249. [0] = {
  250. .start = 0x203FB800,
  251. .end = 0x203FB800 + 1,
  252. .flags = IORESOURCE_MEM,
  253. },
  254. [1] = {
  255. .start = 0x203FB804,
  256. .end = 0x203FB804 + 1,
  257. .flags = IORESOURCE_MEM,
  258. },
  259. [2] = {
  260. .start = IRQ_PF9,
  261. .end = IRQ_PF9,
  262. .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
  263. },
  264. };
  265. static struct platform_device dm9000_device = {
  266. .name = "dm9000",
  267. .id = -1,
  268. .num_resources = ARRAY_SIZE(dm9000_resources),
  269. .resource = dm9000_resources,
  270. };
  271. #endif
  272. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  273. static struct resource sl811_hcd_resources[] = {
  274. {
  275. .start = 0x20340000,
  276. .end = 0x20340000,
  277. .flags = IORESOURCE_MEM,
  278. }, {
  279. .start = 0x20340004,
  280. .end = 0x20340004,
  281. .flags = IORESOURCE_MEM,
  282. }, {
  283. .start = CONFIG_USB_SL811_BFIN_IRQ,
  284. .end = CONFIG_USB_SL811_BFIN_IRQ,
  285. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  286. },
  287. };
  288. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  289. void sl811_port_power(struct device *dev, int is_on)
  290. {
  291. gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
  292. gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
  293. }
  294. #endif
  295. static struct sl811_platform_data sl811_priv = {
  296. .potpg = 10,
  297. .power = 250, /* == 500mA */
  298. #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
  299. .port_power = &sl811_port_power,
  300. #endif
  301. };
  302. static struct platform_device sl811_hcd_device = {
  303. .name = "sl811-hcd",
  304. .id = 0,
  305. .dev = {
  306. .platform_data = &sl811_priv,
  307. },
  308. .num_resources = ARRAY_SIZE(sl811_hcd_resources),
  309. .resource = sl811_hcd_resources,
  310. };
  311. #endif
  312. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  313. static struct resource isp1362_hcd_resources[] = {
  314. {
  315. .start = 0x20360000,
  316. .end = 0x20360000,
  317. .flags = IORESOURCE_MEM,
  318. }, {
  319. .start = 0x20360004,
  320. .end = 0x20360004,
  321. .flags = IORESOURCE_MEM,
  322. }, {
  323. .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  324. .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
  325. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  326. },
  327. };
  328. static struct isp1362_platform_data isp1362_priv = {
  329. .sel15Kres = 1,
  330. .clknotstop = 0,
  331. .oc_enable = 0,
  332. .int_act_high = 0,
  333. .int_edge_triggered = 0,
  334. .remote_wakeup_connected = 0,
  335. .no_power_switching = 1,
  336. .power_switching_mode = 0,
  337. };
  338. static struct platform_device isp1362_hcd_device = {
  339. .name = "isp1362-hcd",
  340. .id = 0,
  341. .dev = {
  342. .platform_data = &isp1362_priv,
  343. },
  344. .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
  345. .resource = isp1362_hcd_resources,
  346. };
  347. #endif
  348. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  349. static struct platform_device bfin_mii_bus = {
  350. .name = "bfin_mii_bus",
  351. };
  352. static struct platform_device bfin_mac_device = {
  353. .name = "bfin_mac",
  354. .dev.platform_data = &bfin_mii_bus,
  355. };
  356. #endif
  357. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  358. static struct resource net2272_bfin_resources[] = {
  359. {
  360. .start = 0x20300000,
  361. .end = 0x20300000 + 0x100,
  362. .flags = IORESOURCE_MEM,
  363. }, {
  364. .start = IRQ_PF7,
  365. .end = IRQ_PF7,
  366. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  367. },
  368. };
  369. static struct platform_device net2272_bfin_device = {
  370. .name = "net2272",
  371. .id = -1,
  372. .num_resources = ARRAY_SIZE(net2272_bfin_resources),
  373. .resource = net2272_bfin_resources,
  374. };
  375. #endif
  376. #if defined(CONFIG_MTD_M25P80) \
  377. || defined(CONFIG_MTD_M25P80_MODULE)
  378. static struct mtd_partition bfin_spi_flash_partitions[] = {
  379. {
  380. .name = "bootloader(spi)",
  381. .size = 0x00040000,
  382. .offset = 0,
  383. .mask_flags = MTD_CAP_ROM
  384. }, {
  385. .name = "linux kernel(spi)",
  386. .size = MTDPART_SIZ_FULL,
  387. .offset = MTDPART_OFS_APPEND,
  388. }
  389. };
  390. static struct flash_platform_data bfin_spi_flash_data = {
  391. .name = "m25p80",
  392. .parts = bfin_spi_flash_partitions,
  393. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  394. .type = "m25p16",
  395. };
  396. /* SPI flash chip (m25p64) */
  397. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  398. .enable_dma = 0, /* use dma transfer with this chip*/
  399. .bits_per_word = 8,
  400. };
  401. #endif
  402. #if defined(CONFIG_BFIN_SPI_ADC) \
  403. || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  404. /* SPI ADC chip */
  405. static struct bfin5xx_spi_chip spi_adc_chip_info = {
  406. .enable_dma = 1, /* use dma transfer with this chip*/
  407. .bits_per_word = 16,
  408. };
  409. #endif
  410. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  411. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  412. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  413. .enable_dma = 0,
  414. .bits_per_word = 16,
  415. };
  416. #endif
  417. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  418. static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  419. .enable_dma = 0,
  420. .bits_per_word = 8,
  421. };
  422. #endif
  423. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  424. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  425. .enable_dma = 0,
  426. .bits_per_word = 16,
  427. };
  428. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  429. .model = 7877,
  430. .vref_delay_usecs = 50, /* internal, no capacitor */
  431. .x_plate_ohms = 419,
  432. .y_plate_ohms = 486,
  433. .pressure_max = 1000,
  434. .pressure_min = 0,
  435. .stopacq_polarity = 1,
  436. .first_conversion_delay = 3,
  437. .acquisition_time = 1,
  438. .averaging = 1,
  439. .pen_down_acc_interval = 1,
  440. };
  441. #endif
  442. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  443. && defined(CONFIG_SND_SOC_WM8731_SPI)
  444. static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
  445. .enable_dma = 0,
  446. .bits_per_word = 16,
  447. };
  448. #endif
  449. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  450. static struct bfin5xx_spi_chip spidev_chip_info = {
  451. .enable_dma = 0,
  452. .bits_per_word = 8,
  453. };
  454. #endif
  455. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  456. #if defined(CONFIG_MTD_M25P80) \
  457. || defined(CONFIG_MTD_M25P80_MODULE)
  458. {
  459. /* the modalias must be the same as spi device driver name */
  460. .modalias = "m25p80", /* Name of spi_driver for this device */
  461. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  462. .bus_num = 0, /* Framework bus number */
  463. .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  464. .platform_data = &bfin_spi_flash_data,
  465. .controller_data = &spi_flash_chip_info,
  466. .mode = SPI_MODE_3,
  467. },
  468. #endif
  469. #if defined(CONFIG_BFIN_SPI_ADC) \
  470. || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  471. {
  472. .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
  473. .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
  474. .bus_num = 0, /* Framework bus number */
  475. .chip_select = 1, /* Framework chip select. */
  476. .platform_data = NULL, /* No spi_driver specific config */
  477. .controller_data = &spi_adc_chip_info,
  478. },
  479. #endif
  480. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  481. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  482. {
  483. .modalias = "ad1836",
  484. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  485. .bus_num = 0,
  486. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  487. .controller_data = &ad1836_spi_chip_info,
  488. },
  489. #endif
  490. #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  491. {
  492. .modalias = "mmc_spi",
  493. .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
  494. .bus_num = 0,
  495. .chip_select = 5,
  496. .controller_data = &mmc_spi_chip_info,
  497. .mode = SPI_MODE_3,
  498. },
  499. #endif
  500. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  501. {
  502. .modalias = "ad7877",
  503. .platform_data = &bfin_ad7877_ts_info,
  504. .irq = IRQ_PF8,
  505. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  506. .bus_num = 0,
  507. .chip_select = 2,
  508. .controller_data = &spi_ad7877_chip_info,
  509. },
  510. #endif
  511. #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
  512. && defined(CONFIG_SND_SOC_WM8731_SPI)
  513. {
  514. .modalias = "wm8731",
  515. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  516. .bus_num = 0,
  517. .chip_select = 5,
  518. .controller_data = &spi_wm8731_chip_info,
  519. .mode = SPI_MODE_0,
  520. },
  521. #endif
  522. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  523. {
  524. .modalias = "spidev",
  525. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  526. .bus_num = 0,
  527. .chip_select = 1,
  528. .controller_data = &spidev_chip_info,
  529. },
  530. #endif
  531. };
  532. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  533. /* SPI controller data */
  534. static struct bfin5xx_spi_master bfin_spi0_info = {
  535. .num_chipselect = 8,
  536. .enable_dma = 1, /* master has the ability to do dma transfer */
  537. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  538. };
  539. /* SPI (0) */
  540. static struct resource bfin_spi0_resource[] = {
  541. [0] = {
  542. .start = SPI0_REGBASE,
  543. .end = SPI0_REGBASE + 0xFF,
  544. .flags = IORESOURCE_MEM,
  545. },
  546. [1] = {
  547. .start = CH_SPI,
  548. .end = CH_SPI,
  549. .flags = IORESOURCE_DMA,
  550. },
  551. [2] = {
  552. .start = IRQ_SPI,
  553. .end = IRQ_SPI,
  554. .flags = IORESOURCE_IRQ,
  555. },
  556. };
  557. static struct platform_device bfin_spi0_device = {
  558. .name = "bfin-spi",
  559. .id = 0, /* Bus number */
  560. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  561. .resource = bfin_spi0_resource,
  562. .dev = {
  563. .platform_data = &bfin_spi0_info, /* Passed to driver */
  564. },
  565. };
  566. #endif /* spi master and devices */
  567. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  568. static struct platform_device bfin_fb_adv7393_device = {
  569. .name = "bfin-adv7393",
  570. };
  571. #endif
  572. #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
  573. static struct mtd_partition cm_partitions[] = {
  574. {
  575. .name = "bootloader(nor)",
  576. .size = 0x40000,
  577. .offset = 0,
  578. }, {
  579. .name = "linux kernel(nor)",
  580. .size = 0x100000,
  581. .offset = MTDPART_OFS_APPEND,
  582. }, {
  583. .name = "file system(nor)",
  584. .size = MTDPART_SIZ_FULL,
  585. .offset = MTDPART_OFS_APPEND,
  586. }
  587. };
  588. static struct physmap_flash_data cm_flash_data = {
  589. .width = 2,
  590. .parts = cm_partitions,
  591. .nr_parts = ARRAY_SIZE(cm_partitions),
  592. };
  593. static unsigned cm_flash_gpios[] = { GPIO_PH9, GPIO_PG11 };
  594. static struct resource cm_flash_resource[] = {
  595. {
  596. .name = "cfi_probe",
  597. .start = 0x20000000,
  598. .end = 0x201fffff,
  599. .flags = IORESOURCE_MEM,
  600. }, {
  601. .start = (unsigned long)cm_flash_gpios,
  602. .end = ARRAY_SIZE(cm_flash_gpios),
  603. .flags = IORESOURCE_IRQ,
  604. }
  605. };
  606. static struct platform_device cm_flash_device = {
  607. .name = "gpio-addr-flash",
  608. .id = 0,
  609. .dev = {
  610. .platform_data = &cm_flash_data,
  611. },
  612. .num_resources = ARRAY_SIZE(cm_flash_resource),
  613. .resource = cm_flash_resource,
  614. };
  615. #endif
  616. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  617. static struct resource bfin_uart_resources[] = {
  618. #ifdef CONFIG_SERIAL_BFIN_UART0
  619. {
  620. .start = 0xFFC00400,
  621. .end = 0xFFC004FF,
  622. .flags = IORESOURCE_MEM,
  623. },
  624. #endif
  625. #ifdef CONFIG_SERIAL_BFIN_UART1
  626. {
  627. .start = 0xFFC02000,
  628. .end = 0xFFC020FF,
  629. .flags = IORESOURCE_MEM,
  630. },
  631. #endif
  632. };
  633. static struct platform_device bfin_uart_device = {
  634. .name = "bfin-uart",
  635. .id = 1,
  636. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  637. .resource = bfin_uart_resources,
  638. };
  639. #endif
  640. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  641. #ifdef CONFIG_BFIN_SIR0
  642. static struct resource bfin_sir0_resources[] = {
  643. {
  644. .start = 0xFFC00400,
  645. .end = 0xFFC004FF,
  646. .flags = IORESOURCE_MEM,
  647. },
  648. {
  649. .start = IRQ_UART0_RX,
  650. .end = IRQ_UART0_RX+1,
  651. .flags = IORESOURCE_IRQ,
  652. },
  653. {
  654. .start = CH_UART0_RX,
  655. .end = CH_UART0_RX+1,
  656. .flags = IORESOURCE_DMA,
  657. },
  658. };
  659. static struct platform_device bfin_sir0_device = {
  660. .name = "bfin_sir",
  661. .id = 0,
  662. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  663. .resource = bfin_sir0_resources,
  664. };
  665. #endif
  666. #ifdef CONFIG_BFIN_SIR1
  667. static struct resource bfin_sir1_resources[] = {
  668. {
  669. .start = 0xFFC02000,
  670. .end = 0xFFC020FF,
  671. .flags = IORESOURCE_MEM,
  672. },
  673. {
  674. .start = IRQ_UART1_RX,
  675. .end = IRQ_UART1_RX+1,
  676. .flags = IORESOURCE_IRQ,
  677. },
  678. {
  679. .start = CH_UART1_RX,
  680. .end = CH_UART1_RX+1,
  681. .flags = IORESOURCE_DMA,
  682. },
  683. };
  684. static struct platform_device bfin_sir1_device = {
  685. .name = "bfin_sir",
  686. .id = 1,
  687. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  688. .resource = bfin_sir1_resources,
  689. };
  690. #endif
  691. #endif
  692. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  693. static struct resource bfin_twi0_resource[] = {
  694. [0] = {
  695. .start = TWI0_REGBASE,
  696. .end = TWI0_REGBASE,
  697. .flags = IORESOURCE_MEM,
  698. },
  699. [1] = {
  700. .start = IRQ_TWI,
  701. .end = IRQ_TWI,
  702. .flags = IORESOURCE_IRQ,
  703. },
  704. };
  705. static struct platform_device i2c_bfin_twi_device = {
  706. .name = "i2c-bfin-twi",
  707. .id = 0,
  708. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  709. .resource = bfin_twi0_resource,
  710. };
  711. #endif
  712. static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
  713. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  714. {
  715. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  716. },
  717. #endif
  718. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  719. {
  720. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  721. .irq = IRQ_PF8,
  722. },
  723. #endif
  724. };
  725. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  726. static struct platform_device bfin_sport0_uart_device = {
  727. .name = "bfin-sport-uart",
  728. .id = 0,
  729. };
  730. static struct platform_device bfin_sport1_uart_device = {
  731. .name = "bfin-sport-uart",
  732. .id = 1,
  733. };
  734. #endif
  735. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  736. #include <linux/input.h>
  737. #include <linux/gpio_keys.h>
  738. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  739. {BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},
  740. };
  741. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  742. .buttons = bfin_gpio_keys_table,
  743. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  744. };
  745. static struct platform_device bfin_device_gpiokeys = {
  746. .name = "gpio-keys",
  747. .dev = {
  748. .platform_data = &bfin_gpio_keys_data,
  749. },
  750. };
  751. #endif
  752. static struct resource bfin_gpios_resources = {
  753. .start = 0,
  754. .end = MAX_BLACKFIN_GPIOS - 1,
  755. .flags = IORESOURCE_IRQ,
  756. };
  757. static struct platform_device bfin_gpios_device = {
  758. .name = "simple-gpio",
  759. .id = -1,
  760. .num_resources = 1,
  761. .resource = &bfin_gpios_resources,
  762. };
  763. static const unsigned int cclk_vlev_datasheet[] =
  764. {
  765. VRPAIR(VLEV_100, 400000000),
  766. VRPAIR(VLEV_105, 426000000),
  767. VRPAIR(VLEV_110, 500000000),
  768. VRPAIR(VLEV_115, 533000000),
  769. VRPAIR(VLEV_120, 600000000),
  770. };
  771. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  772. .tuple_tab = cclk_vlev_datasheet,
  773. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  774. .vr_settling_time = 25 /* us */,
  775. };
  776. static struct platform_device bfin_dpmc = {
  777. .name = "bfin dpmc",
  778. .dev = {
  779. .platform_data = &bfin_dmpc_vreg_data,
  780. },
  781. };
  782. static struct platform_device *cmbf527_devices[] __initdata = {
  783. &bfin_dpmc,
  784. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  785. &bf5xx_nand_device,
  786. #endif
  787. #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
  788. &bfin_pcmcia_cf_device,
  789. #endif
  790. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  791. &rtc_device,
  792. #endif
  793. #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
  794. &sl811_hcd_device,
  795. #endif
  796. #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  797. &isp1362_hcd_device,
  798. #endif
  799. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  800. &bfin_isp1760_device,
  801. #endif
  802. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  803. &musb_device,
  804. #endif
  805. #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
  806. &smc91x_device,
  807. #endif
  808. #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
  809. &dm9000_device,
  810. #endif
  811. #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
  812. &bfin_mii_bus,
  813. &bfin_mac_device,
  814. #endif
  815. #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
  816. &net2272_bfin_device,
  817. #endif
  818. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  819. &bfin_spi0_device,
  820. #endif
  821. #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
  822. &bfin_fb_adv7393_device,
  823. #endif
  824. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  825. &bfin_uart_device,
  826. #endif
  827. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  828. #ifdef CONFIG_BFIN_SIR0
  829. &bfin_sir0_device,
  830. #endif
  831. #ifdef CONFIG_BFIN_SIR1
  832. &bfin_sir1_device,
  833. #endif
  834. #endif
  835. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  836. &i2c_bfin_twi_device,
  837. #endif
  838. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  839. &bfin_sport0_uart_device,
  840. &bfin_sport1_uart_device,
  841. #endif
  842. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  843. &bfin_device_gpiokeys,
  844. #endif
  845. #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
  846. &cm_flash_device,
  847. #endif
  848. &bfin_gpios_device,
  849. };
  850. static int __init cm_init(void)
  851. {
  852. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  853. i2c_register_board_info(0, bfin_i2c_board_info,
  854. ARRAY_SIZE(bfin_i2c_board_info));
  855. platform_add_devices(cmbf527_devices, ARRAY_SIZE(cmbf527_devices));
  856. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  857. return 0;
  858. }
  859. arch_initcall(cm_init);
  860. void native_machine_restart(char *cmd)
  861. {
  862. /* workaround reboot hang when booting from SPI */
  863. if ((bfin_read_SYSCR() & 0x7) == 0x3)
  864. bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
  865. }
  866. void bfin_get_ether_addr(char *addr)
  867. {
  868. random_ether_addr(addr);
  869. printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
  870. }
  871. EXPORT_SYMBOL(bfin_get_ether_addr);