debug-mmrs.c 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893
  1. /*
  2. * debugfs interface to core/system MMRs
  3. *
  4. * Copyright 2007-2011 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later
  7. */
  8. #include <linux/debugfs.h>
  9. #include <linux/fs.h>
  10. #include <linux/kernel.h>
  11. #include <linux/module.h>
  12. #include <linux/i2c/bfin_twi.h>
  13. #include <asm/blackfin.h>
  14. #include <asm/gpio.h>
  15. #include <asm/gptimers.h>
  16. #include <asm/bfin_can.h>
  17. #include <asm/bfin_dma.h>
  18. #include <asm/bfin_ppi.h>
  19. #include <asm/bfin_serial.h>
  20. #include <asm/bfin5xx_spi.h>
  21. #include <asm/bfin_twi.h>
  22. /* Common code defines PORT_MUX on us, so redirect the MMR back locally */
  23. #ifdef BFIN_PORT_MUX
  24. #undef PORT_MUX
  25. #define PORT_MUX BFIN_PORT_MUX
  26. #endif
  27. #define _d(name, bits, addr, perms) debugfs_create_x##bits(name, perms, parent, (u##bits *)(addr))
  28. #define d(name, bits, addr) _d(name, bits, addr, S_IRUSR|S_IWUSR)
  29. #define d_RO(name, bits, addr) _d(name, bits, addr, S_IRUSR)
  30. #define d_WO(name, bits, addr) _d(name, bits, addr, S_IWUSR)
  31. #define D_RO(name, bits) d_RO(#name, bits, name)
  32. #define D_WO(name, bits) d_WO(#name, bits, name)
  33. #define D32(name) d(#name, 32, name)
  34. #define D16(name) d(#name, 16, name)
  35. #define REGS_OFF(peri, mmr) offsetof(struct bfin_##peri##_regs, mmr)
  36. #define __REGS(peri, sname, rname) \
  37. do { \
  38. struct bfin_##peri##_regs r; \
  39. void *addr = (void *)(base + REGS_OFF(peri, rname)); \
  40. strcpy(_buf, sname); \
  41. if (sizeof(r.rname) == 2) \
  42. debugfs_create_x16(buf, S_IRUSR|S_IWUSR, parent, addr); \
  43. else \
  44. debugfs_create_x32(buf, S_IRUSR|S_IWUSR, parent, addr); \
  45. } while (0)
  46. #define REGS_STR_PFX(buf, pfx, num) \
  47. ({ \
  48. buf + (num >= 0 ? \
  49. sprintf(buf, #pfx "%i_", num) : \
  50. sprintf(buf, #pfx "_")); \
  51. })
  52. #define REGS_STR_PFX_C(buf, pfx, num) \
  53. ({ \
  54. buf + (num >= 0 ? \
  55. sprintf(buf, #pfx "%c_", 'A' + num) : \
  56. sprintf(buf, #pfx "_")); \
  57. })
  58. /*
  59. * Core registers (not memory mapped)
  60. */
  61. extern u32 last_seqstat;
  62. static int debug_cclk_get(void *data, u64 *val)
  63. {
  64. *val = get_cclk();
  65. return 0;
  66. }
  67. DEFINE_SIMPLE_ATTRIBUTE(fops_debug_cclk, debug_cclk_get, NULL, "0x%08llx\n");
  68. static int debug_sclk_get(void *data, u64 *val)
  69. {
  70. *val = get_sclk();
  71. return 0;
  72. }
  73. DEFINE_SIMPLE_ATTRIBUTE(fops_debug_sclk, debug_sclk_get, NULL, "0x%08llx\n");
  74. #define DEFINE_SYSREG(sr, pre, post) \
  75. static int sysreg_##sr##_get(void *data, u64 *val) \
  76. { \
  77. unsigned long tmp; \
  78. pre; \
  79. __asm__ __volatile__("%0 = " #sr ";" : "=d"(tmp)); \
  80. *val = tmp; \
  81. return 0; \
  82. } \
  83. static int sysreg_##sr##_set(void *data, u64 val) \
  84. { \
  85. unsigned long tmp = val; \
  86. __asm__ __volatile__(#sr " = %0;" : : "d"(tmp)); \
  87. post; \
  88. return 0; \
  89. } \
  90. DEFINE_SIMPLE_ATTRIBUTE(fops_sysreg_##sr, sysreg_##sr##_get, sysreg_##sr##_set, "0x%08llx\n")
  91. DEFINE_SYSREG(cycles, , );
  92. DEFINE_SYSREG(cycles2, __asm__ __volatile__("%0 = cycles;" : "=d"(tmp)), );
  93. DEFINE_SYSREG(emudat, , );
  94. DEFINE_SYSREG(seqstat, , );
  95. DEFINE_SYSREG(syscfg, , CSYNC());
  96. #define D_SYSREG(sr) debugfs_create_file(#sr, S_IRUSR|S_IWUSR, parent, NULL, &fops_sysreg_##sr)
  97. #ifndef CONFIG_BF60x
  98. /*
  99. * CAN
  100. */
  101. #define CAN_OFF(mmr) REGS_OFF(can, mmr)
  102. #define __CAN(uname, lname) __REGS(can, #uname, lname)
  103. static void __init __maybe_unused
  104. bfin_debug_mmrs_can(struct dentry *parent, unsigned long base, int num)
  105. {
  106. static struct dentry *am, *mb;
  107. int i, j;
  108. char buf[32], *_buf = REGS_STR_PFX(buf, CAN, num);
  109. if (!am) {
  110. am = debugfs_create_dir("am", parent);
  111. mb = debugfs_create_dir("mb", parent);
  112. }
  113. __CAN(MC1, mc1);
  114. __CAN(MD1, md1);
  115. __CAN(TRS1, trs1);
  116. __CAN(TRR1, trr1);
  117. __CAN(TA1, ta1);
  118. __CAN(AA1, aa1);
  119. __CAN(RMP1, rmp1);
  120. __CAN(RML1, rml1);
  121. __CAN(MBTIF1, mbtif1);
  122. __CAN(MBRIF1, mbrif1);
  123. __CAN(MBIM1, mbim1);
  124. __CAN(RFH1, rfh1);
  125. __CAN(OPSS1, opss1);
  126. __CAN(MC2, mc2);
  127. __CAN(MD2, md2);
  128. __CAN(TRS2, trs2);
  129. __CAN(TRR2, trr2);
  130. __CAN(TA2, ta2);
  131. __CAN(AA2, aa2);
  132. __CAN(RMP2, rmp2);
  133. __CAN(RML2, rml2);
  134. __CAN(MBTIF2, mbtif2);
  135. __CAN(MBRIF2, mbrif2);
  136. __CAN(MBIM2, mbim2);
  137. __CAN(RFH2, rfh2);
  138. __CAN(OPSS2, opss2);
  139. __CAN(CLOCK, clock);
  140. __CAN(TIMING, timing);
  141. __CAN(DEBUG, debug);
  142. __CAN(STATUS, status);
  143. __CAN(CEC, cec);
  144. __CAN(GIS, gis);
  145. __CAN(GIM, gim);
  146. __CAN(GIF, gif);
  147. __CAN(CONTROL, control);
  148. __CAN(INTR, intr);
  149. __CAN(VERSION, version);
  150. __CAN(MBTD, mbtd);
  151. __CAN(EWR, ewr);
  152. __CAN(ESR, esr);
  153. /*__CAN(UCREG, ucreg); no longer exists */
  154. __CAN(UCCNT, uccnt);
  155. __CAN(UCRC, ucrc);
  156. __CAN(UCCNF, uccnf);
  157. __CAN(VERSION2, version2);
  158. for (i = 0; i < 32; ++i) {
  159. sprintf(_buf, "AM%02iL", i);
  160. debugfs_create_x16(buf, S_IRUSR|S_IWUSR, am,
  161. (u16 *)(base + CAN_OFF(msk[i].aml)));
  162. sprintf(_buf, "AM%02iH", i);
  163. debugfs_create_x16(buf, S_IRUSR|S_IWUSR, am,
  164. (u16 *)(base + CAN_OFF(msk[i].amh)));
  165. for (j = 0; j < 3; ++j) {
  166. sprintf(_buf, "MB%02i_DATA%i", i, j);
  167. debugfs_create_x16(buf, S_IRUSR|S_IWUSR, mb,
  168. (u16 *)(base + CAN_OFF(chl[i].data[j*2])));
  169. }
  170. sprintf(_buf, "MB%02i_LENGTH", i);
  171. debugfs_create_x16(buf, S_IRUSR|S_IWUSR, mb,
  172. (u16 *)(base + CAN_OFF(chl[i].dlc)));
  173. sprintf(_buf, "MB%02i_TIMESTAMP", i);
  174. debugfs_create_x16(buf, S_IRUSR|S_IWUSR, mb,
  175. (u16 *)(base + CAN_OFF(chl[i].tsv)));
  176. sprintf(_buf, "MB%02i_ID0", i);
  177. debugfs_create_x16(buf, S_IRUSR|S_IWUSR, mb,
  178. (u16 *)(base + CAN_OFF(chl[i].id0)));
  179. sprintf(_buf, "MB%02i_ID1", i);
  180. debugfs_create_x16(buf, S_IRUSR|S_IWUSR, mb,
  181. (u16 *)(base + CAN_OFF(chl[i].id1)));
  182. }
  183. }
  184. #define CAN(num) bfin_debug_mmrs_can(parent, CAN##num##_MC1, num)
  185. /*
  186. * DMA
  187. */
  188. #define __DMA(uname, lname) __REGS(dma, #uname, lname)
  189. static void __init __maybe_unused
  190. bfin_debug_mmrs_dma(struct dentry *parent, unsigned long base, int num, char mdma, const char *pfx)
  191. {
  192. char buf[32], *_buf;
  193. if (mdma)
  194. _buf = buf + sprintf(buf, "%s_%c%i_", pfx, mdma, num);
  195. else
  196. _buf = buf + sprintf(buf, "%s%i_", pfx, num);
  197. __DMA(NEXT_DESC_PTR, next_desc_ptr);
  198. __DMA(START_ADDR, start_addr);
  199. __DMA(CONFIG, config);
  200. __DMA(X_COUNT, x_count);
  201. __DMA(X_MODIFY, x_modify);
  202. __DMA(Y_COUNT, y_count);
  203. __DMA(Y_MODIFY, y_modify);
  204. __DMA(CURR_DESC_PTR, curr_desc_ptr);
  205. __DMA(CURR_ADDR, curr_addr);
  206. __DMA(IRQ_STATUS, irq_status);
  207. #ifndef CONFIG_BF60x
  208. if (strcmp(pfx, "IMDMA") != 0)
  209. __DMA(PERIPHERAL_MAP, peripheral_map);
  210. #endif
  211. __DMA(CURR_X_COUNT, curr_x_count);
  212. __DMA(CURR_Y_COUNT, curr_y_count);
  213. }
  214. #define _DMA(num, base, mdma, pfx) bfin_debug_mmrs_dma(parent, base, num, mdma, pfx "DMA")
  215. #define DMA(num) _DMA(num, DMA##num##_NEXT_DESC_PTR, 0, "")
  216. #define _MDMA(num, x) \
  217. do { \
  218. _DMA(num, x##DMA_D##num##_NEXT_DESC_PTR, 'D', #x); \
  219. _DMA(num, x##DMA_S##num##_NEXT_DESC_PTR, 'S', #x); \
  220. } while (0)
  221. #define MDMA(num) _MDMA(num, M)
  222. #define IMDMA(num) _MDMA(num, IM)
  223. /*
  224. * EPPI
  225. */
  226. #define __EPPI(uname, lname) __REGS(eppi, #uname, lname)
  227. static void __init __maybe_unused
  228. bfin_debug_mmrs_eppi(struct dentry *parent, unsigned long base, int num)
  229. {
  230. char buf[32], *_buf = REGS_STR_PFX(buf, EPPI, num);
  231. __EPPI(STATUS, status);
  232. __EPPI(HCOUNT, hcount);
  233. __EPPI(HDELAY, hdelay);
  234. __EPPI(VCOUNT, vcount);
  235. __EPPI(VDELAY, vdelay);
  236. __EPPI(FRAME, frame);
  237. __EPPI(LINE, line);
  238. __EPPI(CLKDIV, clkdiv);
  239. __EPPI(CONTROL, control);
  240. __EPPI(FS1W_HBL, fs1w_hbl);
  241. __EPPI(FS1P_AVPL, fs1p_avpl);
  242. __EPPI(FS2W_LVB, fs2w_lvb);
  243. __EPPI(FS2P_LAVF, fs2p_lavf);
  244. __EPPI(CLIP, clip);
  245. }
  246. #define EPPI(num) bfin_debug_mmrs_eppi(parent, EPPI##num##_STATUS, num)
  247. /*
  248. * General Purpose Timers
  249. */
  250. #define __GPTIMER(uname, lname) __REGS(gptimer, #uname, lname)
  251. static void __init __maybe_unused
  252. bfin_debug_mmrs_gptimer(struct dentry *parent, unsigned long base, int num)
  253. {
  254. char buf[32], *_buf = REGS_STR_PFX(buf, TIMER, num);
  255. __GPTIMER(CONFIG, config);
  256. __GPTIMER(COUNTER, counter);
  257. __GPTIMER(PERIOD, period);
  258. __GPTIMER(WIDTH, width);
  259. }
  260. #define GPTIMER(num) bfin_debug_mmrs_gptimer(parent, TIMER##num##_CONFIG, num)
  261. #define GPTIMER_GROUP_OFF(mmr) REGS_OFF(gptimer_group, mmr)
  262. #define __GPTIMER_GROUP(uname, lname) __REGS(gptimer_group, #uname, lname)
  263. static void __init __maybe_unused
  264. bfin_debug_mmrs_gptimer_group(struct dentry *parent, unsigned long base, int num)
  265. {
  266. char buf[32], *_buf;
  267. if (num == -1) {
  268. _buf = buf + sprintf(buf, "TIMER_");
  269. __GPTIMER_GROUP(ENABLE, enable);
  270. __GPTIMER_GROUP(DISABLE, disable);
  271. __GPTIMER_GROUP(STATUS, status);
  272. } else {
  273. /* These MMRs are a bit odd as the group # is a suffix */
  274. _buf = buf + sprintf(buf, "TIMER_ENABLE%i", num);
  275. d(buf, 16, base + GPTIMER_GROUP_OFF(enable));
  276. _buf = buf + sprintf(buf, "TIMER_DISABLE%i", num);
  277. d(buf, 16, base + GPTIMER_GROUP_OFF(disable));
  278. _buf = buf + sprintf(buf, "TIMER_STATUS%i", num);
  279. d(buf, 32, base + GPTIMER_GROUP_OFF(status));
  280. }
  281. }
  282. #define GPTIMER_GROUP(mmr, num) bfin_debug_mmrs_gptimer_group(parent, mmr, num)
  283. /*
  284. * Handshake MDMA
  285. */
  286. #define __HMDMA(uname, lname) __REGS(hmdma, #uname, lname)
  287. static void __init __maybe_unused
  288. bfin_debug_mmrs_hmdma(struct dentry *parent, unsigned long base, int num)
  289. {
  290. char buf[32], *_buf = REGS_STR_PFX(buf, HMDMA, num);
  291. __HMDMA(CONTROL, control);
  292. __HMDMA(ECINIT, ecinit);
  293. __HMDMA(BCINIT, bcinit);
  294. __HMDMA(ECURGENT, ecurgent);
  295. __HMDMA(ECOVERFLOW, ecoverflow);
  296. __HMDMA(ECOUNT, ecount);
  297. __HMDMA(BCOUNT, bcount);
  298. }
  299. #define HMDMA(num) bfin_debug_mmrs_hmdma(parent, HMDMA##num##_CONTROL, num)
  300. /*
  301. * Peripheral Interrupts (PINT/GPIO)
  302. */
  303. #ifdef PINT0_MASK_SET
  304. #define __PINT(uname, lname) __REGS(pint, #uname, lname)
  305. static void __init __maybe_unused
  306. bfin_debug_mmrs_pint(struct dentry *parent, unsigned long base, int num)
  307. {
  308. char buf[32], *_buf = REGS_STR_PFX(buf, PINT, num);
  309. __PINT(MASK_SET, mask_set);
  310. __PINT(MASK_CLEAR, mask_clear);
  311. __PINT(REQUEST, request);
  312. __PINT(ASSIGN, assign);
  313. __PINT(EDGE_SET, edge_set);
  314. __PINT(EDGE_CLEAR, edge_clear);
  315. __PINT(INVERT_SET, invert_set);
  316. __PINT(INVERT_CLEAR, invert_clear);
  317. __PINT(PINSTATE, pinstate);
  318. __PINT(LATCH, latch);
  319. }
  320. #define PINT(num) bfin_debug_mmrs_pint(parent, PINT##num##_MASK_SET, num)
  321. #endif
  322. /*
  323. * Port/GPIO
  324. */
  325. #define bfin_gpio_regs gpio_port_t
  326. #define __PORT(uname, lname) __REGS(gpio, #uname, lname)
  327. static void __init __maybe_unused
  328. bfin_debug_mmrs_port(struct dentry *parent, unsigned long base, int num)
  329. {
  330. char buf[32], *_buf;
  331. #ifdef __ADSPBF54x__
  332. _buf = REGS_STR_PFX_C(buf, PORT, num);
  333. __PORT(FER, port_fer);
  334. __PORT(SET, data_set);
  335. __PORT(CLEAR, data_clear);
  336. __PORT(DIR_SET, dir_set);
  337. __PORT(DIR_CLEAR, dir_clear);
  338. __PORT(INEN, inen);
  339. __PORT(MUX, port_mux);
  340. #else
  341. _buf = buf + sprintf(buf, "PORT%cIO_", num);
  342. __PORT(CLEAR, data_clear);
  343. __PORT(SET, data_set);
  344. __PORT(TOGGLE, toggle);
  345. __PORT(MASKA, maska);
  346. __PORT(MASKA_CLEAR, maska_clear);
  347. __PORT(MASKA_SET, maska_set);
  348. __PORT(MASKA_TOGGLE, maska_toggle);
  349. __PORT(MASKB, maskb);
  350. __PORT(MASKB_CLEAR, maskb_clear);
  351. __PORT(MASKB_SET, maskb_set);
  352. __PORT(MASKB_TOGGLE, maskb_toggle);
  353. __PORT(DIR, dir);
  354. __PORT(POLAR, polar);
  355. __PORT(EDGE, edge);
  356. __PORT(BOTH, both);
  357. __PORT(INEN, inen);
  358. #endif
  359. _buf[-1] = '\0';
  360. d(buf, 16, base + REGS_OFF(gpio, data));
  361. }
  362. #define PORT(base, num) bfin_debug_mmrs_port(parent, base, num)
  363. /*
  364. * PPI
  365. */
  366. #define __PPI(uname, lname) __REGS(ppi, #uname, lname)
  367. static void __init __maybe_unused
  368. bfin_debug_mmrs_ppi(struct dentry *parent, unsigned long base, int num)
  369. {
  370. char buf[32], *_buf = REGS_STR_PFX(buf, PPI, num);
  371. __PPI(CONTROL, control);
  372. __PPI(STATUS, status);
  373. __PPI(COUNT, count);
  374. __PPI(DELAY, delay);
  375. __PPI(FRAME, frame);
  376. }
  377. #define PPI(num) bfin_debug_mmrs_ppi(parent, PPI##num##_CONTROL, num)
  378. /*
  379. * SPI
  380. */
  381. #define __SPI(uname, lname) __REGS(spi, #uname, lname)
  382. static void __init __maybe_unused
  383. bfin_debug_mmrs_spi(struct dentry *parent, unsigned long base, int num)
  384. {
  385. char buf[32], *_buf = REGS_STR_PFX(buf, SPI, num);
  386. __SPI(CTL, ctl);
  387. __SPI(FLG, flg);
  388. __SPI(STAT, stat);
  389. __SPI(TDBR, tdbr);
  390. __SPI(RDBR, rdbr);
  391. __SPI(BAUD, baud);
  392. __SPI(SHADOW, shadow);
  393. }
  394. #define SPI(num) bfin_debug_mmrs_spi(parent, SPI##num##_REGBASE, num)
  395. /*
  396. * SPORT
  397. */
  398. static inline int sport_width(void *mmr)
  399. {
  400. unsigned long lmmr = (unsigned long)mmr;
  401. if ((lmmr & 0xff) == 0x10)
  402. /* SPORT#_TX has 0x10 offset -> SPORT#_TCR2 has 0x04 offset */
  403. lmmr -= 0xc;
  404. else
  405. /* SPORT#_RX has 0x18 offset -> SPORT#_RCR2 has 0x24 offset */
  406. lmmr += 0xc;
  407. /* extract SLEN field from control register 2 and add 1 */
  408. return (bfin_read16(lmmr) & 0x1f) + 1;
  409. }
  410. static int sport_set(void *mmr, u64 val)
  411. {
  412. unsigned long flags;
  413. local_irq_save(flags);
  414. if (sport_width(mmr) <= 16)
  415. bfin_write16(mmr, val);
  416. else
  417. bfin_write32(mmr, val);
  418. local_irq_restore(flags);
  419. return 0;
  420. }
  421. static int sport_get(void *mmr, u64 *val)
  422. {
  423. unsigned long flags;
  424. local_irq_save(flags);
  425. if (sport_width(mmr) <= 16)
  426. *val = bfin_read16(mmr);
  427. else
  428. *val = bfin_read32(mmr);
  429. local_irq_restore(flags);
  430. return 0;
  431. }
  432. DEFINE_SIMPLE_ATTRIBUTE(fops_sport, sport_get, sport_set, "0x%08llx\n");
  433. /*DEFINE_SIMPLE_ATTRIBUTE(fops_sport_ro, sport_get, NULL, "0x%08llx\n");*/
  434. DEFINE_SIMPLE_ATTRIBUTE(fops_sport_wo, NULL, sport_set, "0x%08llx\n");
  435. #define SPORT_OFF(mmr) (SPORT0_##mmr - SPORT0_TCR1)
  436. #define _D_SPORT(name, perms, fops) \
  437. do { \
  438. strcpy(_buf, #name); \
  439. debugfs_create_file(buf, perms, parent, (void *)(base + SPORT_OFF(name)), fops); \
  440. } while (0)
  441. #define __SPORT_RW(name) _D_SPORT(name, S_IRUSR|S_IWUSR, &fops_sport)
  442. #define __SPORT_RO(name) _D_SPORT(name, S_IRUSR, &fops_sport_ro)
  443. #define __SPORT_WO(name) _D_SPORT(name, S_IWUSR, &fops_sport_wo)
  444. #define __SPORT(name, bits) \
  445. do { \
  446. strcpy(_buf, #name); \
  447. debugfs_create_x##bits(buf, S_IRUSR|S_IWUSR, parent, (u##bits *)(base + SPORT_OFF(name))); \
  448. } while (0)
  449. static void __init __maybe_unused
  450. bfin_debug_mmrs_sport(struct dentry *parent, unsigned long base, int num)
  451. {
  452. char buf[32], *_buf = REGS_STR_PFX(buf, SPORT, num);
  453. __SPORT(CHNL, 16);
  454. __SPORT(MCMC1, 16);
  455. __SPORT(MCMC2, 16);
  456. __SPORT(MRCS0, 32);
  457. __SPORT(MRCS1, 32);
  458. __SPORT(MRCS2, 32);
  459. __SPORT(MRCS3, 32);
  460. __SPORT(MTCS0, 32);
  461. __SPORT(MTCS1, 32);
  462. __SPORT(MTCS2, 32);
  463. __SPORT(MTCS3, 32);
  464. __SPORT(RCLKDIV, 16);
  465. __SPORT(RCR1, 16);
  466. __SPORT(RCR2, 16);
  467. __SPORT(RFSDIV, 16);
  468. __SPORT_RW(RX);
  469. __SPORT(STAT, 16);
  470. __SPORT(TCLKDIV, 16);
  471. __SPORT(TCR1, 16);
  472. __SPORT(TCR2, 16);
  473. __SPORT(TFSDIV, 16);
  474. __SPORT_WO(TX);
  475. }
  476. #define SPORT(num) bfin_debug_mmrs_sport(parent, SPORT##num##_TCR1, num)
  477. /*
  478. * TWI
  479. */
  480. #define __TWI(uname, lname) __REGS(twi, #uname, lname)
  481. static void __init __maybe_unused
  482. bfin_debug_mmrs_twi(struct dentry *parent, unsigned long base, int num)
  483. {
  484. char buf[32], *_buf = REGS_STR_PFX(buf, TWI, num);
  485. __TWI(CLKDIV, clkdiv);
  486. __TWI(CONTROL, control);
  487. __TWI(SLAVE_CTL, slave_ctl);
  488. __TWI(SLAVE_STAT, slave_stat);
  489. __TWI(SLAVE_ADDR, slave_addr);
  490. __TWI(MASTER_CTL, master_ctl);
  491. __TWI(MASTER_STAT, master_stat);
  492. __TWI(MASTER_ADDR, master_addr);
  493. __TWI(INT_STAT, int_stat);
  494. __TWI(INT_MASK, int_mask);
  495. __TWI(FIFO_CTL, fifo_ctl);
  496. __TWI(FIFO_STAT, fifo_stat);
  497. __TWI(XMT_DATA8, xmt_data8);
  498. __TWI(XMT_DATA16, xmt_data16);
  499. __TWI(RCV_DATA8, rcv_data8);
  500. __TWI(RCV_DATA16, rcv_data16);
  501. }
  502. #define TWI(num) bfin_debug_mmrs_twi(parent, TWI##num##_CLKDIV, num)
  503. /*
  504. * UART
  505. */
  506. #define __UART(uname, lname) __REGS(uart, #uname, lname)
  507. static void __init __maybe_unused
  508. bfin_debug_mmrs_uart(struct dentry *parent, unsigned long base, int num)
  509. {
  510. char buf[32], *_buf = REGS_STR_PFX(buf, UART, num);
  511. #ifdef BFIN_UART_BF54X_STYLE
  512. __UART(DLL, dll);
  513. __UART(DLH, dlh);
  514. __UART(GCTL, gctl);
  515. __UART(LCR, lcr);
  516. __UART(MCR, mcr);
  517. __UART(LSR, lsr);
  518. __UART(MSR, msr);
  519. __UART(SCR, scr);
  520. __UART(IER_SET, ier_set);
  521. __UART(IER_CLEAR, ier_clear);
  522. __UART(THR, thr);
  523. __UART(RBR, rbr);
  524. #else
  525. __UART(DLL, dll);
  526. __UART(THR, thr);
  527. __UART(RBR, rbr);
  528. __UART(DLH, dlh);
  529. __UART(IER, ier);
  530. __UART(IIR, iir);
  531. __UART(LCR, lcr);
  532. __UART(MCR, mcr);
  533. __UART(LSR, lsr);
  534. __UART(MSR, msr);
  535. __UART(SCR, scr);
  536. __UART(GCTL, gctl);
  537. #endif
  538. }
  539. #define UART(num) bfin_debug_mmrs_uart(parent, UART##num##_DLL, num)
  540. #endif /* CONFIG_BF60x */
  541. /*
  542. * The actual debugfs generation
  543. */
  544. static struct dentry *debug_mmrs_dentry;
  545. static int __init bfin_debug_mmrs_init(void)
  546. {
  547. struct dentry *top, *parent;
  548. pr_info("debug-mmrs: setting up Blackfin MMR debugfs\n");
  549. top = debugfs_create_dir("blackfin", NULL);
  550. if (top == NULL)
  551. return -1;
  552. parent = debugfs_create_dir("core_regs", top);
  553. debugfs_create_file("cclk", S_IRUSR, parent, NULL, &fops_debug_cclk);
  554. debugfs_create_file("sclk", S_IRUSR, parent, NULL, &fops_debug_sclk);
  555. debugfs_create_x32("last_seqstat", S_IRUSR, parent, &last_seqstat);
  556. D_SYSREG(cycles);
  557. D_SYSREG(cycles2);
  558. D_SYSREG(emudat);
  559. D_SYSREG(seqstat);
  560. D_SYSREG(syscfg);
  561. /* Core MMRs */
  562. parent = debugfs_create_dir("ctimer", top);
  563. D32(TCNTL);
  564. D32(TCOUNT);
  565. D32(TPERIOD);
  566. D32(TSCALE);
  567. parent = debugfs_create_dir("cec", top);
  568. D32(EVT0);
  569. D32(EVT1);
  570. D32(EVT2);
  571. D32(EVT3);
  572. D32(EVT4);
  573. D32(EVT5);
  574. D32(EVT6);
  575. D32(EVT7);
  576. D32(EVT8);
  577. D32(EVT9);
  578. D32(EVT10);
  579. D32(EVT11);
  580. D32(EVT12);
  581. D32(EVT13);
  582. D32(EVT14);
  583. D32(EVT15);
  584. D32(EVT_OVERRIDE);
  585. D32(IMASK);
  586. D32(IPEND);
  587. D32(ILAT);
  588. D32(IPRIO);
  589. parent = debugfs_create_dir("debug", top);
  590. D32(DBGSTAT);
  591. D32(DSPID);
  592. parent = debugfs_create_dir("mmu", top);
  593. D32(SRAM_BASE_ADDRESS);
  594. D32(DCPLB_ADDR0);
  595. D32(DCPLB_ADDR10);
  596. D32(DCPLB_ADDR11);
  597. D32(DCPLB_ADDR12);
  598. D32(DCPLB_ADDR13);
  599. D32(DCPLB_ADDR14);
  600. D32(DCPLB_ADDR15);
  601. D32(DCPLB_ADDR1);
  602. D32(DCPLB_ADDR2);
  603. D32(DCPLB_ADDR3);
  604. D32(DCPLB_ADDR4);
  605. D32(DCPLB_ADDR5);
  606. D32(DCPLB_ADDR6);
  607. D32(DCPLB_ADDR7);
  608. D32(DCPLB_ADDR8);
  609. D32(DCPLB_ADDR9);
  610. D32(DCPLB_DATA0);
  611. D32(DCPLB_DATA10);
  612. D32(DCPLB_DATA11);
  613. D32(DCPLB_DATA12);
  614. D32(DCPLB_DATA13);
  615. D32(DCPLB_DATA14);
  616. D32(DCPLB_DATA15);
  617. D32(DCPLB_DATA1);
  618. D32(DCPLB_DATA2);
  619. D32(DCPLB_DATA3);
  620. D32(DCPLB_DATA4);
  621. D32(DCPLB_DATA5);
  622. D32(DCPLB_DATA6);
  623. D32(DCPLB_DATA7);
  624. D32(DCPLB_DATA8);
  625. D32(DCPLB_DATA9);
  626. D32(DCPLB_FAULT_ADDR);
  627. D32(DCPLB_STATUS);
  628. D32(DMEM_CONTROL);
  629. D32(DTEST_COMMAND);
  630. D32(DTEST_DATA0);
  631. D32(DTEST_DATA1);
  632. D32(ICPLB_ADDR0);
  633. D32(ICPLB_ADDR1);
  634. D32(ICPLB_ADDR2);
  635. D32(ICPLB_ADDR3);
  636. D32(ICPLB_ADDR4);
  637. D32(ICPLB_ADDR5);
  638. D32(ICPLB_ADDR6);
  639. D32(ICPLB_ADDR7);
  640. D32(ICPLB_ADDR8);
  641. D32(ICPLB_ADDR9);
  642. D32(ICPLB_ADDR10);
  643. D32(ICPLB_ADDR11);
  644. D32(ICPLB_ADDR12);
  645. D32(ICPLB_ADDR13);
  646. D32(ICPLB_ADDR14);
  647. D32(ICPLB_ADDR15);
  648. D32(ICPLB_DATA0);
  649. D32(ICPLB_DATA1);
  650. D32(ICPLB_DATA2);
  651. D32(ICPLB_DATA3);
  652. D32(ICPLB_DATA4);
  653. D32(ICPLB_DATA5);
  654. D32(ICPLB_DATA6);
  655. D32(ICPLB_DATA7);
  656. D32(ICPLB_DATA8);
  657. D32(ICPLB_DATA9);
  658. D32(ICPLB_DATA10);
  659. D32(ICPLB_DATA11);
  660. D32(ICPLB_DATA12);
  661. D32(ICPLB_DATA13);
  662. D32(ICPLB_DATA14);
  663. D32(ICPLB_DATA15);
  664. D32(ICPLB_FAULT_ADDR);
  665. D32(ICPLB_STATUS);
  666. D32(IMEM_CONTROL);
  667. if (!ANOMALY_05000481) {
  668. D32(ITEST_COMMAND);
  669. D32(ITEST_DATA0);
  670. D32(ITEST_DATA1);
  671. }
  672. parent = debugfs_create_dir("perf", top);
  673. D32(PFCNTR0);
  674. D32(PFCNTR1);
  675. D32(PFCTL);
  676. parent = debugfs_create_dir("trace", top);
  677. D32(TBUF);
  678. D32(TBUFCTL);
  679. D32(TBUFSTAT);
  680. parent = debugfs_create_dir("watchpoint", top);
  681. D32(WPIACTL);
  682. D32(WPIA0);
  683. D32(WPIA1);
  684. D32(WPIA2);
  685. D32(WPIA3);
  686. D32(WPIA4);
  687. D32(WPIA5);
  688. D32(WPIACNT0);
  689. D32(WPIACNT1);
  690. D32(WPIACNT2);
  691. D32(WPIACNT3);
  692. D32(WPIACNT4);
  693. D32(WPIACNT5);
  694. D32(WPDACTL);
  695. D32(WPDA0);
  696. D32(WPDA1);
  697. D32(WPDACNT0);
  698. D32(WPDACNT1);
  699. D32(WPSTAT);
  700. #ifndef CONFIG_BF60x
  701. /* System MMRs */
  702. #ifdef ATAPI_CONTROL
  703. parent = debugfs_create_dir("atapi", top);
  704. D16(ATAPI_CONTROL);
  705. D16(ATAPI_DEV_ADDR);
  706. D16(ATAPI_DEV_RXBUF);
  707. D16(ATAPI_DEV_TXBUF);
  708. D16(ATAPI_DMA_TFRCNT);
  709. D16(ATAPI_INT_MASK);
  710. D16(ATAPI_INT_STATUS);
  711. D16(ATAPI_LINE_STATUS);
  712. D16(ATAPI_MULTI_TIM_0);
  713. D16(ATAPI_MULTI_TIM_1);
  714. D16(ATAPI_MULTI_TIM_2);
  715. D16(ATAPI_PIO_TFRCNT);
  716. D16(ATAPI_PIO_TIM_0);
  717. D16(ATAPI_PIO_TIM_1);
  718. D16(ATAPI_REG_TIM_0);
  719. D16(ATAPI_SM_STATE);
  720. D16(ATAPI_STATUS);
  721. D16(ATAPI_TERMINATE);
  722. D16(ATAPI_UDMAOUT_TFRCNT);
  723. D16(ATAPI_ULTRA_TIM_0);
  724. D16(ATAPI_ULTRA_TIM_1);
  725. D16(ATAPI_ULTRA_TIM_2);
  726. D16(ATAPI_ULTRA_TIM_3);
  727. D16(ATAPI_UMAIN_TFRCNT);
  728. D16(ATAPI_XFER_LEN);
  729. #endif
  730. #if defined(CAN_MC1) || defined(CAN0_MC1) || defined(CAN1_MC1)
  731. parent = debugfs_create_dir("can", top);
  732. # ifdef CAN_MC1
  733. bfin_debug_mmrs_can(parent, CAN_MC1, -1);
  734. # endif
  735. # ifdef CAN0_MC1
  736. CAN(0);
  737. # endif
  738. # ifdef CAN1_MC1
  739. CAN(1);
  740. # endif
  741. #endif
  742. #ifdef CNT_COMMAND
  743. parent = debugfs_create_dir("counter", top);
  744. D16(CNT_COMMAND);
  745. D16(CNT_CONFIG);
  746. D32(CNT_COUNTER);
  747. D16(CNT_DEBOUNCE);
  748. D16(CNT_IMASK);
  749. D32(CNT_MAX);
  750. D32(CNT_MIN);
  751. D16(CNT_STATUS);
  752. #endif
  753. parent = debugfs_create_dir("dmac", top);
  754. #ifdef DMAC_TC_CNT
  755. D16(DMAC_TC_CNT);
  756. D16(DMAC_TC_PER);
  757. #endif
  758. #ifdef DMAC0_TC_CNT
  759. D16(DMAC0_TC_CNT);
  760. D16(DMAC0_TC_PER);
  761. #endif
  762. #ifdef DMAC1_TC_CNT
  763. D16(DMAC1_TC_CNT);
  764. D16(DMAC1_TC_PER);
  765. #endif
  766. #ifdef DMAC1_PERIMUX
  767. D16(DMAC1_PERIMUX);
  768. #endif
  769. #ifdef __ADSPBF561__
  770. /* XXX: should rewrite the MMR map */
  771. # define DMA0_NEXT_DESC_PTR DMA2_0_NEXT_DESC_PTR
  772. # define DMA1_NEXT_DESC_PTR DMA2_1_NEXT_DESC_PTR
  773. # define DMA2_NEXT_DESC_PTR DMA2_2_NEXT_DESC_PTR
  774. # define DMA3_NEXT_DESC_PTR DMA2_3_NEXT_DESC_PTR
  775. # define DMA4_NEXT_DESC_PTR DMA2_4_NEXT_DESC_PTR
  776. # define DMA5_NEXT_DESC_PTR DMA2_5_NEXT_DESC_PTR
  777. # define DMA6_NEXT_DESC_PTR DMA2_6_NEXT_DESC_PTR
  778. # define DMA7_NEXT_DESC_PTR DMA2_7_NEXT_DESC_PTR
  779. # define DMA8_NEXT_DESC_PTR DMA2_8_NEXT_DESC_PTR
  780. # define DMA9_NEXT_DESC_PTR DMA2_9_NEXT_DESC_PTR
  781. # define DMA10_NEXT_DESC_PTR DMA2_10_NEXT_DESC_PTR
  782. # define DMA11_NEXT_DESC_PTR DMA2_11_NEXT_DESC_PTR
  783. # define DMA12_NEXT_DESC_PTR DMA1_0_NEXT_DESC_PTR
  784. # define DMA13_NEXT_DESC_PTR DMA1_1_NEXT_DESC_PTR
  785. # define DMA14_NEXT_DESC_PTR DMA1_2_NEXT_DESC_PTR
  786. # define DMA15_NEXT_DESC_PTR DMA1_3_NEXT_DESC_PTR
  787. # define DMA16_NEXT_DESC_PTR DMA1_4_NEXT_DESC_PTR
  788. # define DMA17_NEXT_DESC_PTR DMA1_5_NEXT_DESC_PTR
  789. # define DMA18_NEXT_DESC_PTR DMA1_6_NEXT_DESC_PTR
  790. # define DMA19_NEXT_DESC_PTR DMA1_7_NEXT_DESC_PTR
  791. # define DMA20_NEXT_DESC_PTR DMA1_8_NEXT_DESC_PTR
  792. # define DMA21_NEXT_DESC_PTR DMA1_9_NEXT_DESC_PTR
  793. # define DMA22_NEXT_DESC_PTR DMA1_10_NEXT_DESC_PTR
  794. # define DMA23_NEXT_DESC_PTR DMA1_11_NEXT_DESC_PTR
  795. #endif
  796. parent = debugfs_create_dir("dma", top);
  797. DMA(0);
  798. DMA(1);
  799. DMA(1);
  800. DMA(2);
  801. DMA(3);
  802. DMA(4);
  803. DMA(5);
  804. DMA(6);
  805. DMA(7);
  806. #ifdef DMA8_NEXT_DESC_PTR
  807. DMA(8);
  808. DMA(9);
  809. DMA(10);
  810. DMA(11);
  811. #endif
  812. #ifdef DMA12_NEXT_DESC_PTR
  813. DMA(12);
  814. DMA(13);
  815. DMA(14);
  816. DMA(15);
  817. DMA(16);
  818. DMA(17);
  819. DMA(18);
  820. DMA(19);
  821. #endif
  822. #ifdef DMA20_NEXT_DESC_PTR
  823. DMA(20);
  824. DMA(21);
  825. DMA(22);
  826. DMA(23);
  827. #endif
  828. parent = debugfs_create_dir("ebiu_amc", top);
  829. D32(EBIU_AMBCTL0);
  830. D32(EBIU_AMBCTL1);
  831. D16(EBIU_AMGCTL);
  832. #ifdef EBIU_MBSCTL
  833. D16(EBIU_MBSCTL);
  834. D32(EBIU_ARBSTAT);
  835. D32(EBIU_MODE);
  836. D16(EBIU_FCTL);
  837. #endif
  838. #ifdef EBIU_SDGCTL
  839. parent = debugfs_create_dir("ebiu_sdram", top);
  840. # ifdef __ADSPBF561__
  841. D32(EBIU_SDBCTL);
  842. # else
  843. D16(EBIU_SDBCTL);
  844. # endif
  845. D32(EBIU_SDGCTL);
  846. D16(EBIU_SDRRC);
  847. D16(EBIU_SDSTAT);
  848. #endif
  849. #ifdef EBIU_DDRACCT
  850. parent = debugfs_create_dir("ebiu_ddr", top);
  851. D32(EBIU_DDRACCT);
  852. D32(EBIU_DDRARCT);
  853. D32(EBIU_DDRBRC0);
  854. D32(EBIU_DDRBRC1);
  855. D32(EBIU_DDRBRC2);
  856. D32(EBIU_DDRBRC3);
  857. D32(EBIU_DDRBRC4);
  858. D32(EBIU_DDRBRC5);
  859. D32(EBIU_DDRBRC6);
  860. D32(EBIU_DDRBRC7);
  861. D32(EBIU_DDRBWC0);
  862. D32(EBIU_DDRBWC1);
  863. D32(EBIU_DDRBWC2);
  864. D32(EBIU_DDRBWC3);
  865. D32(EBIU_DDRBWC4);
  866. D32(EBIU_DDRBWC5);
  867. D32(EBIU_DDRBWC6);
  868. D32(EBIU_DDRBWC7);
  869. D32(EBIU_DDRCTL0);
  870. D32(EBIU_DDRCTL1);
  871. D32(EBIU_DDRCTL2);
  872. D32(EBIU_DDRCTL3);
  873. D32(EBIU_DDRGC0);
  874. D32(EBIU_DDRGC1);
  875. D32(EBIU_DDRGC2);
  876. D32(EBIU_DDRGC3);
  877. D32(EBIU_DDRMCCL);
  878. D32(EBIU_DDRMCEN);
  879. D32(EBIU_DDRQUE);
  880. D32(EBIU_DDRTACT);
  881. D32(EBIU_ERRADD);
  882. D16(EBIU_ERRMST);
  883. D16(EBIU_RSTCTL);
  884. #endif
  885. #ifdef EMAC_ADDRHI
  886. parent = debugfs_create_dir("emac", top);
  887. D32(EMAC_ADDRHI);
  888. D32(EMAC_ADDRLO);
  889. D32(EMAC_FLC);
  890. D32(EMAC_HASHHI);
  891. D32(EMAC_HASHLO);
  892. D32(EMAC_MMC_CTL);
  893. D32(EMAC_MMC_RIRQE);
  894. D32(EMAC_MMC_RIRQS);
  895. D32(EMAC_MMC_TIRQE);
  896. D32(EMAC_MMC_TIRQS);
  897. D32(EMAC_OPMODE);
  898. D32(EMAC_RXC_ALIGN);
  899. D32(EMAC_RXC_ALLFRM);
  900. D32(EMAC_RXC_ALLOCT);
  901. D32(EMAC_RXC_BROAD);
  902. D32(EMAC_RXC_DMAOVF);
  903. D32(EMAC_RXC_EQ64);
  904. D32(EMAC_RXC_FCS);
  905. D32(EMAC_RXC_GE1024);
  906. D32(EMAC_RXC_LNERRI);
  907. D32(EMAC_RXC_LNERRO);
  908. D32(EMAC_RXC_LONG);
  909. D32(EMAC_RXC_LT1024);
  910. D32(EMAC_RXC_LT128);
  911. D32(EMAC_RXC_LT256);
  912. D32(EMAC_RXC_LT512);
  913. D32(EMAC_RXC_MACCTL);
  914. D32(EMAC_RXC_MULTI);
  915. D32(EMAC_RXC_OCTET);
  916. D32(EMAC_RXC_OK);
  917. D32(EMAC_RXC_OPCODE);
  918. D32(EMAC_RXC_PAUSE);
  919. D32(EMAC_RXC_SHORT);
  920. D32(EMAC_RXC_TYPED);
  921. D32(EMAC_RXC_UNICST);
  922. D32(EMAC_RX_IRQE);
  923. D32(EMAC_RX_STAT);
  924. D32(EMAC_RX_STKY);
  925. D32(EMAC_STAADD);
  926. D32(EMAC_STADAT);
  927. D32(EMAC_SYSCTL);
  928. D32(EMAC_SYSTAT);
  929. D32(EMAC_TXC_1COL);
  930. D32(EMAC_TXC_ABORT);
  931. D32(EMAC_TXC_ALLFRM);
  932. D32(EMAC_TXC_ALLOCT);
  933. D32(EMAC_TXC_BROAD);
  934. D32(EMAC_TXC_CRSERR);
  935. D32(EMAC_TXC_DEFER);
  936. D32(EMAC_TXC_DMAUND);
  937. D32(EMAC_TXC_EQ64);
  938. D32(EMAC_TXC_GE1024);
  939. D32(EMAC_TXC_GT1COL);
  940. D32(EMAC_TXC_LATECL);
  941. D32(EMAC_TXC_LT1024);
  942. D32(EMAC_TXC_LT128);
  943. D32(EMAC_TXC_LT256);
  944. D32(EMAC_TXC_LT512);
  945. D32(EMAC_TXC_MACCTL);
  946. D32(EMAC_TXC_MULTI);
  947. D32(EMAC_TXC_OCTET);
  948. D32(EMAC_TXC_OK);
  949. D32(EMAC_TXC_UNICST);
  950. D32(EMAC_TXC_XS_COL);
  951. D32(EMAC_TXC_XS_DFR);
  952. D32(EMAC_TX_IRQE);
  953. D32(EMAC_TX_STAT);
  954. D32(EMAC_TX_STKY);
  955. D32(EMAC_VLAN1);
  956. D32(EMAC_VLAN2);
  957. D32(EMAC_WKUP_CTL);
  958. D32(EMAC_WKUP_FFCMD);
  959. D32(EMAC_WKUP_FFCRC0);
  960. D32(EMAC_WKUP_FFCRC1);
  961. D32(EMAC_WKUP_FFMSK0);
  962. D32(EMAC_WKUP_FFMSK1);
  963. D32(EMAC_WKUP_FFMSK2);
  964. D32(EMAC_WKUP_FFMSK3);
  965. D32(EMAC_WKUP_FFOFF);
  966. # ifdef EMAC_PTP_ACCR
  967. D32(EMAC_PTP_ACCR);
  968. D32(EMAC_PTP_ADDEND);
  969. D32(EMAC_PTP_ALARMHI);
  970. D32(EMAC_PTP_ALARMLO);
  971. D16(EMAC_PTP_CTL);
  972. D32(EMAC_PTP_FOFF);
  973. D32(EMAC_PTP_FV1);
  974. D32(EMAC_PTP_FV2);
  975. D32(EMAC_PTP_FV3);
  976. D16(EMAC_PTP_ID_OFF);
  977. D32(EMAC_PTP_ID_SNAP);
  978. D16(EMAC_PTP_IE);
  979. D16(EMAC_PTP_ISTAT);
  980. D32(EMAC_PTP_OFFSET);
  981. D32(EMAC_PTP_PPS_PERIOD);
  982. D32(EMAC_PTP_PPS_STARTHI);
  983. D32(EMAC_PTP_PPS_STARTLO);
  984. D32(EMAC_PTP_RXSNAPHI);
  985. D32(EMAC_PTP_RXSNAPLO);
  986. D32(EMAC_PTP_TIMEHI);
  987. D32(EMAC_PTP_TIMELO);
  988. D32(EMAC_PTP_TXSNAPHI);
  989. D32(EMAC_PTP_TXSNAPLO);
  990. # endif
  991. #endif
  992. #if defined(EPPI0_STATUS) || defined(EPPI1_STATUS) || defined(EPPI2_STATUS)
  993. parent = debugfs_create_dir("eppi", top);
  994. # ifdef EPPI0_STATUS
  995. EPPI(0);
  996. # endif
  997. # ifdef EPPI1_STATUS
  998. EPPI(1);
  999. # endif
  1000. # ifdef EPPI2_STATUS
  1001. EPPI(2);
  1002. # endif
  1003. #endif
  1004. parent = debugfs_create_dir("gptimer", top);
  1005. #ifdef TIMER_ENABLE
  1006. GPTIMER_GROUP(TIMER_ENABLE, -1);
  1007. #endif
  1008. #ifdef TIMER_ENABLE0
  1009. GPTIMER_GROUP(TIMER_ENABLE0, 0);
  1010. #endif
  1011. #ifdef TIMER_ENABLE1
  1012. GPTIMER_GROUP(TIMER_ENABLE1, 1);
  1013. #endif
  1014. /* XXX: Should convert BF561 MMR names */
  1015. #ifdef TMRS4_DISABLE
  1016. GPTIMER_GROUP(TMRS4_ENABLE, 0);
  1017. GPTIMER_GROUP(TMRS8_ENABLE, 1);
  1018. #endif
  1019. GPTIMER(0);
  1020. GPTIMER(1);
  1021. GPTIMER(2);
  1022. #ifdef TIMER3_CONFIG
  1023. GPTIMER(3);
  1024. GPTIMER(4);
  1025. GPTIMER(5);
  1026. GPTIMER(6);
  1027. GPTIMER(7);
  1028. #endif
  1029. #ifdef TIMER8_CONFIG
  1030. GPTIMER(8);
  1031. GPTIMER(9);
  1032. GPTIMER(10);
  1033. #endif
  1034. #ifdef TIMER11_CONFIG
  1035. GPTIMER(11);
  1036. #endif
  1037. #ifdef HMDMA0_CONTROL
  1038. parent = debugfs_create_dir("hmdma", top);
  1039. HMDMA(0);
  1040. HMDMA(1);
  1041. #endif
  1042. #ifdef HOST_CONTROL
  1043. parent = debugfs_create_dir("hostdp", top);
  1044. D16(HOST_CONTROL);
  1045. D16(HOST_STATUS);
  1046. D16(HOST_TIMEOUT);
  1047. #endif
  1048. #ifdef IMDMA_S0_CONFIG
  1049. parent = debugfs_create_dir("imdma", top);
  1050. IMDMA(0);
  1051. IMDMA(1);
  1052. #endif
  1053. #ifdef KPAD_CTL
  1054. parent = debugfs_create_dir("keypad", top);
  1055. D16(KPAD_CTL);
  1056. D16(KPAD_PRESCALE);
  1057. D16(KPAD_MSEL);
  1058. D16(KPAD_ROWCOL);
  1059. D16(KPAD_STAT);
  1060. D16(KPAD_SOFTEVAL);
  1061. #endif
  1062. parent = debugfs_create_dir("mdma", top);
  1063. MDMA(0);
  1064. MDMA(1);
  1065. #ifdef MDMA_D2_CONFIG
  1066. MDMA(2);
  1067. MDMA(3);
  1068. #endif
  1069. #ifdef MXVR_CONFIG
  1070. parent = debugfs_create_dir("mxvr", top);
  1071. D16(MXVR_CONFIG);
  1072. # ifdef MXVR_PLL_CTL_0
  1073. D32(MXVR_PLL_CTL_0);
  1074. # endif
  1075. D32(MXVR_STATE_0);
  1076. D32(MXVR_STATE_1);
  1077. D32(MXVR_INT_STAT_0);
  1078. D32(MXVR_INT_STAT_1);
  1079. D32(MXVR_INT_EN_0);
  1080. D32(MXVR_INT_EN_1);
  1081. D16(MXVR_POSITION);
  1082. D16(MXVR_MAX_POSITION);
  1083. D16(MXVR_DELAY);
  1084. D16(MXVR_MAX_DELAY);
  1085. D32(MXVR_LADDR);
  1086. D16(MXVR_GADDR);
  1087. D32(MXVR_AADDR);
  1088. D32(MXVR_ALLOC_0);
  1089. D32(MXVR_ALLOC_1);
  1090. D32(MXVR_ALLOC_2);
  1091. D32(MXVR_ALLOC_3);
  1092. D32(MXVR_ALLOC_4);
  1093. D32(MXVR_ALLOC_5);
  1094. D32(MXVR_ALLOC_6);
  1095. D32(MXVR_ALLOC_7);
  1096. D32(MXVR_ALLOC_8);
  1097. D32(MXVR_ALLOC_9);
  1098. D32(MXVR_ALLOC_10);
  1099. D32(MXVR_ALLOC_11);
  1100. D32(MXVR_ALLOC_12);
  1101. D32(MXVR_ALLOC_13);
  1102. D32(MXVR_ALLOC_14);
  1103. D32(MXVR_SYNC_LCHAN_0);
  1104. D32(MXVR_SYNC_LCHAN_1);
  1105. D32(MXVR_SYNC_LCHAN_2);
  1106. D32(MXVR_SYNC_LCHAN_3);
  1107. D32(MXVR_SYNC_LCHAN_4);
  1108. D32(MXVR_SYNC_LCHAN_5);
  1109. D32(MXVR_SYNC_LCHAN_6);
  1110. D32(MXVR_SYNC_LCHAN_7);
  1111. D32(MXVR_DMA0_CONFIG);
  1112. D32(MXVR_DMA0_START_ADDR);
  1113. D16(MXVR_DMA0_COUNT);
  1114. D32(MXVR_DMA0_CURR_ADDR);
  1115. D16(MXVR_DMA0_CURR_COUNT);
  1116. D32(MXVR_DMA1_CONFIG);
  1117. D32(MXVR_DMA1_START_ADDR);
  1118. D16(MXVR_DMA1_COUNT);
  1119. D32(MXVR_DMA1_CURR_ADDR);
  1120. D16(MXVR_DMA1_CURR_COUNT);
  1121. D32(MXVR_DMA2_CONFIG);
  1122. D32(MXVR_DMA2_START_ADDR);
  1123. D16(MXVR_DMA2_COUNT);
  1124. D32(MXVR_DMA2_CURR_ADDR);
  1125. D16(MXVR_DMA2_CURR_COUNT);
  1126. D32(MXVR_DMA3_CONFIG);
  1127. D32(MXVR_DMA3_START_ADDR);
  1128. D16(MXVR_DMA3_COUNT);
  1129. D32(MXVR_DMA3_CURR_ADDR);
  1130. D16(MXVR_DMA3_CURR_COUNT);
  1131. D32(MXVR_DMA4_CONFIG);
  1132. D32(MXVR_DMA4_START_ADDR);
  1133. D16(MXVR_DMA4_COUNT);
  1134. D32(MXVR_DMA4_CURR_ADDR);
  1135. D16(MXVR_DMA4_CURR_COUNT);
  1136. D32(MXVR_DMA5_CONFIG);
  1137. D32(MXVR_DMA5_START_ADDR);
  1138. D16(MXVR_DMA5_COUNT);
  1139. D32(MXVR_DMA5_CURR_ADDR);
  1140. D16(MXVR_DMA5_CURR_COUNT);
  1141. D32(MXVR_DMA6_CONFIG);
  1142. D32(MXVR_DMA6_START_ADDR);
  1143. D16(MXVR_DMA6_COUNT);
  1144. D32(MXVR_DMA6_CURR_ADDR);
  1145. D16(MXVR_DMA6_CURR_COUNT);
  1146. D32(MXVR_DMA7_CONFIG);
  1147. D32(MXVR_DMA7_START_ADDR);
  1148. D16(MXVR_DMA7_COUNT);
  1149. D32(MXVR_DMA7_CURR_ADDR);
  1150. D16(MXVR_DMA7_CURR_COUNT);
  1151. D16(MXVR_AP_CTL);
  1152. D32(MXVR_APRB_START_ADDR);
  1153. D32(MXVR_APRB_CURR_ADDR);
  1154. D32(MXVR_APTB_START_ADDR);
  1155. D32(MXVR_APTB_CURR_ADDR);
  1156. D32(MXVR_CM_CTL);
  1157. D32(MXVR_CMRB_START_ADDR);
  1158. D32(MXVR_CMRB_CURR_ADDR);
  1159. D32(MXVR_CMTB_START_ADDR);
  1160. D32(MXVR_CMTB_CURR_ADDR);
  1161. D32(MXVR_RRDB_START_ADDR);
  1162. D32(MXVR_RRDB_CURR_ADDR);
  1163. D32(MXVR_PAT_DATA_0);
  1164. D32(MXVR_PAT_EN_0);
  1165. D32(MXVR_PAT_DATA_1);
  1166. D32(MXVR_PAT_EN_1);
  1167. D16(MXVR_FRAME_CNT_0);
  1168. D16(MXVR_FRAME_CNT_1);
  1169. D32(MXVR_ROUTING_0);
  1170. D32(MXVR_ROUTING_1);
  1171. D32(MXVR_ROUTING_2);
  1172. D32(MXVR_ROUTING_3);
  1173. D32(MXVR_ROUTING_4);
  1174. D32(MXVR_ROUTING_5);
  1175. D32(MXVR_ROUTING_6);
  1176. D32(MXVR_ROUTING_7);
  1177. D32(MXVR_ROUTING_8);
  1178. D32(MXVR_ROUTING_9);
  1179. D32(MXVR_ROUTING_10);
  1180. D32(MXVR_ROUTING_11);
  1181. D32(MXVR_ROUTING_12);
  1182. D32(MXVR_ROUTING_13);
  1183. D32(MXVR_ROUTING_14);
  1184. # ifdef MXVR_PLL_CTL_1
  1185. D32(MXVR_PLL_CTL_1);
  1186. # endif
  1187. D16(MXVR_BLOCK_CNT);
  1188. # ifdef MXVR_CLK_CTL
  1189. D32(MXVR_CLK_CTL);
  1190. # endif
  1191. # ifdef MXVR_CDRPLL_CTL
  1192. D32(MXVR_CDRPLL_CTL);
  1193. # endif
  1194. # ifdef MXVR_FMPLL_CTL
  1195. D32(MXVR_FMPLL_CTL);
  1196. # endif
  1197. # ifdef MXVR_PIN_CTL
  1198. D16(MXVR_PIN_CTL);
  1199. # endif
  1200. # ifdef MXVR_SCLK_CNT
  1201. D16(MXVR_SCLK_CNT);
  1202. # endif
  1203. #endif
  1204. #ifdef NFC_ADDR
  1205. parent = debugfs_create_dir("nfc", top);
  1206. D_WO(NFC_ADDR, 16);
  1207. D_WO(NFC_CMD, 16);
  1208. D_RO(NFC_COUNT, 16);
  1209. D16(NFC_CTL);
  1210. D_WO(NFC_DATA_RD, 16);
  1211. D_WO(NFC_DATA_WR, 16);
  1212. D_RO(NFC_ECC0, 16);
  1213. D_RO(NFC_ECC1, 16);
  1214. D_RO(NFC_ECC2, 16);
  1215. D_RO(NFC_ECC3, 16);
  1216. D16(NFC_IRQMASK);
  1217. D16(NFC_IRQSTAT);
  1218. D_WO(NFC_PGCTL, 16);
  1219. D_RO(NFC_READ, 16);
  1220. D16(NFC_RST);
  1221. D_RO(NFC_STAT, 16);
  1222. #endif
  1223. #ifdef OTP_CONTROL
  1224. parent = debugfs_create_dir("otp", top);
  1225. D16(OTP_CONTROL);
  1226. D16(OTP_BEN);
  1227. D16(OTP_STATUS);
  1228. D32(OTP_TIMING);
  1229. D32(OTP_DATA0);
  1230. D32(OTP_DATA1);
  1231. D32(OTP_DATA2);
  1232. D32(OTP_DATA3);
  1233. #endif
  1234. #ifdef PINT0_MASK_SET
  1235. parent = debugfs_create_dir("pint", top);
  1236. PINT(0);
  1237. PINT(1);
  1238. PINT(2);
  1239. PINT(3);
  1240. #endif
  1241. #ifdef PIXC_CTL
  1242. parent = debugfs_create_dir("pixc", top);
  1243. D16(PIXC_CTL);
  1244. D16(PIXC_PPL);
  1245. D16(PIXC_LPF);
  1246. D16(PIXC_AHSTART);
  1247. D16(PIXC_AHEND);
  1248. D16(PIXC_AVSTART);
  1249. D16(PIXC_AVEND);
  1250. D16(PIXC_ATRANSP);
  1251. D16(PIXC_BHSTART);
  1252. D16(PIXC_BHEND);
  1253. D16(PIXC_BVSTART);
  1254. D16(PIXC_BVEND);
  1255. D16(PIXC_BTRANSP);
  1256. D16(PIXC_INTRSTAT);
  1257. D32(PIXC_RYCON);
  1258. D32(PIXC_GUCON);
  1259. D32(PIXC_BVCON);
  1260. D32(PIXC_CCBIAS);
  1261. D32(PIXC_TC);
  1262. #endif
  1263. parent = debugfs_create_dir("pll", top);
  1264. D16(PLL_CTL);
  1265. D16(PLL_DIV);
  1266. D16(PLL_LOCKCNT);
  1267. D16(PLL_STAT);
  1268. D16(VR_CTL);
  1269. D32(CHIPID); /* it's part of this hardware block */
  1270. #if defined(PPI_CONTROL) || defined(PPI0_CONTROL) || defined(PPI1_CONTROL)
  1271. parent = debugfs_create_dir("ppi", top);
  1272. # ifdef PPI_CONTROL
  1273. bfin_debug_mmrs_ppi(parent, PPI_CONTROL, -1);
  1274. # endif
  1275. # ifdef PPI0_CONTROL
  1276. PPI(0);
  1277. # endif
  1278. # ifdef PPI1_CONTROL
  1279. PPI(1);
  1280. # endif
  1281. #endif
  1282. #ifdef PWM_CTRL
  1283. parent = debugfs_create_dir("pwm", top);
  1284. D16(PWM_CTRL);
  1285. D16(PWM_STAT);
  1286. D16(PWM_TM);
  1287. D16(PWM_DT);
  1288. D16(PWM_GATE);
  1289. D16(PWM_CHA);
  1290. D16(PWM_CHB);
  1291. D16(PWM_CHC);
  1292. D16(PWM_SEG);
  1293. D16(PWM_SYNCWT);
  1294. D16(PWM_CHAL);
  1295. D16(PWM_CHBL);
  1296. D16(PWM_CHCL);
  1297. D16(PWM_LSI);
  1298. D16(PWM_STAT2);
  1299. #endif
  1300. #ifdef RSI_CONFIG
  1301. parent = debugfs_create_dir("rsi", top);
  1302. D32(RSI_ARGUMENT);
  1303. D16(RSI_CEATA_CONTROL);
  1304. D16(RSI_CLK_CONTROL);
  1305. D16(RSI_COMMAND);
  1306. D16(RSI_CONFIG);
  1307. D16(RSI_DATA_CNT);
  1308. D16(RSI_DATA_CONTROL);
  1309. D16(RSI_DATA_LGTH);
  1310. D32(RSI_DATA_TIMER);
  1311. D16(RSI_EMASK);
  1312. D16(RSI_ESTAT);
  1313. D32(RSI_FIFO);
  1314. D16(RSI_FIFO_CNT);
  1315. D32(RSI_MASK0);
  1316. D32(RSI_MASK1);
  1317. D16(RSI_PID0);
  1318. D16(RSI_PID1);
  1319. D16(RSI_PID2);
  1320. D16(RSI_PID3);
  1321. D16(RSI_PID4);
  1322. D16(RSI_PID5);
  1323. D16(RSI_PID6);
  1324. D16(RSI_PID7);
  1325. D16(RSI_PWR_CONTROL);
  1326. D16(RSI_RD_WAIT_EN);
  1327. D32(RSI_RESPONSE0);
  1328. D32(RSI_RESPONSE1);
  1329. D32(RSI_RESPONSE2);
  1330. D32(RSI_RESPONSE3);
  1331. D16(RSI_RESP_CMD);
  1332. D32(RSI_STATUS);
  1333. D_WO(RSI_STATUSCL, 16);
  1334. #endif
  1335. #ifdef RTC_ALARM
  1336. parent = debugfs_create_dir("rtc", top);
  1337. D32(RTC_ALARM);
  1338. D16(RTC_ICTL);
  1339. D16(RTC_ISTAT);
  1340. D16(RTC_PREN);
  1341. D32(RTC_STAT);
  1342. D16(RTC_SWCNT);
  1343. #endif
  1344. #ifdef SDH_CFG
  1345. parent = debugfs_create_dir("sdh", top);
  1346. D32(SDH_ARGUMENT);
  1347. D16(SDH_CFG);
  1348. D16(SDH_CLK_CTL);
  1349. D16(SDH_COMMAND);
  1350. D_RO(SDH_DATA_CNT, 16);
  1351. D16(SDH_DATA_CTL);
  1352. D16(SDH_DATA_LGTH);
  1353. D32(SDH_DATA_TIMER);
  1354. D16(SDH_E_MASK);
  1355. D16(SDH_E_STATUS);
  1356. D32(SDH_FIFO);
  1357. D_RO(SDH_FIFO_CNT, 16);
  1358. D32(SDH_MASK0);
  1359. D32(SDH_MASK1);
  1360. D_RO(SDH_PID0, 16);
  1361. D_RO(SDH_PID1, 16);
  1362. D_RO(SDH_PID2, 16);
  1363. D_RO(SDH_PID3, 16);
  1364. D_RO(SDH_PID4, 16);
  1365. D_RO(SDH_PID5, 16);
  1366. D_RO(SDH_PID6, 16);
  1367. D_RO(SDH_PID7, 16);
  1368. D16(SDH_PWR_CTL);
  1369. D16(SDH_RD_WAIT_EN);
  1370. D_RO(SDH_RESPONSE0, 32);
  1371. D_RO(SDH_RESPONSE1, 32);
  1372. D_RO(SDH_RESPONSE2, 32);
  1373. D_RO(SDH_RESPONSE3, 32);
  1374. D_RO(SDH_RESP_CMD, 16);
  1375. D_RO(SDH_STATUS, 32);
  1376. D_WO(SDH_STATUS_CLR, 16);
  1377. #endif
  1378. #ifdef SECURE_CONTROL
  1379. parent = debugfs_create_dir("security", top);
  1380. D16(SECURE_CONTROL);
  1381. D16(SECURE_STATUS);
  1382. D32(SECURE_SYSSWT);
  1383. #endif
  1384. parent = debugfs_create_dir("sic", top);
  1385. D16(SWRST);
  1386. D16(SYSCR);
  1387. D16(SIC_RVECT);
  1388. D32(SIC_IAR0);
  1389. D32(SIC_IAR1);
  1390. D32(SIC_IAR2);
  1391. #ifdef SIC_IAR3
  1392. D32(SIC_IAR3);
  1393. #endif
  1394. #ifdef SIC_IAR4
  1395. D32(SIC_IAR4);
  1396. D32(SIC_IAR5);
  1397. D32(SIC_IAR6);
  1398. #endif
  1399. #ifdef SIC_IAR7
  1400. D32(SIC_IAR7);
  1401. #endif
  1402. #ifdef SIC_IAR8
  1403. D32(SIC_IAR8);
  1404. D32(SIC_IAR9);
  1405. D32(SIC_IAR10);
  1406. D32(SIC_IAR11);
  1407. #endif
  1408. #ifdef SIC_IMASK
  1409. D32(SIC_IMASK);
  1410. D32(SIC_ISR);
  1411. D32(SIC_IWR);
  1412. #endif
  1413. #ifdef SIC_IMASK0
  1414. D32(SIC_IMASK0);
  1415. D32(SIC_IMASK1);
  1416. D32(SIC_ISR0);
  1417. D32(SIC_ISR1);
  1418. D32(SIC_IWR0);
  1419. D32(SIC_IWR1);
  1420. #endif
  1421. #ifdef SIC_IMASK2
  1422. D32(SIC_IMASK2);
  1423. D32(SIC_ISR2);
  1424. D32(SIC_IWR2);
  1425. #endif
  1426. #ifdef SICB_RVECT
  1427. D16(SICB_SWRST);
  1428. D16(SICB_SYSCR);
  1429. D16(SICB_RVECT);
  1430. D32(SICB_IAR0);
  1431. D32(SICB_IAR1);
  1432. D32(SICB_IAR2);
  1433. D32(SICB_IAR3);
  1434. D32(SICB_IAR4);
  1435. D32(SICB_IAR5);
  1436. D32(SICB_IAR6);
  1437. D32(SICB_IAR7);
  1438. D32(SICB_IMASK0);
  1439. D32(SICB_IMASK1);
  1440. D32(SICB_ISR0);
  1441. D32(SICB_ISR1);
  1442. D32(SICB_IWR0);
  1443. D32(SICB_IWR1);
  1444. #endif
  1445. parent = debugfs_create_dir("spi", top);
  1446. #ifdef SPI0_REGBASE
  1447. SPI(0);
  1448. #endif
  1449. #ifdef SPI1_REGBASE
  1450. SPI(1);
  1451. #endif
  1452. #ifdef SPI2_REGBASE
  1453. SPI(2);
  1454. #endif
  1455. parent = debugfs_create_dir("sport", top);
  1456. #ifdef SPORT0_STAT
  1457. SPORT(0);
  1458. #endif
  1459. #ifdef SPORT1_STAT
  1460. SPORT(1);
  1461. #endif
  1462. #ifdef SPORT2_STAT
  1463. SPORT(2);
  1464. #endif
  1465. #ifdef SPORT3_STAT
  1466. SPORT(3);
  1467. #endif
  1468. #if defined(TWI_CLKDIV) || defined(TWI0_CLKDIV) || defined(TWI1_CLKDIV)
  1469. parent = debugfs_create_dir("twi", top);
  1470. # ifdef TWI_CLKDIV
  1471. bfin_debug_mmrs_twi(parent, TWI_CLKDIV, -1);
  1472. # endif
  1473. # ifdef TWI0_CLKDIV
  1474. TWI(0);
  1475. # endif
  1476. # ifdef TWI1_CLKDIV
  1477. TWI(1);
  1478. # endif
  1479. #endif
  1480. parent = debugfs_create_dir("uart", top);
  1481. #ifdef BFIN_UART_DLL
  1482. bfin_debug_mmrs_uart(parent, BFIN_UART_DLL, -1);
  1483. #endif
  1484. #ifdef UART0_DLL
  1485. UART(0);
  1486. #endif
  1487. #ifdef UART1_DLL
  1488. UART(1);
  1489. #endif
  1490. #ifdef UART2_DLL
  1491. UART(2);
  1492. #endif
  1493. #ifdef UART3_DLL
  1494. UART(3);
  1495. #endif
  1496. #ifdef USB_FADDR
  1497. parent = debugfs_create_dir("usb", top);
  1498. D16(USB_FADDR);
  1499. D16(USB_POWER);
  1500. D16(USB_INTRTX);
  1501. D16(USB_INTRRX);
  1502. D16(USB_INTRTXE);
  1503. D16(USB_INTRRXE);
  1504. D16(USB_INTRUSB);
  1505. D16(USB_INTRUSBE);
  1506. D16(USB_FRAME);
  1507. D16(USB_INDEX);
  1508. D16(USB_TESTMODE);
  1509. D16(USB_GLOBINTR);
  1510. D16(USB_GLOBAL_CTL);
  1511. D16(USB_TX_MAX_PACKET);
  1512. D16(USB_CSR0);
  1513. D16(USB_TXCSR);
  1514. D16(USB_RX_MAX_PACKET);
  1515. D16(USB_RXCSR);
  1516. D16(USB_COUNT0);
  1517. D16(USB_RXCOUNT);
  1518. D16(USB_TXTYPE);
  1519. D16(USB_NAKLIMIT0);
  1520. D16(USB_TXINTERVAL);
  1521. D16(USB_RXTYPE);
  1522. D16(USB_RXINTERVAL);
  1523. D16(USB_TXCOUNT);
  1524. D16(USB_EP0_FIFO);
  1525. D16(USB_EP1_FIFO);
  1526. D16(USB_EP2_FIFO);
  1527. D16(USB_EP3_FIFO);
  1528. D16(USB_EP4_FIFO);
  1529. D16(USB_EP5_FIFO);
  1530. D16(USB_EP6_FIFO);
  1531. D16(USB_EP7_FIFO);
  1532. D16(USB_OTG_DEV_CTL);
  1533. D16(USB_OTG_VBUS_IRQ);
  1534. D16(USB_OTG_VBUS_MASK);
  1535. D16(USB_LINKINFO);
  1536. D16(USB_VPLEN);
  1537. D16(USB_HS_EOF1);
  1538. D16(USB_FS_EOF1);
  1539. D16(USB_LS_EOF1);
  1540. D16(USB_APHY_CNTRL);
  1541. D16(USB_APHY_CALIB);
  1542. D16(USB_APHY_CNTRL2);
  1543. D16(USB_PLLOSC_CTRL);
  1544. D16(USB_SRP_CLKDIV);
  1545. D16(USB_EP_NI0_TXMAXP);
  1546. D16(USB_EP_NI0_TXCSR);
  1547. D16(USB_EP_NI0_RXMAXP);
  1548. D16(USB_EP_NI0_RXCSR);
  1549. D16(USB_EP_NI0_RXCOUNT);
  1550. D16(USB_EP_NI0_TXTYPE);
  1551. D16(USB_EP_NI0_TXINTERVAL);
  1552. D16(USB_EP_NI0_RXTYPE);
  1553. D16(USB_EP_NI0_RXINTERVAL);
  1554. D16(USB_EP_NI0_TXCOUNT);
  1555. D16(USB_EP_NI1_TXMAXP);
  1556. D16(USB_EP_NI1_TXCSR);
  1557. D16(USB_EP_NI1_RXMAXP);
  1558. D16(USB_EP_NI1_RXCSR);
  1559. D16(USB_EP_NI1_RXCOUNT);
  1560. D16(USB_EP_NI1_TXTYPE);
  1561. D16(USB_EP_NI1_TXINTERVAL);
  1562. D16(USB_EP_NI1_RXTYPE);
  1563. D16(USB_EP_NI1_RXINTERVAL);
  1564. D16(USB_EP_NI1_TXCOUNT);
  1565. D16(USB_EP_NI2_TXMAXP);
  1566. D16(USB_EP_NI2_TXCSR);
  1567. D16(USB_EP_NI2_RXMAXP);
  1568. D16(USB_EP_NI2_RXCSR);
  1569. D16(USB_EP_NI2_RXCOUNT);
  1570. D16(USB_EP_NI2_TXTYPE);
  1571. D16(USB_EP_NI2_TXINTERVAL);
  1572. D16(USB_EP_NI2_RXTYPE);
  1573. D16(USB_EP_NI2_RXINTERVAL);
  1574. D16(USB_EP_NI2_TXCOUNT);
  1575. D16(USB_EP_NI3_TXMAXP);
  1576. D16(USB_EP_NI3_TXCSR);
  1577. D16(USB_EP_NI3_RXMAXP);
  1578. D16(USB_EP_NI3_RXCSR);
  1579. D16(USB_EP_NI3_RXCOUNT);
  1580. D16(USB_EP_NI3_TXTYPE);
  1581. D16(USB_EP_NI3_TXINTERVAL);
  1582. D16(USB_EP_NI3_RXTYPE);
  1583. D16(USB_EP_NI3_RXINTERVAL);
  1584. D16(USB_EP_NI3_TXCOUNT);
  1585. D16(USB_EP_NI4_TXMAXP);
  1586. D16(USB_EP_NI4_TXCSR);
  1587. D16(USB_EP_NI4_RXMAXP);
  1588. D16(USB_EP_NI4_RXCSR);
  1589. D16(USB_EP_NI4_RXCOUNT);
  1590. D16(USB_EP_NI4_TXTYPE);
  1591. D16(USB_EP_NI4_TXINTERVAL);
  1592. D16(USB_EP_NI4_RXTYPE);
  1593. D16(USB_EP_NI4_RXINTERVAL);
  1594. D16(USB_EP_NI4_TXCOUNT);
  1595. D16(USB_EP_NI5_TXMAXP);
  1596. D16(USB_EP_NI5_TXCSR);
  1597. D16(USB_EP_NI5_RXMAXP);
  1598. D16(USB_EP_NI5_RXCSR);
  1599. D16(USB_EP_NI5_RXCOUNT);
  1600. D16(USB_EP_NI5_TXTYPE);
  1601. D16(USB_EP_NI5_TXINTERVAL);
  1602. D16(USB_EP_NI5_RXTYPE);
  1603. D16(USB_EP_NI5_RXINTERVAL);
  1604. D16(USB_EP_NI5_TXCOUNT);
  1605. D16(USB_EP_NI6_TXMAXP);
  1606. D16(USB_EP_NI6_TXCSR);
  1607. D16(USB_EP_NI6_RXMAXP);
  1608. D16(USB_EP_NI6_RXCSR);
  1609. D16(USB_EP_NI6_RXCOUNT);
  1610. D16(USB_EP_NI6_TXTYPE);
  1611. D16(USB_EP_NI6_TXINTERVAL);
  1612. D16(USB_EP_NI6_RXTYPE);
  1613. D16(USB_EP_NI6_RXINTERVAL);
  1614. D16(USB_EP_NI6_TXCOUNT);
  1615. D16(USB_EP_NI7_TXMAXP);
  1616. D16(USB_EP_NI7_TXCSR);
  1617. D16(USB_EP_NI7_RXMAXP);
  1618. D16(USB_EP_NI7_RXCSR);
  1619. D16(USB_EP_NI7_RXCOUNT);
  1620. D16(USB_EP_NI7_TXTYPE);
  1621. D16(USB_EP_NI7_TXINTERVAL);
  1622. D16(USB_EP_NI7_RXTYPE);
  1623. D16(USB_EP_NI7_RXINTERVAL);
  1624. D16(USB_EP_NI7_TXCOUNT);
  1625. D16(USB_DMA_INTERRUPT);
  1626. D16(USB_DMA0CONTROL);
  1627. D16(USB_DMA0ADDRLOW);
  1628. D16(USB_DMA0ADDRHIGH);
  1629. D16(USB_DMA0COUNTLOW);
  1630. D16(USB_DMA0COUNTHIGH);
  1631. D16(USB_DMA1CONTROL);
  1632. D16(USB_DMA1ADDRLOW);
  1633. D16(USB_DMA1ADDRHIGH);
  1634. D16(USB_DMA1COUNTLOW);
  1635. D16(USB_DMA1COUNTHIGH);
  1636. D16(USB_DMA2CONTROL);
  1637. D16(USB_DMA2ADDRLOW);
  1638. D16(USB_DMA2ADDRHIGH);
  1639. D16(USB_DMA2COUNTLOW);
  1640. D16(USB_DMA2COUNTHIGH);
  1641. D16(USB_DMA3CONTROL);
  1642. D16(USB_DMA3ADDRLOW);
  1643. D16(USB_DMA3ADDRHIGH);
  1644. D16(USB_DMA3COUNTLOW);
  1645. D16(USB_DMA3COUNTHIGH);
  1646. D16(USB_DMA4CONTROL);
  1647. D16(USB_DMA4ADDRLOW);
  1648. D16(USB_DMA4ADDRHIGH);
  1649. D16(USB_DMA4COUNTLOW);
  1650. D16(USB_DMA4COUNTHIGH);
  1651. D16(USB_DMA5CONTROL);
  1652. D16(USB_DMA5ADDRLOW);
  1653. D16(USB_DMA5ADDRHIGH);
  1654. D16(USB_DMA5COUNTLOW);
  1655. D16(USB_DMA5COUNTHIGH);
  1656. D16(USB_DMA6CONTROL);
  1657. D16(USB_DMA6ADDRLOW);
  1658. D16(USB_DMA6ADDRHIGH);
  1659. D16(USB_DMA6COUNTLOW);
  1660. D16(USB_DMA6COUNTHIGH);
  1661. D16(USB_DMA7CONTROL);
  1662. D16(USB_DMA7ADDRLOW);
  1663. D16(USB_DMA7ADDRHIGH);
  1664. D16(USB_DMA7COUNTLOW);
  1665. D16(USB_DMA7COUNTHIGH);
  1666. #endif
  1667. #ifdef WDOG_CNT
  1668. parent = debugfs_create_dir("watchdog", top);
  1669. D32(WDOG_CNT);
  1670. D16(WDOG_CTL);
  1671. D32(WDOG_STAT);
  1672. #endif
  1673. #ifdef WDOGA_CNT
  1674. parent = debugfs_create_dir("watchdog", top);
  1675. D32(WDOGA_CNT);
  1676. D16(WDOGA_CTL);
  1677. D32(WDOGA_STAT);
  1678. D32(WDOGB_CNT);
  1679. D16(WDOGB_CTL);
  1680. D32(WDOGB_STAT);
  1681. #endif
  1682. /* BF533 glue */
  1683. #ifdef FIO_FLAG_D
  1684. #define PORTFIO FIO_FLAG_D
  1685. #endif
  1686. /* BF561 glue */
  1687. #ifdef FIO0_FLAG_D
  1688. #define PORTFIO FIO0_FLAG_D
  1689. #endif
  1690. #ifdef FIO1_FLAG_D
  1691. #define PORTGIO FIO1_FLAG_D
  1692. #endif
  1693. #ifdef FIO2_FLAG_D
  1694. #define PORTHIO FIO2_FLAG_D
  1695. #endif
  1696. parent = debugfs_create_dir("port", top);
  1697. #ifdef PORTFIO
  1698. PORT(PORTFIO, 'F');
  1699. #endif
  1700. #ifdef PORTGIO
  1701. PORT(PORTGIO, 'G');
  1702. #endif
  1703. #ifdef PORTHIO
  1704. PORT(PORTHIO, 'H');
  1705. #endif
  1706. #ifdef __ADSPBF51x__
  1707. D16(PORTF_FER);
  1708. D16(PORTF_DRIVE);
  1709. D16(PORTF_HYSTERESIS);
  1710. D16(PORTF_MUX);
  1711. D16(PORTG_FER);
  1712. D16(PORTG_DRIVE);
  1713. D16(PORTG_HYSTERESIS);
  1714. D16(PORTG_MUX);
  1715. D16(PORTH_FER);
  1716. D16(PORTH_DRIVE);
  1717. D16(PORTH_HYSTERESIS);
  1718. D16(PORTH_MUX);
  1719. D16(MISCPORT_DRIVE);
  1720. D16(MISCPORT_HYSTERESIS);
  1721. #endif /* BF51x */
  1722. #ifdef __ADSPBF52x__
  1723. D16(PORTF_FER);
  1724. D16(PORTF_DRIVE);
  1725. D16(PORTF_HYSTERESIS);
  1726. D16(PORTF_MUX);
  1727. D16(PORTF_SLEW);
  1728. D16(PORTG_FER);
  1729. D16(PORTG_DRIVE);
  1730. D16(PORTG_HYSTERESIS);
  1731. D16(PORTG_MUX);
  1732. D16(PORTG_SLEW);
  1733. D16(PORTH_FER);
  1734. D16(PORTH_DRIVE);
  1735. D16(PORTH_HYSTERESIS);
  1736. D16(PORTH_MUX);
  1737. D16(PORTH_SLEW);
  1738. D16(MISCPORT_DRIVE);
  1739. D16(MISCPORT_HYSTERESIS);
  1740. D16(MISCPORT_SLEW);
  1741. #endif /* BF52x */
  1742. #ifdef BF537_FAMILY
  1743. D16(PORTF_FER);
  1744. D16(PORTG_FER);
  1745. D16(PORTH_FER);
  1746. D16(PORT_MUX);
  1747. #endif /* BF534 BF536 BF537 */
  1748. #ifdef BF538_FAMILY
  1749. D16(PORTCIO_FER);
  1750. D16(PORTCIO);
  1751. D16(PORTCIO_CLEAR);
  1752. D16(PORTCIO_SET);
  1753. D16(PORTCIO_TOGGLE);
  1754. D16(PORTCIO_DIR);
  1755. D16(PORTCIO_INEN);
  1756. D16(PORTDIO);
  1757. D16(PORTDIO_CLEAR);
  1758. D16(PORTDIO_DIR);
  1759. D16(PORTDIO_FER);
  1760. D16(PORTDIO_INEN);
  1761. D16(PORTDIO_SET);
  1762. D16(PORTDIO_TOGGLE);
  1763. D16(PORTEIO);
  1764. D16(PORTEIO_CLEAR);
  1765. D16(PORTEIO_DIR);
  1766. D16(PORTEIO_FER);
  1767. D16(PORTEIO_INEN);
  1768. D16(PORTEIO_SET);
  1769. D16(PORTEIO_TOGGLE);
  1770. #endif /* BF538 BF539 */
  1771. #ifdef __ADSPBF54x__
  1772. {
  1773. int num;
  1774. unsigned long base;
  1775. base = PORTA_FER;
  1776. for (num = 0; num < 10; ++num) {
  1777. PORT(base, num);
  1778. base += sizeof(struct bfin_gpio_regs);
  1779. }
  1780. }
  1781. #endif /* BF54x */
  1782. #endif /* CONFIG_BF60x */
  1783. debug_mmrs_dentry = top;
  1784. return 0;
  1785. }
  1786. module_init(bfin_debug_mmrs_init);
  1787. static void __exit bfin_debug_mmrs_exit(void)
  1788. {
  1789. debugfs_remove_recursive(debug_mmrs_dentry);
  1790. }
  1791. module_exit(bfin_debug_mmrs_exit);
  1792. MODULE_LICENSE("GPL");