ezkit.c 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481
  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. .name = "mc"
  552. },
  553. [2] = { /* DMA IRQ */
  554. .start = IRQ_USB_DMA,
  555. .end = IRQ_USB_DMA,
  556. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  557. .name = "dma"
  558. },
  559. };
  560. static struct musb_hdrc_config musb_config = {
  561. .multipoint = 0,
  562. .dyn_fifo = 0,
  563. .soft_con = 1,
  564. .dma = 1,
  565. .num_eps = 8,
  566. .dma_channels = 8,
  567. .gpio_vrsel = GPIO_PE7,
  568. /* Some custom boards need to be active low, just set it to "0"
  569. * if it is the case.
  570. */
  571. .gpio_vrsel_active = 1,
  572. };
  573. static struct musb_hdrc_platform_data musb_plat = {
  574. #if defined(CONFIG_USB_MUSB_OTG)
  575. .mode = MUSB_OTG,
  576. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  577. .mode = MUSB_HOST,
  578. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  579. .mode = MUSB_PERIPHERAL,
  580. #endif
  581. .config = &musb_config,
  582. };
  583. static u64 musb_dmamask = ~(u32)0;
  584. static struct platform_device musb_device = {
  585. .name = "musb-hdrc",
  586. .id = 0,
  587. .dev = {
  588. .dma_mask = &musb_dmamask,
  589. .coherent_dma_mask = 0xffffffff,
  590. .platform_data = &musb_plat,
  591. },
  592. .num_resources = ARRAY_SIZE(musb_resources),
  593. .resource = musb_resources,
  594. };
  595. #endif
  596. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  597. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  598. static struct resource bfin_sport0_uart_resources[] = {
  599. {
  600. .start = SPORT0_TCR1,
  601. .end = SPORT0_MRCS3+4,
  602. .flags = IORESOURCE_MEM,
  603. },
  604. {
  605. .start = IRQ_SPORT0_RX,
  606. .end = IRQ_SPORT0_RX+1,
  607. .flags = IORESOURCE_IRQ,
  608. },
  609. {
  610. .start = IRQ_SPORT0_ERROR,
  611. .end = IRQ_SPORT0_ERROR,
  612. .flags = IORESOURCE_IRQ,
  613. },
  614. };
  615. unsigned short bfin_sport0_peripherals[] = {
  616. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  617. P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
  618. };
  619. static struct platform_device bfin_sport0_uart_device = {
  620. .name = "bfin-sport-uart",
  621. .id = 0,
  622. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  623. .resource = bfin_sport0_uart_resources,
  624. .dev = {
  625. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  626. },
  627. };
  628. #endif
  629. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  630. static struct resource bfin_sport1_uart_resources[] = {
  631. {
  632. .start = SPORT1_TCR1,
  633. .end = SPORT1_MRCS3+4,
  634. .flags = IORESOURCE_MEM,
  635. },
  636. {
  637. .start = IRQ_SPORT1_RX,
  638. .end = IRQ_SPORT1_RX+1,
  639. .flags = IORESOURCE_IRQ,
  640. },
  641. {
  642. .start = IRQ_SPORT1_ERROR,
  643. .end = IRQ_SPORT1_ERROR,
  644. .flags = IORESOURCE_IRQ,
  645. },
  646. };
  647. unsigned short bfin_sport1_peripherals[] = {
  648. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  649. P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
  650. };
  651. static struct platform_device bfin_sport1_uart_device = {
  652. .name = "bfin-sport-uart",
  653. .id = 1,
  654. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  655. .resource = bfin_sport1_uart_resources,
  656. .dev = {
  657. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  658. },
  659. };
  660. #endif
  661. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  662. static struct resource bfin_sport2_uart_resources[] = {
  663. {
  664. .start = SPORT2_TCR1,
  665. .end = SPORT2_MRCS3+4,
  666. .flags = IORESOURCE_MEM,
  667. },
  668. {
  669. .start = IRQ_SPORT2_RX,
  670. .end = IRQ_SPORT2_RX+1,
  671. .flags = IORESOURCE_IRQ,
  672. },
  673. {
  674. .start = IRQ_SPORT2_ERROR,
  675. .end = IRQ_SPORT2_ERROR,
  676. .flags = IORESOURCE_IRQ,
  677. },
  678. };
  679. unsigned short bfin_sport2_peripherals[] = {
  680. P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
  681. P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
  682. };
  683. static struct platform_device bfin_sport2_uart_device = {
  684. .name = "bfin-sport-uart",
  685. .id = 2,
  686. .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
  687. .resource = bfin_sport2_uart_resources,
  688. .dev = {
  689. .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
  690. },
  691. };
  692. #endif
  693. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  694. static struct resource bfin_sport3_uart_resources[] = {
  695. {
  696. .start = SPORT3_TCR1,
  697. .end = SPORT3_MRCS3+4,
  698. .flags = IORESOURCE_MEM,
  699. },
  700. {
  701. .start = IRQ_SPORT3_RX,
  702. .end = IRQ_SPORT3_RX+1,
  703. .flags = IORESOURCE_IRQ,
  704. },
  705. {
  706. .start = IRQ_SPORT3_ERROR,
  707. .end = IRQ_SPORT3_ERROR,
  708. .flags = IORESOURCE_IRQ,
  709. },
  710. };
  711. unsigned short bfin_sport3_peripherals[] = {
  712. P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
  713. P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
  714. };
  715. static struct platform_device bfin_sport3_uart_device = {
  716. .name = "bfin-sport-uart",
  717. .id = 3,
  718. .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
  719. .resource = bfin_sport3_uart_resources,
  720. .dev = {
  721. .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
  722. },
  723. };
  724. #endif
  725. #endif
  726. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  727. unsigned short bfin_can_peripherals[] = {
  728. P_CAN0_RX, P_CAN0_TX, 0
  729. };
  730. static struct resource bfin_can_resources[] = {
  731. {
  732. .start = 0xFFC02A00,
  733. .end = 0xFFC02FFF,
  734. .flags = IORESOURCE_MEM,
  735. },
  736. {
  737. .start = IRQ_CAN0_RX,
  738. .end = IRQ_CAN0_RX,
  739. .flags = IORESOURCE_IRQ,
  740. },
  741. {
  742. .start = IRQ_CAN0_TX,
  743. .end = IRQ_CAN0_TX,
  744. .flags = IORESOURCE_IRQ,
  745. },
  746. {
  747. .start = IRQ_CAN0_ERROR,
  748. .end = IRQ_CAN0_ERROR,
  749. .flags = IORESOURCE_IRQ,
  750. },
  751. };
  752. static struct platform_device bfin_can_device = {
  753. .name = "bfin_can",
  754. .num_resources = ARRAY_SIZE(bfin_can_resources),
  755. .resource = bfin_can_resources,
  756. .dev = {
  757. .platform_data = &bfin_can_peripherals, /* Passed to driver */
  758. },
  759. };
  760. #endif
  761. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  762. static struct resource bfin_atapi_resources[] = {
  763. {
  764. .start = 0xFFC03800,
  765. .end = 0xFFC0386F,
  766. .flags = IORESOURCE_MEM,
  767. },
  768. {
  769. .start = IRQ_ATAPI_ERR,
  770. .end = IRQ_ATAPI_ERR,
  771. .flags = IORESOURCE_IRQ,
  772. },
  773. };
  774. static struct platform_device bfin_atapi_device = {
  775. .name = "pata-bf54x",
  776. .id = -1,
  777. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  778. .resource = bfin_atapi_resources,
  779. };
  780. #endif
  781. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  782. static struct mtd_partition partition_info[] = {
  783. {
  784. .name = "bootloader(nand)",
  785. .offset = 0,
  786. .size = 0x80000,
  787. }, {
  788. .name = "linux kernel(nand)",
  789. .offset = MTDPART_OFS_APPEND,
  790. .size = 4 * 1024 * 1024,
  791. },
  792. {
  793. .name = "file system(nand)",
  794. .offset = MTDPART_OFS_APPEND,
  795. .size = MTDPART_SIZ_FULL,
  796. },
  797. };
  798. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  799. .data_width = NFC_NWIDTH_8,
  800. .partitions = partition_info,
  801. .nr_partitions = ARRAY_SIZE(partition_info),
  802. .rd_dly = 3,
  803. .wr_dly = 3,
  804. };
  805. static struct resource bf5xx_nand_resources[] = {
  806. {
  807. .start = 0xFFC03B00,
  808. .end = 0xFFC03B4F,
  809. .flags = IORESOURCE_MEM,
  810. },
  811. {
  812. .start = CH_NFC,
  813. .end = CH_NFC,
  814. .flags = IORESOURCE_IRQ,
  815. },
  816. };
  817. static struct platform_device bf5xx_nand_device = {
  818. .name = "bf5xx-nand",
  819. .id = 0,
  820. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  821. .resource = bf5xx_nand_resources,
  822. .dev = {
  823. .platform_data = &bf5xx_nand_platform,
  824. },
  825. };
  826. #endif
  827. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  828. static struct bfin_sd_host bfin_sdh_data = {
  829. .dma_chan = CH_SDH,
  830. .irq_int0 = IRQ_SDH_MASK0,
  831. .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
  832. };
  833. static struct platform_device bf54x_sdh_device = {
  834. .name = "bfin-sdh",
  835. .id = 0,
  836. .dev = {
  837. .platform_data = &bfin_sdh_data,
  838. },
  839. };
  840. #endif
  841. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  842. static struct mtd_partition ezkit_partitions[] = {
  843. {
  844. .name = "bootloader(nor)",
  845. .size = 0x80000,
  846. .offset = 0,
  847. }, {
  848. .name = "linux kernel(nor)",
  849. .size = 0x400000,
  850. .offset = MTDPART_OFS_APPEND,
  851. }, {
  852. .name = "file system(nor)",
  853. .size = MTDPART_SIZ_FULL,
  854. .offset = MTDPART_OFS_APPEND,
  855. }
  856. };
  857. static struct physmap_flash_data ezkit_flash_data = {
  858. .width = 2,
  859. .parts = ezkit_partitions,
  860. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  861. };
  862. static struct resource ezkit_flash_resource = {
  863. .start = 0x20000000,
  864. .end = 0x21ffffff,
  865. .flags = IORESOURCE_MEM,
  866. };
  867. static struct platform_device ezkit_flash_device = {
  868. .name = "physmap-flash",
  869. .id = 0,
  870. .dev = {
  871. .platform_data = &ezkit_flash_data,
  872. },
  873. .num_resources = 1,
  874. .resource = &ezkit_flash_resource,
  875. };
  876. #endif
  877. #if defined(CONFIG_MTD_M25P80) \
  878. || defined(CONFIG_MTD_M25P80_MODULE)
  879. /* SPI flash chip (m25p16) */
  880. static struct mtd_partition bfin_spi_flash_partitions[] = {
  881. {
  882. .name = "bootloader(spi)",
  883. .size = 0x00080000,
  884. .offset = 0,
  885. .mask_flags = MTD_CAP_ROM
  886. }, {
  887. .name = "linux kernel(spi)",
  888. .size = MTDPART_SIZ_FULL,
  889. .offset = MTDPART_OFS_APPEND,
  890. }
  891. };
  892. static struct flash_platform_data bfin_spi_flash_data = {
  893. .name = "m25p80",
  894. .parts = bfin_spi_flash_partitions,
  895. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  896. .type = "m25p16",
  897. };
  898. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  899. .enable_dma = 0, /* use dma transfer with this chip*/
  900. .bits_per_word = 8,
  901. };
  902. #endif
  903. #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
  904. || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
  905. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  906. .enable_dma = 0,
  907. .bits_per_word = 16,
  908. };
  909. #endif
  910. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  911. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  912. .enable_dma = 0,
  913. .bits_per_word = 16,
  914. };
  915. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  916. .model = 7877,
  917. .vref_delay_usecs = 50, /* internal, no capacitor */
  918. .x_plate_ohms = 419,
  919. .y_plate_ohms = 486,
  920. .pressure_max = 1000,
  921. .pressure_min = 0,
  922. .stopacq_polarity = 1,
  923. .first_conversion_delay = 3,
  924. .acquisition_time = 1,
  925. .averaging = 1,
  926. .pen_down_acc_interval = 1,
  927. };
  928. #endif
  929. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  930. static struct bfin5xx_spi_chip spidev_chip_info = {
  931. .enable_dma = 0,
  932. .bits_per_word = 8,
  933. };
  934. #endif
  935. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  936. static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
  937. .enable_dma = 0, /* use dma transfer with this chip*/
  938. .bits_per_word = 8,
  939. };
  940. #endif
  941. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  942. #if defined(CONFIG_MTD_M25P80) \
  943. || defined(CONFIG_MTD_M25P80_MODULE)
  944. {
  945. /* the modalias must be the same as spi device driver name */
  946. .modalias = "m25p80", /* Name of spi_driver for this device */
  947. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  948. .bus_num = 0, /* Framework bus number */
  949. .chip_select = 1, /* SPI_SSEL1*/
  950. .platform_data = &bfin_spi_flash_data,
  951. .controller_data = &spi_flash_chip_info,
  952. .mode = SPI_MODE_3,
  953. },
  954. #endif
  955. #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
  956. || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
  957. {
  958. .modalias = "ad183x",
  959. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  960. .bus_num = 1,
  961. .chip_select = 4,
  962. .controller_data = &ad1836_spi_chip_info,
  963. },
  964. #endif
  965. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  966. {
  967. .modalias = "ad7877",
  968. .platform_data = &bfin_ad7877_ts_info,
  969. .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
  970. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  971. .bus_num = 0,
  972. .chip_select = 2,
  973. .controller_data = &spi_ad7877_chip_info,
  974. },
  975. #endif
  976. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  977. {
  978. .modalias = "spidev",
  979. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  980. .bus_num = 0,
  981. .chip_select = 1,
  982. .controller_data = &spidev_chip_info,
  983. },
  984. #endif
  985. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  986. {
  987. .modalias = "adxl34x",
  988. .platform_data = &adxl34x_info,
  989. .irq = IRQ_PC5,
  990. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  991. .bus_num = 1,
  992. .chip_select = 2,
  993. .controller_data = &spi_adxl34x_chip_info,
  994. .mode = SPI_MODE_3,
  995. },
  996. #endif
  997. };
  998. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  999. /* SPI (0) */
  1000. static struct resource bfin_spi0_resource[] = {
  1001. [0] = {
  1002. .start = SPI0_REGBASE,
  1003. .end = SPI0_REGBASE + 0xFF,
  1004. .flags = IORESOURCE_MEM,
  1005. },
  1006. [1] = {
  1007. .start = CH_SPI0,
  1008. .end = CH_SPI0,
  1009. .flags = IORESOURCE_DMA,
  1010. },
  1011. [2] = {
  1012. .start = IRQ_SPI0,
  1013. .end = IRQ_SPI0,
  1014. .flags = IORESOURCE_IRQ,
  1015. }
  1016. };
  1017. /* SPI (1) */
  1018. static struct resource bfin_spi1_resource[] = {
  1019. [0] = {
  1020. .start = SPI1_REGBASE,
  1021. .end = SPI1_REGBASE + 0xFF,
  1022. .flags = IORESOURCE_MEM,
  1023. },
  1024. [1] = {
  1025. .start = CH_SPI1,
  1026. .end = CH_SPI1,
  1027. .flags = IORESOURCE_DMA,
  1028. },
  1029. [2] = {
  1030. .start = IRQ_SPI1,
  1031. .end = IRQ_SPI1,
  1032. .flags = IORESOURCE_IRQ,
  1033. }
  1034. };
  1035. /* SPI controller data */
  1036. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  1037. .num_chipselect = 4,
  1038. .enable_dma = 1, /* master has the ability to do dma transfer */
  1039. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1040. };
  1041. static struct platform_device bf54x_spi_master0 = {
  1042. .name = "bfin-spi",
  1043. .id = 0, /* Bus number */
  1044. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1045. .resource = bfin_spi0_resource,
  1046. .dev = {
  1047. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  1048. },
  1049. };
  1050. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  1051. .num_chipselect = 4,
  1052. .enable_dma = 1, /* master has the ability to do dma transfer */
  1053. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  1054. };
  1055. static struct platform_device bf54x_spi_master1 = {
  1056. .name = "bfin-spi",
  1057. .id = 1, /* Bus number */
  1058. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  1059. .resource = bfin_spi1_resource,
  1060. .dev = {
  1061. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  1062. },
  1063. };
  1064. #endif /* spi master and devices */
  1065. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1066. static struct resource bfin_twi0_resource[] = {
  1067. [0] = {
  1068. .start = TWI0_REGBASE,
  1069. .end = TWI0_REGBASE + 0xFF,
  1070. .flags = IORESOURCE_MEM,
  1071. },
  1072. [1] = {
  1073. .start = IRQ_TWI0,
  1074. .end = IRQ_TWI0,
  1075. .flags = IORESOURCE_IRQ,
  1076. },
  1077. };
  1078. static struct platform_device i2c_bfin_twi0_device = {
  1079. .name = "i2c-bfin-twi",
  1080. .id = 0,
  1081. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1082. .resource = bfin_twi0_resource,
  1083. };
  1084. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1085. static struct resource bfin_twi1_resource[] = {
  1086. [0] = {
  1087. .start = TWI1_REGBASE,
  1088. .end = TWI1_REGBASE + 0xFF,
  1089. .flags = IORESOURCE_MEM,
  1090. },
  1091. [1] = {
  1092. .start = IRQ_TWI1,
  1093. .end = IRQ_TWI1,
  1094. .flags = IORESOURCE_IRQ,
  1095. },
  1096. };
  1097. static struct platform_device i2c_bfin_twi1_device = {
  1098. .name = "i2c-bfin-twi",
  1099. .id = 1,
  1100. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  1101. .resource = bfin_twi1_resource,
  1102. };
  1103. #endif
  1104. #endif
  1105. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  1106. };
  1107. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1108. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  1109. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  1110. {
  1111. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  1112. },
  1113. #endif
  1114. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  1115. {
  1116. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  1117. .irq = 212,
  1118. },
  1119. #endif
  1120. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  1121. {
  1122. I2C_BOARD_INFO("adxl34x", 0x53),
  1123. .irq = IRQ_PC5,
  1124. .platform_data = (void *)&adxl34x_info,
  1125. },
  1126. #endif
  1127. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  1128. {
  1129. I2C_BOARD_INFO("ad5252", 0x2f),
  1130. },
  1131. #endif
  1132. };
  1133. #endif
  1134. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1135. #include <linux/gpio_keys.h>
  1136. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  1137. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  1138. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  1139. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  1140. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  1141. };
  1142. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  1143. .buttons = bfin_gpio_keys_table,
  1144. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  1145. };
  1146. static struct platform_device bfin_device_gpiokeys = {
  1147. .name = "gpio-keys",
  1148. .dev = {
  1149. .platform_data = &bfin_gpio_keys_data,
  1150. },
  1151. };
  1152. #endif
  1153. static const unsigned int cclk_vlev_datasheet[] =
  1154. {
  1155. /*
  1156. * Internal VLEV BF54XSBBC1533
  1157. ****temporarily using these values until data sheet is updated
  1158. */
  1159. VRPAIR(VLEV_085, 150000000),
  1160. VRPAIR(VLEV_090, 250000000),
  1161. VRPAIR(VLEV_110, 276000000),
  1162. VRPAIR(VLEV_115, 301000000),
  1163. VRPAIR(VLEV_120, 525000000),
  1164. VRPAIR(VLEV_125, 550000000),
  1165. VRPAIR(VLEV_130, 600000000),
  1166. };
  1167. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1168. .tuple_tab = cclk_vlev_datasheet,
  1169. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1170. .vr_settling_time = 25 /* us */,
  1171. };
  1172. static struct platform_device bfin_dpmc = {
  1173. .name = "bfin dpmc",
  1174. .dev = {
  1175. .platform_data = &bfin_dmpc_vreg_data,
  1176. },
  1177. };
  1178. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1179. static struct platform_device bfin_i2s = {
  1180. .name = "bfin-i2s",
  1181. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1182. /* TODO: add platform data here */
  1183. };
  1184. #endif
  1185. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1186. static struct platform_device bfin_tdm = {
  1187. .name = "bfin-tdm",
  1188. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1189. /* TODO: add platform data here */
  1190. };
  1191. #endif
  1192. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1193. static struct platform_device bfin_ac97 = {
  1194. .name = "bfin-ac97",
  1195. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1196. /* TODO: add platform data here */
  1197. };
  1198. #endif
  1199. static struct platform_device *ezkit_devices[] __initdata = {
  1200. &bfin_dpmc,
  1201. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1202. &rtc_device,
  1203. #endif
  1204. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1205. #ifdef CONFIG_SERIAL_BFIN_UART0
  1206. &bfin_uart0_device,
  1207. #endif
  1208. #ifdef CONFIG_SERIAL_BFIN_UART1
  1209. &bfin_uart1_device,
  1210. #endif
  1211. #ifdef CONFIG_SERIAL_BFIN_UART2
  1212. &bfin_uart2_device,
  1213. #endif
  1214. #ifdef CONFIG_SERIAL_BFIN_UART3
  1215. &bfin_uart3_device,
  1216. #endif
  1217. #endif
  1218. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1219. #ifdef CONFIG_BFIN_SIR0
  1220. &bfin_sir0_device,
  1221. #endif
  1222. #ifdef CONFIG_BFIN_SIR1
  1223. &bfin_sir1_device,
  1224. #endif
  1225. #ifdef CONFIG_BFIN_SIR2
  1226. &bfin_sir2_device,
  1227. #endif
  1228. #ifdef CONFIG_BFIN_SIR3
  1229. &bfin_sir3_device,
  1230. #endif
  1231. #endif
  1232. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  1233. &bf54x_lq043_device,
  1234. #endif
  1235. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  1236. &smsc911x_device,
  1237. #endif
  1238. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  1239. &musb_device,
  1240. #endif
  1241. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1242. &bfin_isp1760_device,
  1243. #endif
  1244. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1245. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1246. &bfin_sport0_uart_device,
  1247. #endif
  1248. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1249. &bfin_sport1_uart_device,
  1250. #endif
  1251. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1252. &bfin_sport2_uart_device,
  1253. #endif
  1254. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  1255. &bfin_sport3_uart_device,
  1256. #endif
  1257. #endif
  1258. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  1259. &bfin_can_device,
  1260. #endif
  1261. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  1262. &bfin_atapi_device,
  1263. #endif
  1264. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  1265. &bf5xx_nand_device,
  1266. #endif
  1267. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  1268. &bf54x_sdh_device,
  1269. #endif
  1270. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  1271. &bf54x_spi_master0,
  1272. &bf54x_spi_master1,
  1273. #endif
  1274. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  1275. &bf54x_kpad_device,
  1276. #endif
  1277. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  1278. &bfin_rotary_device,
  1279. #endif
  1280. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1281. &i2c_bfin_twi0_device,
  1282. #if !defined(CONFIG_BF542)
  1283. &i2c_bfin_twi1_device,
  1284. #endif
  1285. #endif
  1286. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1287. &bfin_device_gpiokeys,
  1288. #endif
  1289. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1290. &ezkit_flash_device,
  1291. #endif
  1292. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1293. &bfin_i2s,
  1294. #endif
  1295. #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
  1296. &bfin_tdm,
  1297. #endif
  1298. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1299. &bfin_ac97,
  1300. #endif
  1301. };
  1302. static int __init ezkit_init(void)
  1303. {
  1304. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1305. i2c_register_board_info(0, bfin_i2c_board_info0,
  1306. ARRAY_SIZE(bfin_i2c_board_info0));
  1307. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1308. i2c_register_board_info(1, bfin_i2c_board_info1,
  1309. ARRAY_SIZE(bfin_i2c_board_info1));
  1310. #endif
  1311. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  1312. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1313. return 0;
  1314. }
  1315. arch_initcall(ezkit_init);
  1316. static struct platform_device *ezkit_early_devices[] __initdata = {
  1317. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  1318. #ifdef CONFIG_SERIAL_BFIN_UART0
  1319. &bfin_uart0_device,
  1320. #endif
  1321. #ifdef CONFIG_SERIAL_BFIN_UART1
  1322. &bfin_uart1_device,
  1323. #endif
  1324. #ifdef CONFIG_SERIAL_BFIN_UART2
  1325. &bfin_uart2_device,
  1326. #endif
  1327. #ifdef CONFIG_SERIAL_BFIN_UART3
  1328. &bfin_uart3_device,
  1329. #endif
  1330. #endif
  1331. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  1332. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1333. &bfin_sport0_uart_device,
  1334. #endif
  1335. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1336. &bfin_sport1_uart_device,
  1337. #endif
  1338. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1339. &bfin_sport2_uart_device,
  1340. #endif
  1341. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  1342. &bfin_sport3_uart_device,
  1343. #endif
  1344. #endif
  1345. };
  1346. void __init native_machine_early_platform_add_devices(void)
  1347. {
  1348. printk(KERN_INFO "register early platform devices\n");
  1349. early_platform_add_devices(ezkit_early_devices,
  1350. ARRAY_SIZE(ezkit_early_devices));
  1351. }