ezkit.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  1. /*
  2. * File: arch/blackfin/mach-bf548/boards/ezkit.c
  3. * Based on: arch/blackfin/mach-bf537/boards/ezkit.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-2007 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/irq.h>
  38. #include <linux/i2c.h>
  39. #include <linux/interrupt.h>
  40. #include <linux/usb/musb.h>
  41. #include <asm/bfin5xx_spi.h>
  42. #include <asm/dma.h>
  43. #include <asm/gpio.h>
  44. #include <asm/nand.h>
  45. #include <asm/dpmc.h>
  46. #include <asm/portmux.h>
  47. #include <asm/bfin_sdh.h>
  48. #include <mach/bf54x_keys.h>
  49. #include <linux/input.h>
  50. #include <linux/spi/ad7877.h>
  51. /*
  52. * Name the Board for the /proc/cpuinfo
  53. */
  54. const char bfin_board_name[] = "ADI BF548-EZKIT";
  55. /*
  56. * Driver needs to know address, irq and flag pin.
  57. */
  58. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  59. #include <linux/usb/isp1760.h>
  60. static struct resource bfin_isp1760_resources[] = {
  61. [0] = {
  62. .start = 0x2C0C0000,
  63. .end = 0x2C0C0000 + 0xfffff,
  64. .flags = IORESOURCE_MEM,
  65. },
  66. [1] = {
  67. .start = IRQ_PG7,
  68. .end = IRQ_PG7,
  69. .flags = IORESOURCE_IRQ,
  70. },
  71. };
  72. static struct isp1760_platform_data isp1760_priv = {
  73. .is_isp1761 = 0,
  74. .port1_disable = 0,
  75. .bus_width_16 = 1,
  76. .port1_otg = 0,
  77. .analog_oc = 0,
  78. .dack_polarity_high = 0,
  79. .dreq_polarity_high = 0,
  80. };
  81. static struct platform_device bfin_isp1760_device = {
  82. .name = "isp1760-hcd",
  83. .id = 0,
  84. .dev = {
  85. .platform_data = &isp1760_priv,
  86. },
  87. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  88. .resource = bfin_isp1760_resources,
  89. };
  90. #endif
  91. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  92. #include <mach/bf54x-lq043.h>
  93. static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
  94. .width = 480,
  95. .height = 272,
  96. .xres = {480, 480, 480},
  97. .yres = {272, 272, 272},
  98. .bpp = {24, 24, 24},
  99. .disp = GPIO_PE3,
  100. };
  101. static struct resource bf54x_lq043_resources[] = {
  102. {
  103. .start = IRQ_EPPI0_ERR,
  104. .end = IRQ_EPPI0_ERR,
  105. .flags = IORESOURCE_IRQ,
  106. },
  107. };
  108. static struct platform_device bf54x_lq043_device = {
  109. .name = "bf54x-lq043",
  110. .id = -1,
  111. .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
  112. .resource = bf54x_lq043_resources,
  113. .dev = {
  114. .platform_data = &bf54x_lq043_data,
  115. },
  116. };
  117. #endif
  118. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  119. static const unsigned int bf548_keymap[] = {
  120. KEYVAL(0, 0, KEY_ENTER),
  121. KEYVAL(0, 1, KEY_HELP),
  122. KEYVAL(0, 2, KEY_0),
  123. KEYVAL(0, 3, KEY_BACKSPACE),
  124. KEYVAL(1, 0, KEY_TAB),
  125. KEYVAL(1, 1, KEY_9),
  126. KEYVAL(1, 2, KEY_8),
  127. KEYVAL(1, 3, KEY_7),
  128. KEYVAL(2, 0, KEY_DOWN),
  129. KEYVAL(2, 1, KEY_6),
  130. KEYVAL(2, 2, KEY_5),
  131. KEYVAL(2, 3, KEY_4),
  132. KEYVAL(3, 0, KEY_UP),
  133. KEYVAL(3, 1, KEY_3),
  134. KEYVAL(3, 2, KEY_2),
  135. KEYVAL(3, 3, KEY_1),
  136. };
  137. static struct bfin_kpad_platform_data bf54x_kpad_data = {
  138. .rows = 4,
  139. .cols = 4,
  140. .keymap = bf548_keymap,
  141. .keymapsize = ARRAY_SIZE(bf548_keymap),
  142. .repeat = 0,
  143. .debounce_time = 5000, /* ns (5ms) */
  144. .coldrive_time = 1000, /* ns (1ms) */
  145. .keyup_test_interval = 50, /* ms (50ms) */
  146. };
  147. static struct resource bf54x_kpad_resources[] = {
  148. {
  149. .start = IRQ_KEY,
  150. .end = IRQ_KEY,
  151. .flags = IORESOURCE_IRQ,
  152. },
  153. };
  154. static struct platform_device bf54x_kpad_device = {
  155. .name = "bf54x-keys",
  156. .id = -1,
  157. .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
  158. .resource = bf54x_kpad_resources,
  159. .dev = {
  160. .platform_data = &bf54x_kpad_data,
  161. },
  162. };
  163. #endif
  164. #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
  165. #include <asm/bfin_rotary.h>
  166. static struct bfin_rotary_platform_data bfin_rotary_data = {
  167. /*.rotary_up_key = KEY_UP,*/
  168. /*.rotary_down_key = KEY_DOWN,*/
  169. .rotary_rel_code = REL_WHEEL,
  170. .rotary_button_key = KEY_ENTER,
  171. .debounce = 10, /* 0..17 */
  172. .mode = ROT_QUAD_ENC | ROT_DEBE,
  173. };
  174. static struct resource bfin_rotary_resources[] = {
  175. {
  176. .start = IRQ_CNT,
  177. .end = IRQ_CNT,
  178. .flags = IORESOURCE_IRQ,
  179. },
  180. };
  181. static struct platform_device bfin_rotary_device = {
  182. .name = "bfin-rotary",
  183. .id = -1,
  184. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  185. .resource = bfin_rotary_resources,
  186. .dev = {
  187. .platform_data = &bfin_rotary_data,
  188. },
  189. };
  190. #endif
  191. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  192. #include <linux/input.h>
  193. #include <linux/spi/adxl34x.h>
  194. static const struct adxl34x_platform_data adxl34x_info = {
  195. .x_axis_offset = 0,
  196. .y_axis_offset = 0,
  197. .z_axis_offset = 0,
  198. .tap_threshold = 0x31,
  199. .tap_duration = 0x10,
  200. .tap_latency = 0x60,
  201. .tap_window = 0xF0,
  202. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  203. .act_axis_control = 0xFF,
  204. .activity_threshold = 5,
  205. .inactivity_threshold = 3,
  206. .inactivity_time = 4,
  207. .free_fall_threshold = 0x7,
  208. .free_fall_time = 0x20,
  209. .data_rate = 0x8,
  210. .data_range = ADXL_FULL_RES,
  211. .ev_type = EV_ABS,
  212. .ev_code_x = ABS_X, /* EV_REL */
  213. .ev_code_y = ABS_Y, /* EV_REL */
  214. .ev_code_z = ABS_Z, /* EV_REL */
  215. .ev_code_tap_x = BTN_TOUCH, /* EV_KEY */
  216. .ev_code_tap_y = BTN_TOUCH, /* EV_KEY */
  217. .ev_code_tap_z = BTN_TOUCH, /* EV_KEY */
  218. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  219. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  220. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  221. .fifo_mode = ADXL_FIFO_STREAM,
  222. };
  223. #endif
  224. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  225. static struct platform_device rtc_device = {
  226. .name = "rtc-bfin",
  227. .id = -1,
  228. };
  229. #endif
  230. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  231. static struct resource bfin_uart_resources[] = {
  232. #ifdef CONFIG_SERIAL_BFIN_UART0
  233. {
  234. .start = 0xFFC00400,
  235. .end = 0xFFC004FF,
  236. .flags = IORESOURCE_MEM,
  237. },
  238. #endif
  239. #ifdef CONFIG_SERIAL_BFIN_UART1
  240. {
  241. .start = 0xFFC02000,
  242. .end = 0xFFC020FF,
  243. .flags = IORESOURCE_MEM,
  244. },
  245. #endif
  246. #ifdef CONFIG_SERIAL_BFIN_UART2
  247. {
  248. .start = 0xFFC02100,
  249. .end = 0xFFC021FF,
  250. .flags = IORESOURCE_MEM,
  251. },
  252. #endif
  253. #ifdef CONFIG_SERIAL_BFIN_UART3
  254. {
  255. .start = 0xFFC03100,
  256. .end = 0xFFC031FF,
  257. .flags = IORESOURCE_MEM,
  258. },
  259. #endif
  260. };
  261. static struct platform_device bfin_uart_device = {
  262. .name = "bfin-uart",
  263. .id = 1,
  264. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  265. .resource = bfin_uart_resources,
  266. };
  267. #endif
  268. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  269. #ifdef CONFIG_BFIN_SIR0
  270. static struct resource bfin_sir0_resources[] = {
  271. {
  272. .start = 0xFFC00400,
  273. .end = 0xFFC004FF,
  274. .flags = IORESOURCE_MEM,
  275. },
  276. {
  277. .start = IRQ_UART0_RX,
  278. .end = IRQ_UART0_RX+1,
  279. .flags = IORESOURCE_IRQ,
  280. },
  281. {
  282. .start = CH_UART0_RX,
  283. .end = CH_UART0_RX+1,
  284. .flags = IORESOURCE_DMA,
  285. },
  286. };
  287. static struct platform_device bfin_sir0_device = {
  288. .name = "bfin_sir",
  289. .id = 0,
  290. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  291. .resource = bfin_sir0_resources,
  292. };
  293. #endif
  294. #ifdef CONFIG_BFIN_SIR1
  295. static struct resource bfin_sir1_resources[] = {
  296. {
  297. .start = 0xFFC02000,
  298. .end = 0xFFC020FF,
  299. .flags = IORESOURCE_MEM,
  300. },
  301. {
  302. .start = IRQ_UART1_RX,
  303. .end = IRQ_UART1_RX+1,
  304. .flags = IORESOURCE_IRQ,
  305. },
  306. {
  307. .start = CH_UART1_RX,
  308. .end = CH_UART1_RX+1,
  309. .flags = IORESOURCE_DMA,
  310. },
  311. };
  312. static struct platform_device bfin_sir1_device = {
  313. .name = "bfin_sir",
  314. .id = 1,
  315. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  316. .resource = bfin_sir1_resources,
  317. };
  318. #endif
  319. #ifdef CONFIG_BFIN_SIR2
  320. static struct resource bfin_sir2_resources[] = {
  321. {
  322. .start = 0xFFC02100,
  323. .end = 0xFFC021FF,
  324. .flags = IORESOURCE_MEM,
  325. },
  326. {
  327. .start = IRQ_UART2_RX,
  328. .end = IRQ_UART2_RX+1,
  329. .flags = IORESOURCE_IRQ,
  330. },
  331. {
  332. .start = CH_UART2_RX,
  333. .end = CH_UART2_RX+1,
  334. .flags = IORESOURCE_DMA,
  335. },
  336. };
  337. static struct platform_device bfin_sir2_device = {
  338. .name = "bfin_sir",
  339. .id = 2,
  340. .num_resources = ARRAY_SIZE(bfin_sir2_resources),
  341. .resource = bfin_sir2_resources,
  342. };
  343. #endif
  344. #ifdef CONFIG_BFIN_SIR3
  345. static struct resource bfin_sir3_resources[] = {
  346. {
  347. .start = 0xFFC03100,
  348. .end = 0xFFC031FF,
  349. .flags = IORESOURCE_MEM,
  350. },
  351. {
  352. .start = IRQ_UART3_RX,
  353. .end = IRQ_UART3_RX+1,
  354. .flags = IORESOURCE_IRQ,
  355. },
  356. {
  357. .start = CH_UART3_RX,
  358. .end = CH_UART3_RX+1,
  359. .flags = IORESOURCE_DMA,
  360. },
  361. };
  362. static struct platform_device bfin_sir3_device = {
  363. .name = "bfin_sir",
  364. .id = 3,
  365. .num_resources = ARRAY_SIZE(bfin_sir3_resources),
  366. .resource = bfin_sir3_resources,
  367. };
  368. #endif
  369. #endif
  370. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  371. static struct resource smsc911x_resources[] = {
  372. {
  373. .name = "smsc911x-memory",
  374. .start = 0x24000000,
  375. .end = 0x24000000 + 0xFF,
  376. .flags = IORESOURCE_MEM,
  377. },
  378. {
  379. .start = IRQ_PE8,
  380. .end = IRQ_PE8,
  381. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  382. },
  383. };
  384. static struct platform_device smsc911x_device = {
  385. .name = "smsc911x",
  386. .id = 0,
  387. .num_resources = ARRAY_SIZE(smsc911x_resources),
  388. .resource = smsc911x_resources,
  389. };
  390. #endif
  391. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  392. static struct resource musb_resources[] = {
  393. [0] = {
  394. .start = 0xFFC03C00,
  395. .end = 0xFFC040FF,
  396. .flags = IORESOURCE_MEM,
  397. },
  398. [1] = { /* general IRQ */
  399. .start = IRQ_USB_INT0,
  400. .end = IRQ_USB_INT0,
  401. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  402. },
  403. [2] = { /* DMA IRQ */
  404. .start = IRQ_USB_DMA,
  405. .end = IRQ_USB_DMA,
  406. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  407. },
  408. };
  409. static struct musb_hdrc_config musb_config = {
  410. .multipoint = 0,
  411. .dyn_fifo = 0,
  412. .soft_con = 1,
  413. .dma = 1,
  414. .num_eps = 8,
  415. .dma_channels = 8,
  416. .gpio_vrsel = GPIO_PE7,
  417. };
  418. static struct musb_hdrc_platform_data musb_plat = {
  419. #if defined(CONFIG_USB_MUSB_OTG)
  420. .mode = MUSB_OTG,
  421. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  422. .mode = MUSB_HOST,
  423. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  424. .mode = MUSB_PERIPHERAL,
  425. #endif
  426. .config = &musb_config,
  427. };
  428. static u64 musb_dmamask = ~(u32)0;
  429. static struct platform_device musb_device = {
  430. .name = "musb_hdrc",
  431. .id = 0,
  432. .dev = {
  433. .dma_mask = &musb_dmamask,
  434. .coherent_dma_mask = 0xffffffff,
  435. .platform_data = &musb_plat,
  436. },
  437. .num_resources = ARRAY_SIZE(musb_resources),
  438. .resource = musb_resources,
  439. };
  440. #endif
  441. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  442. static struct resource bfin_atapi_resources[] = {
  443. {
  444. .start = 0xFFC03800,
  445. .end = 0xFFC0386F,
  446. .flags = IORESOURCE_MEM,
  447. },
  448. {
  449. .start = IRQ_ATAPI_ERR,
  450. .end = IRQ_ATAPI_ERR,
  451. .flags = IORESOURCE_IRQ,
  452. },
  453. };
  454. static struct platform_device bfin_atapi_device = {
  455. .name = "pata-bf54x",
  456. .id = -1,
  457. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  458. .resource = bfin_atapi_resources,
  459. };
  460. #endif
  461. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  462. static struct mtd_partition partition_info[] = {
  463. {
  464. .name = "linux kernel(nand)",
  465. .offset = 0,
  466. .size = 4 * 1024 * 1024,
  467. },
  468. {
  469. .name = "file system(nand)",
  470. .offset = MTDPART_OFS_APPEND,
  471. .size = MTDPART_SIZ_FULL,
  472. },
  473. };
  474. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  475. .page_size = NFC_PG_SIZE_256,
  476. .data_width = NFC_NWIDTH_8,
  477. .partitions = partition_info,
  478. .nr_partitions = ARRAY_SIZE(partition_info),
  479. .rd_dly = 3,
  480. .wr_dly = 3,
  481. };
  482. static struct resource bf5xx_nand_resources[] = {
  483. {
  484. .start = 0xFFC03B00,
  485. .end = 0xFFC03B4F,
  486. .flags = IORESOURCE_MEM,
  487. },
  488. {
  489. .start = CH_NFC,
  490. .end = CH_NFC,
  491. .flags = IORESOURCE_IRQ,
  492. },
  493. };
  494. static struct platform_device bf5xx_nand_device = {
  495. .name = "bf5xx-nand",
  496. .id = 0,
  497. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  498. .resource = bf5xx_nand_resources,
  499. .dev = {
  500. .platform_data = &bf5xx_nand_platform,
  501. },
  502. };
  503. #endif
  504. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  505. static struct bfin_sd_host bfin_sdh_data = {
  506. .dma_chan = CH_SDH,
  507. .irq_int0 = IRQ_SDH_MASK0,
  508. .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
  509. };
  510. static struct platform_device bf54x_sdh_device = {
  511. .name = "bfin-sdh",
  512. .id = 0,
  513. .dev = {
  514. .platform_data = &bfin_sdh_data,
  515. },
  516. };
  517. #endif
  518. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  519. static struct mtd_partition ezkit_partitions[] = {
  520. {
  521. .name = "bootloader(nor)",
  522. .size = 0x40000,
  523. .offset = 0,
  524. }, {
  525. .name = "linux kernel(nor)",
  526. .size = 0x400000,
  527. .offset = MTDPART_OFS_APPEND,
  528. }, {
  529. .name = "file system(nor)",
  530. .size = MTDPART_SIZ_FULL,
  531. .offset = MTDPART_OFS_APPEND,
  532. }
  533. };
  534. static struct physmap_flash_data ezkit_flash_data = {
  535. .width = 2,
  536. .parts = ezkit_partitions,
  537. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  538. };
  539. static struct resource ezkit_flash_resource = {
  540. .start = 0x20000000,
  541. .end = 0x21ffffff,
  542. .flags = IORESOURCE_MEM,
  543. };
  544. static struct platform_device ezkit_flash_device = {
  545. .name = "physmap-flash",
  546. .id = 0,
  547. .dev = {
  548. .platform_data = &ezkit_flash_data,
  549. },
  550. .num_resources = 1,
  551. .resource = &ezkit_flash_resource,
  552. };
  553. #endif
  554. #if defined(CONFIG_MTD_M25P80) \
  555. || defined(CONFIG_MTD_M25P80_MODULE)
  556. /* SPI flash chip (m25p16) */
  557. static struct mtd_partition bfin_spi_flash_partitions[] = {
  558. {
  559. .name = "bootloader(spi)",
  560. .size = 0x00040000,
  561. .offset = 0,
  562. .mask_flags = MTD_CAP_ROM
  563. }, {
  564. .name = "linux kernel(spi)",
  565. .size = MTDPART_SIZ_FULL,
  566. .offset = MTDPART_OFS_APPEND,
  567. }
  568. };
  569. static struct flash_platform_data bfin_spi_flash_data = {
  570. .name = "m25p80",
  571. .parts = bfin_spi_flash_partitions,
  572. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  573. .type = "m25p16",
  574. };
  575. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  576. .enable_dma = 0, /* use dma transfer with this chip*/
  577. .bits_per_word = 8,
  578. .cs_change_per_word = 0,
  579. };
  580. #endif
  581. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  582. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  583. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  584. .enable_dma = 0,
  585. .bits_per_word = 16,
  586. };
  587. #endif
  588. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  589. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  590. .cs_change_per_word = 0,
  591. .enable_dma = 0,
  592. .bits_per_word = 16,
  593. };
  594. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  595. .model = 7877,
  596. .vref_delay_usecs = 50, /* internal, no capacitor */
  597. .x_plate_ohms = 419,
  598. .y_plate_ohms = 486,
  599. .pressure_max = 1000,
  600. .pressure_min = 0,
  601. .stopacq_polarity = 1,
  602. .first_conversion_delay = 3,
  603. .acquisition_time = 1,
  604. .averaging = 1,
  605. .pen_down_acc_interval = 1,
  606. };
  607. #endif
  608. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  609. static struct bfin5xx_spi_chip spidev_chip_info = {
  610. .enable_dma = 0,
  611. .bits_per_word = 8,
  612. };
  613. #endif
  614. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  615. static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
  616. .enable_dma = 0, /* use dma transfer with this chip*/
  617. .bits_per_word = 8,
  618. .cs_change_per_word = 0,
  619. };
  620. #endif
  621. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  622. #if defined(CONFIG_MTD_M25P80) \
  623. || defined(CONFIG_MTD_M25P80_MODULE)
  624. {
  625. /* the modalias must be the same as spi device driver name */
  626. .modalias = "m25p80", /* Name of spi_driver for this device */
  627. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  628. .bus_num = 0, /* Framework bus number */
  629. .chip_select = 1, /* SPI_SSEL1*/
  630. .platform_data = &bfin_spi_flash_data,
  631. .controller_data = &spi_flash_chip_info,
  632. .mode = SPI_MODE_3,
  633. },
  634. #endif
  635. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  636. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  637. {
  638. .modalias = "ad1836-spi",
  639. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  640. .bus_num = 1,
  641. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  642. .controller_data = &ad1836_spi_chip_info,
  643. },
  644. #endif
  645. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  646. {
  647. .modalias = "ad7877",
  648. .platform_data = &bfin_ad7877_ts_info,
  649. .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
  650. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  651. .bus_num = 0,
  652. .chip_select = 2,
  653. .controller_data = &spi_ad7877_chip_info,
  654. },
  655. #endif
  656. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  657. {
  658. .modalias = "spidev",
  659. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  660. .bus_num = 0,
  661. .chip_select = 1,
  662. .controller_data = &spidev_chip_info,
  663. },
  664. #endif
  665. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  666. {
  667. .modalias = "adxl34x",
  668. .platform_data = &adxl34x_info,
  669. .irq = IRQ_PC5,
  670. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  671. .bus_num = 1,
  672. .chip_select = 2,
  673. .controller_data = &spi_adxl34x_chip_info,
  674. .mode = SPI_MODE_3,
  675. },
  676. #endif
  677. };
  678. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  679. /* SPI (0) */
  680. static struct resource bfin_spi0_resource[] = {
  681. [0] = {
  682. .start = SPI0_REGBASE,
  683. .end = SPI0_REGBASE + 0xFF,
  684. .flags = IORESOURCE_MEM,
  685. },
  686. [1] = {
  687. .start = CH_SPI0,
  688. .end = CH_SPI0,
  689. .flags = IORESOURCE_DMA,
  690. },
  691. [2] = {
  692. .start = IRQ_SPI0,
  693. .end = IRQ_SPI0,
  694. .flags = IORESOURCE_IRQ,
  695. }
  696. };
  697. /* SPI (1) */
  698. static struct resource bfin_spi1_resource[] = {
  699. [0] = {
  700. .start = SPI1_REGBASE,
  701. .end = SPI1_REGBASE + 0xFF,
  702. .flags = IORESOURCE_MEM,
  703. },
  704. [1] = {
  705. .start = CH_SPI1,
  706. .end = CH_SPI1,
  707. .flags = IORESOURCE_DMA,
  708. },
  709. [2] = {
  710. .start = IRQ_SPI1,
  711. .end = IRQ_SPI1,
  712. .flags = IORESOURCE_IRQ,
  713. }
  714. };
  715. /* SPI controller data */
  716. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  717. .num_chipselect = 8,
  718. .enable_dma = 1, /* master has the ability to do dma transfer */
  719. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  720. };
  721. static struct platform_device bf54x_spi_master0 = {
  722. .name = "bfin-spi",
  723. .id = 0, /* Bus number */
  724. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  725. .resource = bfin_spi0_resource,
  726. .dev = {
  727. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  728. },
  729. };
  730. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  731. .num_chipselect = 8,
  732. .enable_dma = 1, /* master has the ability to do dma transfer */
  733. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  734. };
  735. static struct platform_device bf54x_spi_master1 = {
  736. .name = "bfin-spi",
  737. .id = 1, /* Bus number */
  738. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  739. .resource = bfin_spi1_resource,
  740. .dev = {
  741. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  742. },
  743. };
  744. #endif /* spi master and devices */
  745. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  746. static struct resource bfin_twi0_resource[] = {
  747. [0] = {
  748. .start = TWI0_REGBASE,
  749. .end = TWI0_REGBASE + 0xFF,
  750. .flags = IORESOURCE_MEM,
  751. },
  752. [1] = {
  753. .start = IRQ_TWI0,
  754. .end = IRQ_TWI0,
  755. .flags = IORESOURCE_IRQ,
  756. },
  757. };
  758. static struct platform_device i2c_bfin_twi0_device = {
  759. .name = "i2c-bfin-twi",
  760. .id = 0,
  761. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  762. .resource = bfin_twi0_resource,
  763. };
  764. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  765. static struct resource bfin_twi1_resource[] = {
  766. [0] = {
  767. .start = TWI1_REGBASE,
  768. .end = TWI1_REGBASE + 0xFF,
  769. .flags = IORESOURCE_MEM,
  770. },
  771. [1] = {
  772. .start = IRQ_TWI1,
  773. .end = IRQ_TWI1,
  774. .flags = IORESOURCE_IRQ,
  775. },
  776. };
  777. static struct platform_device i2c_bfin_twi1_device = {
  778. .name = "i2c-bfin-twi",
  779. .id = 1,
  780. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  781. .resource = bfin_twi1_resource,
  782. };
  783. #endif
  784. #endif
  785. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  786. };
  787. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  788. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  789. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
  790. {
  791. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  792. },
  793. #endif
  794. #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
  795. {
  796. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  797. .irq = 212,
  798. },
  799. #endif
  800. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  801. {
  802. I2C_BOARD_INFO("adxl34x", 0x53),
  803. .irq = IRQ_PC5,
  804. .platform_data = (void *)&adxl34x_info,
  805. },
  806. #endif
  807. };
  808. #endif
  809. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  810. #include <linux/gpio_keys.h>
  811. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  812. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  813. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  814. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  815. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  816. };
  817. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  818. .buttons = bfin_gpio_keys_table,
  819. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  820. };
  821. static struct platform_device bfin_device_gpiokeys = {
  822. .name = "gpio-keys",
  823. .dev = {
  824. .platform_data = &bfin_gpio_keys_data,
  825. },
  826. };
  827. #endif
  828. static struct resource bfin_gpios_resources = {
  829. .start = 0,
  830. .end = MAX_BLACKFIN_GPIOS - 1,
  831. .flags = IORESOURCE_IRQ,
  832. };
  833. static struct platform_device bfin_gpios_device = {
  834. .name = "simple-gpio",
  835. .id = -1,
  836. .num_resources = 1,
  837. .resource = &bfin_gpios_resources,
  838. };
  839. static const unsigned int cclk_vlev_datasheet[] =
  840. {
  841. /*
  842. * Internal VLEV BF54XSBBC1533
  843. ****temporarily using these values until data sheet is updated
  844. */
  845. VRPAIR(VLEV_085, 150000000),
  846. VRPAIR(VLEV_090, 250000000),
  847. VRPAIR(VLEV_110, 276000000),
  848. VRPAIR(VLEV_115, 301000000),
  849. VRPAIR(VLEV_120, 525000000),
  850. VRPAIR(VLEV_125, 550000000),
  851. VRPAIR(VLEV_130, 600000000),
  852. };
  853. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  854. .tuple_tab = cclk_vlev_datasheet,
  855. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  856. .vr_settling_time = 25 /* us */,
  857. };
  858. static struct platform_device bfin_dpmc = {
  859. .name = "bfin dpmc",
  860. .dev = {
  861. .platform_data = &bfin_dmpc_vreg_data,
  862. },
  863. };
  864. static struct platform_device *ezkit_devices[] __initdata = {
  865. &bfin_dpmc,
  866. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  867. &rtc_device,
  868. #endif
  869. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  870. &bfin_uart_device,
  871. #endif
  872. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  873. #ifdef CONFIG_BFIN_SIR0
  874. &bfin_sir0_device,
  875. #endif
  876. #ifdef CONFIG_BFIN_SIR1
  877. &bfin_sir1_device,
  878. #endif
  879. #ifdef CONFIG_BFIN_SIR2
  880. &bfin_sir2_device,
  881. #endif
  882. #ifdef CONFIG_BFIN_SIR3
  883. &bfin_sir3_device,
  884. #endif
  885. #endif
  886. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  887. &bf54x_lq043_device,
  888. #endif
  889. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  890. &smsc911x_device,
  891. #endif
  892. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  893. &musb_device,
  894. #endif
  895. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  896. &bfin_isp1760_device,
  897. #endif
  898. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  899. &bfin_atapi_device,
  900. #endif
  901. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  902. &bf5xx_nand_device,
  903. #endif
  904. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  905. &bf54x_sdh_device,
  906. #endif
  907. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  908. &bf54x_spi_master0,
  909. &bf54x_spi_master1,
  910. #endif
  911. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  912. &bf54x_kpad_device,
  913. #endif
  914. #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
  915. &bfin_rotary_device,
  916. #endif
  917. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  918. &i2c_bfin_twi0_device,
  919. #if !defined(CONFIG_BF542)
  920. &i2c_bfin_twi1_device,
  921. #endif
  922. #endif
  923. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  924. &bfin_device_gpiokeys,
  925. #endif
  926. &bfin_gpios_device,
  927. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  928. &ezkit_flash_device,
  929. #endif
  930. };
  931. static int __init ezkit_init(void)
  932. {
  933. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  934. i2c_register_board_info(0, bfin_i2c_board_info0,
  935. ARRAY_SIZE(bfin_i2c_board_info0));
  936. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  937. i2c_register_board_info(1, bfin_i2c_board_info1,
  938. ARRAY_SIZE(bfin_i2c_board_info1));
  939. #endif
  940. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  941. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  942. return 0;
  943. }
  944. arch_initcall(ezkit_init);