ezkit.c 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. * 2005 National ICT Australia (NICTA)
  4. * Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <linux/device.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/mtd/mtd.h>
  11. #include <linux/mtd/partitions.h>
  12. #include <linux/mtd/physmap.h>
  13. #include <linux/spi/spi.h>
  14. #include <linux/spi/flash.h>
  15. #include <linux/irq.h>
  16. #include <linux/i2c.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/usb/musb.h>
  19. #include <asm/bfin6xx_spi.h>
  20. #include <asm/dma.h>
  21. #include <asm/gpio.h>
  22. #include <asm/nand.h>
  23. #include <asm/dpmc.h>
  24. #include <asm/portmux.h>
  25. #include <asm/bfin_sdh.h>
  26. #include <linux/input.h>
  27. #include <linux/spi/ad7877.h>
  28. /*
  29. * Name the Board for the /proc/cpuinfo
  30. */
  31. const char bfin_board_name[] = "ADI BF609-EZKIT";
  32. /*
  33. * Driver needs to know address, irq and flag pin.
  34. */
  35. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  36. #include <linux/usb/isp1760.h>
  37. static struct resource bfin_isp1760_resources[] = {
  38. [0] = {
  39. .start = 0x2C0C0000,
  40. .end = 0x2C0C0000 + 0xfffff,
  41. .flags = IORESOURCE_MEM,
  42. },
  43. [1] = {
  44. .start = IRQ_PG7,
  45. .end = IRQ_PG7,
  46. .flags = IORESOURCE_IRQ,
  47. },
  48. };
  49. static struct isp1760_platform_data isp1760_priv = {
  50. .is_isp1761 = 0,
  51. .bus_width_16 = 1,
  52. .port1_otg = 0,
  53. .analog_oc = 0,
  54. .dack_polarity_high = 0,
  55. .dreq_polarity_high = 0,
  56. };
  57. static struct platform_device bfin_isp1760_device = {
  58. .name = "isp1760",
  59. .id = 0,
  60. .dev = {
  61. .platform_data = &isp1760_priv,
  62. },
  63. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  64. .resource = bfin_isp1760_resources,
  65. };
  66. #endif
  67. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  68. #include <asm/bfin_rotary.h>
  69. static struct bfin_rotary_platform_data bfin_rotary_data = {
  70. /*.rotary_up_key = KEY_UP,*/
  71. /*.rotary_down_key = KEY_DOWN,*/
  72. .rotary_rel_code = REL_WHEEL,
  73. .rotary_button_key = KEY_ENTER,
  74. .debounce = 10, /* 0..17 */
  75. .mode = ROT_QUAD_ENC | ROT_DEBE,
  76. };
  77. static struct resource bfin_rotary_resources[] = {
  78. {
  79. .start = IRQ_CNT,
  80. .end = IRQ_CNT,
  81. .flags = IORESOURCE_IRQ,
  82. },
  83. };
  84. static struct platform_device bfin_rotary_device = {
  85. .name = "bfin-rotary",
  86. .id = -1,
  87. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  88. .resource = bfin_rotary_resources,
  89. .dev = {
  90. .platform_data = &bfin_rotary_data,
  91. },
  92. };
  93. #endif
  94. #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
  95. #include <linux/stmmac.h>
  96. static unsigned short pins[] = P_RMII0;
  97. static struct stmmac_mdio_bus_data phy_private_data = {
  98. .bus_id = 0,
  99. .phy_mask = 1,
  100. };
  101. static struct plat_stmmacenet_data eth_private_data = {
  102. .bus_id = 0,
  103. .enh_desc = 1,
  104. .phy_addr = 1,
  105. .mdio_bus_data = &phy_private_data,
  106. };
  107. static struct platform_device bfin_eth_device = {
  108. .name = "stmmaceth",
  109. .id = 0,
  110. .num_resources = 2,
  111. .resource = (struct resource[]) {
  112. {
  113. .start = EMAC0_MACCFG,
  114. .end = EMAC0_MACCFG + 0x1274,
  115. .flags = IORESOURCE_MEM,
  116. },
  117. {
  118. .name = "macirq",
  119. .start = IRQ_EMAC0_STAT,
  120. .end = IRQ_EMAC0_STAT,
  121. .flags = IORESOURCE_IRQ,
  122. },
  123. },
  124. .dev = {
  125. .power.can_wakeup = 1,
  126. .platform_data = &eth_private_data,
  127. }
  128. };
  129. #endif
  130. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  131. #include <linux/input/adxl34x.h>
  132. static const struct adxl34x_platform_data adxl34x_info = {
  133. .x_axis_offset = 0,
  134. .y_axis_offset = 0,
  135. .z_axis_offset = 0,
  136. .tap_threshold = 0x31,
  137. .tap_duration = 0x10,
  138. .tap_latency = 0x60,
  139. .tap_window = 0xF0,
  140. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  141. .act_axis_control = 0xFF,
  142. .activity_threshold = 5,
  143. .inactivity_threshold = 3,
  144. .inactivity_time = 4,
  145. .free_fall_threshold = 0x7,
  146. .free_fall_time = 0x20,
  147. .data_rate = 0x8,
  148. .data_range = ADXL_FULL_RES,
  149. .ev_type = EV_ABS,
  150. .ev_code_x = ABS_X, /* EV_REL */
  151. .ev_code_y = ABS_Y, /* EV_REL */
  152. .ev_code_z = ABS_Z, /* EV_REL */
  153. .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
  154. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  155. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  156. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  157. .fifo_mode = ADXL_FIFO_STREAM,
  158. .orientation_enable = ADXL_EN_ORIENTATION_3D,
  159. .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
  160. .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
  161. /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
  162. .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
  163. };
  164. #endif
  165. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  166. static struct platform_device rtc_device = {
  167. .name = "rtc-bfin",
  168. .id = -1,
  169. };
  170. #endif
  171. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  172. #ifdef CONFIG_SERIAL_BFIN_UART0
  173. static struct resource bfin_uart0_resources[] = {
  174. {
  175. .start = UART0_REVID,
  176. .end = UART0_RXDIV+4,
  177. .flags = IORESOURCE_MEM,
  178. },
  179. {
  180. .start = IRQ_UART0_TX,
  181. .end = IRQ_UART0_TX,
  182. .flags = IORESOURCE_IRQ,
  183. },
  184. {
  185. .start = IRQ_UART0_RX,
  186. .end = IRQ_UART0_RX,
  187. .flags = IORESOURCE_IRQ,
  188. },
  189. {
  190. .start = IRQ_UART0_STAT,
  191. .end = IRQ_UART0_STAT,
  192. .flags = IORESOURCE_IRQ,
  193. },
  194. {
  195. .start = CH_UART0_TX,
  196. .end = CH_UART0_TX,
  197. .flags = IORESOURCE_DMA,
  198. },
  199. {
  200. .start = CH_UART0_RX,
  201. .end = CH_UART0_RX,
  202. .flags = IORESOURCE_DMA,
  203. },
  204. #ifdef CONFIG_BFIN_UART0_CTSRTS
  205. { /* CTS pin -- 0 means not supported */
  206. .start = GPIO_PD10,
  207. .end = GPIO_PD10,
  208. .flags = IORESOURCE_IO,
  209. },
  210. { /* RTS pin -- 0 means not supported */
  211. .start = GPIO_PD9,
  212. .end = GPIO_PD9,
  213. .flags = IORESOURCE_IO,
  214. },
  215. #endif
  216. };
  217. static unsigned short bfin_uart0_peripherals[] = {
  218. P_UART0_TX, P_UART0_RX,
  219. #ifdef CONFIG_BFIN_UART0_CTSRTS
  220. P_UART0_RTS, P_UART0_CTS,
  221. #endif
  222. 0
  223. };
  224. static struct platform_device bfin_uart0_device = {
  225. .name = "bfin-uart",
  226. .id = 0,
  227. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  228. .resource = bfin_uart0_resources,
  229. .dev = {
  230. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  231. },
  232. };
  233. #endif
  234. #ifdef CONFIG_SERIAL_BFIN_UART1
  235. static struct resource bfin_uart1_resources[] = {
  236. {
  237. .start = UART1_REVID,
  238. .end = UART1_RXDIV+4,
  239. .flags = IORESOURCE_MEM,
  240. },
  241. {
  242. .start = IRQ_UART1_TX,
  243. .end = IRQ_UART1_TX,
  244. .flags = IORESOURCE_IRQ,
  245. },
  246. {
  247. .start = IRQ_UART1_RX,
  248. .end = IRQ_UART1_RX,
  249. .flags = IORESOURCE_IRQ,
  250. },
  251. {
  252. .start = IRQ_UART1_STAT,
  253. .end = IRQ_UART1_STAT,
  254. .flags = IORESOURCE_IRQ,
  255. },
  256. {
  257. .start = CH_UART1_TX,
  258. .end = CH_UART1_TX,
  259. .flags = IORESOURCE_DMA,
  260. },
  261. {
  262. .start = CH_UART1_RX,
  263. .end = CH_UART1_RX,
  264. .flags = IORESOURCE_DMA,
  265. },
  266. #ifdef CONFIG_BFIN_UART1_CTSRTS
  267. { /* CTS pin -- 0 means not supported */
  268. .start = GPIO_PG13,
  269. .end = GPIO_PG13,
  270. .flags = IORESOURCE_IO,
  271. },
  272. { /* RTS pin -- 0 means not supported */
  273. .start = GPIO_PG10,
  274. .end = GPIO_PG10,
  275. .flags = IORESOURCE_IO,
  276. },
  277. #endif
  278. };
  279. static unsigned short bfin_uart1_peripherals[] = {
  280. P_UART1_TX, P_UART1_RX,
  281. #ifdef CONFIG_BFIN_UART1_CTSRTS
  282. P_UART1_RTS, P_UART1_CTS,
  283. #endif
  284. 0
  285. };
  286. static struct platform_device bfin_uart1_device = {
  287. .name = "bfin-uart",
  288. .id = 1,
  289. .num_resources = ARRAY_SIZE(bfin_uart1_resources),
  290. .resource = bfin_uart1_resources,
  291. .dev = {
  292. .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
  293. },
  294. };
  295. #endif
  296. #endif
  297. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  298. #ifdef CONFIG_BFIN_SIR0
  299. static struct resource bfin_sir0_resources[] = {
  300. {
  301. .start = 0xFFC00400,
  302. .end = 0xFFC004FF,
  303. .flags = IORESOURCE_MEM,
  304. },
  305. {
  306. .start = IRQ_UART0_TX,
  307. .end = IRQ_UART0_TX+1,
  308. .flags = IORESOURCE_IRQ,
  309. },
  310. {
  311. .start = CH_UART0_TX,
  312. .end = CH_UART0_TX+1,
  313. .flags = IORESOURCE_DMA,
  314. },
  315. };
  316. static struct platform_device bfin_sir0_device = {
  317. .name = "bfin_sir",
  318. .id = 0,
  319. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  320. .resource = bfin_sir0_resources,
  321. };
  322. #endif
  323. #ifdef CONFIG_BFIN_SIR1
  324. static struct resource bfin_sir1_resources[] = {
  325. {
  326. .start = 0xFFC02000,
  327. .end = 0xFFC020FF,
  328. .flags = IORESOURCE_MEM,
  329. },
  330. {
  331. .start = IRQ_UART1_TX,
  332. .end = IRQ_UART1_TX+1,
  333. .flags = IORESOURCE_IRQ,
  334. },
  335. {
  336. .start = CH_UART1_TX,
  337. .end = CH_UART1_TX+1,
  338. .flags = IORESOURCE_DMA,
  339. },
  340. };
  341. static struct platform_device bfin_sir1_device = {
  342. .name = "bfin_sir",
  343. .id = 1,
  344. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  345. .resource = bfin_sir1_resources,
  346. };
  347. #endif
  348. #endif
  349. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  350. static struct resource musb_resources[] = {
  351. [0] = {
  352. .start = 0xFFCC1000,
  353. .end = 0xFFCC1398,
  354. .flags = IORESOURCE_MEM,
  355. },
  356. [1] = { /* general IRQ */
  357. .start = IRQ_USB_STAT,
  358. .end = IRQ_USB_STAT,
  359. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  360. .name = "mc"
  361. },
  362. [2] = { /* DMA IRQ */
  363. .start = IRQ_USB_DMA,
  364. .end = IRQ_USB_DMA,
  365. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  366. .name = "dma"
  367. },
  368. };
  369. static struct musb_hdrc_config musb_config = {
  370. .multipoint = 1,
  371. .dyn_fifo = 0,
  372. .dma = 1,
  373. .num_eps = 16,
  374. .dma_channels = 8,
  375. .clkin = 48, /* musb CLKIN in MHZ */
  376. };
  377. static struct musb_hdrc_platform_data musb_plat = {
  378. #if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
  379. .mode = MUSB_OTG,
  380. #elif defined(CONFIG_USB_MUSB_HDRC)
  381. .mode = MUSB_HOST,
  382. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  383. .mode = MUSB_PERIPHERAL,
  384. #endif
  385. .config = &musb_config,
  386. };
  387. static u64 musb_dmamask = ~(u32)0;
  388. static struct platform_device musb_device = {
  389. .name = "musb-blackfin",
  390. .id = 0,
  391. .dev = {
  392. .dma_mask = &musb_dmamask,
  393. .coherent_dma_mask = 0xffffffff,
  394. .platform_data = &musb_plat,
  395. },
  396. .num_resources = ARRAY_SIZE(musb_resources),
  397. .resource = musb_resources,
  398. };
  399. #endif
  400. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  401. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  402. static struct resource bfin_sport0_uart_resources[] = {
  403. {
  404. .start = SPORT0_TCR1,
  405. .end = SPORT0_MRCS3+4,
  406. .flags = IORESOURCE_MEM,
  407. },
  408. {
  409. .start = IRQ_SPORT0_RX,
  410. .end = IRQ_SPORT0_RX+1,
  411. .flags = IORESOURCE_IRQ,
  412. },
  413. {
  414. .start = IRQ_SPORT0_ERROR,
  415. .end = IRQ_SPORT0_ERROR,
  416. .flags = IORESOURCE_IRQ,
  417. },
  418. };
  419. static unsigned short bfin_sport0_peripherals[] = {
  420. P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
  421. P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
  422. };
  423. static struct platform_device bfin_sport0_uart_device = {
  424. .name = "bfin-sport-uart",
  425. .id = 0,
  426. .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
  427. .resource = bfin_sport0_uart_resources,
  428. .dev = {
  429. .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
  430. },
  431. };
  432. #endif
  433. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  434. static struct resource bfin_sport1_uart_resources[] = {
  435. {
  436. .start = SPORT1_TCR1,
  437. .end = SPORT1_MRCS3+4,
  438. .flags = IORESOURCE_MEM,
  439. },
  440. {
  441. .start = IRQ_SPORT1_RX,
  442. .end = IRQ_SPORT1_RX+1,
  443. .flags = IORESOURCE_IRQ,
  444. },
  445. {
  446. .start = IRQ_SPORT1_ERROR,
  447. .end = IRQ_SPORT1_ERROR,
  448. .flags = IORESOURCE_IRQ,
  449. },
  450. };
  451. static unsigned short bfin_sport1_peripherals[] = {
  452. P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
  453. P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
  454. };
  455. static struct platform_device bfin_sport1_uart_device = {
  456. .name = "bfin-sport-uart",
  457. .id = 1,
  458. .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
  459. .resource = bfin_sport1_uart_resources,
  460. .dev = {
  461. .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
  462. },
  463. };
  464. #endif
  465. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  466. static struct resource bfin_sport2_uart_resources[] = {
  467. {
  468. .start = SPORT2_TCR1,
  469. .end = SPORT2_MRCS3+4,
  470. .flags = IORESOURCE_MEM,
  471. },
  472. {
  473. .start = IRQ_SPORT2_RX,
  474. .end = IRQ_SPORT2_RX+1,
  475. .flags = IORESOURCE_IRQ,
  476. },
  477. {
  478. .start = IRQ_SPORT2_ERROR,
  479. .end = IRQ_SPORT2_ERROR,
  480. .flags = IORESOURCE_IRQ,
  481. },
  482. };
  483. static unsigned short bfin_sport2_peripherals[] = {
  484. P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
  485. P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
  486. };
  487. static struct platform_device bfin_sport2_uart_device = {
  488. .name = "bfin-sport-uart",
  489. .id = 2,
  490. .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
  491. .resource = bfin_sport2_uart_resources,
  492. .dev = {
  493. .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
  494. },
  495. };
  496. #endif
  497. #endif
  498. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  499. static unsigned short bfin_can0_peripherals[] = {
  500. P_CAN0_RX, P_CAN0_TX, 0
  501. };
  502. static struct resource bfin_can0_resources[] = {
  503. {
  504. .start = 0xFFC00A00,
  505. .end = 0xFFC00FFF,
  506. .flags = IORESOURCE_MEM,
  507. },
  508. {
  509. .start = IRQ_CAN0_RX,
  510. .end = IRQ_CAN0_RX,
  511. .flags = IORESOURCE_IRQ,
  512. },
  513. {
  514. .start = IRQ_CAN0_TX,
  515. .end = IRQ_CAN0_TX,
  516. .flags = IORESOURCE_IRQ,
  517. },
  518. {
  519. .start = IRQ_CAN0_STAT,
  520. .end = IRQ_CAN0_STAT,
  521. .flags = IORESOURCE_IRQ,
  522. },
  523. };
  524. static struct platform_device bfin_can0_device = {
  525. .name = "bfin_can",
  526. .id = 0,
  527. .num_resources = ARRAY_SIZE(bfin_can0_resources),
  528. .resource = bfin_can0_resources,
  529. .dev = {
  530. .platform_data = &bfin_can0_peripherals, /* Passed to driver */
  531. },
  532. };
  533. #endif
  534. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  535. static struct mtd_partition partition_info[] = {
  536. {
  537. .name = "bootloader(nand)",
  538. .offset = 0,
  539. .size = 0x80000,
  540. }, {
  541. .name = "linux kernel(nand)",
  542. .offset = MTDPART_OFS_APPEND,
  543. .size = 4 * 1024 * 1024,
  544. },
  545. {
  546. .name = "file system(nand)",
  547. .offset = MTDPART_OFS_APPEND,
  548. .size = MTDPART_SIZ_FULL,
  549. },
  550. };
  551. static struct bf5xx_nand_platform bfin_nand_platform = {
  552. .data_width = NFC_NWIDTH_8,
  553. .partitions = partition_info,
  554. .nr_partitions = ARRAY_SIZE(partition_info),
  555. .rd_dly = 3,
  556. .wr_dly = 3,
  557. };
  558. static struct resource bfin_nand_resources[] = {
  559. {
  560. .start = 0xFFC03B00,
  561. .end = 0xFFC03B4F,
  562. .flags = IORESOURCE_MEM,
  563. },
  564. {
  565. .start = CH_NFC,
  566. .end = CH_NFC,
  567. .flags = IORESOURCE_IRQ,
  568. },
  569. };
  570. static struct platform_device bfin_nand_device = {
  571. .name = "bfin-nand",
  572. .id = 0,
  573. .num_resources = ARRAY_SIZE(bfin_nand_resources),
  574. .resource = bfin_nand_resources,
  575. .dev = {
  576. .platform_data = &bfin_nand_platform,
  577. },
  578. };
  579. #endif
  580. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  581. static struct bfin_sd_host bfin_sdh_data = {
  582. .dma_chan = CH_RSI,
  583. .irq_int0 = IRQ_RSI_INT0,
  584. .pin_req = {P_RSI_DATA0, P_RSI_DATA1, P_RSI_DATA2, P_RSI_DATA3, P_RSI_CMD, P_RSI_CLK, 0},
  585. };
  586. static struct platform_device bfin_sdh_device = {
  587. .name = "bfin-sdh",
  588. .id = 0,
  589. .dev = {
  590. .platform_data = &bfin_sdh_data,
  591. },
  592. };
  593. #endif
  594. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  595. static struct mtd_partition ezkit_partitions[] = {
  596. {
  597. .name = "bootloader(nor)",
  598. .size = 0x80000,
  599. .offset = 0,
  600. }, {
  601. .name = "linux kernel(nor)",
  602. .size = 0x400000,
  603. .offset = MTDPART_OFS_APPEND,
  604. }, {
  605. .name = "file system(nor)",
  606. .size = 0x1000000 - 0x80000 - 0x400000,
  607. .offset = MTDPART_OFS_APPEND,
  608. },
  609. };
  610. int bf609_nor_flash_init(struct platform_device *dev)
  611. {
  612. #define CONFIG_SMC_GCTL_VAL 0x00000010
  613. const unsigned short pins[] = {
  614. P_A3, P_A4, P_A5, P_A6, P_A7, P_A8, P_A9, P_A10, P_A11, P_A12,
  615. P_A13, P_A14, P_A15, P_A16, P_A17, P_A18, P_A19, P_A20, P_A21,
  616. P_A22, P_A23, P_A24, P_A25, P_NORCK, 0,
  617. };
  618. peripheral_request_list(pins, "smc0");
  619. bfin_write32(SMC_GCTL, CONFIG_SMC_GCTL_VAL);
  620. bfin_write32(SMC_B0CTL, 0x01002011);
  621. bfin_write32(SMC_B0TIM, 0x08170977);
  622. bfin_write32(SMC_B0ETIM, 0x00092231);
  623. return 0;
  624. }
  625. static struct physmap_flash_data ezkit_flash_data = {
  626. .width = 2,
  627. .parts = ezkit_partitions,
  628. .init = bf609_nor_flash_init,
  629. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  630. #ifdef CONFIG_ROMKERNEL
  631. .probe_type = "map_rom",
  632. #endif
  633. };
  634. static struct resource ezkit_flash_resource = {
  635. .start = 0xb0000000,
  636. .end = 0xb0ffffff,
  637. .flags = IORESOURCE_MEM,
  638. };
  639. static struct platform_device ezkit_flash_device = {
  640. .name = "physmap-flash",
  641. .id = 0,
  642. .dev = {
  643. .platform_data = &ezkit_flash_data,
  644. },
  645. .num_resources = 1,
  646. .resource = &ezkit_flash_resource,
  647. };
  648. #endif
  649. #if defined(CONFIG_MTD_M25P80) \
  650. || defined(CONFIG_MTD_M25P80_MODULE)
  651. /* SPI flash chip (w25q32) */
  652. static struct mtd_partition bfin_spi_flash_partitions[] = {
  653. {
  654. .name = "bootloader(spi)",
  655. .size = 0x00080000,
  656. .offset = 0,
  657. .mask_flags = MTD_CAP_ROM
  658. }, {
  659. .name = "linux kernel(spi)",
  660. .size = 0x00180000,
  661. .offset = MTDPART_OFS_APPEND,
  662. }, {
  663. .name = "file system(spi)",
  664. .size = MTDPART_SIZ_FULL,
  665. .offset = MTDPART_OFS_APPEND,
  666. }
  667. };
  668. static struct flash_platform_data bfin_spi_flash_data = {
  669. .name = "m25p80",
  670. .parts = bfin_spi_flash_partitions,
  671. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  672. .type = "w25q32",
  673. };
  674. static struct bfin6xx_spi_chip spi_flash_chip_info = {
  675. .enable_dma = true, /* use dma transfer with this chip*/
  676. };
  677. #endif
  678. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  679. static struct bfin6xx_spi_chip spidev_chip_info = {
  680. .enable_dma = true,
  681. };
  682. #endif
  683. #if defined(CONFIG_SND_BF6XX_I2S) || defined(CONFIG_SND_BF6XX_I2S_MODULE)
  684. static struct platform_device bfin_i2s_pcm = {
  685. .name = "bfin-i2s-pcm-audio",
  686. .id = -1,
  687. };
  688. #endif
  689. #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
  690. defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
  691. #include <asm/bfin_sport3.h>
  692. static struct resource bfin_snd_resources[] = {
  693. {
  694. .start = SPORT0_CTL_A,
  695. .end = SPORT0_CTL_A,
  696. .flags = IORESOURCE_MEM,
  697. },
  698. {
  699. .start = SPORT0_CTL_B,
  700. .end = SPORT0_CTL_B,
  701. .flags = IORESOURCE_MEM,
  702. },
  703. {
  704. .start = CH_SPORT0_TX,
  705. .end = CH_SPORT0_TX,
  706. .flags = IORESOURCE_DMA,
  707. },
  708. {
  709. .start = CH_SPORT0_RX,
  710. .end = CH_SPORT0_RX,
  711. .flags = IORESOURCE_DMA,
  712. },
  713. {
  714. .start = IRQ_SPORT0_TX_STAT,
  715. .end = IRQ_SPORT0_TX_STAT,
  716. .flags = IORESOURCE_IRQ,
  717. },
  718. {
  719. .start = IRQ_SPORT0_RX_STAT,
  720. .end = IRQ_SPORT0_RX_STAT,
  721. .flags = IORESOURCE_IRQ,
  722. },
  723. };
  724. static const unsigned short bfin_snd_pin[] = {
  725. P_SPORT0_ACLK, P_SPORT0_AFS, P_SPORT0_AD0, P_SPORT0_BCLK,
  726. P_SPORT0_BFS, P_SPORT0_BD0, 0,
  727. };
  728. static struct bfin_snd_platform_data bfin_snd_data = {
  729. .pin_req = bfin_snd_pin,
  730. };
  731. static struct platform_device bfin_i2s = {
  732. .name = "bfin-i2s",
  733. .num_resources = ARRAY_SIZE(bfin_snd_resources),
  734. .resource = bfin_snd_resources,
  735. .dev = {
  736. .platform_data = &bfin_snd_data,
  737. },
  738. };
  739. #endif
  740. #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
  741. defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
  742. static struct platform_device adau1761_device = {
  743. .name = "bfin-eval-adau1x61",
  744. };
  745. #endif
  746. #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
  747. #include <sound/adau17x1.h>
  748. static struct adau1761_platform_data adau1761_info = {
  749. .lineout_mode = ADAU1761_OUTPUT_MODE_LINE,
  750. .headphone_mode = ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
  751. };
  752. #endif
  753. #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
  754. || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
  755. #include <linux/videodev2.h>
  756. #include <media/blackfin/bfin_capture.h>
  757. #include <media/blackfin/ppi.h>
  758. static const unsigned short ppi_req[] = {
  759. P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
  760. P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
  761. P_PPI0_D8, P_PPI0_D9, P_PPI0_D10, P_PPI0_D11,
  762. P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, P_PPI0_D15,
  763. P_PPI0_D16, P_PPI0_D17, P_PPI0_D18, P_PPI0_D19,
  764. P_PPI0_D20, P_PPI0_D21, P_PPI0_D22, P_PPI0_D23,
  765. P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
  766. 0,
  767. };
  768. static const struct ppi_info ppi_info = {
  769. .type = PPI_TYPE_EPPI3,
  770. .dma_ch = CH_EPPI0_CH0,
  771. .irq_err = IRQ_EPPI0_STAT,
  772. .base = (void __iomem *)EPPI0_STAT,
  773. .pin_req = ppi_req,
  774. };
  775. #if defined(CONFIG_VIDEO_VS6624) \
  776. || defined(CONFIG_VIDEO_VS6624_MODULE)
  777. static struct v4l2_input vs6624_inputs[] = {
  778. {
  779. .index = 0,
  780. .name = "Camera",
  781. .type = V4L2_INPUT_TYPE_CAMERA,
  782. .std = V4L2_STD_UNKNOWN,
  783. },
  784. };
  785. static struct bcap_route vs6624_routes[] = {
  786. {
  787. .input = 0,
  788. .output = 0,
  789. },
  790. };
  791. static const unsigned vs6624_ce_pin = GPIO_PD1;
  792. static struct bfin_capture_config bfin_capture_data = {
  793. .card_name = "BF609",
  794. .inputs = vs6624_inputs,
  795. .num_inputs = ARRAY_SIZE(vs6624_inputs),
  796. .routes = vs6624_routes,
  797. .i2c_adapter_id = 0,
  798. .board_info = {
  799. .type = "vs6624",
  800. .addr = 0x10,
  801. .platform_data = (void *)&vs6624_ce_pin,
  802. },
  803. .ppi_info = &ppi_info,
  804. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1HI_FS2HI
  805. | EPPI_CTL_POLC3 | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
  806. .blank_clocks = 8,
  807. };
  808. #endif
  809. #if defined(CONFIG_VIDEO_ADV7842) \
  810. || defined(CONFIG_VIDEO_ADV7842_MODULE)
  811. #include <media/adv7842.h>
  812. static struct v4l2_input adv7842_inputs[] = {
  813. {
  814. .index = 0,
  815. .name = "Composite",
  816. .type = V4L2_INPUT_TYPE_CAMERA,
  817. .std = V4L2_STD_ALL,
  818. },
  819. {
  820. .index = 1,
  821. .name = "S-Video",
  822. .type = V4L2_INPUT_TYPE_CAMERA,
  823. .std = V4L2_STD_ALL,
  824. },
  825. {
  826. .index = 2,
  827. .name = "Component",
  828. .type = V4L2_INPUT_TYPE_CAMERA,
  829. .std = V4L2_STD_ALL,
  830. },
  831. {
  832. .index = 3,
  833. .name = "VGA",
  834. .type = V4L2_INPUT_TYPE_CAMERA,
  835. .std = V4L2_STD_ALL,
  836. },
  837. {
  838. .index = 4,
  839. .name = "HDMI",
  840. .type = V4L2_INPUT_TYPE_CAMERA,
  841. .std = V4L2_STD_ALL,
  842. },
  843. };
  844. static struct bcap_route adv7842_routes[] = {
  845. {
  846. .input = 3,
  847. },
  848. {
  849. .input = 4,
  850. },
  851. {
  852. .input = 2,
  853. },
  854. {
  855. .input = 1,
  856. },
  857. {
  858. .input = 0,
  859. },
  860. };
  861. static struct adv7842_platform_data adv7842_data = {
  862. .ain_sel = ADV7842_AIN10_11_12_NC_SYNC_4_1,
  863. .op_ch_sel = ADV7842_OP_CH_SEL_BRG,
  864. .prim_mode = ADV7842_PRIM_MODE_SDP,
  865. .vid_std_select = ADV7842_SDP_VID_STD_CVBS_SD_4x1,
  866. .inp_color_space = ADV7842_INP_COLOR_SPACE_AUTO,
  867. .op_format_sel = ADV7842_OP_FORMAT_SEL_SDR_ITU656_8,
  868. .op_656_range = 1,
  869. .blank_data = 1,
  870. .insert_av_codes = 1,
  871. .i2c_sdp_io = 0x30,
  872. .i2c_sdp = 0x31,
  873. .i2c_cp = 0x32,
  874. .i2c_vdp = 0x33,
  875. .i2c_afe = 0x34,
  876. .i2c_hdmi = 0x35,
  877. .i2c_repeater = 0x36,
  878. .i2c_edid = 0x37,
  879. .i2c_infoframe = 0x38,
  880. .i2c_cec = 0x39,
  881. .i2c_avlink = 0x3a,
  882. };
  883. static struct bfin_capture_config bfin_capture_data = {
  884. .card_name = "BF609",
  885. .inputs = adv7842_inputs,
  886. .num_inputs = ARRAY_SIZE(adv7842_inputs),
  887. .routes = adv7842_routes,
  888. .i2c_adapter_id = 0,
  889. .board_info = {
  890. .type = "adv7842",
  891. .addr = 0x20,
  892. .platform_data = (void *)&adv7842_data,
  893. },
  894. .ppi_info = &ppi_info,
  895. .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FLDSEL
  896. | EPPI_CTL_ACTIVE656),
  897. };
  898. #endif
  899. static struct platform_device bfin_capture_device = {
  900. .name = "bfin_capture",
  901. .dev = {
  902. .platform_data = &bfin_capture_data,
  903. },
  904. };
  905. #endif
  906. #if defined(CONFIG_BFIN_CRC)
  907. #define BFIN_CRC_NAME "bfin-crc"
  908. static struct resource bfin_crc0_resources[] = {
  909. {
  910. .start = REG_CRC0_CTL,
  911. .end = REG_CRC0_REVID+4,
  912. .flags = IORESOURCE_MEM,
  913. },
  914. {
  915. .start = IRQ_CRC0_DCNTEXP,
  916. .end = IRQ_CRC0_DCNTEXP,
  917. .flags = IORESOURCE_IRQ,
  918. },
  919. {
  920. .start = CH_MEM_STREAM0_SRC_CRC0,
  921. .end = CH_MEM_STREAM0_SRC_CRC0,
  922. .flags = IORESOURCE_DMA,
  923. },
  924. {
  925. .start = CH_MEM_STREAM0_DEST_CRC0,
  926. .end = CH_MEM_STREAM0_DEST_CRC0,
  927. .flags = IORESOURCE_DMA,
  928. },
  929. };
  930. static struct platform_device bfin_crc0_device = {
  931. .name = BFIN_CRC_NAME,
  932. .id = 0,
  933. .num_resources = ARRAY_SIZE(bfin_crc0_resources),
  934. .resource = bfin_crc0_resources,
  935. };
  936. static struct resource bfin_crc1_resources[] = {
  937. {
  938. .start = REG_CRC1_CTL,
  939. .end = REG_CRC1_REVID+4,
  940. .flags = IORESOURCE_MEM,
  941. },
  942. {
  943. .start = IRQ_CRC1_DCNTEXP,
  944. .end = IRQ_CRC1_DCNTEXP,
  945. .flags = IORESOURCE_IRQ,
  946. },
  947. {
  948. .start = CH_MEM_STREAM1_SRC_CRC1,
  949. .end = CH_MEM_STREAM1_SRC_CRC1,
  950. .flags = IORESOURCE_DMA,
  951. },
  952. {
  953. .start = CH_MEM_STREAM1_DEST_CRC1,
  954. .end = CH_MEM_STREAM1_DEST_CRC1,
  955. .flags = IORESOURCE_DMA,
  956. },
  957. };
  958. static struct platform_device bfin_crc1_device = {
  959. .name = BFIN_CRC_NAME,
  960. .id = 1,
  961. .num_resources = ARRAY_SIZE(bfin_crc1_resources),
  962. .resource = bfin_crc1_resources,
  963. };
  964. #endif
  965. #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
  966. #define BFIN_CRYPTO_CRC_NAME "bfin-hmac-crc"
  967. #define BFIN_CRYPTO_CRC_POLY_DATA 0x5c5c5c5c
  968. static struct resource bfin_crypto_crc_resources[] = {
  969. {
  970. .start = REG_CRC0_CTL,
  971. .end = REG_CRC0_REVID+4,
  972. .flags = IORESOURCE_MEM,
  973. },
  974. {
  975. .start = IRQ_CRC0_DCNTEXP,
  976. .end = IRQ_CRC0_DCNTEXP,
  977. .flags = IORESOURCE_IRQ,
  978. },
  979. {
  980. .start = CH_MEM_STREAM0_SRC_CRC0,
  981. .end = CH_MEM_STREAM0_SRC_CRC0,
  982. .flags = IORESOURCE_DMA,
  983. },
  984. };
  985. static struct platform_device bfin_crypto_crc_device = {
  986. .name = BFIN_CRYPTO_CRC_NAME,
  987. .id = 0,
  988. .num_resources = ARRAY_SIZE(bfin_crypto_crc_resources),
  989. .resource = bfin_crypto_crc_resources,
  990. .dev = {
  991. .platform_data = (void *)BFIN_CRYPTO_CRC_POLY_DATA,
  992. },
  993. };
  994. #endif
  995. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  996. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  997. .model = 7877,
  998. .vref_delay_usecs = 50, /* internal, no capacitor */
  999. .x_plate_ohms = 419,
  1000. .y_plate_ohms = 486,
  1001. .pressure_max = 1000,
  1002. .pressure_min = 0,
  1003. .stopacq_polarity = 1,
  1004. .first_conversion_delay = 3,
  1005. .acquisition_time = 1,
  1006. .averaging = 1,
  1007. .pen_down_acc_interval = 1,
  1008. };
  1009. #endif
  1010. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1011. #include <linux/input.h>
  1012. #include <linux/gpio_keys.h>
  1013. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  1014. {BTN_0, GPIO_PB10, 1, "gpio-keys: BTN0"},
  1015. {BTN_1, GPIO_PE1, 1, "gpio-keys: BTN1"},
  1016. };
  1017. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  1018. .buttons = bfin_gpio_keys_table,
  1019. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  1020. };
  1021. static struct platform_device bfin_device_gpiokeys = {
  1022. .name = "gpio-keys",
  1023. .dev = {
  1024. .platform_data = &bfin_gpio_keys_data,
  1025. },
  1026. };
  1027. #endif
  1028. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  1029. #if defined(CONFIG_MTD_M25P80) \
  1030. || defined(CONFIG_MTD_M25P80_MODULE)
  1031. {
  1032. /* the modalias must be the same as spi device driver name */
  1033. .modalias = "m25p80", /* Name of spi_driver for this device */
  1034. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  1035. .bus_num = 0, /* Framework bus number */
  1036. .chip_select = 1, /* SPI_SSEL1*/
  1037. .platform_data = &bfin_spi_flash_data,
  1038. .controller_data = &spi_flash_chip_info,
  1039. .mode = SPI_MODE_3,
  1040. },
  1041. #endif
  1042. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  1043. {
  1044. .modalias = "ad7877",
  1045. .platform_data = &bfin_ad7877_ts_info,
  1046. .irq = IRQ_PD9,
  1047. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  1048. .bus_num = 0,
  1049. .chip_select = 4,
  1050. },
  1051. #endif
  1052. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  1053. {
  1054. .modalias = "spidev",
  1055. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  1056. .bus_num = 0,
  1057. .chip_select = 1,
  1058. .controller_data = &spidev_chip_info,
  1059. },
  1060. #endif
  1061. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  1062. {
  1063. .modalias = "adxl34x",
  1064. .platform_data = &adxl34x_info,
  1065. .irq = IRQ_PC5,
  1066. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  1067. .bus_num = 1,
  1068. .chip_select = 2,
  1069. .mode = SPI_MODE_3,
  1070. },
  1071. #endif
  1072. };
  1073. #if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE)
  1074. /* SPI (0) */
  1075. static struct resource bfin_spi0_resource[] = {
  1076. {
  1077. .start = SPI0_REGBASE,
  1078. .end = SPI0_REGBASE + 0xFF,
  1079. .flags = IORESOURCE_MEM,
  1080. },
  1081. {
  1082. .start = CH_SPI0_TX,
  1083. .end = CH_SPI0_TX,
  1084. .flags = IORESOURCE_DMA,
  1085. },
  1086. {
  1087. .start = CH_SPI0_RX,
  1088. .end = CH_SPI0_RX,
  1089. .flags = IORESOURCE_DMA,
  1090. },
  1091. };
  1092. /* SPI (1) */
  1093. static struct resource bfin_spi1_resource[] = {
  1094. {
  1095. .start = SPI1_REGBASE,
  1096. .end = SPI1_REGBASE + 0xFF,
  1097. .flags = IORESOURCE_MEM,
  1098. },
  1099. {
  1100. .start = CH_SPI1_TX,
  1101. .end = CH_SPI1_TX,
  1102. .flags = IORESOURCE_DMA,
  1103. },
  1104. {
  1105. .start = CH_SPI1_RX,
  1106. .end = CH_SPI1_RX,
  1107. .flags = IORESOURCE_DMA,
  1108. },
  1109. };
  1110. /* SPI controller data */
  1111. static struct bfin6xx_spi_master bf60x_spi_master_info0 = {
  1112. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1113. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  1114. };
  1115. static struct platform_device bf60x_spi_master0 = {
  1116. .name = "bfin-spi",
  1117. .id = 0, /* Bus number */
  1118. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  1119. .resource = bfin_spi0_resource,
  1120. .dev = {
  1121. .platform_data = &bf60x_spi_master_info0, /* Passed to driver */
  1122. },
  1123. };
  1124. static struct bfin6xx_spi_master bf60x_spi_master_info1 = {
  1125. .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
  1126. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  1127. };
  1128. static struct platform_device bf60x_spi_master1 = {
  1129. .name = "bfin-spi",
  1130. .id = 1, /* Bus number */
  1131. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  1132. .resource = bfin_spi1_resource,
  1133. .dev = {
  1134. .platform_data = &bf60x_spi_master_info1, /* Passed to driver */
  1135. },
  1136. };
  1137. #endif /* spi master and devices */
  1138. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1139. static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
  1140. static struct resource bfin_twi0_resource[] = {
  1141. [0] = {
  1142. .start = TWI0_CLKDIV,
  1143. .end = TWI0_CLKDIV + 0xFF,
  1144. .flags = IORESOURCE_MEM,
  1145. },
  1146. [1] = {
  1147. .start = IRQ_TWI0,
  1148. .end = IRQ_TWI0,
  1149. .flags = IORESOURCE_IRQ,
  1150. },
  1151. };
  1152. static struct platform_device i2c_bfin_twi0_device = {
  1153. .name = "i2c-bfin-twi",
  1154. .id = 0,
  1155. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  1156. .resource = bfin_twi0_resource,
  1157. .dev = {
  1158. .platform_data = &bfin_twi0_pins,
  1159. },
  1160. };
  1161. static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
  1162. static struct resource bfin_twi1_resource[] = {
  1163. [0] = {
  1164. .start = TWI1_CLKDIV,
  1165. .end = TWI1_CLKDIV + 0xFF,
  1166. .flags = IORESOURCE_MEM,
  1167. },
  1168. [1] = {
  1169. .start = IRQ_TWI1,
  1170. .end = IRQ_TWI1,
  1171. .flags = IORESOURCE_IRQ,
  1172. },
  1173. };
  1174. static struct platform_device i2c_bfin_twi1_device = {
  1175. .name = "i2c-bfin-twi",
  1176. .id = 1,
  1177. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  1178. .resource = bfin_twi1_resource,
  1179. .dev = {
  1180. .platform_data = &bfin_twi1_pins,
  1181. },
  1182. };
  1183. #endif
  1184. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  1185. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  1186. {
  1187. I2C_BOARD_INFO("adxl34x", 0x53),
  1188. .irq = IRQ_PC5,
  1189. .platform_data = (void *)&adxl34x_info,
  1190. },
  1191. #endif
  1192. #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
  1193. {
  1194. I2C_BOARD_INFO("adau1761", 0x38),
  1195. .platform_data = (void *)&adau1761_info
  1196. },
  1197. #endif
  1198. #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
  1199. {
  1200. I2C_BOARD_INFO("ssm2602", 0x1b),
  1201. },
  1202. #endif
  1203. };
  1204. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  1205. };
  1206. static const unsigned int cclk_vlev_datasheet[] =
  1207. {
  1208. /*
  1209. * Internal VLEV BF54XSBBC1533
  1210. ****temporarily using these values until data sheet is updated
  1211. */
  1212. VRPAIR(VLEV_085, 150000000),
  1213. VRPAIR(VLEV_090, 250000000),
  1214. VRPAIR(VLEV_110, 276000000),
  1215. VRPAIR(VLEV_115, 301000000),
  1216. VRPAIR(VLEV_120, 525000000),
  1217. VRPAIR(VLEV_125, 550000000),
  1218. VRPAIR(VLEV_130, 600000000),
  1219. };
  1220. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  1221. .tuple_tab = cclk_vlev_datasheet,
  1222. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  1223. .vr_settling_time = 25 /* us */,
  1224. };
  1225. static struct platform_device bfin_dpmc = {
  1226. .name = "bfin dpmc",
  1227. .dev = {
  1228. .platform_data = &bfin_dmpc_vreg_data,
  1229. },
  1230. };
  1231. static struct platform_device *ezkit_devices[] __initdata = {
  1232. &bfin_dpmc,
  1233. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  1234. &rtc_device,
  1235. #endif
  1236. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  1237. #ifdef CONFIG_SERIAL_BFIN_UART0
  1238. &bfin_uart0_device,
  1239. #endif
  1240. #ifdef CONFIG_SERIAL_BFIN_UART1
  1241. &bfin_uart1_device,
  1242. #endif
  1243. #endif
  1244. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  1245. #ifdef CONFIG_BFIN_SIR0
  1246. &bfin_sir0_device,
  1247. #endif
  1248. #ifdef CONFIG_BFIN_SIR1
  1249. &bfin_sir1_device,
  1250. #endif
  1251. #endif
  1252. #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
  1253. &bfin_eth_device,
  1254. #endif
  1255. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  1256. &musb_device,
  1257. #endif
  1258. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  1259. &bfin_isp1760_device,
  1260. #endif
  1261. #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
  1262. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1263. &bfin_sport0_uart_device,
  1264. #endif
  1265. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1266. &bfin_sport1_uart_device,
  1267. #endif
  1268. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1269. &bfin_sport2_uart_device,
  1270. #endif
  1271. #endif
  1272. #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
  1273. &bfin_can0_device,
  1274. #endif
  1275. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  1276. &bfin_nand_device,
  1277. #endif
  1278. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  1279. &bfin_sdh_device,
  1280. #endif
  1281. #if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE)
  1282. &bf60x_spi_master0,
  1283. &bf60x_spi_master1,
  1284. #endif
  1285. #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
  1286. &bfin_rotary_device,
  1287. #endif
  1288. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  1289. &i2c_bfin_twi0_device,
  1290. #if !defined(CONFIG_BF542)
  1291. &i2c_bfin_twi1_device,
  1292. #endif
  1293. #endif
  1294. #if defined(CONFIG_BFIN_CRC)
  1295. &bfin_crc0_device,
  1296. &bfin_crc1_device,
  1297. #endif
  1298. #if defined(CONFIG_CRYPTO_DEV_BFIN_CRC)
  1299. &bfin_crypto_crc_device,
  1300. #endif
  1301. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  1302. &bfin_device_gpiokeys,
  1303. #endif
  1304. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  1305. &ezkit_flash_device,
  1306. #endif
  1307. #if defined(CONFIG_SND_BF6XX_I2S) || defined(CONFIG_SND_BF6XX_I2S_MODULE)
  1308. &bfin_i2s_pcm,
  1309. #endif
  1310. #if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
  1311. defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
  1312. &bfin_i2s,
  1313. #endif
  1314. #if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
  1315. defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
  1316. &adau1761_device,
  1317. #endif
  1318. #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
  1319. || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
  1320. &bfin_capture_device,
  1321. #endif
  1322. };
  1323. static int __init ezkit_init(void)
  1324. {
  1325. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  1326. i2c_register_board_info(0, bfin_i2c_board_info0,
  1327. ARRAY_SIZE(bfin_i2c_board_info0));
  1328. i2c_register_board_info(1, bfin_i2c_board_info1,
  1329. ARRAY_SIZE(bfin_i2c_board_info1));
  1330. #if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
  1331. if (!peripheral_request_list(pins, "emac0"))
  1332. printk(KERN_ERR "%s(): request emac pins failed\n", __func__);
  1333. #endif
  1334. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  1335. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  1336. return 0;
  1337. }
  1338. arch_initcall(ezkit_init);
  1339. static struct platform_device *ezkit_early_devices[] __initdata = {
  1340. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  1341. #ifdef CONFIG_SERIAL_BFIN_UART0
  1342. &bfin_uart0_device,
  1343. #endif
  1344. #ifdef CONFIG_SERIAL_BFIN_UART1
  1345. &bfin_uart1_device,
  1346. #endif
  1347. #endif
  1348. #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
  1349. #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
  1350. &bfin_sport0_uart_device,
  1351. #endif
  1352. #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
  1353. &bfin_sport1_uart_device,
  1354. #endif
  1355. #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
  1356. &bfin_sport2_uart_device,
  1357. #endif
  1358. #endif
  1359. };
  1360. void __init native_machine_early_platform_add_devices(void)
  1361. {
  1362. printk(KERN_INFO "register early platform devices\n");
  1363. early_platform_add_devices(ezkit_early_devices,
  1364. ARRAY_SIZE(ezkit_early_devices));
  1365. }