ezkit.c 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. * 2005 National ICT Australia (NICTA)
  4. * Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <linux/device.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/mtd/mtd.h>
  11. #include <linux/mtd/partitions.h>
  12. #include <linux/mtd/physmap.h>
  13. #include <linux/spi/spi.h>
  14. #include <linux/spi/flash.h>
  15. #include <linux/irq.h>
  16. #include <linux/i2c.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/usb/musb.h>
  19. #include <asm/bfin5xx_spi.h>
  20. #include <asm/dma.h>
  21. #include <asm/gpio.h>
  22. #include <asm/nand.h>
  23. #include <asm/dpmc.h>
  24. #include <asm/portmux.h>
  25. #include <asm/bfin_sdh.h>
  26. #include <mach/bf54x_keys.h>
  27. #include <linux/input.h>
  28. #include <linux/spi/ad7877.h>
  29. /*
  30. * Name the Board for the /proc/cpuinfo
  31. */
  32. const char bfin_board_name[] = "ADI BF548-EZKIT";
  33. /*
  34. * Driver needs to know address, irq and flag pin.
  35. */
  36. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  37. #include <linux/usb/isp1760.h>
  38. static struct resource bfin_isp1760_resources[] = {
  39. [0] = {
  40. .start = 0x2C0C0000,
  41. .end = 0x2C0C0000 + 0xfffff,
  42. .flags = IORESOURCE_MEM,
  43. },
  44. [1] = {
  45. .start = IRQ_PG7,
  46. .end = IRQ_PG7,
  47. .flags = IORESOURCE_IRQ,
  48. },
  49. };
  50. static struct isp1760_platform_data isp1760_priv = {
  51. .is_isp1761 = 0,
  52. .bus_width_16 = 1,
  53. .port1_otg = 0,
  54. .analog_oc = 0,
  55. .dack_polarity_high = 0,
  56. .dreq_polarity_high = 0,
  57. };
  58. static struct platform_device bfin_isp1760_device = {
  59. .name = "isp1760",
  60. .id = 0,
  61. .dev = {
  62. .platform_data = &isp1760_priv,
  63. },
  64. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  65. .resource = bfin_isp1760_resources,
  66. };
  67. #endif
  68. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  69. #include <mach/bf54x-lq043.h>
  70. static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
  71. .width = 95,
  72. .height = 54,
  73. .xres = {480, 480, 480},
  74. .yres = {272, 272, 272},
  75. .bpp = {24, 24, 24},
  76. .disp = GPIO_PE3,
  77. };
  78. static struct resource bf54x_lq043_resources[] = {
  79. {
  80. .start = IRQ_EPPI0_ERR,
  81. .end = IRQ_EPPI0_ERR,
  82. .flags = IORESOURCE_IRQ,
  83. },
  84. };
  85. static struct platform_device bf54x_lq043_device = {
  86. .name = "bf54x-lq043",
  87. .id = -1,
  88. .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
  89. .resource = bf54x_lq043_resources,
  90. .dev = {
  91. .platform_data = &bf54x_lq043_data,
  92. },
  93. };
  94. #endif
  95. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  96. static const unsigned int bf548_keymap[] = {
  97. KEYVAL(0, 0, KEY_ENTER),
  98. KEYVAL(0, 1, KEY_HELP),
  99. KEYVAL(0, 2, KEY_0),
  100. KEYVAL(0, 3, KEY_BACKSPACE),
  101. KEYVAL(1, 0, KEY_TAB),
  102. KEYVAL(1, 1, KEY_9),
  103. KEYVAL(1, 2, KEY_8),
  104. KEYVAL(1, 3, KEY_7),
  105. KEYVAL(2, 0, KEY_DOWN),
  106. KEYVAL(2, 1, KEY_6),
  107. KEYVAL(2, 2, KEY_5),
  108. KEYVAL(2, 3, KEY_4),
  109. KEYVAL(3, 0, KEY_UP),
  110. KEYVAL(3, 1, KEY_3),
  111. KEYVAL(3, 2, KEY_2),
  112. KEYVAL(3, 3, KEY_1),
  113. };
  114. static struct bfin_kpad_platform_data bf54x_kpad_data = {
  115. .rows = 4,
  116. .cols = 4,
  117. .keymap = bf548_keymap,
  118. .keymapsize = ARRAY_SIZE(bf548_keymap),
  119. .repeat = 0,
  120. .debounce_time = 5000, /* ns (5ms) */
  121. .coldrive_time = 1000, /* ns (1ms) */
  122. .keyup_test_interval = 50, /* ms (50ms) */
  123. };
  124. static struct resource bf54x_kpad_resources[] = {
  125. {
  126. .start = IRQ_KEY,
  127. .end = IRQ_KEY,
  128. .flags = IORESOURCE_IRQ,
  129. },
  130. };
  131. static struct platform_device bf54x_kpad_device = {
  132. .name = "bf54x-keys",
  133. .id = -1,
  134. .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
  135. .resource = bf54x_kpad_resources,
  136. .dev = {
  137. .platform_data = &bf54x_kpad_data,
  138. },
  139. };
  140. #endif
  141. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  142. #include <asm/bfin_rotary.h>
  143. static struct bfin_rotary_platform_data bfin_rotary_data = {
  144. /*.rotary_up_key = KEY_UP,*/
  145. /*.rotary_down_key = KEY_DOWN,*/
  146. .rotary_rel_code = REL_WHEEL,
  147. .rotary_button_key = KEY_ENTER,
  148. .debounce = 10, /* 0..17 */
  149. .mode = ROT_QUAD_ENC | ROT_DEBE,
  150. };
  151. static struct resource bfin_rotary_resources[] = {
  152. {
  153. .start = IRQ_CNT,
  154. .end = IRQ_CNT,
  155. .flags = IORESOURCE_IRQ,
  156. },
  157. };
  158. static struct platform_device bfin_rotary_device = {
  159. .name = "bfin-rotary",
  160. .id = -1,
  161. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  162. .resource = bfin_rotary_resources,
  163. .dev = {
  164. .platform_data = &bfin_rotary_data,
  165. },
  166. };
  167. #endif
  168. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  169. #include <linux/input/adxl34x.h>
  170. static const struct adxl34x_platform_data adxl34x_info = {
  171. .x_axis_offset = 0,
  172. .y_axis_offset = 0,
  173. .z_axis_offset = 0,
  174. .tap_threshold = 0x31,
  175. .tap_duration = 0x10,
  176. .tap_latency = 0x60,
  177. .tap_window = 0xF0,
  178. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  179. .act_axis_control = 0xFF,
  180. .activity_threshold = 5,
  181. .inactivity_threshold = 3,
  182. .inactivity_time = 4,
  183. .free_fall_threshold = 0x7,
  184. .free_fall_time = 0x20,
  185. .data_rate = 0x8,
  186. .data_range = ADXL_FULL_RES,
  187. .ev_type = EV_ABS,
  188. .ev_code_x = ABS_X, /* EV_REL */
  189. .ev_code_y = ABS_Y, /* EV_REL */
  190. .ev_code_z = ABS_Z, /* EV_REL */
  191. .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
  192. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  193. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  194. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  195. .fifo_mode = ADXL_FIFO_STREAM,
  196. .orientation_enable = ADXL_EN_ORIENTATION_3D,
  197. .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
  198. .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
  199. /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
  200. .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
  201. };
  202. #endif
  203. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  204. static struct platform_device rtc_device = {
  205. .name = "rtc-bfin",
  206. .id = -1,
  207. };
  208. #endif
  209. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  210. #ifdef CONFIG_SERIAL_BFIN_UART0
  211. static struct resource bfin_uart0_resources[] = {
  212. {
  213. .start = UART0_DLL,
  214. .end = UART0_RBR+2,
  215. .flags = IORESOURCE_MEM,
  216. },
  217. {
  218. .start = IRQ_UART0_RX,
  219. .end = IRQ_UART0_RX+1,
  220. .flags = IORESOURCE_IRQ,
  221. },
  222. {
  223. .start = IRQ_UART0_ERROR,
  224. .end = IRQ_UART0_ERROR,
  225. .flags = IORESOURCE_IRQ,
  226. },
  227. {
  228. .start = CH_UART0_TX,
  229. .end = CH_UART0_TX,
  230. .flags = IORESOURCE_DMA,
  231. },
  232. {
  233. .start = CH_UART0_RX,
  234. .end = CH_UART0_RX,
  235. .flags = IORESOURCE_DMA,
  236. },
  237. };
  238. unsigned short bfin_uart0_peripherals[] = {
  239. P_UART0_TX, P_UART0_RX, 0
  240. };
  241. static struct platform_device bfin_uart0_device = {
  242. .name = "bfin-uart",
  243. .id = 0,
  244. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  245. .resource = bfin_uart0_resources,
  246. .dev = {
  247. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  248. },
  249. };
  250. #endif
  251. #ifdef CONFIG_SERIAL_BFIN_UART1
  252. static struct resource bfin_uart1_resources[] = {
  253. {
  254. .start = UART1_DLL,
  255. .end = UART1_RBR+2,
  256. .flags = IORESOURCE_MEM,
  257. },
  258. {
  259. .start = IRQ_UART1_RX,
  260. .end = IRQ_UART1_RX+1,
  261. .flags = IORESOURCE_IRQ,
  262. },
  263. {
  264. .start = IRQ_UART1_ERROR,
  265. .end = IRQ_UART1_ERROR,
  266. .flags = IORESOURCE_IRQ,
  267. },
  268. {
  269. .start = CH_UART1_TX,
  270. .end = CH_UART1_TX,
  271. .flags = IORESOURCE_DMA,
  272. },
  273. {
  274. .start = CH_UART1_RX,
  275. .end = CH_UART1_RX,
  276. .flags = IORESOURCE_DMA,
  277. },
  278. #ifdef CONFIG_BFIN_UART1_CTSRTS
  279. { /* CTS pin -- 0 means not supported */
  280. .start = GPIO_PE10,
  281. .end = GPIO_PE10,
  282. .flags = IORESOURCE_IO,
  283. },
  284. { /* RTS pin -- 0 means not supported */
  285. .start = GPIO_PE9,
  286. .end = GPIO_PE9,
  287. .flags = IORESOURCE_IO,
  288. },
  289. #endif
  290. };
  291. unsigned short bfin_uart1_peripherals[] = {
  292. P_UART1_TX, P_UART1_RX,
  293. #ifdef CONFIG_BFIN_UART1_CTSRTS
  294. P_UART1_RTS, P_UART1_CTS,
  295. #endif
  296. 0
  297. };
  298. static struct platform_device bfin_uart1_device = {
  299. .name = "bfin-uart",
  300. .id = 1,
  301. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  302. .resource = bfin_uart1_resources,
  303. .dev = {
  304. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  305. },
  306. };
  307. #endif
  308. #ifdef CONFIG_SERIAL_BFIN_UART2
  309. static struct resource bfin_uart2_resources[] = {
  310. {
  311. .start = UART2_DLL,
  312. .end = UART2_RBR+2,
  313. .flags = IORESOURCE_MEM,
  314. },
  315. {
  316. .start = IRQ_UART2_RX,
  317. .end = IRQ_UART2_RX+1,
  318. .flags = IORESOURCE_IRQ,
  319. },
  320. {
  321. .start = IRQ_UART2_ERROR,
  322. .end = IRQ_UART2_ERROR,
  323. .flags = IORESOURCE_IRQ,
  324. },
  325. {
  326. .start = CH_UART2_TX,
  327. .end = CH_UART2_TX,
  328. .flags = IORESOURCE_DMA,
  329. },
  330. {
  331. .start = CH_UART2_RX,
  332. .end = CH_UART2_RX,
  333. .flags = IORESOURCE_DMA,
  334. },
  335. };
  336. unsigned short bfin_uart2_peripherals[] = {
  337. P_UART2_TX, P_UART2_RX, 0
  338. };
  339. static struct platform_device bfin_uart2_device = {
  340. .name = "bfin-uart",
  341. .id = 2,
  342. .num_resources = ARRAY_SIZE(bfin_uart2_resources),
  343. .resource = bfin_uart2_resources,
  344. .dev = {
  345. .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
  346. },
  347. };
  348. #endif
  349. #ifdef CONFIG_SERIAL_BFIN_UART3
  350. static struct resource bfin_uart3_resources[] = {
  351. {
  352. .start = UART3_DLL,
  353. .end = UART3_RBR+2,
  354. .flags = IORESOURCE_MEM,
  355. },
  356. {
  357. .start = IRQ_UART3_RX,
  358. .end = IRQ_UART3_RX+1,
  359. .flags = IORESOURCE_IRQ,
  360. },
  361. {
  362. .start = IRQ_UART3_ERROR,
  363. .end = IRQ_UART3_ERROR,
  364. .flags = IORESOURCE_IRQ,
  365. },
  366. {
  367. .start = CH_UART3_TX,
  368. .end = CH_UART3_TX,
  369. .flags = IORESOURCE_DMA,
  370. },
  371. {
  372. .start = CH_UART3_RX,
  373. .end = CH_UART3_RX,
  374. .flags = IORESOURCE_DMA,
  375. },
  376. #ifdef CONFIG_BFIN_UART3_CTSRTS
  377. { /* CTS pin -- 0 means not supported */
  378. .start = GPIO_PB3,
  379. .end = GPIO_PB3,
  380. .flags = IORESOURCE_IO,
  381. },
  382. { /* RTS pin -- 0 means not supported */
  383. .start = GPIO_PB2,
  384. .end = GPIO_PB2,
  385. .flags = IORESOURCE_IO,
  386. },
  387. #endif
  388. };
  389. unsigned short bfin_uart3_peripherals[] = {
  390. P_UART3_TX, P_UART3_RX,
  391. #ifdef CONFIG_BFIN_UART3_CTSRTS
  392. P_UART3_RTS, P_UART3_CTS,
  393. #endif
  394. 0
  395. };
  396. static struct platform_device bfin_uart3_device = {
  397. .name = "bfin-uart",
  398. .id = 3,
  399. .num_resources = ARRAY_SIZE(bfin_uart3_resources),
  400. .resource = bfin_uart3_resources,
  401. .dev = {
  402. .platform_data = &bfin_uart3_peripherals, /* Passed to driver */
  403. },
  404. };
  405. #endif
  406. #endif
  407. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  408. #ifdef CONFIG_BFIN_SIR0
  409. static struct resource bfin_sir0_resources[] = {
  410. {
  411. .start = 0xFFC00400,
  412. .end = 0xFFC004FF,
  413. .flags = IORESOURCE_MEM,
  414. },
  415. {
  416. .start = IRQ_UART0_RX,
  417. .end = IRQ_UART0_RX+1,
  418. .flags = IORESOURCE_IRQ,
  419. },
  420. {
  421. .start = CH_UART0_RX,
  422. .end = CH_UART0_RX+1,
  423. .flags = IORESOURCE_DMA,
  424. },
  425. };
  426. static struct platform_device bfin_sir0_device = {
  427. .name = "bfin_sir",
  428. .id = 0,
  429. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  430. .resource = bfin_sir0_resources,
  431. };
  432. #endif
  433. #ifdef CONFIG_BFIN_SIR1
  434. static struct resource bfin_sir1_resources[] = {
  435. {
  436. .start = 0xFFC02000,
  437. .end = 0xFFC020FF,
  438. .flags = IORESOURCE_MEM,
  439. },
  440. {
  441. .start = IRQ_UART1_RX,
  442. .end = IRQ_UART1_RX+1,
  443. .flags = IORESOURCE_IRQ,
  444. },
  445. {
  446. .start = CH_UART1_RX,
  447. .end = CH_UART1_RX+1,
  448. .flags = IORESOURCE_DMA,
  449. },
  450. };
  451. static struct platform_device bfin_sir1_device = {
  452. .name = "bfin_sir",
  453. .id = 1,
  454. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  455. .resource = bfin_sir1_resources,
  456. };
  457. #endif
  458. #ifdef CONFIG_BFIN_SIR2
  459. static struct resource bfin_sir2_resources[] = {
  460. {
  461. .start = 0xFFC02100,
  462. .end = 0xFFC021FF,
  463. .flags = IORESOURCE_MEM,
  464. },
  465. {
  466. .start = IRQ_UART2_RX,
  467. .end = IRQ_UART2_RX+1,
  468. .flags = IORESOURCE_IRQ,
  469. },
  470. {
  471. .start = CH_UART2_RX,
  472. .end = CH_UART2_RX+1,
  473. .flags = IORESOURCE_DMA,
  474. },
  475. };
  476. static struct platform_device bfin_sir2_device = {
  477. .name = "bfin_sir",
  478. .id = 2,
  479. .num_resources = ARRAY_SIZE(bfin_sir2_resources),
  480. .resource = bfin_sir2_resources,
  481. };
  482. #endif
  483. #ifdef CONFIG_BFIN_SIR3
  484. static struct resource bfin_sir3_resources[] = {
  485. {
  486. .start = 0xFFC03100,
  487. .end = 0xFFC031FF,
  488. .flags = IORESOURCE_MEM,
  489. },
  490. {
  491. .start = IRQ_UART3_RX,
  492. .end = IRQ_UART3_RX+1,
  493. .flags = IORESOURCE_IRQ,
  494. },
  495. {
  496. .start = CH_UART3_RX,
  497. .end = CH_UART3_RX+1,
  498. .flags = IORESOURCE_DMA,
  499. },
  500. };
  501. static struct platform_device bfin_sir3_device = {
  502. .name = "bfin_sir",
  503. .id = 3,
  504. .num_resources = ARRAY_SIZE(bfin_sir3_resources),
  505. .resource = bfin_sir3_resources,
  506. };
  507. #endif
  508. #endif
  509. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  510. #include <linux/smsc911x.h>
  511. static struct resource smsc911x_resources[] = {
  512. {
  513. .name = "smsc911x-memory",
  514. .start = 0x24000000,
  515. .end = 0x24000000 + 0xFF,
  516. .flags = IORESOURCE_MEM,
  517. },
  518. {
  519. .start = IRQ_PE8,
  520. .end = IRQ_PE8,
  521. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  522. },
  523. };
  524. static struct smsc911x_platform_config smsc911x_config = {
  525. .flags = SMSC911X_USE_32BIT,
  526. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  527. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  528. .phy_interface = PHY_INTERFACE_MODE_MII,
  529. };
  530. static struct platform_device smsc911x_device = {
  531. .name = "smsc911x",
  532. .id = 0,
  533. .num_resources = ARRAY_SIZE(smsc911x_resources),
  534. .resource = smsc911x_resources,
  535. .dev = {
  536. .platform_data = &smsc911x_config,
  537. },
  538. };
  539. #endif
  540. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  541. static struct resource musb_resources[] = {
  542. [0] = {
  543. .start = 0xFFC03C00,
  544. .end = 0xFFC040FF,
  545. .flags = IORESOURCE_MEM,
  546. },
  547. [1] = { /* general IRQ */
  548. .start = IRQ_USB_INT0,
  549. .end = IRQ_USB_INT0,
  550. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  551. },
  552. [2] = { /* DMA IRQ */
  553. .start = IRQ_USB_DMA,
  554. .end = IRQ_USB_DMA,
  555. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  556. },
  557. };
  558. static struct musb_hdrc_config musb_config = {
  559. .multipoint = 0,
  560. .dyn_fifo = 0,
  561. .soft_con = 1,
  562. .dma = 1,
  563. .num_eps = 8,
  564. .dma_channels = 8,
  565. .gpio_vrsel = GPIO_PE7,
  566. };
  567. static struct musb_hdrc_platform_data musb_plat = {
  568. #if defined(CONFIG_USB_MUSB_OTG)
  569. .mode = MUSB_OTG,
  570. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  571. .mode = MUSB_HOST,
  572. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  573. .mode = MUSB_PERIPHERAL,
  574. #endif
  575. .config = &musb_config,
  576. };
  577. static u64 musb_dmamask = ~(u32)0;
  578. static struct platform_device musb_device = {
  579. .name = "musb_hdrc",
  580. .id = 0,
  581. .dev = {
  582. .dma_mask = &musb_dmamask,
  583. .coherent_dma_mask = 0xffffffff,
  584. .platform_data = &musb_plat,
  585. },
  586. .num_resources = ARRAY_SIZE(musb_resources),
  587. .resource = musb_resources,
  588. };
  589. #endif
  590. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  591. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  592. static struct resource bfin_sport0_uart_resources[] = {
  593. {
  594. .start = SPORT0_TCR1,
  595. .end = SPORT0_MRCS3+4,
  596. .flags = IORESOURCE_MEM,
  597. },
  598. {
  599. .start = IRQ_SPORT0_RX,
  600. .end = IRQ_SPORT0_RX+1,
  601. .flags = IORESOURCE_IRQ,
  602. },
  603. {
  604. .start = IRQ_SPORT0_ERROR,
  605. .end = IRQ_SPORT0_ERROR,
  606. .flags = IORESOURCE_IRQ,
  607. },
  608. };
  609. unsigned short bfin_sport0_peripherals[] = {
  610. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  611. P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
  612. };
  613. static struct platform_device bfin_sport0_uart_device = {
  614. .name = "bfin-sport-uart",
  615. .id = 0,
  616. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  617. .resource = bfin_sport0_uart_resources,
  618. .dev = {
  619. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  620. },
  621. };
  622. #endif
  623. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  624. static struct resource bfin_sport1_uart_resources[] = {
  625. {
  626. .start = SPORT1_TCR1,
  627. .end = SPORT1_MRCS3+4,
  628. .flags = IORESOURCE_MEM,
  629. },
  630. {
  631. .start = IRQ_SPORT1_RX,
  632. .end = IRQ_SPORT1_RX+1,
  633. .flags = IORESOURCE_IRQ,
  634. },
  635. {
  636. .start = IRQ_SPORT1_ERROR,
  637. .end = IRQ_SPORT1_ERROR,
  638. .flags = IORESOURCE_IRQ,
  639. },
  640. };
  641. unsigned short bfin_sport1_peripherals[] = {
  642. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  643. P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
  644. };
  645. static struct platform_device bfin_sport1_uart_device = {
  646. .name = "bfin-sport-uart",
  647. .id = 1,
  648. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  649. .resource = bfin_sport1_uart_resources,
  650. .dev = {
  651. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  652. },
  653. };
  654. #endif
  655. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  656. static struct resource bfin_sport2_uart_resources[] = {
  657. {
  658. .start = SPORT2_TCR1,
  659. .end = SPORT2_MRCS3+4,
  660. .flags = IORESOURCE_MEM,
  661. },
  662. {
  663. .start = IRQ_SPORT2_RX,
  664. .end = IRQ_SPORT2_RX+1,
  665. .flags = IORESOURCE_IRQ,
  666. },
  667. {
  668. .start = IRQ_SPORT2_ERROR,
  669. .end = IRQ_SPORT2_ERROR,
  670. .flags = IORESOURCE_IRQ,
  671. },
  672. };
  673. unsigned short bfin_sport2_peripherals[] = {
  674. P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
  675. P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
  676. };
  677. static struct platform_device bfin_sport2_uart_device = {
  678. .name = "bfin-sport-uart",
  679. .id = 2,
  680. .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
  681. .resource = bfin_sport2_uart_resources,
  682. .dev = {
  683. .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
  684. },
  685. };
  686. #endif
  687. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  688. static struct resource bfin_sport3_uart_resources[] = {
  689. {
  690. .start = SPORT3_TCR1,
  691. .end = SPORT3_MRCS3+4,
  692. .flags = IORESOURCE_MEM,
  693. },
  694. {
  695. .start = IRQ_SPORT3_RX,
  696. .end = IRQ_SPORT3_RX+1,
  697. .flags = IORESOURCE_IRQ,
  698. },
  699. {
  700. .start = IRQ_SPORT3_ERROR,
  701. .end = IRQ_SPORT3_ERROR,
  702. .flags = IORESOURCE_IRQ,
  703. },
  704. };
  705. unsigned short bfin_sport3_peripherals[] = {
  706. P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
  707. P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
  708. };
  709. static struct platform_device bfin_sport3_uart_device = {
  710. .name = "bfin-sport-uart",
  711. .id = 3,
  712. .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
  713. .resource = bfin_sport3_uart_resources,
  714. .dev = {
  715. .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
  716. },
  717. };
  718. #endif
  719. #endif
  720. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  721. unsigned short bfin_can_peripherals[] = {
  722. P_CAN0_RX, P_CAN0_TX, 0
  723. };
  724. static struct resource bfin_can_resources[] = {
  725. {
  726. .start = 0xFFC02A00,
  727. .end = 0xFFC02FFF,
  728. .flags = IORESOURCE_MEM,
  729. },
  730. {
  731. .start = IRQ_CAN0_RX,
  732. .end = IRQ_CAN0_RX,
  733. .flags = IORESOURCE_IRQ,
  734. },
  735. {
  736. .start = IRQ_CAN0_TX,
  737. .end = IRQ_CAN0_TX,
  738. .flags = IORESOURCE_IRQ,
  739. },
  740. {
  741. .start = IRQ_CAN0_ERROR,
  742. .end = IRQ_CAN0_ERROR,
  743. .flags = IORESOURCE_IRQ,
  744. },
  745. };
  746. static struct platform_device bfin_can_device = {
  747. .name = "bfin_can",
  748. .num_resources = ARRAY_SIZE(bfin_can_resources),
  749. .resource = bfin_can_resources,
  750. .dev = {
  751. .platform_data = &bfin_can_peripherals, /* Passed to driver */
  752. },
  753. };
  754. #endif
  755. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  756. static struct resource bfin_atapi_resources[] = {
  757. {
  758. .start = 0xFFC03800,
  759. .end = 0xFFC0386F,
  760. .flags = IORESOURCE_MEM,
  761. },
  762. {
  763. .start = IRQ_ATAPI_ERR,
  764. .end = IRQ_ATAPI_ERR,
  765. .flags = IORESOURCE_IRQ,
  766. },
  767. };
  768. static struct platform_device bfin_atapi_device = {
  769. .name = "pata-bf54x",
  770. .id = -1,
  771. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  772. .resource = bfin_atapi_resources,
  773. };
  774. #endif
  775. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  776. static struct mtd_partition partition_info[] = {
  777. {
  778. .name = "linux kernel(nand)",
  779. .offset = 0,
  780. .size = 4 * 1024 * 1024,
  781. },
  782. {
  783. .name = "file system(nand)",
  784. .offset = MTDPART_OFS_APPEND,
  785. .size = MTDPART_SIZ_FULL,
  786. },
  787. };
  788. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  789. .page_size = NFC_PG_SIZE_256,
  790. .data_width = NFC_NWIDTH_8,
  791. .partitions = partition_info,
  792. .nr_partitions = ARRAY_SIZE(partition_info),
  793. .rd_dly = 3,
  794. .wr_dly = 3,
  795. };
  796. static struct resource bf5xx_nand_resources[] = {
  797. {
  798. .start = 0xFFC03B00,
  799. .end = 0xFFC03B4F,
  800. .flags = IORESOURCE_MEM,
  801. },
  802. {
  803. .start = CH_NFC,
  804. .end = CH_NFC,
  805. .flags = IORESOURCE_IRQ,
  806. },
  807. };
  808. static struct platform_device bf5xx_nand_device = {
  809. .name = "bf5xx-nand",
  810. .id = 0,
  811. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  812. .resource = bf5xx_nand_resources,
  813. .dev = {
  814. .platform_data = &bf5xx_nand_platform,
  815. },
  816. };
  817. #endif
  818. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  819. static struct bfin_sd_host bfin_sdh_data = {
  820. .dma_chan = CH_SDH,
  821. .irq_int0 = IRQ_SDH_MASK0,
  822. .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
  823. };
  824. static struct platform_device bf54x_sdh_device = {
  825. .name = "bfin-sdh",
  826. .id = 0,
  827. .dev = {
  828. .platform_data = &bfin_sdh_data,
  829. },
  830. };
  831. #endif
  832. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  833. static struct mtd_partition ezkit_partitions[] = {
  834. {
  835. .name = "bootloader(nor)",
  836. .size = 0x40000,
  837. .offset = 0,
  838. }, {
  839. .name = "linux kernel(nor)",
  840. .size = 0x400000,
  841. .offset = MTDPART_OFS_APPEND,
  842. }, {
  843. .name = "file system(nor)",
  844. .size = MTDPART_SIZ_FULL,
  845. .offset = MTDPART_OFS_APPEND,
  846. }
  847. };
  848. static struct physmap_flash_data ezkit_flash_data = {
  849. .width = 2,
  850. .parts = ezkit_partitions,
  851. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  852. };
  853. static struct resource ezkit_flash_resource = {
  854. .start = 0x20000000,
  855. .end = 0x21ffffff,
  856. .flags = IORESOURCE_MEM,
  857. };
  858. static struct platform_device ezkit_flash_device = {
  859. .name = "physmap-flash",
  860. .id = 0,
  861. .dev = {
  862. .platform_data = &ezkit_flash_data,
  863. },
  864. .num_resources = 1,
  865. .resource = &ezkit_flash_resource,
  866. };
  867. #endif
  868. #if defined(CONFIG_MTD_M25P80) \
  869. || defined(CONFIG_MTD_M25P80_MODULE)
  870. /* SPI flash chip (m25p16) */
  871. static struct mtd_partition bfin_spi_flash_partitions[] = {
  872. {
  873. .name = "bootloader(spi)",
  874. .size = 0x00040000,
  875. .offset = 0,
  876. .mask_flags = MTD_CAP_ROM
  877. }, {
  878. .name = "linux kernel(spi)",
  879. .size = MTDPART_SIZ_FULL,
  880. .offset = MTDPART_OFS_APPEND,
  881. }
  882. };
  883. static struct flash_platform_data bfin_spi_flash_data = {
  884. .name = "m25p80",
  885. .parts = bfin_spi_flash_partitions,
  886. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  887. .type = "m25p16",
  888. };
  889. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  890. .enable_dma = 0, /* use dma transfer with this chip*/
  891. .bits_per_word = 8,
  892. };
  893. #endif
  894. #if defined(CONFIG_SND_BLACKFIN_AD183X) \
  895. || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
  896. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  897. .enable_dma = 0,
  898. .bits_per_word = 16,
  899. };
  900. #endif
  901. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  902. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  903. .enable_dma = 0,
  904. .bits_per_word = 16,
  905. };
  906. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  907. .model = 7877,
  908. .vref_delay_usecs = 50, /* internal, no capacitor */
  909. .x_plate_ohms = 419,
  910. .y_plate_ohms = 486,
  911. .pressure_max = 1000,
  912. .pressure_min = 0,
  913. .stopacq_polarity = 1,
  914. .first_conversion_delay = 3,
  915. .acquisition_time = 1,
  916. .averaging = 1,
  917. .pen_down_acc_interval = 1,
  918. };
  919. #endif
  920. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  921. static struct bfin5xx_spi_chip spidev_chip_info = {
  922. .enable_dma = 0,
  923. .bits_per_word = 8,
  924. };
  925. #endif
  926. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  927. static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
  928. .enable_dma = 0, /* use dma transfer with this chip*/
  929. .bits_per_word = 8,
  930. };
  931. #endif
  932. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  933. #if defined(CONFIG_MTD_M25P80) \
  934. || defined(CONFIG_MTD_M25P80_MODULE)
  935. {
  936. /* the modalias must be the same as spi device driver name */
  937. .modalias = "m25p80", /* Name of spi_driver for this device */
  938. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  939. .bus_num = 0, /* Framework bus number */
  940. .chip_select = 1, /* SPI_SSEL1*/
  941. .platform_data = &bfin_spi_flash_data,
  942. .controller_data = &spi_flash_chip_info,
  943. .mode = SPI_MODE_3,
  944. },
  945. #endif
  946. #if defined(CONFIG_SND_BLACKFIN_AD183X) \
  947. || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
  948. {
  949. .modalias = "ad1836",
  950. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  951. .bus_num = 1,
  952. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  953. .controller_data = &ad1836_spi_chip_info,
  954. },
  955. #endif
  956. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  957. {
  958. .modalias = "ad7877",
  959. .platform_data = &bfin_ad7877_ts_info,
  960. .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
  961. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  962. .bus_num = 0,
  963. .chip_select = 2,
  964. .controller_data = &spi_ad7877_chip_info,
  965. },
  966. #endif
  967. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  968. {
  969. .modalias = "spidev",
  970. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  971. .bus_num = 0,
  972. .chip_select = 1,
  973. .controller_data = &spidev_chip_info,
  974. },
  975. #endif
  976. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  977. {
  978. .modalias = "adxl34x",
  979. .platform_data = &adxl34x_info,
  980. .irq = IRQ_PC5,
  981. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  982. .bus_num = 1,
  983. .chip_select = 2,
  984. .controller_data = &spi_adxl34x_chip_info,
  985. .mode = SPI_MODE_3,
  986. },
  987. #endif
  988. };
  989. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  990. /* SPI (0) */
  991. static struct resource bfin_spi0_resource[] = {
  992. [0] = {
  993. .start = SPI0_REGBASE,
  994. .end = SPI0_REGBASE + 0xFF,
  995. .flags = IORESOURCE_MEM,
  996. },
  997. [1] = {
  998. .start = CH_SPI0,
  999. .end = CH_SPI0,
  1000. .flags = IORESOURCE_DMA,
  1001. },
  1002. [2] = {
  1003. .start = IRQ_SPI0,
  1004. .end = IRQ_SPI0,
  1005. .flags = IORESOURCE_IRQ,
  1006. }
  1007. };
  1008. /* SPI (1) */
  1009. static struct resource bfin_spi1_resource[] = {
  1010. [0] = {
  1011. .start = SPI1_REGBASE,
  1012. .end = SPI1_REGBASE + 0xFF,
  1013. .flags = IORESOURCE_MEM,
  1014. },
  1015. [1] = {
  1016. .start = CH_SPI1,
  1017. .end = CH_SPI1,
  1018. .flags = IORESOURCE_DMA,
  1019. },
  1020. [2] = {
  1021. .start = IRQ_SPI1,
  1022. .end = IRQ_SPI1,
  1023. .flags = IORESOURCE_IRQ,
  1024. }
  1025. };
  1026. /* SPI controller data */
  1027. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  1028. .num_chipselect = 3,
  1029. .enable_dma = 1, /* master has the ability to do dma transfer */
  1030. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1031. };
  1032. static struct platform_device bf54x_spi_master0 = {
  1033. .name = "bfin-spi",
  1034. .id = 0, /* Bus number */
  1035. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1036. .resource = bfin_spi0_resource,
  1037. .dev = {
  1038. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  1039. },
  1040. };
  1041. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  1042. .num_chipselect = 3,
  1043. .enable_dma = 1, /* master has the ability to do dma transfer */
  1044. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  1045. };
  1046. static struct platform_device bf54x_spi_master1 = {
  1047. .name = "bfin-spi",
  1048. .id = 1, /* Bus number */
  1049. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  1050. .resource = bfin_spi1_resource,
  1051. .dev = {
  1052. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  1053. },
  1054. };
  1055. #endif /* spi master and devices */
  1056. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1057. static struct resource bfin_twi0_resource[] = {
  1058. [0] = {
  1059. .start = TWI0_REGBASE,
  1060. .end = TWI0_REGBASE + 0xFF,
  1061. .flags = IORESOURCE_MEM,
  1062. },
  1063. [1] = {
  1064. .start = IRQ_TWI0,
  1065. .end = IRQ_TWI0,
  1066. .flags = IORESOURCE_IRQ,
  1067. },
  1068. };
  1069. static struct platform_device i2c_bfin_twi0_device = {
  1070. .name = "i2c-bfin-twi",
  1071. .id = 0,
  1072. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1073. .resource = bfin_twi0_resource,
  1074. };
  1075. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1076. static struct resource bfin_twi1_resource[] = {
  1077. [0] = {
  1078. .start = TWI1_REGBASE,
  1079. .end = TWI1_REGBASE + 0xFF,
  1080. .flags = IORESOURCE_MEM,
  1081. },
  1082. [1] = {
  1083. .start = IRQ_TWI1,
  1084. .end = IRQ_TWI1,
  1085. .flags = IORESOURCE_IRQ,
  1086. },
  1087. };
  1088. static struct platform_device i2c_bfin_twi1_device = {
  1089. .name = "i2c-bfin-twi",
  1090. .id = 1,
  1091. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  1092. .resource = bfin_twi1_resource,
  1093. };
  1094. #endif
  1095. #endif
  1096. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  1097. };
  1098. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1099. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  1100. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  1101. {
  1102. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  1103. },
  1104. #endif
  1105. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  1106. {
  1107. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  1108. .irq = 212,
  1109. },
  1110. #endif
  1111. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  1112. {
  1113. I2C_BOARD_INFO("adxl34x", 0x53),
  1114. .irq = IRQ_PC5,
  1115. .platform_data = (void *)&adxl34x_info,
  1116. },
  1117. #endif
  1118. };
  1119. #endif
  1120. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1121. #include <linux/gpio_keys.h>
  1122. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  1123. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  1124. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  1125. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  1126. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  1127. };
  1128. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  1129. .buttons = bfin_gpio_keys_table,
  1130. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  1131. };
  1132. static struct platform_device bfin_device_gpiokeys = {
  1133. .name = "gpio-keys",
  1134. .dev = {
  1135. .platform_data = &bfin_gpio_keys_data,
  1136. },
  1137. };
  1138. #endif
  1139. static const unsigned int cclk_vlev_datasheet[] =
  1140. {
  1141. /*
  1142. * Internal VLEV BF54XSBBC1533
  1143. ****temporarily using these values until data sheet is updated
  1144. */
  1145. VRPAIR(VLEV_085, 150000000),
  1146. VRPAIR(VLEV_090, 250000000),
  1147. VRPAIR(VLEV_110, 276000000),
  1148. VRPAIR(VLEV_115, 301000000),
  1149. VRPAIR(VLEV_120, 525000000),
  1150. VRPAIR(VLEV_125, 550000000),
  1151. VRPAIR(VLEV_130, 600000000),
  1152. };
  1153. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1154. .tuple_tab = cclk_vlev_datasheet,
  1155. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1156. .vr_settling_time = 25 /* us */,
  1157. };
  1158. static struct platform_device bfin_dpmc = {
  1159. .name = "bfin dpmc",
  1160. .dev = {
  1161. .platform_data = &bfin_dmpc_vreg_data,
  1162. },
  1163. };
  1164. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1165. static struct platform_device bfin_i2s = {
  1166. .name = "bfin-i2s",
  1167. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1168. /* TODO: add platform data here */
  1169. };
  1170. #endif
  1171. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1172. static struct platform_device bfin_tdm = {
  1173. .name = "bfin-tdm",
  1174. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1175. /* TODO: add platform data here */
  1176. };
  1177. #endif
  1178. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1179. static struct platform_device bfin_ac97 = {
  1180. .name = "bfin-ac97",
  1181. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1182. /* TODO: add platform data here */
  1183. };
  1184. #endif
  1185. static struct platform_device *ezkit_devices[] __initdata = {
  1186. &bfin_dpmc,
  1187. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1188. &rtc_device,
  1189. #endif
  1190. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1191. #ifdef CONFIG_SERIAL_BFIN_UART0
  1192. &bfin_uart0_device,
  1193. #endif
  1194. #ifdef CONFIG_SERIAL_BFIN_UART1
  1195. &bfin_uart1_device,
  1196. #endif
  1197. #ifdef CONFIG_SERIAL_BFIN_UART2
  1198. &bfin_uart2_device,
  1199. #endif
  1200. #ifdef CONFIG_SERIAL_BFIN_UART3
  1201. &bfin_uart3_device,
  1202. #endif
  1203. #endif
  1204. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1205. #ifdef CONFIG_BFIN_SIR0
  1206. &bfin_sir0_device,
  1207. #endif
  1208. #ifdef CONFIG_BFIN_SIR1
  1209. &bfin_sir1_device,
  1210. #endif
  1211. #ifdef CONFIG_BFIN_SIR2
  1212. &bfin_sir2_device,
  1213. #endif
  1214. #ifdef CONFIG_BFIN_SIR3
  1215. &bfin_sir3_device,
  1216. #endif
  1217. #endif
  1218. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  1219. &bf54x_lq043_device,
  1220. #endif
  1221. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  1222. &smsc911x_device,
  1223. #endif
  1224. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  1225. &musb_device,
  1226. #endif
  1227. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1228. &bfin_isp1760_device,
  1229. #endif
  1230. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1231. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1232. &bfin_sport0_uart_device,
  1233. #endif
  1234. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1235. &bfin_sport1_uart_device,
  1236. #endif
  1237. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1238. &bfin_sport2_uart_device,
  1239. #endif
  1240. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  1241. &bfin_sport3_uart_device,
  1242. #endif
  1243. #endif
  1244. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  1245. &bfin_can_device,
  1246. #endif
  1247. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  1248. &bfin_atapi_device,
  1249. #endif
  1250. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  1251. &bf5xx_nand_device,
  1252. #endif
  1253. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  1254. &bf54x_sdh_device,
  1255. #endif
  1256. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  1257. &bf54x_spi_master0,
  1258. &bf54x_spi_master1,
  1259. #endif
  1260. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  1261. &bf54x_kpad_device,
  1262. #endif
  1263. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  1264. &bfin_rotary_device,
  1265. #endif
  1266. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1267. &i2c_bfin_twi0_device,
  1268. #if !defined(CONFIG_BF542)
  1269. &i2c_bfin_twi1_device,
  1270. #endif
  1271. #endif
  1272. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1273. &bfin_device_gpiokeys,
  1274. #endif
  1275. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1276. &ezkit_flash_device,
  1277. #endif
  1278. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1279. &bfin_i2s,
  1280. #endif
  1281. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1282. &bfin_tdm,
  1283. #endif
  1284. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1285. &bfin_ac97,
  1286. #endif
  1287. };
  1288. static int __init ezkit_init(void)
  1289. {
  1290. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1291. i2c_register_board_info(0, bfin_i2c_board_info0,
  1292. ARRAY_SIZE(bfin_i2c_board_info0));
  1293. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1294. i2c_register_board_info(1, bfin_i2c_board_info1,
  1295. ARRAY_SIZE(bfin_i2c_board_info1));
  1296. #endif
  1297. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  1298. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1299. return 0;
  1300. }
  1301. arch_initcall(ezkit_init);
  1302. static struct platform_device *ezkit_early_devices[] __initdata = {
  1303. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  1304. #ifdef CONFIG_SERIAL_BFIN_UART0
  1305. &bfin_uart0_device,
  1306. #endif
  1307. #ifdef CONFIG_SERIAL_BFIN_UART1
  1308. &bfin_uart1_device,
  1309. #endif
  1310. #ifdef CONFIG_SERIAL_BFIN_UART2
  1311. &bfin_uart2_device,
  1312. #endif
  1313. #ifdef CONFIG_SERIAL_BFIN_UART3
  1314. &bfin_uart3_device,
  1315. #endif
  1316. #endif
  1317. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  1318. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1319. &bfin_sport0_uart_device,
  1320. #endif
  1321. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1322. &bfin_sport1_uart_device,
  1323. #endif
  1324. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1325. &bfin_sport2_uart_device,
  1326. #endif
  1327. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  1328. &bfin_sport3_uart_device,
  1329. #endif
  1330. #endif
  1331. };
  1332. void __init native_machine_early_platform_add_devices(void)
  1333. {
  1334. printk(KERN_INFO "register early platform devices\n");
  1335. early_platform_add_devices(ezkit_early_devices,
  1336. ARRAY_SIZE(ezkit_early_devices));
  1337. }