ezkit.c 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198
  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 <linux/pinctrl/machine.h>
  20. #include <linux/pinctrl/pinconf-generic.h>
  21. #include <linux/platform_data/pinctrl-adi2.h>
  22. #include <asm/bfin5xx_spi.h>
  23. #include <asm/dma.h>
  24. #include <asm/gpio.h>
  25. #include <asm/nand.h>
  26. #include <asm/dpmc.h>
  27. #include <asm/bfin_sport.h>
  28. #include <asm/portmux.h>
  29. #include <asm/bfin_sdh.h>
  30. #include <mach/bf54x_keys.h>
  31. #include <linux/input.h>
  32. #include <linux/spi/ad7877.h>
  33. /*
  34. * Name the Board for the /proc/cpuinfo
  35. */
  36. const char bfin_board_name[] = "ADI BF548-EZKIT";
  37. /*
  38. * Driver needs to know address, irq and flag pin.
  39. */
  40. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  41. #include <linux/usb/isp1760.h>
  42. static struct resource bfin_isp1760_resources[] = {
  43. [0] = {
  44. .start = 0x2C0C0000,
  45. .end = 0x2C0C0000 + 0xfffff,
  46. .flags = IORESOURCE_MEM,
  47. },
  48. [1] = {
  49. .start = IRQ_PG7,
  50. .end = IRQ_PG7,
  51. .flags = IORESOURCE_IRQ,
  52. },
  53. };
  54. static struct isp1760_platform_data isp1760_priv = {
  55. .is_isp1761 = 0,
  56. .bus_width_16 = 1,
  57. .port1_otg = 0,
  58. .analog_oc = 0,
  59. .dack_polarity_high = 0,
  60. .dreq_polarity_high = 0,
  61. };
  62. static struct platform_device bfin_isp1760_device = {
  63. .name = "isp1760",
  64. .id = 0,
  65. .dev = {
  66. .platform_data = &isp1760_priv,
  67. },
  68. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  69. .resource = bfin_isp1760_resources,
  70. };
  71. #endif
  72. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  73. #include <mach/bf54x-lq043.h>
  74. static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
  75. .width = 95,
  76. .height = 54,
  77. .xres = {480, 480, 480},
  78. .yres = {272, 272, 272},
  79. .bpp = {24, 24, 24},
  80. .disp = GPIO_PE3,
  81. };
  82. static struct resource bf54x_lq043_resources[] = {
  83. {
  84. .start = IRQ_EPPI0_ERR,
  85. .end = IRQ_EPPI0_ERR,
  86. .flags = IORESOURCE_IRQ,
  87. },
  88. };
  89. static struct platform_device bf54x_lq043_device = {
  90. .name = "bf54x-lq043",
  91. .id = -1,
  92. .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
  93. .resource = bf54x_lq043_resources,
  94. .dev = {
  95. .platform_data = &bf54x_lq043_data,
  96. },
  97. };
  98. #endif
  99. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  100. static const unsigned int bf548_keymap[] = {
  101. KEYVAL(0, 0, KEY_ENTER),
  102. KEYVAL(0, 1, KEY_HELP),
  103. KEYVAL(0, 2, KEY_0),
  104. KEYVAL(0, 3, KEY_BACKSPACE),
  105. KEYVAL(1, 0, KEY_TAB),
  106. KEYVAL(1, 1, KEY_9),
  107. KEYVAL(1, 2, KEY_8),
  108. KEYVAL(1, 3, KEY_7),
  109. KEYVAL(2, 0, KEY_DOWN),
  110. KEYVAL(2, 1, KEY_6),
  111. KEYVAL(2, 2, KEY_5),
  112. KEYVAL(2, 3, KEY_4),
  113. KEYVAL(3, 0, KEY_UP),
  114. KEYVAL(3, 1, KEY_3),
  115. KEYVAL(3, 2, KEY_2),
  116. KEYVAL(3, 3, KEY_1),
  117. };
  118. static struct bfin_kpad_platform_data bf54x_kpad_data = {
  119. .rows = 4,
  120. .cols = 4,
  121. .keymap = bf548_keymap,
  122. .keymapsize = ARRAY_SIZE(bf548_keymap),
  123. .repeat = 0,
  124. .debounce_time = 5000, /* ns (5ms) */
  125. .coldrive_time = 1000, /* ns (1ms) */
  126. .keyup_test_interval = 50, /* ms (50ms) */
  127. };
  128. static struct resource bf54x_kpad_resources[] = {
  129. {
  130. .start = IRQ_KEY,
  131. .end = IRQ_KEY,
  132. .flags = IORESOURCE_IRQ,
  133. },
  134. };
  135. static struct platform_device bf54x_kpad_device = {
  136. .name = "bf54x-keys",
  137. .id = -1,
  138. .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
  139. .resource = bf54x_kpad_resources,
  140. .dev = {
  141. .platform_data = &bf54x_kpad_data,
  142. },
  143. };
  144. #endif
  145. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  146. #include <asm/bfin_rotary.h>
  147. static struct bfin_rotary_platform_data bfin_rotary_data = {
  148. /*.rotary_up_key = KEY_UP,*/
  149. /*.rotary_down_key = KEY_DOWN,*/
  150. .rotary_rel_code = REL_WHEEL,
  151. .rotary_button_key = KEY_ENTER,
  152. .debounce = 10, /* 0..17 */
  153. .mode = ROT_QUAD_ENC | ROT_DEBE,
  154. .pm_wakeup = 1,
  155. };
  156. static struct resource bfin_rotary_resources[] = {
  157. {
  158. .start = IRQ_CNT,
  159. .end = IRQ_CNT,
  160. .flags = IORESOURCE_IRQ,
  161. },
  162. };
  163. static struct platform_device bfin_rotary_device = {
  164. .name = "bfin-rotary",
  165. .id = -1,
  166. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  167. .resource = bfin_rotary_resources,
  168. .dev = {
  169. .platform_data = &bfin_rotary_data,
  170. },
  171. };
  172. #endif
  173. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  174. #include <linux/input/adxl34x.h>
  175. static const struct adxl34x_platform_data adxl34x_info = {
  176. .x_axis_offset = 0,
  177. .y_axis_offset = 0,
  178. .z_axis_offset = 0,
  179. .tap_threshold = 0x31,
  180. .tap_duration = 0x10,
  181. .tap_latency = 0x60,
  182. .tap_window = 0xF0,
  183. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  184. .act_axis_control = 0xFF,
  185. .activity_threshold = 5,
  186. .inactivity_threshold = 3,
  187. .inactivity_time = 4,
  188. .free_fall_threshold = 0x7,
  189. .free_fall_time = 0x20,
  190. .data_rate = 0x8,
  191. .data_range = ADXL_FULL_RES,
  192. .ev_type = EV_ABS,
  193. .ev_code_x = ABS_X, /* EV_REL */
  194. .ev_code_y = ABS_Y, /* EV_REL */
  195. .ev_code_z = ABS_Z, /* EV_REL */
  196. .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
  197. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  198. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  199. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  200. .fifo_mode = ADXL_FIFO_STREAM,
  201. .orientation_enable = ADXL_EN_ORIENTATION_3D,
  202. .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
  203. .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
  204. /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
  205. .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
  206. };
  207. #endif
  208. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  209. static struct platform_device rtc_device = {
  210. .name = "rtc-bfin",
  211. .id = -1,
  212. };
  213. #endif
  214. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  215. #ifdef CONFIG_SERIAL_BFIN_UART0
  216. static struct resource bfin_uart0_resources[] = {
  217. {
  218. .start = UART0_DLL,
  219. .end = UART0_RBR+2,
  220. .flags = IORESOURCE_MEM,
  221. },
  222. #ifdef CONFIG_EARLY_PRINTK
  223. {
  224. .start = PORTE_FER,
  225. .end = PORTE_FER+2,
  226. .flags = IORESOURCE_REG,
  227. },
  228. #endif
  229. {
  230. .start = IRQ_UART0_TX,
  231. .end = IRQ_UART0_TX,
  232. .flags = IORESOURCE_IRQ,
  233. },
  234. {
  235. .start = IRQ_UART0_RX,
  236. .end = IRQ_UART0_RX,
  237. .flags = IORESOURCE_IRQ,
  238. },
  239. {
  240. .start = IRQ_UART0_ERROR,
  241. .end = IRQ_UART0_ERROR,
  242. .flags = IORESOURCE_IRQ,
  243. },
  244. {
  245. .start = CH_UART0_TX,
  246. .end = CH_UART0_TX,
  247. .flags = IORESOURCE_DMA,
  248. },
  249. {
  250. .start = CH_UART0_RX,
  251. .end = CH_UART0_RX,
  252. .flags = IORESOURCE_DMA,
  253. },
  254. };
  255. static unsigned short bfin_uart0_peripherals[] = {
  256. P_UART0_TX, P_UART0_RX, 0
  257. };
  258. static struct platform_device bfin_uart0_device = {
  259. .name = "bfin-uart",
  260. .id = 0,
  261. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  262. .resource = bfin_uart0_resources,
  263. .dev = {
  264. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  265. },
  266. };
  267. #endif
  268. #ifdef CONFIG_SERIAL_BFIN_UART1
  269. static struct resource bfin_uart1_resources[] = {
  270. {
  271. .start = UART1_DLL,
  272. .end = UART1_RBR+2,
  273. .flags = IORESOURCE_MEM,
  274. },
  275. #ifdef CONFIG_EARLY_PRINTK
  276. {
  277. .start = PORTH_FER,
  278. .end = PORTH_FER+2,
  279. .flags = IORESOURCE_REG,
  280. },
  281. #endif
  282. {
  283. .start = IRQ_UART1_TX,
  284. .end = IRQ_UART1_TX,
  285. .flags = IORESOURCE_IRQ,
  286. },
  287. {
  288. .start = IRQ_UART1_RX,
  289. .end = IRQ_UART1_RX,
  290. .flags = IORESOURCE_IRQ,
  291. },
  292. {
  293. .start = IRQ_UART1_ERROR,
  294. .end = IRQ_UART1_ERROR,
  295. .flags = IORESOURCE_IRQ,
  296. },
  297. {
  298. .start = CH_UART1_TX,
  299. .end = CH_UART1_TX,
  300. .flags = IORESOURCE_DMA,
  301. },
  302. {
  303. .start = CH_UART1_RX,
  304. .end = CH_UART1_RX,
  305. .flags = IORESOURCE_DMA,
  306. },
  307. #ifdef CONFIG_BFIN_UART1_CTSRTS
  308. { /* CTS pin -- 0 means not supported */
  309. .start = GPIO_PE10,
  310. .end = GPIO_PE10,
  311. .flags = IORESOURCE_IO,
  312. },
  313. { /* RTS pin -- 0 means not supported */
  314. .start = GPIO_PE9,
  315. .end = GPIO_PE9,
  316. .flags = IORESOURCE_IO,
  317. },
  318. #endif
  319. };
  320. static unsigned short bfin_uart1_peripherals[] = {
  321. P_UART1_TX, P_UART1_RX,
  322. #ifdef CONFIG_BFIN_UART1_CTSRTS
  323. P_UART1_RTS, P_UART1_CTS,
  324. #endif
  325. 0
  326. };
  327. static struct platform_device bfin_uart1_device = {
  328. .name = "bfin-uart",
  329. .id = 1,
  330. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  331. .resource = bfin_uart1_resources,
  332. .dev = {
  333. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  334. },
  335. };
  336. #endif
  337. #ifdef CONFIG_SERIAL_BFIN_UART2
  338. static struct resource bfin_uart2_resources[] = {
  339. {
  340. .start = UART2_DLL,
  341. .end = UART2_RBR+2,
  342. .flags = IORESOURCE_MEM,
  343. },
  344. #ifdef CONFIG_EARLY_PRINTK
  345. {
  346. .start = PORTB_FER,
  347. .end = PORTB_FER+2,
  348. .flags = IORESOURCE_REG,
  349. },
  350. #endif
  351. {
  352. .start = IRQ_UART2_TX,
  353. .end = IRQ_UART2_TX,
  354. .flags = IORESOURCE_IRQ,
  355. },
  356. {
  357. .start = IRQ_UART2_RX,
  358. .end = IRQ_UART2_RX,
  359. .flags = IORESOURCE_IRQ,
  360. },
  361. {
  362. .start = IRQ_UART2_ERROR,
  363. .end = IRQ_UART2_ERROR,
  364. .flags = IORESOURCE_IRQ,
  365. },
  366. {
  367. .start = CH_UART2_TX,
  368. .end = CH_UART2_TX,
  369. .flags = IORESOURCE_DMA,
  370. },
  371. {
  372. .start = CH_UART2_RX,
  373. .end = CH_UART2_RX,
  374. .flags = IORESOURCE_DMA,
  375. },
  376. };
  377. static unsigned short bfin_uart2_peripherals[] = {
  378. P_UART2_TX, P_UART2_RX, 0
  379. };
  380. static struct platform_device bfin_uart2_device = {
  381. .name = "bfin-uart",
  382. .id = 2,
  383. .num_resources = ARRAY_SIZE(bfin_uart2_resources),
  384. .resource = bfin_uart2_resources,
  385. .dev = {
  386. .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
  387. },
  388. };
  389. #endif
  390. #ifdef CONFIG_SERIAL_BFIN_UART3
  391. static struct resource bfin_uart3_resources[] = {
  392. {
  393. .start = UART3_DLL,
  394. .end = UART3_RBR+2,
  395. .flags = IORESOURCE_MEM,
  396. },
  397. #ifdef CONFIG_EARLY_PRINTK
  398. {
  399. .start = PORTB_FER,
  400. .end = PORTB_FER+2,
  401. .flags = IORESOURCE_REG,
  402. },
  403. #endif
  404. {
  405. .start = IRQ_UART3_TX,
  406. .end = IRQ_UART3_TX,
  407. .flags = IORESOURCE_IRQ,
  408. },
  409. {
  410. .start = IRQ_UART3_RX,
  411. .end = IRQ_UART3_RX,
  412. .flags = IORESOURCE_IRQ,
  413. },
  414. {
  415. .start = IRQ_UART3_ERROR,
  416. .end = IRQ_UART3_ERROR,
  417. .flags = IORESOURCE_IRQ,
  418. },
  419. {
  420. .start = CH_UART3_TX,
  421. .end = CH_UART3_TX,
  422. .flags = IORESOURCE_DMA,
  423. },
  424. {
  425. .start = CH_UART3_RX,
  426. .end = CH_UART3_RX,
  427. .flags = IORESOURCE_DMA,
  428. },
  429. #ifdef CONFIG_BFIN_UART3_CTSRTS
  430. { /* CTS pin -- 0 means not supported */
  431. .start = GPIO_PB3,
  432. .end = GPIO_PB3,
  433. .flags = IORESOURCE_IO,
  434. },
  435. { /* RTS pin -- 0 means not supported */
  436. .start = GPIO_PB2,
  437. .end = GPIO_PB2,
  438. .flags = IORESOURCE_IO,
  439. },
  440. #endif
  441. };
  442. static unsigned short bfin_uart3_peripherals[] = {
  443. P_UART3_TX, P_UART3_RX,
  444. #ifdef CONFIG_BFIN_UART3_CTSRTS
  445. P_UART3_RTS, P_UART3_CTS,
  446. #endif
  447. 0
  448. };
  449. static struct platform_device bfin_uart3_device = {
  450. .name = "bfin-uart",
  451. .id = 3,
  452. .num_resources = ARRAY_SIZE(bfin_uart3_resources),
  453. .resource = bfin_uart3_resources,
  454. .dev = {
  455. .platform_data = &bfin_uart3_peripherals, /* Passed to driver */
  456. },
  457. };
  458. #endif
  459. #endif
  460. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  461. #ifdef CONFIG_BFIN_SIR0
  462. static struct resource bfin_sir0_resources[] = {
  463. {
  464. .start = 0xFFC00400,
  465. .end = 0xFFC004FF,
  466. .flags = IORESOURCE_MEM,
  467. },
  468. {
  469. .start = IRQ_UART0_RX,
  470. .end = IRQ_UART0_RX+1,
  471. .flags = IORESOURCE_IRQ,
  472. },
  473. {
  474. .start = CH_UART0_RX,
  475. .end = CH_UART0_RX+1,
  476. .flags = IORESOURCE_DMA,
  477. },
  478. };
  479. static struct platform_device bfin_sir0_device = {
  480. .name = "bfin_sir",
  481. .id = 0,
  482. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  483. .resource = bfin_sir0_resources,
  484. };
  485. #endif
  486. #ifdef CONFIG_BFIN_SIR1
  487. static struct resource bfin_sir1_resources[] = {
  488. {
  489. .start = 0xFFC02000,
  490. .end = 0xFFC020FF,
  491. .flags = IORESOURCE_MEM,
  492. },
  493. {
  494. .start = IRQ_UART1_RX,
  495. .end = IRQ_UART1_RX+1,
  496. .flags = IORESOURCE_IRQ,
  497. },
  498. {
  499. .start = CH_UART1_RX,
  500. .end = CH_UART1_RX+1,
  501. .flags = IORESOURCE_DMA,
  502. },
  503. };
  504. static struct platform_device bfin_sir1_device = {
  505. .name = "bfin_sir",
  506. .id = 1,
  507. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  508. .resource = bfin_sir1_resources,
  509. };
  510. #endif
  511. #ifdef CONFIG_BFIN_SIR2
  512. static struct resource bfin_sir2_resources[] = {
  513. {
  514. .start = 0xFFC02100,
  515. .end = 0xFFC021FF,
  516. .flags = IORESOURCE_MEM,
  517. },
  518. {
  519. .start = IRQ_UART2_RX,
  520. .end = IRQ_UART2_RX+1,
  521. .flags = IORESOURCE_IRQ,
  522. },
  523. {
  524. .start = CH_UART2_RX,
  525. .end = CH_UART2_RX+1,
  526. .flags = IORESOURCE_DMA,
  527. },
  528. };
  529. static struct platform_device bfin_sir2_device = {
  530. .name = "bfin_sir",
  531. .id = 2,
  532. .num_resources = ARRAY_SIZE(bfin_sir2_resources),
  533. .resource = bfin_sir2_resources,
  534. };
  535. #endif
  536. #ifdef CONFIG_BFIN_SIR3
  537. static struct resource bfin_sir3_resources[] = {
  538. {
  539. .start = 0xFFC03100,
  540. .end = 0xFFC031FF,
  541. .flags = IORESOURCE_MEM,
  542. },
  543. {
  544. .start = IRQ_UART3_RX,
  545. .end = IRQ_UART3_RX+1,
  546. .flags = IORESOURCE_IRQ,
  547. },
  548. {
  549. .start = CH_UART3_RX,
  550. .end = CH_UART3_RX+1,
  551. .flags = IORESOURCE_DMA,
  552. },
  553. };
  554. static struct platform_device bfin_sir3_device = {
  555. .name = "bfin_sir",
  556. .id = 3,
  557. .num_resources = ARRAY_SIZE(bfin_sir3_resources),
  558. .resource = bfin_sir3_resources,
  559. };
  560. #endif
  561. #endif
  562. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  563. #include <linux/smsc911x.h>
  564. static struct resource smsc911x_resources[] = {
  565. {
  566. .name = "smsc911x-memory",
  567. .start = 0x24000000,
  568. .end = 0x24000000 + 0xFF,
  569. .flags = IORESOURCE_MEM,
  570. },
  571. {
  572. .start = IRQ_PE8,
  573. .end = IRQ_PE8,
  574. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  575. },
  576. };
  577. static struct smsc911x_platform_config smsc911x_config = {
  578. .flags = SMSC911X_USE_32BIT,
  579. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  580. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  581. .phy_interface = PHY_INTERFACE_MODE_MII,
  582. };
  583. static struct platform_device smsc911x_device = {
  584. .name = "smsc911x",
  585. .id = 0,
  586. .num_resources = ARRAY_SIZE(smsc911x_resources),
  587. .resource = smsc911x_resources,
  588. .dev = {
  589. .platform_data = &smsc911x_config,
  590. },
  591. };
  592. #endif
  593. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  594. static struct resource musb_resources[] = {
  595. [0] = {
  596. .start = 0xFFC03C00,
  597. .end = 0xFFC040FF,
  598. .flags = IORESOURCE_MEM,
  599. },
  600. [1] = { /* general IRQ */
  601. .start = IRQ_USB_INT0,
  602. .end = IRQ_USB_INT0,
  603. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  604. .name = "mc"
  605. },
  606. [2] = { /* DMA IRQ */
  607. .start = IRQ_USB_DMA,
  608. .end = IRQ_USB_DMA,
  609. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  610. .name = "dma"
  611. },
  612. };
  613. static struct musb_hdrc_config musb_config = {
  614. .multipoint = 0,
  615. .dyn_fifo = 0,
  616. .soft_con = 1,
  617. .dma = 1,
  618. .num_eps = 8,
  619. .dma_channels = 8,
  620. .gpio_vrsel = GPIO_PE7,
  621. /* Some custom boards need to be active low, just set it to "0"
  622. * if it is the case.
  623. */
  624. .gpio_vrsel_active = 1,
  625. .clkin = 24, /* musb CLKIN in MHZ */
  626. };
  627. static struct musb_hdrc_platform_data musb_plat = {
  628. #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
  629. .mode = MUSB_OTG,
  630. #elif defined(CONFIG_USB_MUSB_HDRC)
  631. .mode = MUSB_HOST,
  632. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  633. .mode = MUSB_PERIPHERAL,
  634. #endif
  635. .config = &musb_config,
  636. };
  637. static u64 musb_dmamask = ~(u32)0;
  638. static struct platform_device musb_device = {
  639. .name = "musb-blackfin",
  640. .id = 0,
  641. .dev = {
  642. .dma_mask = &musb_dmamask,
  643. .coherent_dma_mask = 0xffffffff,
  644. .platform_data = &musb_plat,
  645. },
  646. .num_resources = ARRAY_SIZE(musb_resources),
  647. .resource = musb_resources,
  648. };
  649. #endif
  650. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  651. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  652. static struct resource bfin_sport0_uart_resources[] = {
  653. {
  654. .start = SPORT0_TCR1,
  655. .end = SPORT0_MRCS3+4,
  656. .flags = IORESOURCE_MEM,
  657. },
  658. {
  659. .start = IRQ_SPORT0_RX,
  660. .end = IRQ_SPORT0_RX+1,
  661. .flags = IORESOURCE_IRQ,
  662. },
  663. {
  664. .start = IRQ_SPORT0_ERROR,
  665. .end = IRQ_SPORT0_ERROR,
  666. .flags = IORESOURCE_IRQ,
  667. },
  668. };
  669. static unsigned short bfin_sport0_peripherals[] = {
  670. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  671. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
  672. };
  673. static struct platform_device bfin_sport0_uart_device = {
  674. .name = "bfin-sport-uart",
  675. .id = 0,
  676. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  677. .resource = bfin_sport0_uart_resources,
  678. .dev = {
  679. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  680. },
  681. };
  682. #endif
  683. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  684. static struct resource bfin_sport1_uart_resources[] = {
  685. {
  686. .start = SPORT1_TCR1,
  687. .end = SPORT1_MRCS3+4,
  688. .flags = IORESOURCE_MEM,
  689. },
  690. {
  691. .start = IRQ_SPORT1_RX,
  692. .end = IRQ_SPORT1_RX+1,
  693. .flags = IORESOURCE_IRQ,
  694. },
  695. {
  696. .start = IRQ_SPORT1_ERROR,
  697. .end = IRQ_SPORT1_ERROR,
  698. .flags = IORESOURCE_IRQ,
  699. },
  700. };
  701. static unsigned short bfin_sport1_peripherals[] = {
  702. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  703. P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
  704. };
  705. static struct platform_device bfin_sport1_uart_device = {
  706. .name = "bfin-sport-uart",
  707. .id = 1,
  708. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  709. .resource = bfin_sport1_uart_resources,
  710. .dev = {
  711. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  712. },
  713. };
  714. #endif
  715. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  716. static struct resource bfin_sport2_uart_resources[] = {
  717. {
  718. .start = SPORT2_TCR1,
  719. .end = SPORT2_MRCS3+4,
  720. .flags = IORESOURCE_MEM,
  721. },
  722. {
  723. .start = IRQ_SPORT2_RX,
  724. .end = IRQ_SPORT2_RX+1,
  725. .flags = IORESOURCE_IRQ,
  726. },
  727. {
  728. .start = IRQ_SPORT2_ERROR,
  729. .end = IRQ_SPORT2_ERROR,
  730. .flags = IORESOURCE_IRQ,
  731. },
  732. };
  733. static unsigned short bfin_sport2_peripherals[] = {
  734. P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
  735. P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
  736. };
  737. static struct platform_device bfin_sport2_uart_device = {
  738. .name = "bfin-sport-uart",
  739. .id = 2,
  740. .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
  741. .resource = bfin_sport2_uart_resources,
  742. .dev = {
  743. .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
  744. },
  745. };
  746. #endif
  747. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  748. static struct resource bfin_sport3_uart_resources[] = {
  749. {
  750. .start = SPORT3_TCR1,
  751. .end = SPORT3_MRCS3+4,
  752. .flags = IORESOURCE_MEM,
  753. },
  754. {
  755. .start = IRQ_SPORT3_RX,
  756. .end = IRQ_SPORT3_RX+1,
  757. .flags = IORESOURCE_IRQ,
  758. },
  759. {
  760. .start = IRQ_SPORT3_ERROR,
  761. .end = IRQ_SPORT3_ERROR,
  762. .flags = IORESOURCE_IRQ,
  763. },
  764. };
  765. static unsigned short bfin_sport3_peripherals[] = {
  766. P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
  767. P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
  768. };
  769. static struct platform_device bfin_sport3_uart_device = {
  770. .name = "bfin-sport-uart",
  771. .id = 3,
  772. .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
  773. .resource = bfin_sport3_uart_resources,
  774. .dev = {
  775. .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
  776. },
  777. };
  778. #endif
  779. #endif
  780. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  781. static unsigned short bfin_can0_peripherals[] = {
  782. P_CAN0_RX, P_CAN0_TX, 0
  783. };
  784. static struct resource bfin_can0_resources[] = {
  785. {
  786. .start = 0xFFC02A00,
  787. .end = 0xFFC02FFF,
  788. .flags = IORESOURCE_MEM,
  789. },
  790. {
  791. .start = IRQ_CAN0_RX,
  792. .end = IRQ_CAN0_RX,
  793. .flags = IORESOURCE_IRQ,
  794. },
  795. {
  796. .start = IRQ_CAN0_TX,
  797. .end = IRQ_CAN0_TX,
  798. .flags = IORESOURCE_IRQ,
  799. },
  800. {
  801. .start = IRQ_CAN0_ERROR,
  802. .end = IRQ_CAN0_ERROR,
  803. .flags = IORESOURCE_IRQ,
  804. },
  805. };
  806. static struct platform_device bfin_can0_device = {
  807. .name = "bfin_can",
  808. .id = 0,
  809. .num_resources = ARRAY_SIZE(bfin_can0_resources),
  810. .resource = bfin_can0_resources,
  811. .dev = {
  812. .platform_data = &bfin_can0_peripherals, /* Passed to driver */
  813. },
  814. };
  815. static unsigned short bfin_can1_peripherals[] = {
  816. P_CAN1_RX, P_CAN1_TX, 0
  817. };
  818. static struct resource bfin_can1_resources[] = {
  819. {
  820. .start = 0xFFC03200,
  821. .end = 0xFFC037FF,
  822. .flags = IORESOURCE_MEM,
  823. },
  824. {
  825. .start = IRQ_CAN1_RX,
  826. .end = IRQ_CAN1_RX,
  827. .flags = IORESOURCE_IRQ,
  828. },
  829. {
  830. .start = IRQ_CAN1_TX,
  831. .end = IRQ_CAN1_TX,
  832. .flags = IORESOURCE_IRQ,
  833. },
  834. {
  835. .start = IRQ_CAN1_ERROR,
  836. .end = IRQ_CAN1_ERROR,
  837. .flags = IORESOURCE_IRQ,
  838. },
  839. };
  840. static struct platform_device bfin_can1_device = {
  841. .name = "bfin_can",
  842. .id = 1,
  843. .num_resources = ARRAY_SIZE(bfin_can1_resources),
  844. .resource = bfin_can1_resources,
  845. .dev = {
  846. .platform_data = &bfin_can1_peripherals, /* Passed to driver */
  847. },
  848. };
  849. #endif
  850. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  851. static struct resource bfin_atapi_resources[] = {
  852. {
  853. .start = 0xFFC03800,
  854. .end = 0xFFC0386F,
  855. .flags = IORESOURCE_MEM,
  856. },
  857. {
  858. .start = IRQ_ATAPI_ERR,
  859. .end = IRQ_ATAPI_ERR,
  860. .flags = IORESOURCE_IRQ,
  861. },
  862. };
  863. static struct platform_device bfin_atapi_device = {
  864. .name = "pata-bf54x",
  865. .id = -1,
  866. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  867. .resource = bfin_atapi_resources,
  868. };
  869. #endif
  870. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  871. static struct mtd_partition partition_info[] = {
  872. {
  873. .name = "bootloader(nand)",
  874. .offset = 0,
  875. .size = 0x80000,
  876. }, {
  877. .name = "linux kernel(nand)",
  878. .offset = MTDPART_OFS_APPEND,
  879. .size = 4 * 1024 * 1024,
  880. },
  881. {
  882. .name = "file system(nand)",
  883. .offset = MTDPART_OFS_APPEND,
  884. .size = MTDPART_SIZ_FULL,
  885. },
  886. };
  887. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  888. .data_width = NFC_NWIDTH_8,
  889. .partitions = partition_info,
  890. .nr_partitions = ARRAY_SIZE(partition_info),
  891. .rd_dly = 3,
  892. .wr_dly = 3,
  893. };
  894. static struct resource bf5xx_nand_resources[] = {
  895. {
  896. .start = 0xFFC03B00,
  897. .end = 0xFFC03B4F,
  898. .flags = IORESOURCE_MEM,
  899. },
  900. {
  901. .start = CH_NFC,
  902. .end = CH_NFC,
  903. .flags = IORESOURCE_IRQ,
  904. },
  905. };
  906. static struct platform_device bf5xx_nand_device = {
  907. .name = "bf5xx-nand",
  908. .id = 0,
  909. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  910. .resource = bf5xx_nand_resources,
  911. .dev = {
  912. .platform_data = &bf5xx_nand_platform,
  913. },
  914. };
  915. #endif
  916. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  917. static struct bfin_sd_host bfin_sdh_data = {
  918. .dma_chan = CH_SDH,
  919. .irq_int0 = IRQ_SDH_MASK0,
  920. .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
  921. };
  922. static struct platform_device bf54x_sdh_device = {
  923. .name = "bfin-sdh",
  924. .id = 0,
  925. .dev = {
  926. .platform_data = &bfin_sdh_data,
  927. },
  928. };
  929. #endif
  930. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  931. static struct mtd_partition ezkit_partitions[] = {
  932. {
  933. .name = "bootloader(nor)",
  934. .size = 0x80000,
  935. .offset = 0,
  936. }, {
  937. .name = "linux kernel(nor)",
  938. .size = 0x400000,
  939. .offset = MTDPART_OFS_APPEND,
  940. }, {
  941. .name = "file system(nor)",
  942. .size = 0x1000000 - 0x80000 - 0x400000 - 0x8000 * 4,
  943. .offset = MTDPART_OFS_APPEND,
  944. }, {
  945. .name = "config(nor)",
  946. .size = 0x8000 * 3,
  947. .offset = MTDPART_OFS_APPEND,
  948. }, {
  949. .name = "u-boot env(nor)",
  950. .size = 0x8000,
  951. .offset = MTDPART_OFS_APPEND,
  952. }
  953. };
  954. static struct physmap_flash_data ezkit_flash_data = {
  955. .width = 2,
  956. .parts = ezkit_partitions,
  957. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  958. };
  959. static struct resource ezkit_flash_resource = {
  960. .start = 0x20000000,
  961. .end = 0x21ffffff,
  962. .flags = IORESOURCE_MEM,
  963. };
  964. static struct platform_device ezkit_flash_device = {
  965. .name = "physmap-flash",
  966. .id = 0,
  967. .dev = {
  968. .platform_data = &ezkit_flash_data,
  969. },
  970. .num_resources = 1,
  971. .resource = &ezkit_flash_resource,
  972. };
  973. #endif
  974. #if defined(CONFIG_MTD_M25P80) \
  975. || defined(CONFIG_MTD_M25P80_MODULE)
  976. /* SPI flash chip (m25p16) */
  977. static struct mtd_partition bfin_spi_flash_partitions[] = {
  978. {
  979. .name = "bootloader(spi)",
  980. .size = 0x00080000,
  981. .offset = 0,
  982. .mask_flags = MTD_CAP_ROM
  983. }, {
  984. .name = "linux kernel(spi)",
  985. .size = MTDPART_SIZ_FULL,
  986. .offset = MTDPART_OFS_APPEND,
  987. }
  988. };
  989. static struct flash_platform_data bfin_spi_flash_data = {
  990. .name = "m25p80",
  991. .parts = bfin_spi_flash_partitions,
  992. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  993. .type = "m25p16",
  994. };
  995. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  996. .enable_dma = 0, /* use dma transfer with this chip*/
  997. };
  998. #endif
  999. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  1000. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  1001. .model = 7877,
  1002. .vref_delay_usecs = 50, /* internal, no capacitor */
  1003. .x_plate_ohms = 419,
  1004. .y_plate_ohms = 486,
  1005. .pressure_max = 1000,
  1006. .pressure_min = 0,
  1007. .stopacq_polarity = 1,
  1008. .first_conversion_delay = 3,
  1009. .acquisition_time = 1,
  1010. .averaging = 1,
  1011. .pen_down_acc_interval = 1,
  1012. };
  1013. #endif
  1014. #ifdef CONFIG_PINCTRL_ADI2
  1015. # define ADI_PINT_DEVNAME "adi-gpio-pint"
  1016. # define ADI_GPIO_DEVNAME "adi-gpio"
  1017. # define ADI_PINCTRL_DEVNAME "pinctrl-adi2"
  1018. static struct platform_device bfin_pinctrl_device = {
  1019. .name = ADI_PINCTRL_DEVNAME,
  1020. .id = 0,
  1021. };
  1022. static struct resource bfin_pint0_resources[] = {
  1023. {
  1024. .start = PINT0_MASK_SET,
  1025. .end = PINT0_LATCH + 3,
  1026. .flags = IORESOURCE_MEM,
  1027. },
  1028. {
  1029. .start = IRQ_PINT0,
  1030. .end = IRQ_PINT0,
  1031. .flags = IORESOURCE_IRQ,
  1032. },
  1033. };
  1034. static struct platform_device bfin_pint0_device = {
  1035. .name = ADI_PINT_DEVNAME,
  1036. .id = 0,
  1037. .num_resources = ARRAY_SIZE(bfin_pint0_resources),
  1038. .resource = bfin_pint0_resources,
  1039. };
  1040. static struct resource bfin_pint1_resources[] = {
  1041. {
  1042. .start = PINT1_MASK_SET,
  1043. .end = PINT1_LATCH + 3,
  1044. .flags = IORESOURCE_MEM,
  1045. },
  1046. {
  1047. .start = IRQ_PINT1,
  1048. .end = IRQ_PINT1,
  1049. .flags = IORESOURCE_IRQ,
  1050. },
  1051. };
  1052. static struct platform_device bfin_pint1_device = {
  1053. .name = ADI_PINT_DEVNAME,
  1054. .id = 1,
  1055. .num_resources = ARRAY_SIZE(bfin_pint1_resources),
  1056. .resource = bfin_pint1_resources,
  1057. };
  1058. static struct resource bfin_pint2_resources[] = {
  1059. {
  1060. .start = PINT2_MASK_SET,
  1061. .end = PINT2_LATCH + 3,
  1062. .flags = IORESOURCE_MEM,
  1063. },
  1064. {
  1065. .start = IRQ_PINT2,
  1066. .end = IRQ_PINT2,
  1067. .flags = IORESOURCE_IRQ,
  1068. },
  1069. };
  1070. static struct platform_device bfin_pint2_device = {
  1071. .name = ADI_PINT_DEVNAME,
  1072. .id = 2,
  1073. .num_resources = ARRAY_SIZE(bfin_pint2_resources),
  1074. .resource = bfin_pint2_resources,
  1075. };
  1076. static struct resource bfin_pint3_resources[] = {
  1077. {
  1078. .start = PINT3_MASK_SET,
  1079. .end = PINT3_LATCH + 3,
  1080. .flags = IORESOURCE_MEM,
  1081. },
  1082. {
  1083. .start = IRQ_PINT3,
  1084. .end = IRQ_PINT3,
  1085. .flags = IORESOURCE_IRQ,
  1086. },
  1087. };
  1088. static struct platform_device bfin_pint3_device = {
  1089. .name = ADI_PINT_DEVNAME,
  1090. .id = 3,
  1091. .num_resources = ARRAY_SIZE(bfin_pint3_resources),
  1092. .resource = bfin_pint3_resources,
  1093. };
  1094. static struct resource bfin_gpa_resources[] = {
  1095. {
  1096. .start = PORTA_FER,
  1097. .end = PORTA_MUX + 3,
  1098. .flags = IORESOURCE_MEM,
  1099. },
  1100. { /* optional */
  1101. .start = IRQ_PA0,
  1102. .end = IRQ_PA0,
  1103. .flags = IORESOURCE_IRQ,
  1104. },
  1105. };
  1106. static struct adi_pinctrl_gpio_platform_data bfin_gpa_pdata = {
  1107. .port_gpio_base = GPIO_PA0, /* Optional */
  1108. .port_pin_base = GPIO_PA0,
  1109. .port_width = GPIO_BANKSIZE,
  1110. .pint_id = 0, /* PINT0 */
  1111. .pint_assign = true, /* PINT upper 16 bit */
  1112. .pint_map = 0, /* mapping mask in PINT */
  1113. };
  1114. static struct platform_device bfin_gpa_device = {
  1115. .name = ADI_GPIO_DEVNAME,
  1116. .id = 0,
  1117. .num_resources = ARRAY_SIZE(bfin_gpa_resources),
  1118. .resource = bfin_gpa_resources,
  1119. .dev = {
  1120. .platform_data = &bfin_gpa_pdata, /* Passed to driver */
  1121. },
  1122. };
  1123. static struct resource bfin_gpb_resources[] = {
  1124. {
  1125. .start = PORTB_FER,
  1126. .end = PORTB_MUX + 3,
  1127. .flags = IORESOURCE_MEM,
  1128. },
  1129. {
  1130. .start = IRQ_PB0,
  1131. .end = IRQ_PB0,
  1132. .flags = IORESOURCE_IRQ,
  1133. },
  1134. };
  1135. static struct adi_pinctrl_gpio_platform_data bfin_gpb_pdata = {
  1136. .port_gpio_base = GPIO_PB0,
  1137. .port_pin_base = GPIO_PB0,
  1138. .port_width = 15,
  1139. .pint_id = 0,
  1140. .pint_assign = true,
  1141. .pint_map = 1,
  1142. };
  1143. static struct platform_device bfin_gpb_device = {
  1144. .name = ADI_GPIO_DEVNAME,
  1145. .id = 1,
  1146. .num_resources = ARRAY_SIZE(bfin_gpb_resources),
  1147. .resource = bfin_gpb_resources,
  1148. .dev = {
  1149. .platform_data = &bfin_gpb_pdata, /* Passed to driver */
  1150. },
  1151. };
  1152. static struct resource bfin_gpc_resources[] = {
  1153. {
  1154. .start = PORTC_FER,
  1155. .end = PORTC_MUX + 3,
  1156. .flags = IORESOURCE_MEM,
  1157. },
  1158. {
  1159. .start = IRQ_PC0,
  1160. .end = IRQ_PC0,
  1161. .flags = IORESOURCE_IRQ,
  1162. },
  1163. };
  1164. static struct adi_pinctrl_gpio_platform_data bfin_gpc_pdata = {
  1165. .port_gpio_base = GPIO_PC0,
  1166. .port_pin_base = GPIO_PC0,
  1167. .port_width = 14,
  1168. .pint_id = 2,
  1169. .pint_assign = true,
  1170. .pint_map = 0,
  1171. };
  1172. static struct platform_device bfin_gpc_device = {
  1173. .name = ADI_GPIO_DEVNAME,
  1174. .id = 2,
  1175. .num_resources = ARRAY_SIZE(bfin_gpc_resources),
  1176. .resource = bfin_gpc_resources,
  1177. .dev = {
  1178. .platform_data = &bfin_gpc_pdata, /* Passed to driver */
  1179. },
  1180. };
  1181. static struct resource bfin_gpd_resources[] = {
  1182. {
  1183. .start = PORTD_FER,
  1184. .end = PORTD_MUX + 3,
  1185. .flags = IORESOURCE_MEM,
  1186. },
  1187. {
  1188. .start = IRQ_PD0,
  1189. .end = IRQ_PD0,
  1190. .flags = IORESOURCE_IRQ,
  1191. },
  1192. };
  1193. static struct adi_pinctrl_gpio_platform_data bfin_gpd_pdata = {
  1194. .port_gpio_base = GPIO_PD0,
  1195. .port_pin_base = GPIO_PD0,
  1196. .port_width = GPIO_BANKSIZE,
  1197. .pint_id = 2,
  1198. .pint_assign = false,
  1199. .pint_map = 1,
  1200. };
  1201. static struct platform_device bfin_gpd_device = {
  1202. .name = ADI_GPIO_DEVNAME,
  1203. .id = 3,
  1204. .num_resources = ARRAY_SIZE(bfin_gpd_resources),
  1205. .resource = bfin_gpd_resources,
  1206. .dev = {
  1207. .platform_data = &bfin_gpd_pdata, /* Passed to driver */
  1208. },
  1209. };
  1210. static struct resource bfin_gpe_resources[] = {
  1211. {
  1212. .start = PORTE_FER,
  1213. .end = PORTE_MUX + 3,
  1214. .flags = IORESOURCE_MEM,
  1215. },
  1216. {
  1217. .start = IRQ_PE0,
  1218. .end = IRQ_PE0,
  1219. .flags = IORESOURCE_IRQ,
  1220. },
  1221. };
  1222. static struct adi_pinctrl_gpio_platform_data bfin_gpe_pdata = {
  1223. .port_gpio_base = GPIO_PE0,
  1224. .port_pin_base = GPIO_PE0,
  1225. .port_width = GPIO_BANKSIZE,
  1226. .pint_id = 3,
  1227. .pint_assign = true,
  1228. .pint_map = 2,
  1229. };
  1230. static struct platform_device bfin_gpe_device = {
  1231. .name = ADI_GPIO_DEVNAME,
  1232. .id = 4,
  1233. .num_resources = ARRAY_SIZE(bfin_gpe_resources),
  1234. .resource = bfin_gpe_resources,
  1235. .dev = {
  1236. .platform_data = &bfin_gpe_pdata, /* Passed to driver */
  1237. },
  1238. };
  1239. static struct resource bfin_gpf_resources[] = {
  1240. {
  1241. .start = PORTF_FER,
  1242. .end = PORTF_MUX + 3,
  1243. .flags = IORESOURCE_MEM,
  1244. },
  1245. {
  1246. .start = IRQ_PF0,
  1247. .end = IRQ_PF0,
  1248. .flags = IORESOURCE_IRQ,
  1249. },
  1250. };
  1251. static struct adi_pinctrl_gpio_platform_data bfin_gpf_pdata = {
  1252. .port_gpio_base = GPIO_PF0,
  1253. .port_pin_base = GPIO_PF0,
  1254. .port_width = GPIO_BANKSIZE,
  1255. .pint_id = 3,
  1256. .pint_assign = false,
  1257. .pint_map = 3,
  1258. };
  1259. static struct platform_device bfin_gpf_device = {
  1260. .name = ADI_GPIO_DEVNAME,
  1261. .id = 5,
  1262. .num_resources = ARRAY_SIZE(bfin_gpf_resources),
  1263. .resource = bfin_gpf_resources,
  1264. .dev = {
  1265. .platform_data = &bfin_gpf_pdata, /* Passed to driver */
  1266. },
  1267. };
  1268. static struct resource bfin_gpg_resources[] = {
  1269. {
  1270. .start = PORTG_FER,
  1271. .end = PORTG_MUX + 3,
  1272. .flags = IORESOURCE_MEM,
  1273. },
  1274. {
  1275. .start = IRQ_PG0,
  1276. .end = IRQ_PG0,
  1277. .flags = IORESOURCE_IRQ,
  1278. },
  1279. };
  1280. static struct adi_pinctrl_gpio_platform_data bfin_gpg_pdata = {
  1281. .port_gpio_base = GPIO_PG0,
  1282. .port_pin_base = GPIO_PG0,
  1283. .port_width = GPIO_BANKSIZE,
  1284. .pint_id = -1,
  1285. };
  1286. static struct platform_device bfin_gpg_device = {
  1287. .name = ADI_GPIO_DEVNAME,
  1288. .id = 6,
  1289. .num_resources = ARRAY_SIZE(bfin_gpg_resources),
  1290. .resource = bfin_gpg_resources,
  1291. .dev = {
  1292. .platform_data = &bfin_gpg_pdata, /* Passed to driver */
  1293. },
  1294. };
  1295. static struct resource bfin_gph_resources[] = {
  1296. {
  1297. .start = PORTH_FER,
  1298. .end = PORTH_MUX + 3,
  1299. .flags = IORESOURCE_MEM,
  1300. },
  1301. {
  1302. .start = IRQ_PH0,
  1303. .end = IRQ_PH0,
  1304. .flags = IORESOURCE_IRQ,
  1305. },
  1306. };
  1307. static struct adi_pinctrl_gpio_platform_data bfin_gph_pdata = {
  1308. .port_gpio_base = GPIO_PH0,
  1309. .port_pin_base = GPIO_PH0,
  1310. .port_width = 14,
  1311. .pint_id = -1,
  1312. };
  1313. static struct platform_device bfin_gph_device = {
  1314. .name = ADI_GPIO_DEVNAME,
  1315. .id = 7,
  1316. .num_resources = ARRAY_SIZE(bfin_gph_resources),
  1317. .resource = bfin_gph_resources,
  1318. .dev = {
  1319. .platform_data = &bfin_gph_pdata, /* Passed to driver */
  1320. },
  1321. };
  1322. static struct resource bfin_gpi_resources[] = {
  1323. {
  1324. .start = PORTI_FER,
  1325. .end = PORTI_MUX + 3,
  1326. .flags = IORESOURCE_MEM,
  1327. },
  1328. {
  1329. .start = IRQ_PI0,
  1330. .end = IRQ_PI0,
  1331. .flags = IORESOURCE_IRQ,
  1332. },
  1333. };
  1334. static struct adi_pinctrl_gpio_platform_data bfin_gpi_pdata = {
  1335. .port_gpio_base = GPIO_PI0,
  1336. .port_pin_base = GPIO_PI0,
  1337. .port_width = GPIO_BANKSIZE,
  1338. .pint_id = -1,
  1339. };
  1340. static struct platform_device bfin_gpi_device = {
  1341. .name = ADI_GPIO_DEVNAME,
  1342. .id = 8,
  1343. .num_resources = ARRAY_SIZE(bfin_gpi_resources),
  1344. .resource = bfin_gpi_resources,
  1345. .dev = {
  1346. .platform_data = &bfin_gpi_pdata, /* Passed to driver */
  1347. },
  1348. };
  1349. static struct resource bfin_gpj_resources[] = {
  1350. {
  1351. .start = PORTJ_FER,
  1352. .end = PORTJ_MUX + 3,
  1353. .flags = IORESOURCE_MEM,
  1354. },
  1355. {
  1356. .start = IRQ_PJ0,
  1357. .end = IRQ_PJ0,
  1358. .flags = IORESOURCE_IRQ,
  1359. },
  1360. };
  1361. static struct adi_pinctrl_gpio_platform_data bfin_gpj_pdata = {
  1362. .port_gpio_base = GPIO_PJ0,
  1363. .port_pin_base = GPIO_PJ0,
  1364. .port_width = 14,
  1365. .pint_id = -1,
  1366. };
  1367. static struct platform_device bfin_gpj_device = {
  1368. .name = ADI_GPIO_DEVNAME,
  1369. .id = 9,
  1370. .num_resources = ARRAY_SIZE(bfin_gpj_resources),
  1371. .resource = bfin_gpj_resources,
  1372. .dev = {
  1373. .platform_data = &bfin_gpj_pdata, /* Passed to driver */
  1374. },
  1375. };
  1376. #endif
  1377. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  1378. #if defined(CONFIG_MTD_M25P80) \
  1379. || defined(CONFIG_MTD_M25P80_MODULE)
  1380. {
  1381. /* the modalias must be the same as spi device driver name */
  1382. .modalias = "m25p80", /* Name of spi_driver for this device */
  1383. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  1384. .bus_num = 0, /* Framework bus number */
  1385. .chip_select = MAX_CTRL_CS + GPIO_PE4, /* SPI_SSEL1*/
  1386. .platform_data = &bfin_spi_flash_data,
  1387. .controller_data = &spi_flash_chip_info,
  1388. .mode = SPI_MODE_3,
  1389. },
  1390. #endif
  1391. #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
  1392. || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
  1393. {
  1394. .modalias = "ad183x",
  1395. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  1396. .bus_num = 1,
  1397. .chip_select = MAX_CTRL_CS + GPIO_PG6, /* SPI_SSEL2 */
  1398. },
  1399. #endif
  1400. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  1401. {
  1402. .modalias = "ad7877",
  1403. .platform_data = &bfin_ad7877_ts_info,
  1404. .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
  1405. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  1406. .bus_num = 0,
  1407. .chip_select = MAX_CTRL_CS + GPIO_PE5, /* SPI_SSEL2 */
  1408. },
  1409. #endif
  1410. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  1411. {
  1412. .modalias = "spidev",
  1413. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  1414. .bus_num = 0,
  1415. .chip_select = MAX_CTRL_CS + GPIO_PE4, /* SPI_SSEL1 */
  1416. },
  1417. #endif
  1418. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  1419. {
  1420. .modalias = "adxl34x",
  1421. .platform_data = &adxl34x_info,
  1422. .irq = IRQ_PC5,
  1423. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  1424. .bus_num = 1,
  1425. .chip_select = MAX_CTRL_CS + GPIO_PG6, /* SPI_SSEL2 */
  1426. .mode = SPI_MODE_3,
  1427. },
  1428. #endif
  1429. };
  1430. #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
  1431. /* SPI (0) */
  1432. static struct resource bfin_spi0_resource[] = {
  1433. [0] = {
  1434. .start = SPI0_REGBASE,
  1435. .end = SPI0_REGBASE + 0xFF,
  1436. .flags = IORESOURCE_MEM,
  1437. },
  1438. [1] = {
  1439. .start = CH_SPI0,
  1440. .end = CH_SPI0,
  1441. .flags = IORESOURCE_DMA,
  1442. },
  1443. [2] = {
  1444. .start = IRQ_SPI0,
  1445. .end = IRQ_SPI0,
  1446. .flags = IORESOURCE_IRQ,
  1447. }
  1448. };
  1449. /* SPI (1) */
  1450. static struct resource bfin_spi1_resource[] = {
  1451. [0] = {
  1452. .start = SPI1_REGBASE,
  1453. .end = SPI1_REGBASE + 0xFF,
  1454. .flags = IORESOURCE_MEM,
  1455. },
  1456. [1] = {
  1457. .start = CH_SPI1,
  1458. .end = CH_SPI1,
  1459. .flags = IORESOURCE_DMA,
  1460. },
  1461. [2] = {
  1462. .start = IRQ_SPI1,
  1463. .end = IRQ_SPI1,
  1464. .flags = IORESOURCE_IRQ,
  1465. }
  1466. };
  1467. /* SPI controller data */
  1468. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  1469. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1470. .enable_dma = 1, /* master has the ability to do dma transfer */
  1471. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1472. };
  1473. static struct platform_device bf54x_spi_master0 = {
  1474. .name = "bfin-spi",
  1475. .id = 0, /* Bus number */
  1476. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1477. .resource = bfin_spi0_resource,
  1478. .dev = {
  1479. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  1480. },
  1481. };
  1482. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  1483. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1484. .enable_dma = 1, /* master has the ability to do dma transfer */
  1485. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  1486. };
  1487. static struct platform_device bf54x_spi_master1 = {
  1488. .name = "bfin-spi",
  1489. .id = 1, /* Bus number */
  1490. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  1491. .resource = bfin_spi1_resource,
  1492. .dev = {
  1493. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  1494. },
  1495. };
  1496. #endif /* spi master and devices */
  1497. #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
  1498. || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
  1499. #include <linux/videodev2.h>
  1500. #include <media/blackfin/bfin_capture.h>
  1501. #include <media/blackfin/ppi.h>
  1502. static const unsigned short ppi_req[] = {
  1503. P_PPI1_D0, P_PPI1_D1, P_PPI1_D2, P_PPI1_D3,
  1504. P_PPI1_D4, P_PPI1_D5, P_PPI1_D6, P_PPI1_D7,
  1505. P_PPI1_CLK, P_PPI1_FS1, P_PPI1_FS2,
  1506. 0,
  1507. };
  1508. static const struct ppi_info ppi_info = {
  1509. .type = PPI_TYPE_EPPI,
  1510. .dma_ch = CH_EPPI1,
  1511. .irq_err = IRQ_EPPI1_ERROR,
  1512. .base = (void __iomem *)EPPI1_STATUS,
  1513. .pin_req = ppi_req,
  1514. };
  1515. #if defined(CONFIG_VIDEO_VS6624) \
  1516. || defined(CONFIG_VIDEO_VS6624_MODULE)
  1517. static struct v4l2_input vs6624_inputs[] = {
  1518. {
  1519. .index = 0,
  1520. .name = "Camera",
  1521. .type = V4L2_INPUT_TYPE_CAMERA,
  1522. .std = V4L2_STD_UNKNOWN,
  1523. },
  1524. };
  1525. static struct bcap_route vs6624_routes[] = {
  1526. {
  1527. .input = 0,
  1528. .output = 0,
  1529. },
  1530. };
  1531. static const unsigned vs6624_ce_pin = GPIO_PG6;
  1532. static struct bfin_capture_config bfin_capture_data = {
  1533. .card_name = "BF548",
  1534. .inputs = vs6624_inputs,
  1535. .num_inputs = ARRAY_SIZE(vs6624_inputs),
  1536. .routes = vs6624_routes,
  1537. .i2c_adapter_id = 0,
  1538. .board_info = {
  1539. .type = "vs6624",
  1540. .addr = 0x10,
  1541. .platform_data = (void *)&vs6624_ce_pin,
  1542. },
  1543. .ppi_info = &ppi_info,
  1544. .ppi_control = (POLC | PACKEN | DLEN_8 | XFR_TYPE | 0x20),
  1545. .int_mask = 0xFFFFFFFF, /* disable error interrupt on eppi */
  1546. .blank_clocks = 8, /* 8 clocks as SAV and EAV */
  1547. };
  1548. #endif
  1549. static struct platform_device bfin_capture_device = {
  1550. .name = "bfin_capture",
  1551. .dev = {
  1552. .platform_data = &bfin_capture_data,
  1553. },
  1554. };
  1555. #endif
  1556. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1557. static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
  1558. static struct resource bfin_twi0_resource[] = {
  1559. [0] = {
  1560. .start = TWI0_REGBASE,
  1561. .end = TWI0_REGBASE + 0xFF,
  1562. .flags = IORESOURCE_MEM,
  1563. },
  1564. [1] = {
  1565. .start = IRQ_TWI0,
  1566. .end = IRQ_TWI0,
  1567. .flags = IORESOURCE_IRQ,
  1568. },
  1569. };
  1570. static struct platform_device i2c_bfin_twi0_device = {
  1571. .name = "i2c-bfin-twi",
  1572. .id = 0,
  1573. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1574. .resource = bfin_twi0_resource,
  1575. .dev = {
  1576. .platform_data = &bfin_twi0_pins,
  1577. },
  1578. };
  1579. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1580. static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
  1581. static struct resource bfin_twi1_resource[] = {
  1582. [0] = {
  1583. .start = TWI1_REGBASE,
  1584. .end = TWI1_REGBASE + 0xFF,
  1585. .flags = IORESOURCE_MEM,
  1586. },
  1587. [1] = {
  1588. .start = IRQ_TWI1,
  1589. .end = IRQ_TWI1,
  1590. .flags = IORESOURCE_IRQ,
  1591. },
  1592. };
  1593. static struct platform_device i2c_bfin_twi1_device = {
  1594. .name = "i2c-bfin-twi",
  1595. .id = 1,
  1596. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  1597. .resource = bfin_twi1_resource,
  1598. .dev = {
  1599. .platform_data = &bfin_twi1_pins,
  1600. },
  1601. };
  1602. #endif
  1603. #endif
  1604. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  1605. #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
  1606. {
  1607. I2C_BOARD_INFO("ssm2602", 0x1b),
  1608. },
  1609. #endif
  1610. };
  1611. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1612. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  1613. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  1614. {
  1615. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  1616. },
  1617. #endif
  1618. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  1619. {
  1620. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  1621. .irq = 212,
  1622. },
  1623. #endif
  1624. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  1625. {
  1626. I2C_BOARD_INFO("adxl34x", 0x53),
  1627. .irq = IRQ_PC5,
  1628. .platform_data = (void *)&adxl34x_info,
  1629. },
  1630. #endif
  1631. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  1632. {
  1633. I2C_BOARD_INFO("ad5252", 0x2f),
  1634. },
  1635. #endif
  1636. };
  1637. #endif
  1638. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1639. #include <linux/gpio_keys.h>
  1640. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  1641. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  1642. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  1643. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  1644. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  1645. };
  1646. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  1647. .buttons = bfin_gpio_keys_table,
  1648. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  1649. };
  1650. static struct platform_device bfin_device_gpiokeys = {
  1651. .name = "gpio-keys",
  1652. .dev = {
  1653. .platform_data = &bfin_gpio_keys_data,
  1654. },
  1655. };
  1656. #endif
  1657. static const unsigned int cclk_vlev_datasheet[] =
  1658. {
  1659. /*
  1660. * Internal VLEV BF54XSBBC1533
  1661. ****temporarily using these values until data sheet is updated
  1662. */
  1663. VRPAIR(VLEV_085, 150000000),
  1664. VRPAIR(VLEV_090, 250000000),
  1665. VRPAIR(VLEV_110, 276000000),
  1666. VRPAIR(VLEV_115, 301000000),
  1667. VRPAIR(VLEV_120, 525000000),
  1668. VRPAIR(VLEV_125, 550000000),
  1669. VRPAIR(VLEV_130, 600000000),
  1670. };
  1671. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1672. .tuple_tab = cclk_vlev_datasheet,
  1673. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1674. .vr_settling_time = 25 /* us */,
  1675. };
  1676. static struct platform_device bfin_dpmc = {
  1677. .name = "bfin dpmc",
  1678. .dev = {
  1679. .platform_data = &bfin_dmpc_vreg_data,
  1680. },
  1681. };
  1682. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
  1683. defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1684. #define SPORT_REQ(x) \
  1685. [x] = {P_SPORT##x##_TFS, P_SPORT##x##_DTPRI, P_SPORT##x##_TSCLK, \
  1686. P_SPORT##x##_RFS, P_SPORT##x##_DRPRI, P_SPORT##x##_RSCLK, 0}
  1687. static const u16 bfin_snd_pin[][7] = {
  1688. SPORT_REQ(0),
  1689. SPORT_REQ(1),
  1690. SPORT_REQ(2),
  1691. SPORT_REQ(3),
  1692. };
  1693. static struct bfin_snd_platform_data bfin_snd_data[] = {
  1694. {
  1695. .pin_req = &bfin_snd_pin[0][0],
  1696. },
  1697. {
  1698. .pin_req = &bfin_snd_pin[1][0],
  1699. },
  1700. {
  1701. .pin_req = &bfin_snd_pin[2][0],
  1702. },
  1703. {
  1704. .pin_req = &bfin_snd_pin[3][0],
  1705. },
  1706. };
  1707. #define BFIN_SND_RES(x) \
  1708. [x] = { \
  1709. { \
  1710. .start = SPORT##x##_TCR1, \
  1711. .end = SPORT##x##_TCR1, \
  1712. .flags = IORESOURCE_MEM \
  1713. }, \
  1714. { \
  1715. .start = CH_SPORT##x##_RX, \
  1716. .end = CH_SPORT##x##_RX, \
  1717. .flags = IORESOURCE_DMA, \
  1718. }, \
  1719. { \
  1720. .start = CH_SPORT##x##_TX, \
  1721. .end = CH_SPORT##x##_TX, \
  1722. .flags = IORESOURCE_DMA, \
  1723. }, \
  1724. { \
  1725. .start = IRQ_SPORT##x##_ERROR, \
  1726. .end = IRQ_SPORT##x##_ERROR, \
  1727. .flags = IORESOURCE_IRQ, \
  1728. } \
  1729. }
  1730. static struct resource bfin_snd_resources[][4] = {
  1731. BFIN_SND_RES(0),
  1732. BFIN_SND_RES(1),
  1733. BFIN_SND_RES(2),
  1734. BFIN_SND_RES(3),
  1735. };
  1736. #endif
  1737. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1738. static struct platform_device bfin_i2s_pcm = {
  1739. .name = "bfin-i2s-pcm-audio",
  1740. .id = -1,
  1741. };
  1742. #endif
  1743. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1744. static struct platform_device bfin_ac97_pcm = {
  1745. .name = "bfin-ac97-pcm-audio",
  1746. .id = -1,
  1747. };
  1748. #endif
  1749. #if defined(CONFIG_SND_BF5XX_SOC_AD73311) || defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE)
  1750. static struct platform_device bfin_ad73311_codec_device = {
  1751. .name = "ad73311",
  1752. .id = -1,
  1753. };
  1754. #endif
  1755. #if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE)
  1756. static struct platform_device bfin_ad1980_codec_device = {
  1757. .name = "ad1980",
  1758. .id = -1,
  1759. };
  1760. #endif
  1761. #if defined(CONFIG_SND_BF5XX_SOC_I2S) || defined(CONFIG_SND_BF5XX_SOC_I2S_MODULE)
  1762. static struct platform_device bfin_i2s = {
  1763. .name = "bfin-i2s",
  1764. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1765. .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
  1766. .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
  1767. .dev = {
  1768. .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
  1769. },
  1770. };
  1771. #endif
  1772. #if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE)
  1773. static struct platform_device bfin_ac97 = {
  1774. .name = "bfin-ac97",
  1775. .id = CONFIG_SND_BF5XX_SPORT_NUM,
  1776. .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
  1777. .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
  1778. .dev = {
  1779. .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
  1780. },
  1781. };
  1782. #endif
  1783. static struct platform_device *ezkit_devices[] __initdata = {
  1784. &bfin_dpmc,
  1785. #if defined(CONFIG_PINCTRL_ADI2)
  1786. &bfin_pinctrl_device,
  1787. &bfin_pint0_device,
  1788. &bfin_pint1_device,
  1789. &bfin_pint2_device,
  1790. &bfin_pint3_device,
  1791. &bfin_gpa_device,
  1792. &bfin_gpb_device,
  1793. &bfin_gpc_device,
  1794. &bfin_gpd_device,
  1795. &bfin_gpe_device,
  1796. &bfin_gpf_device,
  1797. &bfin_gpg_device,
  1798. &bfin_gph_device,
  1799. &bfin_gpi_device,
  1800. &bfin_gpj_device,
  1801. #endif
  1802. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1803. &rtc_device,
  1804. #endif
  1805. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1806. #ifdef CONFIG_SERIAL_BFIN_UART0
  1807. &bfin_uart0_device,
  1808. #endif
  1809. #ifdef CONFIG_SERIAL_BFIN_UART1
  1810. &bfin_uart1_device,
  1811. #endif
  1812. #ifdef CONFIG_SERIAL_BFIN_UART2
  1813. &bfin_uart2_device,
  1814. #endif
  1815. #ifdef CONFIG_SERIAL_BFIN_UART3
  1816. &bfin_uart3_device,
  1817. #endif
  1818. #endif
  1819. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1820. #ifdef CONFIG_BFIN_SIR0
  1821. &bfin_sir0_device,
  1822. #endif
  1823. #ifdef CONFIG_BFIN_SIR1
  1824. &bfin_sir1_device,
  1825. #endif
  1826. #ifdef CONFIG_BFIN_SIR2
  1827. &bfin_sir2_device,
  1828. #endif
  1829. #ifdef CONFIG_BFIN_SIR3
  1830. &bfin_sir3_device,
  1831. #endif
  1832. #endif
  1833. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  1834. &bf54x_lq043_device,
  1835. #endif
  1836. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  1837. &smsc911x_device,
  1838. #endif
  1839. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  1840. &musb_device,
  1841. #endif
  1842. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1843. &bfin_isp1760_device,
  1844. #endif
  1845. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1846. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1847. &bfin_sport0_uart_device,
  1848. #endif
  1849. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1850. &bfin_sport1_uart_device,
  1851. #endif
  1852. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1853. &bfin_sport2_uart_device,
  1854. #endif
  1855. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  1856. &bfin_sport3_uart_device,
  1857. #endif
  1858. #endif
  1859. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  1860. &bfin_can0_device,
  1861. &bfin_can1_device,
  1862. #endif
  1863. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  1864. &bfin_atapi_device,
  1865. #endif
  1866. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  1867. &bf5xx_nand_device,
  1868. #endif
  1869. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  1870. &bf54x_sdh_device,
  1871. #endif
  1872. #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
  1873. &bf54x_spi_master0,
  1874. &bf54x_spi_master1,
  1875. #endif
  1876. #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
  1877. || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
  1878. &bfin_capture_device,
  1879. #endif
  1880. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  1881. &bf54x_kpad_device,
  1882. #endif
  1883. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  1884. &bfin_rotary_device,
  1885. #endif
  1886. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1887. &i2c_bfin_twi0_device,
  1888. #if !defined(CONFIG_BF542)
  1889. &i2c_bfin_twi1_device,
  1890. #endif
  1891. #endif
  1892. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1893. &bfin_device_gpiokeys,
  1894. #endif
  1895. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1896. &ezkit_flash_device,
  1897. #endif
  1898. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1899. &bfin_i2s_pcm,
  1900. #endif
  1901. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1902. &bfin_ac97_pcm,
  1903. #endif
  1904. #if defined(CONFIG_SND_BF5XX_SOC_AD1980) || defined(CONFIG_SND_BF5XX_SOC_AD1980_MODULE)
  1905. &bfin_ad1980_codec_device,
  1906. #endif
  1907. #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
  1908. &bfin_i2s,
  1909. #endif
  1910. #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
  1911. &bfin_ac97,
  1912. #endif
  1913. };
  1914. /* Pin control settings */
  1915. static struct pinctrl_map __initdata bfin_pinmux_map[] = {
  1916. /* per-device maps */
  1917. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.0", "pinctrl-adi2.0", NULL, "uart0"),
  1918. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL, "uart1"),
  1919. #ifdef CONFIG_BFIN_UART1_CTSRTS
  1920. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL, "uart1_ctsrts"),
  1921. #endif
  1922. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.2", "pinctrl-adi2.0", NULL, "uart2"),
  1923. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.3", "pinctrl-adi2.0", NULL, "uart3"),
  1924. #ifdef CONFIG_BFIN_UART3_CTSRTS
  1925. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.3", "pinctrl-adi2.0", NULL, "uart3_ctsrts"),
  1926. #endif
  1927. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.0", "pinctrl-adi2.0", NULL, "uart0"),
  1928. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.1", "pinctrl-adi2.0", NULL, "uart1"),
  1929. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.2", "pinctrl-adi2.0", NULL, "uart2"),
  1930. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.3", "pinctrl-adi2.0", NULL, "uart3"),
  1931. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sdh.0", "pinctrl-adi2.0", NULL, "rsi0"),
  1932. PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi.0", "pinctrl-adi2.0", NULL, "spi0"),
  1933. PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi.1", "pinctrl-adi2.0", NULL, "spi1"),
  1934. PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.0", "pinctrl-adi2.0", NULL, "twi0"),
  1935. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1936. PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.1", "pinctrl-adi2.0", NULL, "twi1"),
  1937. #endif
  1938. PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL, "rotary"),
  1939. PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL, "can0"),
  1940. PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.1", "pinctrl-adi2.0", NULL, "can1"),
  1941. PIN_MAP_MUX_GROUP_DEFAULT("bf54x-lq043", "pinctrl-adi2.0", NULL, "ppi0_24b"),
  1942. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL, "sport0"),
  1943. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL, "sport0"),
  1944. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.0", "pinctrl-adi2.0", NULL, "sport0"),
  1945. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL, "sport1"),
  1946. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.1", "pinctrl-adi2.0", NULL, "sport1"),
  1947. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.1", "pinctrl-adi2.0", NULL, "sport1"),
  1948. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.2", "pinctrl-adi2.0", NULL, "sport2"),
  1949. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.2", "pinctrl-adi2.0", NULL, "sport2"),
  1950. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.2", "pinctrl-adi2.0", NULL, "sport2"),
  1951. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.3", "pinctrl-adi2.0", NULL, "sport3"),
  1952. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.3", "pinctrl-adi2.0", NULL, "sport3"),
  1953. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.3", "pinctrl-adi2.0", NULL, "sport3"),
  1954. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.0", "pinctrl-adi2.0", NULL, "sport0"),
  1955. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.1", "pinctrl-adi2.0", NULL, "sport1"),
  1956. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.2", "pinctrl-adi2.0", NULL, "sport2"),
  1957. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.3", "pinctrl-adi2.0", NULL, "sport3"),
  1958. PIN_MAP_MUX_GROUP_DEFAULT("pata-bf54x", "pinctrl-adi2.0", NULL, "atapi"),
  1959. #ifdef CONFIG_BF548_ATAPI_ALTERNATIVE_PORT
  1960. PIN_MAP_MUX_GROUP_DEFAULT("pata-bf54x", "pinctrl-adi2.0", NULL, "atapi_alter"),
  1961. #endif
  1962. PIN_MAP_MUX_GROUP_DEFAULT("bf5xx-nand.0", "pinctrl-adi2.0", NULL, "nfc0"),
  1963. PIN_MAP_MUX_GROUP_DEFAULT("bf54x-keys", "pinctrl-adi2.0", NULL, "keys_4x4"),
  1964. };
  1965. static int __init ezkit_init(void)
  1966. {
  1967. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1968. /* Initialize pinmuxing */
  1969. pinctrl_register_mappings(bfin_pinmux_map,
  1970. ARRAY_SIZE(bfin_pinmux_map));
  1971. i2c_register_board_info(0, bfin_i2c_board_info0,
  1972. ARRAY_SIZE(bfin_i2c_board_info0));
  1973. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1974. i2c_register_board_info(1, bfin_i2c_board_info1,
  1975. ARRAY_SIZE(bfin_i2c_board_info1));
  1976. #endif
  1977. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  1978. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1979. return 0;
  1980. }
  1981. arch_initcall(ezkit_init);
  1982. static struct platform_device *ezkit_early_devices[] __initdata = {
  1983. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  1984. #ifdef CONFIG_SERIAL_BFIN_UART0
  1985. &bfin_uart0_device,
  1986. #endif
  1987. #ifdef CONFIG_SERIAL_BFIN_UART1
  1988. &bfin_uart1_device,
  1989. #endif
  1990. #ifdef CONFIG_SERIAL_BFIN_UART2
  1991. &bfin_uart2_device,
  1992. #endif
  1993. #ifdef CONFIG_SERIAL_BFIN_UART3
  1994. &bfin_uart3_device,
  1995. #endif
  1996. #endif
  1997. };
  1998. void __init native_machine_early_platform_add_devices(void)
  1999. {
  2000. printk(KERN_INFO "register early platform devices\n");
  2001. early_platform_add_devices(ezkit_early_devices,
  2002. ARRAY_SIZE(ezkit_early_devices));
  2003. }