mfp.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. /*
  2. * linux/include/asm-arm/arch-pxa/mfp.h
  3. *
  4. * Multi-Function Pin Definitions
  5. *
  6. * Copyright (C) 2007 Marvell International Ltd.
  7. *
  8. * 2007-8-21: eric miao <eric.y.miao@gmail.com>
  9. * initial version
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #ifndef __ASM_ARCH_MFP_H
  16. #define __ASM_ARCH_MFP_H
  17. #define MFPR_BASE (0x40e10000)
  18. #define MFPR_SIZE (PAGE_SIZE)
  19. #define mfp_to_gpio(m) ((m) % 128)
  20. /* list of all the configurable MFP pins */
  21. enum {
  22. MFP_PIN_INVALID = -1,
  23. MFP_PIN_GPIO0 = 0,
  24. MFP_PIN_GPIO1,
  25. MFP_PIN_GPIO2,
  26. MFP_PIN_GPIO3,
  27. MFP_PIN_GPIO4,
  28. MFP_PIN_GPIO5,
  29. MFP_PIN_GPIO6,
  30. MFP_PIN_GPIO7,
  31. MFP_PIN_GPIO8,
  32. MFP_PIN_GPIO9,
  33. MFP_PIN_GPIO10,
  34. MFP_PIN_GPIO11,
  35. MFP_PIN_GPIO12,
  36. MFP_PIN_GPIO13,
  37. MFP_PIN_GPIO14,
  38. MFP_PIN_GPIO15,
  39. MFP_PIN_GPIO16,
  40. MFP_PIN_GPIO17,
  41. MFP_PIN_GPIO18,
  42. MFP_PIN_GPIO19,
  43. MFP_PIN_GPIO20,
  44. MFP_PIN_GPIO21,
  45. MFP_PIN_GPIO22,
  46. MFP_PIN_GPIO23,
  47. MFP_PIN_GPIO24,
  48. MFP_PIN_GPIO25,
  49. MFP_PIN_GPIO26,
  50. MFP_PIN_GPIO27,
  51. MFP_PIN_GPIO28,
  52. MFP_PIN_GPIO29,
  53. MFP_PIN_GPIO30,
  54. MFP_PIN_GPIO31,
  55. MFP_PIN_GPIO32,
  56. MFP_PIN_GPIO33,
  57. MFP_PIN_GPIO34,
  58. MFP_PIN_GPIO35,
  59. MFP_PIN_GPIO36,
  60. MFP_PIN_GPIO37,
  61. MFP_PIN_GPIO38,
  62. MFP_PIN_GPIO39,
  63. MFP_PIN_GPIO40,
  64. MFP_PIN_GPIO41,
  65. MFP_PIN_GPIO42,
  66. MFP_PIN_GPIO43,
  67. MFP_PIN_GPIO44,
  68. MFP_PIN_GPIO45,
  69. MFP_PIN_GPIO46,
  70. MFP_PIN_GPIO47,
  71. MFP_PIN_GPIO48,
  72. MFP_PIN_GPIO49,
  73. MFP_PIN_GPIO50,
  74. MFP_PIN_GPIO51,
  75. MFP_PIN_GPIO52,
  76. MFP_PIN_GPIO53,
  77. MFP_PIN_GPIO54,
  78. MFP_PIN_GPIO55,
  79. MFP_PIN_GPIO56,
  80. MFP_PIN_GPIO57,
  81. MFP_PIN_GPIO58,
  82. MFP_PIN_GPIO59,
  83. MFP_PIN_GPIO60,
  84. MFP_PIN_GPIO61,
  85. MFP_PIN_GPIO62,
  86. MFP_PIN_GPIO63,
  87. MFP_PIN_GPIO64,
  88. MFP_PIN_GPIO65,
  89. MFP_PIN_GPIO66,
  90. MFP_PIN_GPIO67,
  91. MFP_PIN_GPIO68,
  92. MFP_PIN_GPIO69,
  93. MFP_PIN_GPIO70,
  94. MFP_PIN_GPIO71,
  95. MFP_PIN_GPIO72,
  96. MFP_PIN_GPIO73,
  97. MFP_PIN_GPIO74,
  98. MFP_PIN_GPIO75,
  99. MFP_PIN_GPIO76,
  100. MFP_PIN_GPIO77,
  101. MFP_PIN_GPIO78,
  102. MFP_PIN_GPIO79,
  103. MFP_PIN_GPIO80,
  104. MFP_PIN_GPIO81,
  105. MFP_PIN_GPIO82,
  106. MFP_PIN_GPIO83,
  107. MFP_PIN_GPIO84,
  108. MFP_PIN_GPIO85,
  109. MFP_PIN_GPIO86,
  110. MFP_PIN_GPIO87,
  111. MFP_PIN_GPIO88,
  112. MFP_PIN_GPIO89,
  113. MFP_PIN_GPIO90,
  114. MFP_PIN_GPIO91,
  115. MFP_PIN_GPIO92,
  116. MFP_PIN_GPIO93,
  117. MFP_PIN_GPIO94,
  118. MFP_PIN_GPIO95,
  119. MFP_PIN_GPIO96,
  120. MFP_PIN_GPIO97,
  121. MFP_PIN_GPIO98,
  122. MFP_PIN_GPIO99,
  123. MFP_PIN_GPIO100,
  124. MFP_PIN_GPIO101,
  125. MFP_PIN_GPIO102,
  126. MFP_PIN_GPIO103,
  127. MFP_PIN_GPIO104,
  128. MFP_PIN_GPIO105,
  129. MFP_PIN_GPIO106,
  130. MFP_PIN_GPIO107,
  131. MFP_PIN_GPIO108,
  132. MFP_PIN_GPIO109,
  133. MFP_PIN_GPIO110,
  134. MFP_PIN_GPIO111,
  135. MFP_PIN_GPIO112,
  136. MFP_PIN_GPIO113,
  137. MFP_PIN_GPIO114,
  138. MFP_PIN_GPIO115,
  139. MFP_PIN_GPIO116,
  140. MFP_PIN_GPIO117,
  141. MFP_PIN_GPIO118,
  142. MFP_PIN_GPIO119,
  143. MFP_PIN_GPIO120,
  144. MFP_PIN_GPIO121,
  145. MFP_PIN_GPIO122,
  146. MFP_PIN_GPIO123,
  147. MFP_PIN_GPIO124,
  148. MFP_PIN_GPIO125,
  149. MFP_PIN_GPIO126,
  150. MFP_PIN_GPIO127,
  151. MFP_PIN_GPIO0_2,
  152. MFP_PIN_GPIO1_2,
  153. MFP_PIN_GPIO2_2,
  154. MFP_PIN_GPIO3_2,
  155. MFP_PIN_GPIO4_2,
  156. MFP_PIN_GPIO5_2,
  157. MFP_PIN_GPIO6_2,
  158. MFP_PIN_GPIO7_2,
  159. MFP_PIN_GPIO8_2,
  160. MFP_PIN_GPIO9_2,
  161. MFP_PIN_GPIO10_2,
  162. MFP_PIN_GPIO11_2,
  163. MFP_PIN_GPIO12_2,
  164. MFP_PIN_GPIO13_2,
  165. MFP_PIN_GPIO14_2,
  166. MFP_PIN_GPIO15_2,
  167. MFP_PIN_GPIO16_2,
  168. MFP_PIN_GPIO17_2,
  169. MFP_PIN_ULPI_STP,
  170. MFP_PIN_ULPI_NXT,
  171. MFP_PIN_ULPI_DIR,
  172. MFP_PIN_nXCVREN,
  173. MFP_PIN_DF_CLE_nOE,
  174. MFP_PIN_DF_nADV1_ALE,
  175. MFP_PIN_DF_SCLK_E,
  176. MFP_PIN_DF_SCLK_S,
  177. MFP_PIN_nBE0,
  178. MFP_PIN_nBE1,
  179. MFP_PIN_DF_nADV2_ALE,
  180. MFP_PIN_DF_INT_RnB,
  181. MFP_PIN_DF_nCS0,
  182. MFP_PIN_DF_nCS1,
  183. MFP_PIN_nLUA,
  184. MFP_PIN_nLLA,
  185. MFP_PIN_DF_nWE,
  186. MFP_PIN_DF_ALE_nWE,
  187. MFP_PIN_DF_nRE_nOE,
  188. MFP_PIN_DF_ADDR0,
  189. MFP_PIN_DF_ADDR1,
  190. MFP_PIN_DF_ADDR2,
  191. MFP_PIN_DF_ADDR3,
  192. MFP_PIN_DF_IO0,
  193. MFP_PIN_DF_IO1,
  194. MFP_PIN_DF_IO2,
  195. MFP_PIN_DF_IO3,
  196. MFP_PIN_DF_IO4,
  197. MFP_PIN_DF_IO5,
  198. MFP_PIN_DF_IO6,
  199. MFP_PIN_DF_IO7,
  200. MFP_PIN_DF_IO8,
  201. MFP_PIN_DF_IO9,
  202. MFP_PIN_DF_IO10,
  203. MFP_PIN_DF_IO11,
  204. MFP_PIN_DF_IO12,
  205. MFP_PIN_DF_IO13,
  206. MFP_PIN_DF_IO14,
  207. MFP_PIN_DF_IO15,
  208. MFP_PIN_MAX,
  209. };
  210. /*
  211. * Table that determines the low power modes outputs, with actual settings
  212. * used in parentheses for don't-care values. Except for the float output,
  213. * the configured driven and pulled levels match, so if there is a need for
  214. * non-LPM pulled output, the same configuration could probably be used.
  215. *
  216. * Output value sleep_oe_n sleep_data pullup_en pulldown_en pull_sel
  217. * (bit 7) (bit 8) (bit 14d) (bit 13d)
  218. *
  219. * Drive 0 0 0 0 X (1) 0
  220. * Drive 1 0 1 X (1) 0 0
  221. * Pull hi (1) 1 X(1) 1 0 0
  222. * Pull lo (0) 1 X(0) 0 1 0
  223. * Z (float) 1 X(0) 0 0 0
  224. */
  225. #define MFP_LPM_DRIVE_LOW 0x8
  226. #define MFP_LPM_DRIVE_HIGH 0x6
  227. #define MFP_LPM_PULL_HIGH 0x7
  228. #define MFP_LPM_PULL_LOW 0x9
  229. #define MFP_LPM_FLOAT 0x1
  230. #define MFP_LPM_PULL_NEITHER 0x0
  231. /*
  232. * The pullup and pulldown state of the MFP pin is by default determined by
  233. * selected alternate function. In case some buggy devices need to override
  234. * this default behavior, pxa3xx_mfp_set_pull() can be invoked with one of
  235. * the following definition as the parameter.
  236. *
  237. * Definition pull_sel pullup_en pulldown_en
  238. * MFP_PULL_HIGH 1 1 0
  239. * MFP_PULL_LOW 1 0 1
  240. * MFP_PULL_BOTH 1 1 1
  241. * MFP_PULL_NONE 1 0 0
  242. * MFP_PULL_DEFAULT 0 X X
  243. *
  244. * NOTE: pxa3xx_mfp_set_pull() will modify the PULLUP_EN and PULLDOWN_EN
  245. * bits, which will cause potential conflicts with the low power mode
  246. * setting, device drivers should take care of this
  247. */
  248. #define MFP_PULL_BOTH (0x7u)
  249. #define MFP_PULL_HIGH (0x6u)
  250. #define MFP_PULL_LOW (0x5u)
  251. #define MFP_PULL_NONE (0x4u)
  252. #define MFP_PULL_DEFAULT (0x0u)
  253. #define MFP_AF0 (0)
  254. #define MFP_AF1 (1)
  255. #define MFP_AF2 (2)
  256. #define MFP_AF3 (3)
  257. #define MFP_AF4 (4)
  258. #define MFP_AF5 (5)
  259. #define MFP_AF6 (6)
  260. #define MFP_AF7 (7)
  261. #define MFP_DS01X (0)
  262. #define MFP_DS02X (1)
  263. #define MFP_DS03X (2)
  264. #define MFP_DS04X (3)
  265. #define MFP_DS06X (4)
  266. #define MFP_DS08X (5)
  267. #define MFP_DS10X (6)
  268. #define MFP_DS12X (7)
  269. #define MFP_EDGE_BOTH 0x3
  270. #define MFP_EDGE_RISE 0x2
  271. #define MFP_EDGE_FALL 0x1
  272. #define MFP_EDGE_NONE 0x0
  273. #define MFPR_AF_MASK 0x0007
  274. #define MFPR_DRV_MASK 0x1c00
  275. #define MFPR_RDH_MASK 0x0200
  276. #define MFPR_LPM_MASK 0xe180
  277. #define MFPR_PULL_MASK 0xe000
  278. #define MFPR_EDGE_MASK 0x0070
  279. #define MFPR_ALT_OFFSET 0
  280. #define MFPR_ERE_OFFSET 4
  281. #define MFPR_EFE_OFFSET 5
  282. #define MFPR_EC_OFFSET 6
  283. #define MFPR_SON_OFFSET 7
  284. #define MFPR_SD_OFFSET 8
  285. #define MFPR_SS_OFFSET 9
  286. #define MFPR_DRV_OFFSET 10
  287. #define MFPR_PD_OFFSET 13
  288. #define MFPR_PU_OFFSET 14
  289. #define MFPR_PS_OFFSET 15
  290. #define MFPR(af, drv, rdh, lpm, edge) \
  291. (((af) & 0x7) | (((drv) & 0x7) << 10) |\
  292. (((rdh) & 0x1) << 9) |\
  293. (((lpm) & 0x3) << 7) |\
  294. (((lpm) & 0x4) << 12)|\
  295. (((lpm) & 0x8) << 10)|\
  296. ((!(edge)) << 6) |\
  297. (((edge) & 0x1) << 5) |\
  298. (((edge) & 0x2) << 3))
  299. /*
  300. * a possible MFP configuration is represented by a 32-bit integer
  301. * bit 0..15 - MFPR value (16-bit)
  302. * bit 16..31 - mfp pin index (used to obtain the MFPR offset)
  303. *
  304. * to facilitate the definition, the following macros are provided
  305. *
  306. * MFPR_DEFAULT - default MFPR value, with
  307. * alternate function = 0,
  308. * drive strength = fast 1mA (MFP_DS01X)
  309. * low power mode = default
  310. * release dalay hold = false (RDH bit)
  311. * edge detection = none
  312. *
  313. * MFP_CFG - default MFPR value with alternate function
  314. * MFP_CFG_DRV - default MFPR value with alternate function and
  315. * pin drive strength
  316. * MFP_CFG_LPM - default MFPR value with alternate function and
  317. * low power mode
  318. * MFP_CFG_X - default MFPR value with alternate function,
  319. * pin drive strength and low power mode
  320. *
  321. * use
  322. *
  323. * MFP_CFG_PIN - to get the MFP pin index
  324. * MFP_CFG_VAL - to get the corresponding MFPR value
  325. */
  326. typedef uint32_t mfp_cfg_t;
  327. #define MFP_CFG_PIN(mfp_cfg) (((mfp_cfg) >> 16) & 0xffff)
  328. #define MFP_CFG_VAL(mfp_cfg) ((mfp_cfg) & 0xffff)
  329. #define MFPR_DEFAULT (0x0000)
  330. #define MFP_CFG(pin, af) \
  331. ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af))
  332. #define MFP_CFG_DRV(pin, af, drv) \
  333. ((MFP_PIN_##pin << 16) | MFPR_DEFAULT |\
  334. ((MFP_##drv) << 10) | (MFP_##af))
  335. #define MFP_CFG_LPM(pin, af, lpm) \
  336. ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af) |\
  337. (((MFP_LPM_##lpm) & 0x3) << 7) |\
  338. (((MFP_LPM_##lpm) & 0x4) << 12) |\
  339. (((MFP_LPM_##lpm) & 0x8) << 10))
  340. #define MFP_CFG_X(pin, af, drv, lpm) \
  341. ((MFP_PIN_##pin << 16) | MFPR_DEFAULT |\
  342. ((MFP_##drv) << 10) | (MFP_##af) |\
  343. (((MFP_LPM_##lpm) & 0x3) << 7) |\
  344. (((MFP_LPM_##lpm) & 0x4) << 12) |\
  345. (((MFP_LPM_##lpm) & 0x8) << 10))
  346. /* common MFP configurations - processor specific ones defined
  347. * in mfp-pxa3xx.h
  348. */
  349. #define GPIO0_GPIO MFP_CFG(GPIO0, AF0)
  350. #define GPIO1_GPIO MFP_CFG(GPIO1, AF0)
  351. #define GPIO2_GPIO MFP_CFG(GPIO2, AF0)
  352. #define GPIO3_GPIO MFP_CFG(GPIO3, AF0)
  353. #define GPIO4_GPIO MFP_CFG(GPIO4, AF0)
  354. #define GPIO5_GPIO MFP_CFG(GPIO5, AF0)
  355. #define GPIO6_GPIO MFP_CFG(GPIO6, AF0)
  356. #define GPIO7_GPIO MFP_CFG(GPIO7, AF0)
  357. #define GPIO8_GPIO MFP_CFG(GPIO8, AF0)
  358. #define GPIO9_GPIO MFP_CFG(GPIO9, AF0)
  359. #define GPIO10_GPIO MFP_CFG(GPIO10, AF0)
  360. #define GPIO11_GPIO MFP_CFG(GPIO11, AF0)
  361. #define GPIO12_GPIO MFP_CFG(GPIO12, AF0)
  362. #define GPIO13_GPIO MFP_CFG(GPIO13, AF0)
  363. #define GPIO14_GPIO MFP_CFG(GPIO14, AF0)
  364. #define GPIO15_GPIO MFP_CFG(GPIO15, AF0)
  365. #define GPIO16_GPIO MFP_CFG(GPIO16, AF0)
  366. #define GPIO17_GPIO MFP_CFG(GPIO17, AF0)
  367. #define GPIO18_GPIO MFP_CFG(GPIO18, AF0)
  368. #define GPIO19_GPIO MFP_CFG(GPIO19, AF0)
  369. #define GPIO20_GPIO MFP_CFG(GPIO20, AF0)
  370. #define GPIO21_GPIO MFP_CFG(GPIO21, AF0)
  371. #define GPIO22_GPIO MFP_CFG(GPIO22, AF0)
  372. #define GPIO23_GPIO MFP_CFG(GPIO23, AF0)
  373. #define GPIO24_GPIO MFP_CFG(GPIO24, AF0)
  374. #define GPIO25_GPIO MFP_CFG(GPIO25, AF0)
  375. #define GPIO26_GPIO MFP_CFG(GPIO26, AF0)
  376. #define GPIO27_GPIO MFP_CFG(GPIO27, AF0)
  377. #define GPIO28_GPIO MFP_CFG(GPIO28, AF0)
  378. #define GPIO29_GPIO MFP_CFG(GPIO29, AF0)
  379. #define GPIO30_GPIO MFP_CFG(GPIO30, AF0)
  380. #define GPIO31_GPIO MFP_CFG(GPIO31, AF0)
  381. #define GPIO32_GPIO MFP_CFG(GPIO32, AF0)
  382. #define GPIO33_GPIO MFP_CFG(GPIO33, AF0)
  383. #define GPIO34_GPIO MFP_CFG(GPIO34, AF0)
  384. #define GPIO35_GPIO MFP_CFG(GPIO35, AF0)
  385. #define GPIO36_GPIO MFP_CFG(GPIO36, AF0)
  386. #define GPIO37_GPIO MFP_CFG(GPIO37, AF0)
  387. #define GPIO38_GPIO MFP_CFG(GPIO38, AF0)
  388. #define GPIO39_GPIO MFP_CFG(GPIO39, AF0)
  389. #define GPIO40_GPIO MFP_CFG(GPIO40, AF0)
  390. #define GPIO41_GPIO MFP_CFG(GPIO41, AF0)
  391. #define GPIO42_GPIO MFP_CFG(GPIO42, AF0)
  392. #define GPIO43_GPIO MFP_CFG(GPIO43, AF0)
  393. #define GPIO44_GPIO MFP_CFG(GPIO44, AF0)
  394. #define GPIO45_GPIO MFP_CFG(GPIO45, AF0)
  395. #define GPIO47_GPIO MFP_CFG(GPIO47, AF0)
  396. #define GPIO48_GPIO MFP_CFG(GPIO48, AF0)
  397. #define GPIO53_GPIO MFP_CFG(GPIO53, AF0)
  398. #define GPIO54_GPIO MFP_CFG(GPIO54, AF0)
  399. #define GPIO55_GPIO MFP_CFG(GPIO55, AF0)
  400. #define GPIO57_GPIO MFP_CFG(GPIO57, AF0)
  401. #define GPIO63_GPIO MFP_CFG(GPIO63, AF0)
  402. #define GPIO64_GPIO MFP_CFG(GPIO64, AF0)
  403. #define GPIO65_GPIO MFP_CFG(GPIO65, AF0)
  404. #define GPIO66_GPIO MFP_CFG(GPIO66, AF0)
  405. #define GPIO67_GPIO MFP_CFG(GPIO67, AF0)
  406. #define GPIO68_GPIO MFP_CFG(GPIO68, AF0)
  407. #define GPIO69_GPIO MFP_CFG(GPIO69, AF0)
  408. #define GPIO70_GPIO MFP_CFG(GPIO70, AF0)
  409. #define GPIO71_GPIO MFP_CFG(GPIO71, AF0)
  410. #define GPIO72_GPIO MFP_CFG(GPIO72, AF0)
  411. #define GPIO73_GPIO MFP_CFG(GPIO73, AF0)
  412. #define GPIO74_GPIO MFP_CFG(GPIO74, AF0)
  413. #define GPIO75_GPIO MFP_CFG(GPIO75, AF0)
  414. #define GPIO76_GPIO MFP_CFG(GPIO76, AF0)
  415. #define GPIO77_GPIO MFP_CFG(GPIO77, AF0)
  416. #define GPIO78_GPIO MFP_CFG(GPIO78, AF0)
  417. #define GPIO79_GPIO MFP_CFG(GPIO79, AF0)
  418. #define GPIO80_GPIO MFP_CFG(GPIO80, AF0)
  419. #define GPIO81_GPIO MFP_CFG(GPIO81, AF0)
  420. #define GPIO82_GPIO MFP_CFG(GPIO82, AF0)
  421. #define GPIO83_GPIO MFP_CFG(GPIO83, AF0)
  422. #define GPIO84_GPIO MFP_CFG(GPIO84, AF0)
  423. #define GPIO85_GPIO MFP_CFG(GPIO85, AF0)
  424. #define GPIO86_GPIO MFP_CFG(GPIO86, AF0)
  425. #define GPIO87_GPIO MFP_CFG(GPIO87, AF0)
  426. #define GPIO88_GPIO MFP_CFG(GPIO88, AF0)
  427. #define GPIO89_GPIO MFP_CFG(GPIO89, AF0)
  428. #define GPIO90_GPIO MFP_CFG(GPIO90, AF0)
  429. #define GPIO91_GPIO MFP_CFG(GPIO91, AF0)
  430. #define GPIO92_GPIO MFP_CFG(GPIO92, AF0)
  431. #define GPIO93_GPIO MFP_CFG(GPIO93, AF0)
  432. #define GPIO94_GPIO MFP_CFG(GPIO94, AF0)
  433. #define GPIO95_GPIO MFP_CFG(GPIO95, AF0)
  434. #define GPIO96_GPIO MFP_CFG(GPIO96, AF0)
  435. #define GPIO97_GPIO MFP_CFG(GPIO97, AF0)
  436. #define GPIO98_GPIO MFP_CFG(GPIO98, AF0)
  437. #define GPIO99_GPIO MFP_CFG(GPIO99, AF0)
  438. #define GPIO100_GPIO MFP_CFG(GPIO100, AF0)
  439. #define GPIO101_GPIO MFP_CFG(GPIO101, AF0)
  440. #define GPIO102_GPIO MFP_CFG(GPIO102, AF0)
  441. #define GPIO103_GPIO MFP_CFG(GPIO103, AF0)
  442. #define GPIO104_GPIO MFP_CFG(GPIO104, AF0)
  443. #define GPIO105_GPIO MFP_CFG(GPIO105, AF0)
  444. #define GPIO106_GPIO MFP_CFG(GPIO106, AF0)
  445. #define GPIO107_GPIO MFP_CFG(GPIO107, AF0)
  446. #define GPIO108_GPIO MFP_CFG(GPIO108, AF0)
  447. #define GPIO109_GPIO MFP_CFG(GPIO109, AF0)
  448. #define GPIO110_GPIO MFP_CFG(GPIO110, AF0)
  449. #define GPIO111_GPIO MFP_CFG(GPIO111, AF0)
  450. #define GPIO112_GPIO MFP_CFG(GPIO112, AF0)
  451. #define GPIO113_GPIO MFP_CFG(GPIO113, AF0)
  452. #define GPIO114_GPIO MFP_CFG(GPIO114, AF0)
  453. #define GPIO115_GPIO MFP_CFG(GPIO115, AF0)
  454. #define GPIO116_GPIO MFP_CFG(GPIO116, AF0)
  455. #define GPIO117_GPIO MFP_CFG(GPIO117, AF0)
  456. #define GPIO118_GPIO MFP_CFG(GPIO118, AF0)
  457. #define GPIO119_GPIO MFP_CFG(GPIO119, AF0)
  458. #define GPIO120_GPIO MFP_CFG(GPIO120, AF0)
  459. #define GPIO121_GPIO MFP_CFG(GPIO121, AF0)
  460. #define GPIO122_GPIO MFP_CFG(GPIO122, AF0)
  461. #define GPIO123_GPIO MFP_CFG(GPIO123, AF0)
  462. #define GPIO124_GPIO MFP_CFG(GPIO124, AF0)
  463. #define GPIO125_GPIO MFP_CFG(GPIO125, AF0)
  464. #define GPIO126_GPIO MFP_CFG(GPIO126, AF0)
  465. #define GPIO127_GPIO MFP_CFG(GPIO127, AF0)
  466. #define GPIO0_2_GPIO MFP_CFG(GPIO0_2, AF0)
  467. #define GPIO1_2_GPIO MFP_CFG(GPIO1_2, AF0)
  468. #define GPIO2_2_GPIO MFP_CFG(GPIO2_2, AF0)
  469. #define GPIO3_2_GPIO MFP_CFG(GPIO3_2, AF0)
  470. #define GPIO4_2_GPIO MFP_CFG(GPIO4_2, AF0)
  471. #define GPIO5_2_GPIO MFP_CFG(GPIO5_2, AF0)
  472. #define GPIO6_2_GPIO MFP_CFG(GPIO6_2, AF0)
  473. /*
  474. * each MFP pin will have a MFPR register, since the offset of the
  475. * register varies between processors, the processor specific code
  476. * should initialize the pin offsets by pxa3xx_mfp_init_addr()
  477. *
  478. * pxa3xx_mfp_init_addr - accepts a table of "pxa3xx_mfp_addr_map"
  479. * structure, which represents a range of MFP pins from "start" to
  480. * "end", with the offset begining at "offset", to define a single
  481. * pin, let "end" = -1
  482. *
  483. * use
  484. *
  485. * MFP_ADDR_X() to define a range of pins
  486. * MFP_ADDR() to define a single pin
  487. * MFP_ADDR_END to signal the end of pin offset definitions
  488. */
  489. struct pxa3xx_mfp_addr_map {
  490. unsigned int start;
  491. unsigned int end;
  492. unsigned long offset;
  493. };
  494. #define MFP_ADDR_X(start, end, offset) \
  495. { MFP_PIN_##start, MFP_PIN_##end, offset }
  496. #define MFP_ADDR(pin, offset) \
  497. { MFP_PIN_##pin, -1, offset }
  498. #define MFP_ADDR_END { MFP_PIN_INVALID, 0 }
  499. struct pxa3xx_mfp_pin {
  500. unsigned long mfpr_off; /* MFPRxx register offset */
  501. unsigned long mfpr_val; /* MFPRxx register value */
  502. };
  503. /*
  504. * pxa3xx_mfp_read()/pxa3xx_mfp_write() - for direct read/write access
  505. * to the MFPR register
  506. */
  507. unsigned long pxa3xx_mfp_read(int mfp);
  508. void pxa3xx_mfp_write(int mfp, unsigned long mfpr_val);
  509. /*
  510. * pxa3xx_mfp_set_afds - set MFP alternate function and drive strength
  511. * pxa3xx_mfp_set_rdh - set MFP release delay hold on/off
  512. * pxa3xx_mfp_set_lpm - set MFP low power mode state
  513. * pxa3xx_mfp_set_edge - set MFP edge detection in low power mode
  514. *
  515. * use these functions to override/change the default configuration
  516. * done by pxa3xx_mfp_set_config(s)
  517. */
  518. void pxa3xx_mfp_set_afds(int mfp, int af, int ds);
  519. void pxa3xx_mfp_set_rdh(int mfp, int rdh);
  520. void pxa3xx_mfp_set_lpm(int mfp, int lpm);
  521. void pxa3xx_mfp_set_edge(int mfp, int edge);
  522. /*
  523. * pxa3xx_mfp_config - configure the MFPR registers
  524. *
  525. * used by board specific initialization code
  526. */
  527. void pxa3xx_mfp_config(mfp_cfg_t *mfp_cfgs, int num);
  528. /*
  529. * pxa3xx_mfp_init_addr() - initialize the mapping between mfp pin
  530. * index and MFPR register offset
  531. *
  532. * used by processor specific code
  533. */
  534. void __init pxa3xx_mfp_init_addr(struct pxa3xx_mfp_addr_map *);
  535. void __init pxa3xx_init_mfp(void);
  536. #endif /* __ASM_ARCH_MFP_H */