ezkit.c 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. /*
  2. * File: arch/blackfin/mach-bf548/boards/ezkit.c
  3. * Based on: arch/blackfin/mach-bf537/boards/ezkit.c
  4. * Author: Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Created:
  7. * Description:
  8. *
  9. * Modified:
  10. * Copyright 2005 National ICT Australia (NICTA)
  11. * Copyright 2004-2007 Analog Devices Inc.
  12. *
  13. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, see the file COPYING, or write
  27. * to the Free Software Foundation, Inc.,
  28. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  29. */
  30. #include <linux/device.h>
  31. #include <linux/platform_device.h>
  32. #include <linux/mtd/mtd.h>
  33. #include <linux/mtd/partitions.h>
  34. #include <linux/mtd/physmap.h>
  35. #include <linux/spi/spi.h>
  36. #include <linux/spi/flash.h>
  37. #include <linux/irq.h>
  38. #include <linux/i2c.h>
  39. #include <linux/interrupt.h>
  40. #include <linux/usb/musb.h>
  41. #include <asm/bfin5xx_spi.h>
  42. #include <asm/dma.h>
  43. #include <asm/gpio.h>
  44. #include <asm/nand.h>
  45. #include <asm/dpmc.h>
  46. #include <asm/portmux.h>
  47. #include <asm/bfin_sdh.h>
  48. #include <mach/bf54x_keys.h>
  49. #include <linux/input.h>
  50. #include <linux/spi/ad7877.h>
  51. /*
  52. * Name the Board for the /proc/cpuinfo
  53. */
  54. const char bfin_board_name[] = "ADI BF548-EZKIT";
  55. /*
  56. * Driver needs to know address, irq and flag pin.
  57. */
  58. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  59. #include <linux/usb/isp1760.h>
  60. static struct resource bfin_isp1760_resources[] = {
  61. [0] = {
  62. .start = 0x2C0C0000,
  63. .end = 0x2C0C0000 + 0xfffff,
  64. .flags = IORESOURCE_MEM,
  65. },
  66. [1] = {
  67. .start = IRQ_PG7,
  68. .end = IRQ_PG7,
  69. .flags = IORESOURCE_IRQ,
  70. },
  71. };
  72. static struct isp1760_platform_data isp1760_priv = {
  73. .is_isp1761 = 0,
  74. .bus_width_16 = 1,
  75. .port1_otg = 0,
  76. .analog_oc = 0,
  77. .dack_polarity_high = 0,
  78. .dreq_polarity_high = 0,
  79. };
  80. static struct platform_device bfin_isp1760_device = {
  81. .name = "isp1760-hcd",
  82. .id = 0,
  83. .dev = {
  84. .platform_data = &isp1760_priv,
  85. },
  86. .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
  87. .resource = bfin_isp1760_resources,
  88. };
  89. #endif
  90. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  91. #include <mach/bf54x-lq043.h>
  92. static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
  93. .width = 95,
  94. .height = 54,
  95. .xres = {480, 480, 480},
  96. .yres = {272, 272, 272},
  97. .bpp = {24, 24, 24},
  98. .disp = GPIO_PE3,
  99. };
  100. static struct resource bf54x_lq043_resources[] = {
  101. {
  102. .start = IRQ_EPPI0_ERR,
  103. .end = IRQ_EPPI0_ERR,
  104. .flags = IORESOURCE_IRQ,
  105. },
  106. };
  107. static struct platform_device bf54x_lq043_device = {
  108. .name = "bf54x-lq043",
  109. .id = -1,
  110. .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
  111. .resource = bf54x_lq043_resources,
  112. .dev = {
  113. .platform_data = &bf54x_lq043_data,
  114. },
  115. };
  116. #endif
  117. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  118. static const unsigned int bf548_keymap[] = {
  119. KEYVAL(0, 0, KEY_ENTER),
  120. KEYVAL(0, 1, KEY_HELP),
  121. KEYVAL(0, 2, KEY_0),
  122. KEYVAL(0, 3, KEY_BACKSPACE),
  123. KEYVAL(1, 0, KEY_TAB),
  124. KEYVAL(1, 1, KEY_9),
  125. KEYVAL(1, 2, KEY_8),
  126. KEYVAL(1, 3, KEY_7),
  127. KEYVAL(2, 0, KEY_DOWN),
  128. KEYVAL(2, 1, KEY_6),
  129. KEYVAL(2, 2, KEY_5),
  130. KEYVAL(2, 3, KEY_4),
  131. KEYVAL(3, 0, KEY_UP),
  132. KEYVAL(3, 1, KEY_3),
  133. KEYVAL(3, 2, KEY_2),
  134. KEYVAL(3, 3, KEY_1),
  135. };
  136. static struct bfin_kpad_platform_data bf54x_kpad_data = {
  137. .rows = 4,
  138. .cols = 4,
  139. .keymap = bf548_keymap,
  140. .keymapsize = ARRAY_SIZE(bf548_keymap),
  141. .repeat = 0,
  142. .debounce_time = 5000, /* ns (5ms) */
  143. .coldrive_time = 1000, /* ns (1ms) */
  144. .keyup_test_interval = 50, /* ms (50ms) */
  145. };
  146. static struct resource bf54x_kpad_resources[] = {
  147. {
  148. .start = IRQ_KEY,
  149. .end = IRQ_KEY,
  150. .flags = IORESOURCE_IRQ,
  151. },
  152. };
  153. static struct platform_device bf54x_kpad_device = {
  154. .name = "bf54x-keys",
  155. .id = -1,
  156. .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
  157. .resource = bf54x_kpad_resources,
  158. .dev = {
  159. .platform_data = &bf54x_kpad_data,
  160. },
  161. };
  162. #endif
  163. #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
  164. #include <asm/bfin_rotary.h>
  165. static struct bfin_rotary_platform_data bfin_rotary_data = {
  166. /*.rotary_up_key = KEY_UP,*/
  167. /*.rotary_down_key = KEY_DOWN,*/
  168. .rotary_rel_code = REL_WHEEL,
  169. .rotary_button_key = KEY_ENTER,
  170. .debounce = 10, /* 0..17 */
  171. .mode = ROT_QUAD_ENC | ROT_DEBE,
  172. };
  173. static struct resource bfin_rotary_resources[] = {
  174. {
  175. .start = IRQ_CNT,
  176. .end = IRQ_CNT,
  177. .flags = IORESOURCE_IRQ,
  178. },
  179. };
  180. static struct platform_device bfin_rotary_device = {
  181. .name = "bfin-rotary",
  182. .id = -1,
  183. .num_resources = ARRAY_SIZE(bfin_rotary_resources),
  184. .resource = bfin_rotary_resources,
  185. .dev = {
  186. .platform_data = &bfin_rotary_data,
  187. },
  188. };
  189. #endif
  190. #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
  191. #include <linux/input.h>
  192. #include <linux/spi/adxl34x.h>
  193. static const struct adxl34x_platform_data adxl34x_info = {
  194. .x_axis_offset = 0,
  195. .y_axis_offset = 0,
  196. .z_axis_offset = 0,
  197. .tap_threshold = 0x31,
  198. .tap_duration = 0x10,
  199. .tap_latency = 0x60,
  200. .tap_window = 0xF0,
  201. .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
  202. .act_axis_control = 0xFF,
  203. .activity_threshold = 5,
  204. .inactivity_threshold = 3,
  205. .inactivity_time = 4,
  206. .free_fall_threshold = 0x7,
  207. .free_fall_time = 0x20,
  208. .data_rate = 0x8,
  209. .data_range = ADXL_FULL_RES,
  210. .ev_type = EV_ABS,
  211. .ev_code_x = ABS_X, /* EV_REL */
  212. .ev_code_y = ABS_Y, /* EV_REL */
  213. .ev_code_z = ABS_Z, /* EV_REL */
  214. .ev_code_tap_x = BTN_TOUCH, /* EV_KEY */
  215. .ev_code_tap_y = BTN_TOUCH, /* EV_KEY */
  216. .ev_code_tap_z = BTN_TOUCH, /* EV_KEY */
  217. /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
  218. /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
  219. .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
  220. .fifo_mode = ADXL_FIFO_STREAM,
  221. };
  222. #endif
  223. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  224. static struct platform_device rtc_device = {
  225. .name = "rtc-bfin",
  226. .id = -1,
  227. };
  228. #endif
  229. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  230. static struct resource bfin_uart_resources[] = {
  231. #ifdef CONFIG_SERIAL_BFIN_UART0
  232. {
  233. .start = 0xFFC00400,
  234. .end = 0xFFC004FF,
  235. .flags = IORESOURCE_MEM,
  236. },
  237. #endif
  238. #ifdef CONFIG_SERIAL_BFIN_UART1
  239. {
  240. .start = 0xFFC02000,
  241. .end = 0xFFC020FF,
  242. .flags = IORESOURCE_MEM,
  243. },
  244. #endif
  245. #ifdef CONFIG_SERIAL_BFIN_UART2
  246. {
  247. .start = 0xFFC02100,
  248. .end = 0xFFC021FF,
  249. .flags = IORESOURCE_MEM,
  250. },
  251. #endif
  252. #ifdef CONFIG_SERIAL_BFIN_UART3
  253. {
  254. .start = 0xFFC03100,
  255. .end = 0xFFC031FF,
  256. .flags = IORESOURCE_MEM,
  257. },
  258. #endif
  259. };
  260. static struct platform_device bfin_uart_device = {
  261. .name = "bfin-uart",
  262. .id = 1,
  263. .num_resources = ARRAY_SIZE(bfin_uart_resources),
  264. .resource = bfin_uart_resources,
  265. };
  266. #endif
  267. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  268. #ifdef CONFIG_BFIN_SIR0
  269. static struct resource bfin_sir0_resources[] = {
  270. {
  271. .start = 0xFFC00400,
  272. .end = 0xFFC004FF,
  273. .flags = IORESOURCE_MEM,
  274. },
  275. {
  276. .start = IRQ_UART0_RX,
  277. .end = IRQ_UART0_RX+1,
  278. .flags = IORESOURCE_IRQ,
  279. },
  280. {
  281. .start = CH_UART0_RX,
  282. .end = CH_UART0_RX+1,
  283. .flags = IORESOURCE_DMA,
  284. },
  285. };
  286. static struct platform_device bfin_sir0_device = {
  287. .name = "bfin_sir",
  288. .id = 0,
  289. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  290. .resource = bfin_sir0_resources,
  291. };
  292. #endif
  293. #ifdef CONFIG_BFIN_SIR1
  294. static struct resource bfin_sir1_resources[] = {
  295. {
  296. .start = 0xFFC02000,
  297. .end = 0xFFC020FF,
  298. .flags = IORESOURCE_MEM,
  299. },
  300. {
  301. .start = IRQ_UART1_RX,
  302. .end = IRQ_UART1_RX+1,
  303. .flags = IORESOURCE_IRQ,
  304. },
  305. {
  306. .start = CH_UART1_RX,
  307. .end = CH_UART1_RX+1,
  308. .flags = IORESOURCE_DMA,
  309. },
  310. };
  311. static struct platform_device bfin_sir1_device = {
  312. .name = "bfin_sir",
  313. .id = 1,
  314. .num_resources = ARRAY_SIZE(bfin_sir1_resources),
  315. .resource = bfin_sir1_resources,
  316. };
  317. #endif
  318. #ifdef CONFIG_BFIN_SIR2
  319. static struct resource bfin_sir2_resources[] = {
  320. {
  321. .start = 0xFFC02100,
  322. .end = 0xFFC021FF,
  323. .flags = IORESOURCE_MEM,
  324. },
  325. {
  326. .start = IRQ_UART2_RX,
  327. .end = IRQ_UART2_RX+1,
  328. .flags = IORESOURCE_IRQ,
  329. },
  330. {
  331. .start = CH_UART2_RX,
  332. .end = CH_UART2_RX+1,
  333. .flags = IORESOURCE_DMA,
  334. },
  335. };
  336. static struct platform_device bfin_sir2_device = {
  337. .name = "bfin_sir",
  338. .id = 2,
  339. .num_resources = ARRAY_SIZE(bfin_sir2_resources),
  340. .resource = bfin_sir2_resources,
  341. };
  342. #endif
  343. #ifdef CONFIG_BFIN_SIR3
  344. static struct resource bfin_sir3_resources[] = {
  345. {
  346. .start = 0xFFC03100,
  347. .end = 0xFFC031FF,
  348. .flags = IORESOURCE_MEM,
  349. },
  350. {
  351. .start = IRQ_UART3_RX,
  352. .end = IRQ_UART3_RX+1,
  353. .flags = IORESOURCE_IRQ,
  354. },
  355. {
  356. .start = CH_UART3_RX,
  357. .end = CH_UART3_RX+1,
  358. .flags = IORESOURCE_DMA,
  359. },
  360. };
  361. static struct platform_device bfin_sir3_device = {
  362. .name = "bfin_sir",
  363. .id = 3,
  364. .num_resources = ARRAY_SIZE(bfin_sir3_resources),
  365. .resource = bfin_sir3_resources,
  366. };
  367. #endif
  368. #endif
  369. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  370. #include <linux/smsc911x.h>
  371. static struct resource smsc911x_resources[] = {
  372. {
  373. .name = "smsc911x-memory",
  374. .start = 0x24000000,
  375. .end = 0x24000000 + 0xFF,
  376. .flags = IORESOURCE_MEM,
  377. },
  378. {
  379. .start = IRQ_PE8,
  380. .end = IRQ_PE8,
  381. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  382. },
  383. };
  384. static struct smsc911x_platform_config smsc911x_config = {
  385. .flags = SMSC911X_USE_32BIT,
  386. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  387. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  388. .phy_interface = PHY_INTERFACE_MODE_MII,
  389. };
  390. static struct platform_device smsc911x_device = {
  391. .name = "smsc911x",
  392. .id = 0,
  393. .num_resources = ARRAY_SIZE(smsc911x_resources),
  394. .resource = smsc911x_resources,
  395. .dev = {
  396. .platform_data = &smsc911x_config,
  397. },
  398. };
  399. #endif
  400. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  401. static struct resource musb_resources[] = {
  402. [0] = {
  403. .start = 0xFFC03C00,
  404. .end = 0xFFC040FF,
  405. .flags = IORESOURCE_MEM,
  406. },
  407. [1] = { /* general IRQ */
  408. .start = IRQ_USB_INT0,
  409. .end = IRQ_USB_INT0,
  410. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  411. },
  412. [2] = { /* DMA IRQ */
  413. .start = IRQ_USB_DMA,
  414. .end = IRQ_USB_DMA,
  415. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  416. },
  417. };
  418. static struct musb_hdrc_config musb_config = {
  419. .multipoint = 0,
  420. .dyn_fifo = 0,
  421. .soft_con = 1,
  422. .dma = 1,
  423. .num_eps = 8,
  424. .dma_channels = 8,
  425. .gpio_vrsel = GPIO_PE7,
  426. };
  427. static struct musb_hdrc_platform_data musb_plat = {
  428. #if defined(CONFIG_USB_MUSB_OTG)
  429. .mode = MUSB_OTG,
  430. #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
  431. .mode = MUSB_HOST,
  432. #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
  433. .mode = MUSB_PERIPHERAL,
  434. #endif
  435. .config = &musb_config,
  436. };
  437. static u64 musb_dmamask = ~(u32)0;
  438. static struct platform_device musb_device = {
  439. .name = "musb_hdrc",
  440. .id = 0,
  441. .dev = {
  442. .dma_mask = &musb_dmamask,
  443. .coherent_dma_mask = 0xffffffff,
  444. .platform_data = &musb_plat,
  445. },
  446. .num_resources = ARRAY_SIZE(musb_resources),
  447. .resource = musb_resources,
  448. };
  449. #endif
  450. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  451. static struct resource bfin_atapi_resources[] = {
  452. {
  453. .start = 0xFFC03800,
  454. .end = 0xFFC0386F,
  455. .flags = IORESOURCE_MEM,
  456. },
  457. {
  458. .start = IRQ_ATAPI_ERR,
  459. .end = IRQ_ATAPI_ERR,
  460. .flags = IORESOURCE_IRQ,
  461. },
  462. };
  463. static struct platform_device bfin_atapi_device = {
  464. .name = "pata-bf54x",
  465. .id = -1,
  466. .num_resources = ARRAY_SIZE(bfin_atapi_resources),
  467. .resource = bfin_atapi_resources,
  468. };
  469. #endif
  470. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  471. static struct mtd_partition partition_info[] = {
  472. {
  473. .name = "linux kernel(nand)",
  474. .offset = 0,
  475. .size = 4 * 1024 * 1024,
  476. },
  477. {
  478. .name = "file system(nand)",
  479. .offset = MTDPART_OFS_APPEND,
  480. .size = MTDPART_SIZ_FULL,
  481. },
  482. };
  483. static struct bf5xx_nand_platform bf5xx_nand_platform = {
  484. .page_size = NFC_PG_SIZE_256,
  485. .data_width = NFC_NWIDTH_8,
  486. .partitions = partition_info,
  487. .nr_partitions = ARRAY_SIZE(partition_info),
  488. .rd_dly = 3,
  489. .wr_dly = 3,
  490. };
  491. static struct resource bf5xx_nand_resources[] = {
  492. {
  493. .start = 0xFFC03B00,
  494. .end = 0xFFC03B4F,
  495. .flags = IORESOURCE_MEM,
  496. },
  497. {
  498. .start = CH_NFC,
  499. .end = CH_NFC,
  500. .flags = IORESOURCE_IRQ,
  501. },
  502. };
  503. static struct platform_device bf5xx_nand_device = {
  504. .name = "bf5xx-nand",
  505. .id = 0,
  506. .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
  507. .resource = bf5xx_nand_resources,
  508. .dev = {
  509. .platform_data = &bf5xx_nand_platform,
  510. },
  511. };
  512. #endif
  513. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  514. static struct bfin_sd_host bfin_sdh_data = {
  515. .dma_chan = CH_SDH,
  516. .irq_int0 = IRQ_SDH_MASK0,
  517. .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
  518. };
  519. static struct platform_device bf54x_sdh_device = {
  520. .name = "bfin-sdh",
  521. .id = 0,
  522. .dev = {
  523. .platform_data = &bfin_sdh_data,
  524. },
  525. };
  526. #endif
  527. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  528. static struct mtd_partition ezkit_partitions[] = {
  529. {
  530. .name = "bootloader(nor)",
  531. .size = 0x40000,
  532. .offset = 0,
  533. }, {
  534. .name = "linux kernel(nor)",
  535. .size = 0x400000,
  536. .offset = MTDPART_OFS_APPEND,
  537. }, {
  538. .name = "file system(nor)",
  539. .size = MTDPART_SIZ_FULL,
  540. .offset = MTDPART_OFS_APPEND,
  541. }
  542. };
  543. static struct physmap_flash_data ezkit_flash_data = {
  544. .width = 2,
  545. .parts = ezkit_partitions,
  546. .nr_parts = ARRAY_SIZE(ezkit_partitions),
  547. };
  548. static struct resource ezkit_flash_resource = {
  549. .start = 0x20000000,
  550. .end = 0x21ffffff,
  551. .flags = IORESOURCE_MEM,
  552. };
  553. static struct platform_device ezkit_flash_device = {
  554. .name = "physmap-flash",
  555. .id = 0,
  556. .dev = {
  557. .platform_data = &ezkit_flash_data,
  558. },
  559. .num_resources = 1,
  560. .resource = &ezkit_flash_resource,
  561. };
  562. #endif
  563. #if defined(CONFIG_MTD_M25P80) \
  564. || defined(CONFIG_MTD_M25P80_MODULE)
  565. /* SPI flash chip (m25p16) */
  566. static struct mtd_partition bfin_spi_flash_partitions[] = {
  567. {
  568. .name = "bootloader(spi)",
  569. .size = 0x00040000,
  570. .offset = 0,
  571. .mask_flags = MTD_CAP_ROM
  572. }, {
  573. .name = "linux kernel(spi)",
  574. .size = MTDPART_SIZ_FULL,
  575. .offset = MTDPART_OFS_APPEND,
  576. }
  577. };
  578. static struct flash_platform_data bfin_spi_flash_data = {
  579. .name = "m25p80",
  580. .parts = bfin_spi_flash_partitions,
  581. .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  582. .type = "m25p16",
  583. };
  584. static struct bfin5xx_spi_chip spi_flash_chip_info = {
  585. .enable_dma = 0, /* use dma transfer with this chip*/
  586. .bits_per_word = 8,
  587. .cs_change_per_word = 0,
  588. };
  589. #endif
  590. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  591. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  592. static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  593. .enable_dma = 0,
  594. .bits_per_word = 16,
  595. };
  596. #endif
  597. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  598. static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
  599. .cs_change_per_word = 0,
  600. .enable_dma = 0,
  601. .bits_per_word = 16,
  602. };
  603. static const struct ad7877_platform_data bfin_ad7877_ts_info = {
  604. .model = 7877,
  605. .vref_delay_usecs = 50, /* internal, no capacitor */
  606. .x_plate_ohms = 419,
  607. .y_plate_ohms = 486,
  608. .pressure_max = 1000,
  609. .pressure_min = 0,
  610. .stopacq_polarity = 1,
  611. .first_conversion_delay = 3,
  612. .acquisition_time = 1,
  613. .averaging = 1,
  614. .pen_down_acc_interval = 1,
  615. };
  616. #endif
  617. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  618. static struct bfin5xx_spi_chip spidev_chip_info = {
  619. .enable_dma = 0,
  620. .bits_per_word = 8,
  621. };
  622. #endif
  623. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  624. static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
  625. .enable_dma = 0, /* use dma transfer with this chip*/
  626. .bits_per_word = 8,
  627. .cs_change_per_word = 0,
  628. };
  629. #endif
  630. static struct spi_board_info bfin_spi_board_info[] __initdata = {
  631. #if defined(CONFIG_MTD_M25P80) \
  632. || defined(CONFIG_MTD_M25P80_MODULE)
  633. {
  634. /* the modalias must be the same as spi device driver name */
  635. .modalias = "m25p80", /* Name of spi_driver for this device */
  636. .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
  637. .bus_num = 0, /* Framework bus number */
  638. .chip_select = 1, /* SPI_SSEL1*/
  639. .platform_data = &bfin_spi_flash_data,
  640. .controller_data = &spi_flash_chip_info,
  641. .mode = SPI_MODE_3,
  642. },
  643. #endif
  644. #if defined(CONFIG_SND_BLACKFIN_AD1836) \
  645. || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  646. {
  647. .modalias = "ad1836",
  648. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  649. .bus_num = 1,
  650. .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
  651. .controller_data = &ad1836_spi_chip_info,
  652. },
  653. #endif
  654. #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
  655. {
  656. .modalias = "ad7877",
  657. .platform_data = &bfin_ad7877_ts_info,
  658. .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
  659. .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
  660. .bus_num = 0,
  661. .chip_select = 2,
  662. .controller_data = &spi_ad7877_chip_info,
  663. },
  664. #endif
  665. #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
  666. {
  667. .modalias = "spidev",
  668. .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
  669. .bus_num = 0,
  670. .chip_select = 1,
  671. .controller_data = &spidev_chip_info,
  672. },
  673. #endif
  674. #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
  675. {
  676. .modalias = "adxl34x",
  677. .platform_data = &adxl34x_info,
  678. .irq = IRQ_PC5,
  679. .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
  680. .bus_num = 1,
  681. .chip_select = 2,
  682. .controller_data = &spi_adxl34x_chip_info,
  683. .mode = SPI_MODE_3,
  684. },
  685. #endif
  686. };
  687. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  688. /* SPI (0) */
  689. static struct resource bfin_spi0_resource[] = {
  690. [0] = {
  691. .start = SPI0_REGBASE,
  692. .end = SPI0_REGBASE + 0xFF,
  693. .flags = IORESOURCE_MEM,
  694. },
  695. [1] = {
  696. .start = CH_SPI0,
  697. .end = CH_SPI0,
  698. .flags = IORESOURCE_DMA,
  699. },
  700. [2] = {
  701. .start = IRQ_SPI0,
  702. .end = IRQ_SPI0,
  703. .flags = IORESOURCE_IRQ,
  704. }
  705. };
  706. /* SPI (1) */
  707. static struct resource bfin_spi1_resource[] = {
  708. [0] = {
  709. .start = SPI1_REGBASE,
  710. .end = SPI1_REGBASE + 0xFF,
  711. .flags = IORESOURCE_MEM,
  712. },
  713. [1] = {
  714. .start = CH_SPI1,
  715. .end = CH_SPI1,
  716. .flags = IORESOURCE_DMA,
  717. },
  718. [2] = {
  719. .start = IRQ_SPI1,
  720. .end = IRQ_SPI1,
  721. .flags = IORESOURCE_IRQ,
  722. }
  723. };
  724. /* SPI controller data */
  725. static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
  726. .num_chipselect = 3,
  727. .enable_dma = 1, /* master has the ability to do dma transfer */
  728. .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
  729. };
  730. static struct platform_device bf54x_spi_master0 = {
  731. .name = "bfin-spi",
  732. .id = 0, /* Bus number */
  733. .num_resources = ARRAY_SIZE(bfin_spi0_resource),
  734. .resource = bfin_spi0_resource,
  735. .dev = {
  736. .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
  737. },
  738. };
  739. static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
  740. .num_chipselect = 3,
  741. .enable_dma = 1, /* master has the ability to do dma transfer */
  742. .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
  743. };
  744. static struct platform_device bf54x_spi_master1 = {
  745. .name = "bfin-spi",
  746. .id = 1, /* Bus number */
  747. .num_resources = ARRAY_SIZE(bfin_spi1_resource),
  748. .resource = bfin_spi1_resource,
  749. .dev = {
  750. .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
  751. },
  752. };
  753. #endif /* spi master and devices */
  754. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  755. static struct resource bfin_twi0_resource[] = {
  756. [0] = {
  757. .start = TWI0_REGBASE,
  758. .end = TWI0_REGBASE + 0xFF,
  759. .flags = IORESOURCE_MEM,
  760. },
  761. [1] = {
  762. .start = IRQ_TWI0,
  763. .end = IRQ_TWI0,
  764. .flags = IORESOURCE_IRQ,
  765. },
  766. };
  767. static struct platform_device i2c_bfin_twi0_device = {
  768. .name = "i2c-bfin-twi",
  769. .id = 0,
  770. .num_resources = ARRAY_SIZE(bfin_twi0_resource),
  771. .resource = bfin_twi0_resource,
  772. };
  773. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  774. static struct resource bfin_twi1_resource[] = {
  775. [0] = {
  776. .start = TWI1_REGBASE,
  777. .end = TWI1_REGBASE + 0xFF,
  778. .flags = IORESOURCE_MEM,
  779. },
  780. [1] = {
  781. .start = IRQ_TWI1,
  782. .end = IRQ_TWI1,
  783. .flags = IORESOURCE_IRQ,
  784. },
  785. };
  786. static struct platform_device i2c_bfin_twi1_device = {
  787. .name = "i2c-bfin-twi",
  788. .id = 1,
  789. .num_resources = ARRAY_SIZE(bfin_twi1_resource),
  790. .resource = bfin_twi1_resource,
  791. };
  792. #endif
  793. #endif
  794. static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
  795. };
  796. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  797. static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
  798. #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
  799. {
  800. I2C_BOARD_INFO("pcf8574_lcd", 0x22),
  801. },
  802. #endif
  803. #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
  804. {
  805. I2C_BOARD_INFO("pcf8574_keypad", 0x27),
  806. .irq = 212,
  807. },
  808. #endif
  809. #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
  810. {
  811. I2C_BOARD_INFO("adxl34x", 0x53),
  812. .irq = IRQ_PC5,
  813. .platform_data = (void *)&adxl34x_info,
  814. },
  815. #endif
  816. };
  817. #endif
  818. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  819. #include <linux/gpio_keys.h>
  820. static struct gpio_keys_button bfin_gpio_keys_table[] = {
  821. {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
  822. {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
  823. {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
  824. {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
  825. };
  826. static struct gpio_keys_platform_data bfin_gpio_keys_data = {
  827. .buttons = bfin_gpio_keys_table,
  828. .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
  829. };
  830. static struct platform_device bfin_device_gpiokeys = {
  831. .name = "gpio-keys",
  832. .dev = {
  833. .platform_data = &bfin_gpio_keys_data,
  834. },
  835. };
  836. #endif
  837. static struct resource bfin_gpios_resources = {
  838. .start = 0,
  839. .end = MAX_BLACKFIN_GPIOS - 1,
  840. .flags = IORESOURCE_IRQ,
  841. };
  842. static struct platform_device bfin_gpios_device = {
  843. .name = "simple-gpio",
  844. .id = -1,
  845. .num_resources = 1,
  846. .resource = &bfin_gpios_resources,
  847. };
  848. static const unsigned int cclk_vlev_datasheet[] =
  849. {
  850. /*
  851. * Internal VLEV BF54XSBBC1533
  852. ****temporarily using these values until data sheet is updated
  853. */
  854. VRPAIR(VLEV_085, 150000000),
  855. VRPAIR(VLEV_090, 250000000),
  856. VRPAIR(VLEV_110, 276000000),
  857. VRPAIR(VLEV_115, 301000000),
  858. VRPAIR(VLEV_120, 525000000),
  859. VRPAIR(VLEV_125, 550000000),
  860. VRPAIR(VLEV_130, 600000000),
  861. };
  862. static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
  863. .tuple_tab = cclk_vlev_datasheet,
  864. .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
  865. .vr_settling_time = 25 /* us */,
  866. };
  867. static struct platform_device bfin_dpmc = {
  868. .name = "bfin dpmc",
  869. .dev = {
  870. .platform_data = &bfin_dmpc_vreg_data,
  871. },
  872. };
  873. static struct platform_device *ezkit_devices[] __initdata = {
  874. &bfin_dpmc,
  875. #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
  876. &rtc_device,
  877. #endif
  878. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  879. &bfin_uart_device,
  880. #endif
  881. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  882. #ifdef CONFIG_BFIN_SIR0
  883. &bfin_sir0_device,
  884. #endif
  885. #ifdef CONFIG_BFIN_SIR1
  886. &bfin_sir1_device,
  887. #endif
  888. #ifdef CONFIG_BFIN_SIR2
  889. &bfin_sir2_device,
  890. #endif
  891. #ifdef CONFIG_BFIN_SIR3
  892. &bfin_sir3_device,
  893. #endif
  894. #endif
  895. #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
  896. &bf54x_lq043_device,
  897. #endif
  898. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  899. &smsc911x_device,
  900. #endif
  901. #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
  902. &musb_device,
  903. #endif
  904. #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
  905. &bfin_isp1760_device,
  906. #endif
  907. #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
  908. &bfin_atapi_device,
  909. #endif
  910. #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
  911. &bf5xx_nand_device,
  912. #endif
  913. #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
  914. &bf54x_sdh_device,
  915. #endif
  916. #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  917. &bf54x_spi_master0,
  918. &bf54x_spi_master1,
  919. #endif
  920. #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
  921. &bf54x_kpad_device,
  922. #endif
  923. #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
  924. &bfin_rotary_device,
  925. #endif
  926. #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
  927. &i2c_bfin_twi0_device,
  928. #if !defined(CONFIG_BF542)
  929. &i2c_bfin_twi1_device,
  930. #endif
  931. #endif
  932. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  933. &bfin_device_gpiokeys,
  934. #endif
  935. &bfin_gpios_device,
  936. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  937. &ezkit_flash_device,
  938. #endif
  939. };
  940. static int __init ezkit_init(void)
  941. {
  942. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  943. i2c_register_board_info(0, bfin_i2c_board_info0,
  944. ARRAY_SIZE(bfin_i2c_board_info0));
  945. #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
  946. i2c_register_board_info(1, bfin_i2c_board_info1,
  947. ARRAY_SIZE(bfin_i2c_board_info1));
  948. #endif
  949. platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
  950. spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
  951. return 0;
  952. }
  953. arch_initcall(ezkit_init);