ezkit.c 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199
  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 <linux/gpio.h>
  23. #include <asm/bfin5xx_spi.h>
  24. #include <asm/dma.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 IS_ENABLED(CONFIG_USB_ISP1760_HCD)
  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 IS_ENABLED(CONFIG_FB_BF54X_LQ043)
  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 IS_ENABLED(CONFIG_KEYBOARD_BFIN)
  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 IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
  146. #include <linux/platform_data/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 = CNT_CONFIG,
  159. .end = CNT_CONFIG + 0xff,
  160. .flags = IORESOURCE_MEM,
  161. },
  162. {
  163. .start = IRQ_CNT,
  164. .end = IRQ_CNT,
  165. .flags = IORESOURCE_IRQ,
  166. },
  167. };
  168. static struct platform_device bfin_rotary_device = {
  169. .name = "bfin-rotary",
  170. .id = -1,
  171. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  172. .resource = bfin_rotary_resources,
  173. .dev = {
  174. .platform_data = &bfin_rotary_data,
  175. },
  176. };
  177. #endif
  178. #if IS_ENABLED(CONFIG_INPUT_ADXL34X)
  179. #include <linux/input/adxl34x.h>
  180. static const struct adxl34x_platform_data adxl34x_info = {
  181. .x_axis_offset = 0,
  182. .y_axis_offset = 0,
  183. .z_axis_offset = 0,
  184. .tap_threshold = 0x31,
  185. .tap_duration = 0x10,
  186. .tap_latency = 0x60,
  187. .tap_window = 0xF0,
  188. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  189. .act_axis_control = 0xFF,
  190. .activity_threshold = 5,
  191. .inactivity_threshold = 3,
  192. .inactivity_time = 4,
  193. .free_fall_threshold = 0x7,
  194. .free_fall_time = 0x20,
  195. .data_rate = 0x8,
  196. .data_range = ADXL_FULL_RES,
  197. .ev_type = EV_ABS,
  198. .ev_code_x = ABS_X, /* EV_REL */
  199. .ev_code_y = ABS_Y, /* EV_REL */
  200. .ev_code_z = ABS_Z, /* EV_REL */
  201. .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
  202. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  203. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  204. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  205. .fifo_mode = ADXL_FIFO_STREAM,
  206. .orientation_enable = ADXL_EN_ORIENTATION_3D,
  207. .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
  208. .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
  209. /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
  210. .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
  211. };
  212. #endif
  213. #if IS_ENABLED(CONFIG_RTC_DRV_BFIN)
  214. static struct platform_device rtc_device = {
  215. .name = "rtc-bfin",
  216. .id = -1,
  217. };
  218. #endif
  219. #if IS_ENABLED(CONFIG_SERIAL_BFIN)
  220. #ifdef CONFIG_SERIAL_BFIN_UART0
  221. static struct resource bfin_uart0_resources[] = {
  222. {
  223. .start = UART0_DLL,
  224. .end = UART0_RBR+2,
  225. .flags = IORESOURCE_MEM,
  226. },
  227. #ifdef CONFIG_EARLY_PRINTK
  228. {
  229. .start = PORTE_FER,
  230. .end = PORTE_FER+2,
  231. .flags = IORESOURCE_REG,
  232. },
  233. #endif
  234. {
  235. .start = IRQ_UART0_TX,
  236. .end = IRQ_UART0_TX,
  237. .flags = IORESOURCE_IRQ,
  238. },
  239. {
  240. .start = IRQ_UART0_RX,
  241. .end = IRQ_UART0_RX,
  242. .flags = IORESOURCE_IRQ,
  243. },
  244. {
  245. .start = IRQ_UART0_ERROR,
  246. .end = IRQ_UART0_ERROR,
  247. .flags = IORESOURCE_IRQ,
  248. },
  249. {
  250. .start = CH_UART0_TX,
  251. .end = CH_UART0_TX,
  252. .flags = IORESOURCE_DMA,
  253. },
  254. {
  255. .start = CH_UART0_RX,
  256. .end = CH_UART0_RX,
  257. .flags = IORESOURCE_DMA,
  258. },
  259. };
  260. static unsigned short bfin_uart0_peripherals[] = {
  261. P_UART0_TX, P_UART0_RX, 0
  262. };
  263. static struct platform_device bfin_uart0_device = {
  264. .name = "bfin-uart",
  265. .id = 0,
  266. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  267. .resource = bfin_uart0_resources,
  268. .dev = {
  269. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  270. },
  271. };
  272. #endif
  273. #ifdef CONFIG_SERIAL_BFIN_UART1
  274. static struct resource bfin_uart1_resources[] = {
  275. {
  276. .start = UART1_DLL,
  277. .end = UART1_RBR+2,
  278. .flags = IORESOURCE_MEM,
  279. },
  280. #ifdef CONFIG_EARLY_PRINTK
  281. {
  282. .start = PORTH_FER,
  283. .end = PORTH_FER+2,
  284. .flags = IORESOURCE_REG,
  285. },
  286. #endif
  287. {
  288. .start = IRQ_UART1_TX,
  289. .end = IRQ_UART1_TX,
  290. .flags = IORESOURCE_IRQ,
  291. },
  292. {
  293. .start = IRQ_UART1_RX,
  294. .end = IRQ_UART1_RX,
  295. .flags = IORESOURCE_IRQ,
  296. },
  297. {
  298. .start = IRQ_UART1_ERROR,
  299. .end = IRQ_UART1_ERROR,
  300. .flags = IORESOURCE_IRQ,
  301. },
  302. {
  303. .start = CH_UART1_TX,
  304. .end = CH_UART1_TX,
  305. .flags = IORESOURCE_DMA,
  306. },
  307. {
  308. .start = CH_UART1_RX,
  309. .end = CH_UART1_RX,
  310. .flags = IORESOURCE_DMA,
  311. },
  312. #ifdef CONFIG_BFIN_UART1_CTSRTS
  313. { /* CTS pin -- 0 means not supported */
  314. .start = GPIO_PE10,
  315. .end = GPIO_PE10,
  316. .flags = IORESOURCE_IO,
  317. },
  318. { /* RTS pin -- 0 means not supported */
  319. .start = GPIO_PE9,
  320. .end = GPIO_PE9,
  321. .flags = IORESOURCE_IO,
  322. },
  323. #endif
  324. };
  325. static unsigned short bfin_uart1_peripherals[] = {
  326. P_UART1_TX, P_UART1_RX,
  327. #ifdef CONFIG_BFIN_UART1_CTSRTS
  328. P_UART1_RTS, P_UART1_CTS,
  329. #endif
  330. 0
  331. };
  332. static struct platform_device bfin_uart1_device = {
  333. .name = "bfin-uart",
  334. .id = 1,
  335. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  336. .resource = bfin_uart1_resources,
  337. .dev = {
  338. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  339. },
  340. };
  341. #endif
  342. #ifdef CONFIG_SERIAL_BFIN_UART2
  343. static struct resource bfin_uart2_resources[] = {
  344. {
  345. .start = UART2_DLL,
  346. .end = UART2_RBR+2,
  347. .flags = IORESOURCE_MEM,
  348. },
  349. #ifdef CONFIG_EARLY_PRINTK
  350. {
  351. .start = PORTB_FER,
  352. .end = PORTB_FER+2,
  353. .flags = IORESOURCE_REG,
  354. },
  355. #endif
  356. {
  357. .start = IRQ_UART2_TX,
  358. .end = IRQ_UART2_TX,
  359. .flags = IORESOURCE_IRQ,
  360. },
  361. {
  362. .start = IRQ_UART2_RX,
  363. .end = IRQ_UART2_RX,
  364. .flags = IORESOURCE_IRQ,
  365. },
  366. {
  367. .start = IRQ_UART2_ERROR,
  368. .end = IRQ_UART2_ERROR,
  369. .flags = IORESOURCE_IRQ,
  370. },
  371. {
  372. .start = CH_UART2_TX,
  373. .end = CH_UART2_TX,
  374. .flags = IORESOURCE_DMA,
  375. },
  376. {
  377. .start = CH_UART2_RX,
  378. .end = CH_UART2_RX,
  379. .flags = IORESOURCE_DMA,
  380. },
  381. };
  382. static unsigned short bfin_uart2_peripherals[] = {
  383. P_UART2_TX, P_UART2_RX, 0
  384. };
  385. static struct platform_device bfin_uart2_device = {
  386. .name = "bfin-uart",
  387. .id = 2,
  388. .num_resources = ARRAY_SIZE(bfin_uart2_resources),
  389. .resource = bfin_uart2_resources,
  390. .dev = {
  391. .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
  392. },
  393. };
  394. #endif
  395. #ifdef CONFIG_SERIAL_BFIN_UART3
  396. static struct resource bfin_uart3_resources[] = {
  397. {
  398. .start = UART3_DLL,
  399. .end = UART3_RBR+2,
  400. .flags = IORESOURCE_MEM,
  401. },
  402. #ifdef CONFIG_EARLY_PRINTK
  403. {
  404. .start = PORTB_FER,
  405. .end = PORTB_FER+2,
  406. .flags = IORESOURCE_REG,
  407. },
  408. #endif
  409. {
  410. .start = IRQ_UART3_TX,
  411. .end = IRQ_UART3_TX,
  412. .flags = IORESOURCE_IRQ,
  413. },
  414. {
  415. .start = IRQ_UART3_RX,
  416. .end = IRQ_UART3_RX,
  417. .flags = IORESOURCE_IRQ,
  418. },
  419. {
  420. .start = IRQ_UART3_ERROR,
  421. .end = IRQ_UART3_ERROR,
  422. .flags = IORESOURCE_IRQ,
  423. },
  424. {
  425. .start = CH_UART3_TX,
  426. .end = CH_UART3_TX,
  427. .flags = IORESOURCE_DMA,
  428. },
  429. {
  430. .start = CH_UART3_RX,
  431. .end = CH_UART3_RX,
  432. .flags = IORESOURCE_DMA,
  433. },
  434. #ifdef CONFIG_BFIN_UART3_CTSRTS
  435. { /* CTS pin -- 0 means not supported */
  436. .start = GPIO_PB3,
  437. .end = GPIO_PB3,
  438. .flags = IORESOURCE_IO,
  439. },
  440. { /* RTS pin -- 0 means not supported */
  441. .start = GPIO_PB2,
  442. .end = GPIO_PB2,
  443. .flags = IORESOURCE_IO,
  444. },
  445. #endif
  446. };
  447. static unsigned short bfin_uart3_peripherals[] = {
  448. P_UART3_TX, P_UART3_RX,
  449. #ifdef CONFIG_BFIN_UART3_CTSRTS
  450. P_UART3_RTS, P_UART3_CTS,
  451. #endif
  452. 0
  453. };
  454. static struct platform_device bfin_uart3_device = {
  455. .name = "bfin-uart",
  456. .id = 3,
  457. .num_resources = ARRAY_SIZE(bfin_uart3_resources),
  458. .resource = bfin_uart3_resources,
  459. .dev = {
  460. .platform_data = &bfin_uart3_peripherals, /* Passed to driver */
  461. },
  462. };
  463. #endif
  464. #endif
  465. #if IS_ENABLED(CONFIG_BFIN_SIR)
  466. #ifdef CONFIG_BFIN_SIR0
  467. static struct resource bfin_sir0_resources[] = {
  468. {
  469. .start = 0xFFC00400,
  470. .end = 0xFFC004FF,
  471. .flags = IORESOURCE_MEM,
  472. },
  473. {
  474. .start = IRQ_UART0_RX,
  475. .end = IRQ_UART0_RX+1,
  476. .flags = IORESOURCE_IRQ,
  477. },
  478. {
  479. .start = CH_UART0_RX,
  480. .end = CH_UART0_RX+1,
  481. .flags = IORESOURCE_DMA,
  482. },
  483. };
  484. static struct platform_device bfin_sir0_device = {
  485. .name = "bfin_sir",
  486. .id = 0,
  487. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  488. .resource = bfin_sir0_resources,
  489. };
  490. #endif
  491. #ifdef CONFIG_BFIN_SIR1
  492. static struct resource bfin_sir1_resources[] = {
  493. {
  494. .start = 0xFFC02000,
  495. .end = 0xFFC020FF,
  496. .flags = IORESOURCE_MEM,
  497. },
  498. {
  499. .start = IRQ_UART1_RX,
  500. .end = IRQ_UART1_RX+1,
  501. .flags = IORESOURCE_IRQ,
  502. },
  503. {
  504. .start = CH_UART1_RX,
  505. .end = CH_UART1_RX+1,
  506. .flags = IORESOURCE_DMA,
  507. },
  508. };
  509. static struct platform_device bfin_sir1_device = {
  510. .name = "bfin_sir",
  511. .id = 1,
  512. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  513. .resource = bfin_sir1_resources,
  514. };
  515. #endif
  516. #ifdef CONFIG_BFIN_SIR2
  517. static struct resource bfin_sir2_resources[] = {
  518. {
  519. .start = 0xFFC02100,
  520. .end = 0xFFC021FF,
  521. .flags = IORESOURCE_MEM,
  522. },
  523. {
  524. .start = IRQ_UART2_RX,
  525. .end = IRQ_UART2_RX+1,
  526. .flags = IORESOURCE_IRQ,
  527. },
  528. {
  529. .start = CH_UART2_RX,
  530. .end = CH_UART2_RX+1,
  531. .flags = IORESOURCE_DMA,
  532. },
  533. };
  534. static struct platform_device bfin_sir2_device = {
  535. .name = "bfin_sir",
  536. .id = 2,
  537. .num_resources = ARRAY_SIZE(bfin_sir2_resources),
  538. .resource = bfin_sir2_resources,
  539. };
  540. #endif
  541. #ifdef CONFIG_BFIN_SIR3
  542. static struct resource bfin_sir3_resources[] = {
  543. {
  544. .start = 0xFFC03100,
  545. .end = 0xFFC031FF,
  546. .flags = IORESOURCE_MEM,
  547. },
  548. {
  549. .start = IRQ_UART3_RX,
  550. .end = IRQ_UART3_RX+1,
  551. .flags = IORESOURCE_IRQ,
  552. },
  553. {
  554. .start = CH_UART3_RX,
  555. .end = CH_UART3_RX+1,
  556. .flags = IORESOURCE_DMA,
  557. },
  558. };
  559. static struct platform_device bfin_sir3_device = {
  560. .name = "bfin_sir",
  561. .id = 3,
  562. .num_resources = ARRAY_SIZE(bfin_sir3_resources),
  563. .resource = bfin_sir3_resources,
  564. };
  565. #endif
  566. #endif
  567. #if IS_ENABLED(CONFIG_SMSC911X)
  568. #include <linux/smsc911x.h>
  569. static struct resource smsc911x_resources[] = {
  570. {
  571. .name = "smsc911x-memory",
  572. .start = 0x24000000,
  573. .end = 0x24000000 + 0xFF,
  574. .flags = IORESOURCE_MEM,
  575. },
  576. {
  577. .start = IRQ_PE8,
  578. .end = IRQ_PE8,
  579. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  580. },
  581. };
  582. static struct smsc911x_platform_config smsc911x_config = {
  583. .flags = SMSC911X_USE_32BIT,
  584. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  585. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  586. .phy_interface = PHY_INTERFACE_MODE_MII,
  587. };
  588. static struct platform_device smsc911x_device = {
  589. .name = "smsc911x",
  590. .id = 0,
  591. .num_resources = ARRAY_SIZE(smsc911x_resources),
  592. .resource = smsc911x_resources,
  593. .dev = {
  594. .platform_data = &smsc911x_config,
  595. },
  596. };
  597. #endif
  598. #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
  599. static struct resource musb_resources[] = {
  600. [0] = {
  601. .start = 0xFFC03C00,
  602. .end = 0xFFC040FF,
  603. .flags = IORESOURCE_MEM,
  604. },
  605. [1] = { /* general IRQ */
  606. .start = IRQ_USB_INT0,
  607. .end = IRQ_USB_INT0,
  608. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  609. .name = "mc"
  610. },
  611. [2] = { /* DMA IRQ */
  612. .start = IRQ_USB_DMA,
  613. .end = IRQ_USB_DMA,
  614. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  615. .name = "dma"
  616. },
  617. };
  618. static struct musb_hdrc_config musb_config = {
  619. .multipoint = 0,
  620. .dyn_fifo = 0,
  621. .soft_con = 1,
  622. .dma = 1,
  623. .num_eps = 8,
  624. .dma_channels = 8,
  625. .gpio_vrsel = GPIO_PE7,
  626. /* Some custom boards need to be active low, just set it to "0"
  627. * if it is the case.
  628. */
  629. .gpio_vrsel_active = 1,
  630. .clkin = 24, /* musb CLKIN in MHZ */
  631. };
  632. static struct musb_hdrc_platform_data musb_plat = {
  633. #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
  634. .mode = MUSB_OTG,
  635. #elif defined(CONFIG_USB_MUSB_HDRC)
  636. .mode = MUSB_HOST,
  637. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  638. .mode = MUSB_PERIPHERAL,
  639. #endif
  640. .config = &musb_config,
  641. };
  642. static u64 musb_dmamask = ~(u32)0;
  643. static struct platform_device musb_device = {
  644. .name = "musb-blackfin",
  645. .id = 0,
  646. .dev = {
  647. .dma_mask = &musb_dmamask,
  648. .coherent_dma_mask = 0xffffffff,
  649. .platform_data = &musb_plat,
  650. },
  651. .num_resources = ARRAY_SIZE(musb_resources),
  652. .resource = musb_resources,
  653. };
  654. #endif
  655. #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
  656. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  657. static struct resource bfin_sport0_uart_resources[] = {
  658. {
  659. .start = SPORT0_TCR1,
  660. .end = SPORT0_MRCS3+4,
  661. .flags = IORESOURCE_MEM,
  662. },
  663. {
  664. .start = IRQ_SPORT0_RX,
  665. .end = IRQ_SPORT0_RX+1,
  666. .flags = IORESOURCE_IRQ,
  667. },
  668. {
  669. .start = IRQ_SPORT0_ERROR,
  670. .end = IRQ_SPORT0_ERROR,
  671. .flags = IORESOURCE_IRQ,
  672. },
  673. };
  674. static unsigned short bfin_sport0_peripherals[] = {
  675. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  676. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
  677. };
  678. static struct platform_device bfin_sport0_uart_device = {
  679. .name = "bfin-sport-uart",
  680. .id = 0,
  681. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  682. .resource = bfin_sport0_uart_resources,
  683. .dev = {
  684. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  685. },
  686. };
  687. #endif
  688. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  689. static struct resource bfin_sport1_uart_resources[] = {
  690. {
  691. .start = SPORT1_TCR1,
  692. .end = SPORT1_MRCS3+4,
  693. .flags = IORESOURCE_MEM,
  694. },
  695. {
  696. .start = IRQ_SPORT1_RX,
  697. .end = IRQ_SPORT1_RX+1,
  698. .flags = IORESOURCE_IRQ,
  699. },
  700. {
  701. .start = IRQ_SPORT1_ERROR,
  702. .end = IRQ_SPORT1_ERROR,
  703. .flags = IORESOURCE_IRQ,
  704. },
  705. };
  706. static unsigned short bfin_sport1_peripherals[] = {
  707. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  708. P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
  709. };
  710. static struct platform_device bfin_sport1_uart_device = {
  711. .name = "bfin-sport-uart",
  712. .id = 1,
  713. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  714. .resource = bfin_sport1_uart_resources,
  715. .dev = {
  716. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  717. },
  718. };
  719. #endif
  720. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  721. static struct resource bfin_sport2_uart_resources[] = {
  722. {
  723. .start = SPORT2_TCR1,
  724. .end = SPORT2_MRCS3+4,
  725. .flags = IORESOURCE_MEM,
  726. },
  727. {
  728. .start = IRQ_SPORT2_RX,
  729. .end = IRQ_SPORT2_RX+1,
  730. .flags = IORESOURCE_IRQ,
  731. },
  732. {
  733. .start = IRQ_SPORT2_ERROR,
  734. .end = IRQ_SPORT2_ERROR,
  735. .flags = IORESOURCE_IRQ,
  736. },
  737. };
  738. static unsigned short bfin_sport2_peripherals[] = {
  739. P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
  740. P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
  741. };
  742. static struct platform_device bfin_sport2_uart_device = {
  743. .name = "bfin-sport-uart",
  744. .id = 2,
  745. .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
  746. .resource = bfin_sport2_uart_resources,
  747. .dev = {
  748. .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
  749. },
  750. };
  751. #endif
  752. #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
  753. static struct resource bfin_sport3_uart_resources[] = {
  754. {
  755. .start = SPORT3_TCR1,
  756. .end = SPORT3_MRCS3+4,
  757. .flags = IORESOURCE_MEM,
  758. },
  759. {
  760. .start = IRQ_SPORT3_RX,
  761. .end = IRQ_SPORT3_RX+1,
  762. .flags = IORESOURCE_IRQ,
  763. },
  764. {
  765. .start = IRQ_SPORT3_ERROR,
  766. .end = IRQ_SPORT3_ERROR,
  767. .flags = IORESOURCE_IRQ,
  768. },
  769. };
  770. static unsigned short bfin_sport3_peripherals[] = {
  771. P_SPORT3_TFS, P_SPORT3_DTPRI, P_SPORT3_TSCLK, P_SPORT3_RFS,
  772. P_SPORT3_DRPRI, P_SPORT3_RSCLK, P_SPORT3_DRSEC, P_SPORT3_DTSEC, 0
  773. };
  774. static struct platform_device bfin_sport3_uart_device = {
  775. .name = "bfin-sport-uart",
  776. .id = 3,
  777. .num_resources = ARRAY_SIZE(bfin_sport3_uart_resources),
  778. .resource = bfin_sport3_uart_resources,
  779. .dev = {
  780. .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
  781. },
  782. };
  783. #endif
  784. #endif
  785. #if IS_ENABLED(CONFIG_CAN_BFIN)
  786. static unsigned short bfin_can0_peripherals[] = {
  787. P_CAN0_RX, P_CAN0_TX, 0
  788. };
  789. static struct resource bfin_can0_resources[] = {
  790. {
  791. .start = 0xFFC02A00,
  792. .end = 0xFFC02FFF,
  793. .flags = IORESOURCE_MEM,
  794. },
  795. {
  796. .start = IRQ_CAN0_RX,
  797. .end = IRQ_CAN0_RX,
  798. .flags = IORESOURCE_IRQ,
  799. },
  800. {
  801. .start = IRQ_CAN0_TX,
  802. .end = IRQ_CAN0_TX,
  803. .flags = IORESOURCE_IRQ,
  804. },
  805. {
  806. .start = IRQ_CAN0_ERROR,
  807. .end = IRQ_CAN0_ERROR,
  808. .flags = IORESOURCE_IRQ,
  809. },
  810. };
  811. static struct platform_device bfin_can0_device = {
  812. .name = "bfin_can",
  813. .id = 0,
  814. .num_resources = ARRAY_SIZE(bfin_can0_resources),
  815. .resource = bfin_can0_resources,
  816. .dev = {
  817. .platform_data = &bfin_can0_peripherals, /* Passed to driver */
  818. },
  819. };
  820. static unsigned short bfin_can1_peripherals[] = {
  821. P_CAN1_RX, P_CAN1_TX, 0
  822. };
  823. static struct resource bfin_can1_resources[] = {
  824. {
  825. .start = 0xFFC03200,
  826. .end = 0xFFC037FF,
  827. .flags = IORESOURCE_MEM,
  828. },
  829. {
  830. .start = IRQ_CAN1_RX,
  831. .end = IRQ_CAN1_RX,
  832. .flags = IORESOURCE_IRQ,
  833. },
  834. {
  835. .start = IRQ_CAN1_TX,
  836. .end = IRQ_CAN1_TX,
  837. .flags = IORESOURCE_IRQ,
  838. },
  839. {
  840. .start = IRQ_CAN1_ERROR,
  841. .end = IRQ_CAN1_ERROR,
  842. .flags = IORESOURCE_IRQ,
  843. },
  844. };
  845. static struct platform_device bfin_can1_device = {
  846. .name = "bfin_can",
  847. .id = 1,
  848. .num_resources = ARRAY_SIZE(bfin_can1_resources),
  849. .resource = bfin_can1_resources,
  850. .dev = {
  851. .platform_data = &bfin_can1_peripherals, /* Passed to driver */
  852. },
  853. };
  854. #endif
  855. #if IS_ENABLED(CONFIG_PATA_BF54X)
  856. static struct resource bfin_atapi_resources[] = {
  857. {
  858. .start = 0xFFC03800,
  859. .end = 0xFFC0386F,
  860. .flags = IORESOURCE_MEM,
  861. },
  862. {
  863. .start = IRQ_ATAPI_ERR,
  864. .end = IRQ_ATAPI_ERR,
  865. .flags = IORESOURCE_IRQ,
  866. },
  867. };
  868. static struct platform_device bfin_atapi_device = {
  869. .name = "pata-bf54x",
  870. .id = -1,
  871. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  872. .resource = bfin_atapi_resources,
  873. };
  874. #endif
  875. #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
  876. static struct mtd_partition partition_info[] = {
  877. {
  878. .name = "bootloader(nand)",
  879. .offset = 0,
  880. .size = 0x80000,
  881. }, {
  882. .name = "linux kernel(nand)",
  883. .offset = MTDPART_OFS_APPEND,
  884. .size = 4 * 1024 * 1024,
  885. },
  886. {
  887. .name = "file system(nand)",
  888. .offset = MTDPART_OFS_APPEND,
  889. .size = MTDPART_SIZ_FULL,
  890. },
  891. };
  892. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  893. .data_width = NFC_NWIDTH_8,
  894. .partitions = partition_info,
  895. .nr_partitions = ARRAY_SIZE(partition_info),
  896. .rd_dly = 3,
  897. .wr_dly = 3,
  898. };
  899. static struct resource bf5xx_nand_resources[] = {
  900. {
  901. .start = 0xFFC03B00,
  902. .end = 0xFFC03B4F,
  903. .flags = IORESOURCE_MEM,
  904. },
  905. {
  906. .start = CH_NFC,
  907. .end = CH_NFC,
  908. .flags = IORESOURCE_IRQ,
  909. },
  910. };
  911. static struct platform_device bf5xx_nand_device = {
  912. .name = "bf5xx-nand",
  913. .id = 0,
  914. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  915. .resource = bf5xx_nand_resources,
  916. .dev = {
  917. .platform_data = &bf5xx_nand_platform,
  918. },
  919. };
  920. #endif
  921. #if IS_ENABLED(CONFIG_SDH_BFIN)
  922. static struct bfin_sd_host bfin_sdh_data = {
  923. .dma_chan = CH_SDH,
  924. .irq_int0 = IRQ_SDH_MASK0,
  925. .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
  926. };
  927. static struct platform_device bf54x_sdh_device = {
  928. .name = "bfin-sdh",
  929. .id = 0,
  930. .dev = {
  931. .platform_data = &bfin_sdh_data,
  932. },
  933. };
  934. #endif
  935. #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
  936. static struct mtd_partition ezkit_partitions[] = {
  937. {
  938. .name = "bootloader(nor)",
  939. .size = 0x80000,
  940. .offset = 0,
  941. }, {
  942. .name = "linux kernel(nor)",
  943. .size = 0x400000,
  944. .offset = MTDPART_OFS_APPEND,
  945. }, {
  946. .name = "file system(nor)",
  947. .size = 0x1000000 - 0x80000 - 0x400000 - 0x8000 * 4,
  948. .offset = MTDPART_OFS_APPEND,
  949. }, {
  950. .name = "config(nor)",
  951. .size = 0x8000 * 3,
  952. .offset = MTDPART_OFS_APPEND,
  953. }, {
  954. .name = "u-boot env(nor)",
  955. .size = 0x8000,
  956. .offset = MTDPART_OFS_APPEND,
  957. }
  958. };
  959. static struct physmap_flash_data ezkit_flash_data = {
  960. .width = 2,
  961. .parts = ezkit_partitions,
  962. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  963. };
  964. static struct resource ezkit_flash_resource = {
  965. .start = 0x20000000,
  966. .end = 0x21ffffff,
  967. .flags = IORESOURCE_MEM,
  968. };
  969. static struct platform_device ezkit_flash_device = {
  970. .name = "physmap-flash",
  971. .id = 0,
  972. .dev = {
  973. .platform_data = &ezkit_flash_data,
  974. },
  975. .num_resources = 1,
  976. .resource = &ezkit_flash_resource,
  977. };
  978. #endif
  979. #if IS_ENABLED(CONFIG_MTD_M25P80)
  980. /* SPI flash chip (m25p16) */
  981. static struct mtd_partition bfin_spi_flash_partitions[] = {
  982. {
  983. .name = "bootloader(spi)",
  984. .size = 0x00080000,
  985. .offset = 0,
  986. .mask_flags = MTD_CAP_ROM
  987. }, {
  988. .name = "linux kernel(spi)",
  989. .size = MTDPART_SIZ_FULL,
  990. .offset = MTDPART_OFS_APPEND,
  991. }
  992. };
  993. static struct flash_platform_data bfin_spi_flash_data = {
  994. .name = "m25p80",
  995. .parts = bfin_spi_flash_partitions,
  996. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  997. .type = "m25p16",
  998. };
  999. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  1000. .enable_dma = 0, /* use dma transfer with this chip*/
  1001. };
  1002. #endif
  1003. #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
  1004. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  1005. .model = 7877,
  1006. .vref_delay_usecs = 50, /* internal, no capacitor */
  1007. .x_plate_ohms = 419,
  1008. .y_plate_ohms = 486,
  1009. .pressure_max = 1000,
  1010. .pressure_min = 0,
  1011. .stopacq_polarity = 1,
  1012. .first_conversion_delay = 3,
  1013. .acquisition_time = 1,
  1014. .averaging = 1,
  1015. .pen_down_acc_interval = 1,
  1016. };
  1017. #endif
  1018. #ifdef CONFIG_PINCTRL_ADI2
  1019. # define ADI_PINT_DEVNAME "adi-gpio-pint"
  1020. # define ADI_GPIO_DEVNAME "adi-gpio"
  1021. # define ADI_PINCTRL_DEVNAME "pinctrl-adi2"
  1022. static struct platform_device bfin_pinctrl_device = {
  1023. .name = ADI_PINCTRL_DEVNAME,
  1024. .id = 0,
  1025. };
  1026. static struct resource bfin_pint0_resources[] = {
  1027. {
  1028. .start = PINT0_MASK_SET,
  1029. .end = PINT0_LATCH + 3,
  1030. .flags = IORESOURCE_MEM,
  1031. },
  1032. {
  1033. .start = IRQ_PINT0,
  1034. .end = IRQ_PINT0,
  1035. .flags = IORESOURCE_IRQ,
  1036. },
  1037. };
  1038. static struct platform_device bfin_pint0_device = {
  1039. .name = ADI_PINT_DEVNAME,
  1040. .id = 0,
  1041. .num_resources = ARRAY_SIZE(bfin_pint0_resources),
  1042. .resource = bfin_pint0_resources,
  1043. };
  1044. static struct resource bfin_pint1_resources[] = {
  1045. {
  1046. .start = PINT1_MASK_SET,
  1047. .end = PINT1_LATCH + 3,
  1048. .flags = IORESOURCE_MEM,
  1049. },
  1050. {
  1051. .start = IRQ_PINT1,
  1052. .end = IRQ_PINT1,
  1053. .flags = IORESOURCE_IRQ,
  1054. },
  1055. };
  1056. static struct platform_device bfin_pint1_device = {
  1057. .name = ADI_PINT_DEVNAME,
  1058. .id = 1,
  1059. .num_resources = ARRAY_SIZE(bfin_pint1_resources),
  1060. .resource = bfin_pint1_resources,
  1061. };
  1062. static struct resource bfin_pint2_resources[] = {
  1063. {
  1064. .start = PINT2_MASK_SET,
  1065. .end = PINT2_LATCH + 3,
  1066. .flags = IORESOURCE_MEM,
  1067. },
  1068. {
  1069. .start = IRQ_PINT2,
  1070. .end = IRQ_PINT2,
  1071. .flags = IORESOURCE_IRQ,
  1072. },
  1073. };
  1074. static struct platform_device bfin_pint2_device = {
  1075. .name = ADI_PINT_DEVNAME,
  1076. .id = 2,
  1077. .num_resources = ARRAY_SIZE(bfin_pint2_resources),
  1078. .resource = bfin_pint2_resources,
  1079. };
  1080. static struct resource bfin_pint3_resources[] = {
  1081. {
  1082. .start = PINT3_MASK_SET,
  1083. .end = PINT3_LATCH + 3,
  1084. .flags = IORESOURCE_MEM,
  1085. },
  1086. {
  1087. .start = IRQ_PINT3,
  1088. .end = IRQ_PINT3,
  1089. .flags = IORESOURCE_IRQ,
  1090. },
  1091. };
  1092. static struct platform_device bfin_pint3_device = {
  1093. .name = ADI_PINT_DEVNAME,
  1094. .id = 3,
  1095. .num_resources = ARRAY_SIZE(bfin_pint3_resources),
  1096. .resource = bfin_pint3_resources,
  1097. };
  1098. static struct resource bfin_gpa_resources[] = {
  1099. {
  1100. .start = PORTA_FER,
  1101. .end = PORTA_MUX + 3,
  1102. .flags = IORESOURCE_MEM,
  1103. },
  1104. { /* optional */
  1105. .start = IRQ_PA0,
  1106. .end = IRQ_PA0,
  1107. .flags = IORESOURCE_IRQ,
  1108. },
  1109. };
  1110. static struct adi_pinctrl_gpio_platform_data bfin_gpa_pdata = {
  1111. .port_gpio_base = GPIO_PA0, /* Optional */
  1112. .port_pin_base = GPIO_PA0,
  1113. .port_width = GPIO_BANKSIZE,
  1114. .pint_id = 0, /* PINT0 */
  1115. .pint_assign = true, /* PINT upper 16 bit */
  1116. .pint_map = 0, /* mapping mask in PINT */
  1117. };
  1118. static struct platform_device bfin_gpa_device = {
  1119. .name = ADI_GPIO_DEVNAME,
  1120. .id = 0,
  1121. .num_resources = ARRAY_SIZE(bfin_gpa_resources),
  1122. .resource = bfin_gpa_resources,
  1123. .dev = {
  1124. .platform_data = &bfin_gpa_pdata, /* Passed to driver */
  1125. },
  1126. };
  1127. static struct resource bfin_gpb_resources[] = {
  1128. {
  1129. .start = PORTB_FER,
  1130. .end = PORTB_MUX + 3,
  1131. .flags = IORESOURCE_MEM,
  1132. },
  1133. {
  1134. .start = IRQ_PB0,
  1135. .end = IRQ_PB0,
  1136. .flags = IORESOURCE_IRQ,
  1137. },
  1138. };
  1139. static struct adi_pinctrl_gpio_platform_data bfin_gpb_pdata = {
  1140. .port_gpio_base = GPIO_PB0,
  1141. .port_pin_base = GPIO_PB0,
  1142. .port_width = 15,
  1143. .pint_id = 0,
  1144. .pint_assign = true,
  1145. .pint_map = 1,
  1146. };
  1147. static struct platform_device bfin_gpb_device = {
  1148. .name = ADI_GPIO_DEVNAME,
  1149. .id = 1,
  1150. .num_resources = ARRAY_SIZE(bfin_gpb_resources),
  1151. .resource = bfin_gpb_resources,
  1152. .dev = {
  1153. .platform_data = &bfin_gpb_pdata, /* Passed to driver */
  1154. },
  1155. };
  1156. static struct resource bfin_gpc_resources[] = {
  1157. {
  1158. .start = PORTC_FER,
  1159. .end = PORTC_MUX + 3,
  1160. .flags = IORESOURCE_MEM,
  1161. },
  1162. {
  1163. .start = IRQ_PC0,
  1164. .end = IRQ_PC0,
  1165. .flags = IORESOURCE_IRQ,
  1166. },
  1167. };
  1168. static struct adi_pinctrl_gpio_platform_data bfin_gpc_pdata = {
  1169. .port_gpio_base = GPIO_PC0,
  1170. .port_pin_base = GPIO_PC0,
  1171. .port_width = 14,
  1172. .pint_id = 2,
  1173. .pint_assign = true,
  1174. .pint_map = 0,
  1175. };
  1176. static struct platform_device bfin_gpc_device = {
  1177. .name = ADI_GPIO_DEVNAME,
  1178. .id = 2,
  1179. .num_resources = ARRAY_SIZE(bfin_gpc_resources),
  1180. .resource = bfin_gpc_resources,
  1181. .dev = {
  1182. .platform_data = &bfin_gpc_pdata, /* Passed to driver */
  1183. },
  1184. };
  1185. static struct resource bfin_gpd_resources[] = {
  1186. {
  1187. .start = PORTD_FER,
  1188. .end = PORTD_MUX + 3,
  1189. .flags = IORESOURCE_MEM,
  1190. },
  1191. {
  1192. .start = IRQ_PD0,
  1193. .end = IRQ_PD0,
  1194. .flags = IORESOURCE_IRQ,
  1195. },
  1196. };
  1197. static struct adi_pinctrl_gpio_platform_data bfin_gpd_pdata = {
  1198. .port_gpio_base = GPIO_PD0,
  1199. .port_pin_base = GPIO_PD0,
  1200. .port_width = GPIO_BANKSIZE,
  1201. .pint_id = 2,
  1202. .pint_assign = false,
  1203. .pint_map = 1,
  1204. };
  1205. static struct platform_device bfin_gpd_device = {
  1206. .name = ADI_GPIO_DEVNAME,
  1207. .id = 3,
  1208. .num_resources = ARRAY_SIZE(bfin_gpd_resources),
  1209. .resource = bfin_gpd_resources,
  1210. .dev = {
  1211. .platform_data = &bfin_gpd_pdata, /* Passed to driver */
  1212. },
  1213. };
  1214. static struct resource bfin_gpe_resources[] = {
  1215. {
  1216. .start = PORTE_FER,
  1217. .end = PORTE_MUX + 3,
  1218. .flags = IORESOURCE_MEM,
  1219. },
  1220. {
  1221. .start = IRQ_PE0,
  1222. .end = IRQ_PE0,
  1223. .flags = IORESOURCE_IRQ,
  1224. },
  1225. };
  1226. static struct adi_pinctrl_gpio_platform_data bfin_gpe_pdata = {
  1227. .port_gpio_base = GPIO_PE0,
  1228. .port_pin_base = GPIO_PE0,
  1229. .port_width = GPIO_BANKSIZE,
  1230. .pint_id = 3,
  1231. .pint_assign = true,
  1232. .pint_map = 2,
  1233. };
  1234. static struct platform_device bfin_gpe_device = {
  1235. .name = ADI_GPIO_DEVNAME,
  1236. .id = 4,
  1237. .num_resources = ARRAY_SIZE(bfin_gpe_resources),
  1238. .resource = bfin_gpe_resources,
  1239. .dev = {
  1240. .platform_data = &bfin_gpe_pdata, /* Passed to driver */
  1241. },
  1242. };
  1243. static struct resource bfin_gpf_resources[] = {
  1244. {
  1245. .start = PORTF_FER,
  1246. .end = PORTF_MUX + 3,
  1247. .flags = IORESOURCE_MEM,
  1248. },
  1249. {
  1250. .start = IRQ_PF0,
  1251. .end = IRQ_PF0,
  1252. .flags = IORESOURCE_IRQ,
  1253. },
  1254. };
  1255. static struct adi_pinctrl_gpio_platform_data bfin_gpf_pdata = {
  1256. .port_gpio_base = GPIO_PF0,
  1257. .port_pin_base = GPIO_PF0,
  1258. .port_width = GPIO_BANKSIZE,
  1259. .pint_id = 3,
  1260. .pint_assign = false,
  1261. .pint_map = 3,
  1262. };
  1263. static struct platform_device bfin_gpf_device = {
  1264. .name = ADI_GPIO_DEVNAME,
  1265. .id = 5,
  1266. .num_resources = ARRAY_SIZE(bfin_gpf_resources),
  1267. .resource = bfin_gpf_resources,
  1268. .dev = {
  1269. .platform_data = &bfin_gpf_pdata, /* Passed to driver */
  1270. },
  1271. };
  1272. static struct resource bfin_gpg_resources[] = {
  1273. {
  1274. .start = PORTG_FER,
  1275. .end = PORTG_MUX + 3,
  1276. .flags = IORESOURCE_MEM,
  1277. },
  1278. {
  1279. .start = IRQ_PG0,
  1280. .end = IRQ_PG0,
  1281. .flags = IORESOURCE_IRQ,
  1282. },
  1283. };
  1284. static struct adi_pinctrl_gpio_platform_data bfin_gpg_pdata = {
  1285. .port_gpio_base = GPIO_PG0,
  1286. .port_pin_base = GPIO_PG0,
  1287. .port_width = GPIO_BANKSIZE,
  1288. .pint_id = -1,
  1289. };
  1290. static struct platform_device bfin_gpg_device = {
  1291. .name = ADI_GPIO_DEVNAME,
  1292. .id = 6,
  1293. .num_resources = ARRAY_SIZE(bfin_gpg_resources),
  1294. .resource = bfin_gpg_resources,
  1295. .dev = {
  1296. .platform_data = &bfin_gpg_pdata, /* Passed to driver */
  1297. },
  1298. };
  1299. static struct resource bfin_gph_resources[] = {
  1300. {
  1301. .start = PORTH_FER,
  1302. .end = PORTH_MUX + 3,
  1303. .flags = IORESOURCE_MEM,
  1304. },
  1305. {
  1306. .start = IRQ_PH0,
  1307. .end = IRQ_PH0,
  1308. .flags = IORESOURCE_IRQ,
  1309. },
  1310. };
  1311. static struct adi_pinctrl_gpio_platform_data bfin_gph_pdata = {
  1312. .port_gpio_base = GPIO_PH0,
  1313. .port_pin_base = GPIO_PH0,
  1314. .port_width = 14,
  1315. .pint_id = -1,
  1316. };
  1317. static struct platform_device bfin_gph_device = {
  1318. .name = ADI_GPIO_DEVNAME,
  1319. .id = 7,
  1320. .num_resources = ARRAY_SIZE(bfin_gph_resources),
  1321. .resource = bfin_gph_resources,
  1322. .dev = {
  1323. .platform_data = &bfin_gph_pdata, /* Passed to driver */
  1324. },
  1325. };
  1326. static struct resource bfin_gpi_resources[] = {
  1327. {
  1328. .start = PORTI_FER,
  1329. .end = PORTI_MUX + 3,
  1330. .flags = IORESOURCE_MEM,
  1331. },
  1332. {
  1333. .start = IRQ_PI0,
  1334. .end = IRQ_PI0,
  1335. .flags = IORESOURCE_IRQ,
  1336. },
  1337. };
  1338. static struct adi_pinctrl_gpio_platform_data bfin_gpi_pdata = {
  1339. .port_gpio_base = GPIO_PI0,
  1340. .port_pin_base = GPIO_PI0,
  1341. .port_width = GPIO_BANKSIZE,
  1342. .pint_id = -1,
  1343. };
  1344. static struct platform_device bfin_gpi_device = {
  1345. .name = ADI_GPIO_DEVNAME,
  1346. .id = 8,
  1347. .num_resources = ARRAY_SIZE(bfin_gpi_resources),
  1348. .resource = bfin_gpi_resources,
  1349. .dev = {
  1350. .platform_data = &bfin_gpi_pdata, /* Passed to driver */
  1351. },
  1352. };
  1353. static struct resource bfin_gpj_resources[] = {
  1354. {
  1355. .start = PORTJ_FER,
  1356. .end = PORTJ_MUX + 3,
  1357. .flags = IORESOURCE_MEM,
  1358. },
  1359. {
  1360. .start = IRQ_PJ0,
  1361. .end = IRQ_PJ0,
  1362. .flags = IORESOURCE_IRQ,
  1363. },
  1364. };
  1365. static struct adi_pinctrl_gpio_platform_data bfin_gpj_pdata = {
  1366. .port_gpio_base = GPIO_PJ0,
  1367. .port_pin_base = GPIO_PJ0,
  1368. .port_width = 14,
  1369. .pint_id = -1,
  1370. };
  1371. static struct platform_device bfin_gpj_device = {
  1372. .name = ADI_GPIO_DEVNAME,
  1373. .id = 9,
  1374. .num_resources = ARRAY_SIZE(bfin_gpj_resources),
  1375. .resource = bfin_gpj_resources,
  1376. .dev = {
  1377. .platform_data = &bfin_gpj_pdata, /* Passed to driver */
  1378. },
  1379. };
  1380. #endif
  1381. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  1382. #if IS_ENABLED(CONFIG_MTD_M25P80)
  1383. {
  1384. /* the modalias must be the same as spi device driver name */
  1385. .modalias = "m25p80", /* Name of spi_driver for this device */
  1386. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  1387. .bus_num = 0, /* Framework bus number */
  1388. .chip_select = MAX_CTRL_CS + GPIO_PE4, /* SPI_SSEL1*/
  1389. .platform_data = &bfin_spi_flash_data,
  1390. .controller_data = &spi_flash_chip_info,
  1391. .mode = SPI_MODE_3,
  1392. },
  1393. #endif
  1394. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD183X)
  1395. {
  1396. .modalias = "ad183x",
  1397. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  1398. .bus_num = 1,
  1399. .chip_select = MAX_CTRL_CS + GPIO_PG6, /* SPI_SSEL2 */
  1400. },
  1401. #endif
  1402. #if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7877)
  1403. {
  1404. .modalias = "ad7877",
  1405. .platform_data = &bfin_ad7877_ts_info,
  1406. .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
  1407. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  1408. .bus_num = 0,
  1409. .chip_select = MAX_CTRL_CS + GPIO_PE5, /* SPI_SSEL2 */
  1410. },
  1411. #endif
  1412. #if IS_ENABLED(CONFIG_SPI_SPIDEV)
  1413. {
  1414. .modalias = "spidev",
  1415. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  1416. .bus_num = 0,
  1417. .chip_select = MAX_CTRL_CS + GPIO_PE4, /* SPI_SSEL1 */
  1418. },
  1419. #endif
  1420. #if IS_ENABLED(CONFIG_INPUT_ADXL34X_SPI)
  1421. {
  1422. .modalias = "adxl34x",
  1423. .platform_data = &adxl34x_info,
  1424. .irq = IRQ_PC5,
  1425. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  1426. .bus_num = 1,
  1427. .chip_select = MAX_CTRL_CS + GPIO_PG6, /* SPI_SSEL2 */
  1428. .mode = SPI_MODE_3,
  1429. },
  1430. #endif
  1431. };
  1432. #if IS_ENABLED(CONFIG_SPI_BFIN5XX)
  1433. /* SPI (0) */
  1434. static struct resource bfin_spi0_resource[] = {
  1435. [0] = {
  1436. .start = SPI0_REGBASE,
  1437. .end = SPI0_REGBASE + 0xFF,
  1438. .flags = IORESOURCE_MEM,
  1439. },
  1440. [1] = {
  1441. .start = CH_SPI0,
  1442. .end = CH_SPI0,
  1443. .flags = IORESOURCE_DMA,
  1444. },
  1445. [2] = {
  1446. .start = IRQ_SPI0,
  1447. .end = IRQ_SPI0,
  1448. .flags = IORESOURCE_IRQ,
  1449. }
  1450. };
  1451. /* SPI (1) */
  1452. static struct resource bfin_spi1_resource[] = {
  1453. [0] = {
  1454. .start = SPI1_REGBASE,
  1455. .end = SPI1_REGBASE + 0xFF,
  1456. .flags = IORESOURCE_MEM,
  1457. },
  1458. [1] = {
  1459. .start = CH_SPI1,
  1460. .end = CH_SPI1,
  1461. .flags = IORESOURCE_DMA,
  1462. },
  1463. [2] = {
  1464. .start = IRQ_SPI1,
  1465. .end = IRQ_SPI1,
  1466. .flags = IORESOURCE_IRQ,
  1467. }
  1468. };
  1469. /* SPI controller data */
  1470. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  1471. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1472. .enable_dma = 1, /* master has the ability to do dma transfer */
  1473. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1474. };
  1475. static struct platform_device bf54x_spi_master0 = {
  1476. .name = "bfin-spi",
  1477. .id = 0, /* Bus number */
  1478. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1479. .resource = bfin_spi0_resource,
  1480. .dev = {
  1481. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  1482. },
  1483. };
  1484. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  1485. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1486. .enable_dma = 1, /* master has the ability to do dma transfer */
  1487. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  1488. };
  1489. static struct platform_device bf54x_spi_master1 = {
  1490. .name = "bfin-spi",
  1491. .id = 1, /* Bus number */
  1492. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  1493. .resource = bfin_spi1_resource,
  1494. .dev = {
  1495. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  1496. },
  1497. };
  1498. #endif /* spi master and devices */
  1499. #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
  1500. #include <linux/videodev2.h>
  1501. #include <media/blackfin/bfin_capture.h>
  1502. #include <media/blackfin/ppi.h>
  1503. static const unsigned short ppi_req[] = {
  1504. P_PPI1_D0, P_PPI1_D1, P_PPI1_D2, P_PPI1_D3,
  1505. P_PPI1_D4, P_PPI1_D5, P_PPI1_D6, P_PPI1_D7,
  1506. P_PPI1_CLK, P_PPI1_FS1, P_PPI1_FS2,
  1507. 0,
  1508. };
  1509. static const struct ppi_info ppi_info = {
  1510. .type = PPI_TYPE_EPPI,
  1511. .dma_ch = CH_EPPI1,
  1512. .irq_err = IRQ_EPPI1_ERROR,
  1513. .base = (void __iomem *)EPPI1_STATUS,
  1514. .pin_req = ppi_req,
  1515. };
  1516. #if IS_ENABLED(CONFIG_VIDEO_VS6624)
  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 IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
  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 IS_ENABLED(CONFIG_SND_SOC_SSM2602)
  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 IS_ENABLED(CONFIG_BFIN_TWI_LCD)
  1614. {
  1615. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  1616. },
  1617. #endif
  1618. #if IS_ENABLED(CONFIG_INPUT_PCF8574)
  1619. {
  1620. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  1621. .irq = 212,
  1622. },
  1623. #endif
  1624. #if IS_ENABLED(CONFIG_INPUT_ADXL34X_I2C)
  1625. {
  1626. I2C_BOARD_INFO("adxl34x", 0x53),
  1627. .irq = IRQ_PC5,
  1628. .platform_data = (void *)&adxl34x_info,
  1629. },
  1630. #endif
  1631. #if IS_ENABLED(CONFIG_BFIN_TWI_LCD)
  1632. {
  1633. I2C_BOARD_INFO("ad5252", 0x2f),
  1634. },
  1635. #endif
  1636. };
  1637. #endif
  1638. #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
  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 IS_ENABLED(CONFIG_SND_BF5XX_I2S) || \
  1683. IS_ENABLED(CONFIG_SND_BF5XX_AC97)
  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 IS_ENABLED(CONFIG_SND_BF5XX_I2S)
  1738. static struct platform_device bfin_i2s_pcm = {
  1739. .name = "bfin-i2s-pcm-audio",
  1740. .id = -1,
  1741. };
  1742. #endif
  1743. #if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
  1744. static struct platform_device bfin_ac97_pcm = {
  1745. .name = "bfin-ac97-pcm-audio",
  1746. .id = -1,
  1747. };
  1748. #endif
  1749. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD73311)
  1750. static struct platform_device bfin_ad73311_codec_device = {
  1751. .name = "ad73311",
  1752. .id = -1,
  1753. };
  1754. #endif
  1755. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1980)
  1756. static struct platform_device bfin_ad1980_codec_device = {
  1757. .name = "ad1980",
  1758. .id = -1,
  1759. };
  1760. #endif
  1761. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_I2S)
  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 IS_ENABLED(CONFIG_SND_BF5XX_SOC_AC97)
  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 IS_ENABLED(CONFIG_RTC_DRV_BFIN)
  1803. &rtc_device,
  1804. #endif
  1805. #if IS_ENABLED(CONFIG_SERIAL_BFIN)
  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 IS_ENABLED(CONFIG_BFIN_SIR)
  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 IS_ENABLED(CONFIG_FB_BF54X_LQ043)
  1834. &bf54x_lq043_device,
  1835. #endif
  1836. #if IS_ENABLED(CONFIG_SMSC911X)
  1837. &smsc911x_device,
  1838. #endif
  1839. #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
  1840. &musb_device,
  1841. #endif
  1842. #if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
  1843. &bfin_isp1760_device,
  1844. #endif
  1845. #if IS_ENABLED(CONFIG_SERIAL_BFIN_SPORT)
  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 IS_ENABLED(CONFIG_CAN_BFIN)
  1860. &bfin_can0_device,
  1861. &bfin_can1_device,
  1862. #endif
  1863. #if IS_ENABLED(CONFIG_PATA_BF54X)
  1864. &bfin_atapi_device,
  1865. #endif
  1866. #if IS_ENABLED(CONFIG_MTD_NAND_BF5XX)
  1867. &bf5xx_nand_device,
  1868. #endif
  1869. #if IS_ENABLED(CONFIG_SDH_BFIN)
  1870. &bf54x_sdh_device,
  1871. #endif
  1872. #if IS_ENABLED(CONFIG_SPI_BFIN5XX)
  1873. &bf54x_spi_master0,
  1874. &bf54x_spi_master1,
  1875. #endif
  1876. #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
  1877. &bfin_capture_device,
  1878. #endif
  1879. #if IS_ENABLED(CONFIG_KEYBOARD_BFIN)
  1880. &bf54x_kpad_device,
  1881. #endif
  1882. #if IS_ENABLED(CONFIG_INPUT_BFIN_ROTARY)
  1883. &bfin_rotary_device,
  1884. #endif
  1885. #if IS_ENABLED(CONFIG_I2C_BLACKFIN_TWI)
  1886. &i2c_bfin_twi0_device,
  1887. #if !defined(CONFIG_BF542)
  1888. &i2c_bfin_twi1_device,
  1889. #endif
  1890. #endif
  1891. #if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
  1892. &bfin_device_gpiokeys,
  1893. #endif
  1894. #if IS_ENABLED(CONFIG_MTD_PHYSMAP)
  1895. &ezkit_flash_device,
  1896. #endif
  1897. #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
  1898. &bfin_i2s_pcm,
  1899. #endif
  1900. #if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
  1901. &bfin_ac97_pcm,
  1902. #endif
  1903. #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1980)
  1904. &bfin_ad1980_codec_device,
  1905. #endif
  1906. #if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
  1907. &bfin_i2s,
  1908. #endif
  1909. #if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
  1910. &bfin_ac97,
  1911. #endif
  1912. };
  1913. /* Pin control settings */
  1914. static struct pinctrl_map __initdata bfin_pinmux_map[] = {
  1915. /* per-device maps */
  1916. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.0", "pinctrl-adi2.0", NULL, "uart0"),
  1917. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL, "uart1"),
  1918. #ifdef CONFIG_BFIN_UART1_CTSRTS
  1919. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.1", "pinctrl-adi2.0", NULL, "uart1_ctsrts"),
  1920. #endif
  1921. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.2", "pinctrl-adi2.0", NULL, "uart2"),
  1922. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.3", "pinctrl-adi2.0", NULL, "uart3"),
  1923. #ifdef CONFIG_BFIN_UART3_CTSRTS
  1924. PIN_MAP_MUX_GROUP_DEFAULT("bfin-uart.3", "pinctrl-adi2.0", NULL, "uart3_ctsrts"),
  1925. #endif
  1926. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.0", "pinctrl-adi2.0", NULL, "uart0"),
  1927. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.1", "pinctrl-adi2.0", NULL, "uart1"),
  1928. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.2", "pinctrl-adi2.0", NULL, "uart2"),
  1929. PIN_MAP_MUX_GROUP_DEFAULT("bfin_sir.3", "pinctrl-adi2.0", NULL, "uart3"),
  1930. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sdh.0", "pinctrl-adi2.0", NULL, "rsi0"),
  1931. PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi.0", "pinctrl-adi2.0", NULL, "spi0"),
  1932. PIN_MAP_MUX_GROUP_DEFAULT("bfin-spi.1", "pinctrl-adi2.0", NULL, "spi1"),
  1933. PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.0", "pinctrl-adi2.0", NULL, "twi0"),
  1934. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1935. PIN_MAP_MUX_GROUP_DEFAULT("i2c-bfin-twi.1", "pinctrl-adi2.0", NULL, "twi1"),
  1936. #endif
  1937. PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL, "rotary"),
  1938. PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL, "can0"),
  1939. PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.1", "pinctrl-adi2.0", NULL, "can1"),
  1940. PIN_MAP_MUX_GROUP_DEFAULT("bf54x-lq043", "pinctrl-adi2.0", "ppi0_24bgrp", "ppi0"),
  1941. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL, "sport0"),
  1942. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL, "sport0"),
  1943. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.0", "pinctrl-adi2.0", NULL, "sport0"),
  1944. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL, "sport1"),
  1945. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.1", "pinctrl-adi2.0", NULL, "sport1"),
  1946. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.1", "pinctrl-adi2.0", NULL, "sport1"),
  1947. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.2", "pinctrl-adi2.0", NULL, "sport2"),
  1948. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.2", "pinctrl-adi2.0", NULL, "sport2"),
  1949. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.2", "pinctrl-adi2.0", NULL, "sport2"),
  1950. PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.3", "pinctrl-adi2.0", NULL, "sport3"),
  1951. PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.3", "pinctrl-adi2.0", NULL, "sport3"),
  1952. PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.3", "pinctrl-adi2.0", NULL, "sport3"),
  1953. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.0", "pinctrl-adi2.0", NULL, "sport0"),
  1954. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.1", "pinctrl-adi2.0", NULL, "sport1"),
  1955. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.2", "pinctrl-adi2.0", NULL, "sport2"),
  1956. PIN_MAP_MUX_GROUP_DEFAULT("bfin-sport-uart.3", "pinctrl-adi2.0", NULL, "sport3"),
  1957. PIN_MAP_MUX_GROUP_DEFAULT("pata-bf54x", "pinctrl-adi2.0", NULL, "atapi"),
  1958. #ifdef CONFIG_BF548_ATAPI_ALTERNATIVE_PORT
  1959. PIN_MAP_MUX_GROUP_DEFAULT("pata-bf54x", "pinctrl-adi2.0", NULL, "atapi_alter"),
  1960. #endif
  1961. PIN_MAP_MUX_GROUP_DEFAULT("bf5xx-nand.0", "pinctrl-adi2.0", NULL, "nfc0"),
  1962. PIN_MAP_MUX_GROUP_DEFAULT("bf54x-keys", "pinctrl-adi2.0", "keys_4x4grp", "keys"),
  1963. PIN_MAP_MUX_GROUP("bf54x-keys", "4bit", "pinctrl-adi2.0", "keys_4x4grp", "keys"),
  1964. PIN_MAP_MUX_GROUP("bf54x-keys", "8bit", "pinctrl-adi2.0", "keys_8x8grp", "keys"),
  1965. };
  1966. static int __init ezkit_init(void)
  1967. {
  1968. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1969. /* Initialize pinmuxing */
  1970. pinctrl_register_mappings(bfin_pinmux_map,
  1971. ARRAY_SIZE(bfin_pinmux_map));
  1972. i2c_register_board_info(0, bfin_i2c_board_info0,
  1973. ARRAY_SIZE(bfin_i2c_board_info0));
  1974. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  1975. i2c_register_board_info(1, bfin_i2c_board_info1,
  1976. ARRAY_SIZE(bfin_i2c_board_info1));
  1977. #endif
  1978. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  1979. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1980. return 0;
  1981. }
  1982. arch_initcall(ezkit_init);
  1983. static struct platform_device *ezkit_early_devices[] __initdata = {
  1984. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  1985. #ifdef CONFIG_SERIAL_BFIN_UART0
  1986. &bfin_uart0_device,
  1987. #endif
  1988. #ifdef CONFIG_SERIAL_BFIN_UART1
  1989. &bfin_uart1_device,
  1990. #endif
  1991. #ifdef CONFIG_SERIAL_BFIN_UART2
  1992. &bfin_uart2_device,
  1993. #endif
  1994. #ifdef CONFIG_SERIAL_BFIN_UART3
  1995. &bfin_uart3_device,
  1996. #endif
  1997. #endif
  1998. };
  1999. void __init native_machine_early_platform_add_devices(void)
  2000. {
  2001. printk(KERN_INFO "register early platform devices\n");
  2002. early_platform_add_devices(ezkit_early_devices,
  2003. ARRAY_SIZE(ezkit_early_devices));
  2004. }