hpi.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. /*
  2. * (C) Copyright 2006
  3. * Markus Klotzbuecher, DENX Software Engineering, mk@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /*
  24. * Host Port Interface (HPI)
  25. */
  26. /* debug levels:
  27. * 0 : errors
  28. * 1 : usefull info
  29. * 2 : lots of info
  30. * 3 : noisy
  31. */
  32. #define DEBUG 0
  33. #include <config.h>
  34. #include <common.h>
  35. #include <mpc8xx.h>
  36. #include "pld.h"
  37. #include "hpi.h"
  38. #define _NOT_USED_ 0xFFFFFFFF
  39. /* original table:
  40. * - inserted loops to achieve long CS low and high Periods (~217ns)
  41. * - move cs high 2/4 to the right
  42. */
  43. const uint dsp_table_slow[] =
  44. {
  45. /* single read (offset 0x00 in upm ram) */
  46. 0x8fffdc04, 0x0fffdc84, 0x0fffdc84, 0x0fffdc00,
  47. 0x3fffdc04, 0xffffdc84, 0xffffdc84, 0xffffdc05,
  48. /* burst read (offset 0x08 in upm ram) */
  49. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  50. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  51. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  52. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  53. /* single write (offset 0x18 in upm ram) */
  54. 0x8fffd004, 0x0fffd084, 0x0fffd084, 0x3fffd000,
  55. 0xffffd084, 0xffffd084, 0xffffd005, _NOT_USED_,
  56. /* burst write (offset 0x20 in upm ram) */
  57. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  58. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  59. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  60. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  61. /* refresh (offset 0x30 in upm ram) */
  62. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  63. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  64. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  65. /* exception (offset 0x3C in upm ram) */
  66. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  67. };
  68. /* dsp hpi upm ram table
  69. * works fine for noninc access, failes on incremental.
  70. * - removed first word
  71. */
  72. const uint dsp_table_fast[] =
  73. {
  74. /* single read (offset 0x00 in upm ram) */
  75. 0x8fffdc04, 0x0fffdc04, 0x0fffdc00, 0x3fffdc04,
  76. 0xffffdc05, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  77. /* burst read (offset 0x08 in upm ram) */
  78. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  79. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  80. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  81. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  82. /* single write (offset 0x18 in upm ram) */
  83. 0x8fffd004, 0x0fffd004, 0x3fffd000, 0xffffd005,
  84. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  85. /* burst write (offset 0x20 in upm ram) */
  86. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  87. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  88. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  89. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  90. /* refresh (offset 0x30 in upm ram) */
  91. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  92. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  93. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  94. /* exception (offset 0x3C in upm ram) */
  95. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  96. };
  97. #ifdef CONFIG_SPC1920_HPI_TEST
  98. #undef HPI_TEST_OSZI
  99. #define HPI_TEST_CHUNKSIZE 0x1000
  100. #define HPI_TEST_PATTERN 0x00000000
  101. #define HPI_TEST_START 0x0
  102. #define HPI_TEST_END 0x30000
  103. #define TINY_AUTOINC_DATA_SIZE 16 /* 32bit words */
  104. #define TINY_AUTOINC_BASE_ADDR 0x0
  105. static int hpi_activate(void);
  106. static void hpi_inactivate(void);
  107. static void dsp_reset(void);
  108. static int hpi_write_inc(u32 addr, u32 *data, u32 count);
  109. static int hpi_read_inc(u32 addr, u32 *buf, u32 count);
  110. static int hpi_write_noinc(u32 addr, u32 data);
  111. static u32 hpi_read_noinc(u32 addr);
  112. int hpi_test(void);
  113. static int hpi_write_addr_test(u32 addr);
  114. static int hpi_read_write_test(u32 addr, u32 data);
  115. static int hpi_tiny_autoinc_test(void);
  116. #endif /* CONFIG_SPC1920_HPI_TEST */
  117. /* init the host port interface on UPMA */
  118. int hpi_init(void)
  119. {
  120. volatile immap_t *immr = (immap_t *) CFG_IMMR;
  121. volatile memctl8xx_t *memctl = &immr->im_memctl;
  122. volatile spc1920_pld_t *pld = (spc1920_pld_t *) CFG_SPC1920_PLD_BASE;
  123. upmconfig(UPMA, (uint *)dsp_table_slow, sizeof(dsp_table_slow)/sizeof(uint));
  124. udelay(100);
  125. memctl->memc_mamr = CFG_MAMR;
  126. memctl->memc_or3 = CFG_OR3;
  127. memctl->memc_br3 = CFG_BR3;
  128. /* reset dsp */
  129. dsp_reset();
  130. /* activate hpi switch*/
  131. pld->dsp_hpi_on = 0x1;
  132. udelay(100);
  133. return 0;
  134. }
  135. #ifdef CONFIG_SPC1920_HPI_TEST
  136. /* activate the Host Port interface */
  137. static int hpi_activate(void)
  138. {
  139. volatile spc1920_pld_t *pld = (spc1920_pld_t *) CFG_SPC1920_PLD_BASE;
  140. /* turn on hpi */
  141. pld->dsp_hpi_on = 0x1;
  142. udelay(5);
  143. /* turn on the power EN_DSP_POWER high*/
  144. /* currently always on TBD */
  145. /* setup hpi control register */
  146. HPI_HPIC_1 = (u16) 0x0008;
  147. HPI_HPIC_2 = (u16) 0x0008;
  148. udelay(100);
  149. return 0;
  150. }
  151. /* turn off the host port interface */
  152. static void hpi_inactivate(void)
  153. {
  154. volatile spc1920_pld_t *pld = (spc1920_pld_t *) CFG_SPC1920_PLD_BASE;
  155. /* deactivate hpi */
  156. pld->dsp_hpi_on = 0x0;
  157. /* reset the dsp */
  158. /* pld->dsp_reset = 0x0; */
  159. /* turn off the power EN_DSP_POWER# high*/
  160. /* currently always on TBD */
  161. }
  162. /* reset the DSP */
  163. static void dsp_reset(void)
  164. {
  165. volatile spc1920_pld_t *pld = (spc1920_pld_t *) CFG_SPC1920_PLD_BASE;
  166. pld->dsp_reset = 0x1;
  167. pld->dsp_hpi_on = 0x0;
  168. udelay(300000);
  169. pld->dsp_reset = 0x0;
  170. pld->dsp_hpi_on = 0x1;
  171. }
  172. /* write using autoinc (count is number of 32bit words) */
  173. static int hpi_write_inc(u32 addr, u32 *data, u32 count)
  174. {
  175. int i;
  176. u16 addr1, addr2;
  177. addr1 = (u16) ((addr >> 16) & 0xffff); /* First HW is most significant */
  178. addr2 = (u16) (addr & 0xffff);
  179. /* write address */
  180. HPI_HPIA_1 = addr1;
  181. HPI_HPIA_2 = addr2;
  182. debugX(4, "writing from data=0x%x to 0x%x\n", data, (data+count));
  183. for(i=0; i<count; i++) {
  184. HPI_HPID_INC_1 = (u16) ((data[i] >> 16) & 0xffff);
  185. HPI_HPID_INC_2 = (u16) (data[i] & 0xffff);
  186. debugX(4, "hpi_write_inc: data1=0x%x, data2=0x%x\n",
  187. (u16) ((data[i] >> 16) & 0xffff),
  188. (u16) (data[i] & 0xffff));
  189. }
  190. #if 0
  191. while(data_ptr < (u16*) (data + count)) {
  192. HPI_HPID_INC_1 = *(data_ptr++);
  193. HPI_HPID_INC_2 = *(data_ptr++);
  194. }
  195. #endif
  196. /* return number of bytes written */
  197. return count;
  198. }
  199. /*
  200. * read using autoinc (count is number of 32bit words)
  201. */
  202. static int hpi_read_inc(u32 addr, u32 *buf, u32 count)
  203. {
  204. int i;
  205. u16 addr1, addr2, data1, data2;
  206. addr1 = (u16) ((addr >> 16) & 0xffff); /* First HW is most significant */
  207. addr2 = (u16) (addr & 0xffff);
  208. /* write address */
  209. HPI_HPIA_1 = addr1;
  210. HPI_HPIA_2 = addr2;
  211. for(i=0; i<count; i++) {
  212. data1 = HPI_HPID_INC_1;
  213. data2 = HPI_HPID_INC_2;
  214. debugX(4, "hpi_read_inc: data1=0x%x, data2=0x%x\n", data1, data2);
  215. buf[i] = (((u32) data1) << 16) | (data2 & 0xffff);
  216. }
  217. #if 0
  218. while(buf_ptr < (u16*) (buf + count)) {
  219. *(buf_ptr++) = HPI_HPID_INC_1;
  220. *(buf_ptr++) = HPI_HPID_INC_2;
  221. }
  222. #endif
  223. /* return number of bytes read */
  224. return count;
  225. }
  226. /* write to non- auto inc regs */
  227. static int hpi_write_noinc(u32 addr, u32 data)
  228. {
  229. u16 addr1, addr2, data1, data2;
  230. addr1 = (u16) ((addr >> 16) & 0xffff); /* First HW is most significant */
  231. addr2 = (u16) (addr & 0xffff);
  232. /* printf("hpi_write_noinc: addr1=0x%x, addr2=0x%x\n", addr1, addr2); */
  233. HPI_HPIA_1 = addr1;
  234. HPI_HPIA_2 = addr2;
  235. data1 = (u16) ((data >> 16) & 0xffff);
  236. data2 = (u16) (data & 0xffff);
  237. /* printf("hpi_write_noinc: data1=0x%x, data2=0x%x\n", data1, data2); */
  238. HPI_HPID_NOINC_1 = data1;
  239. HPI_HPID_NOINC_2 = data2;
  240. return 0;
  241. }
  242. /* read from non- auto inc regs */
  243. static u32 hpi_read_noinc(u32 addr)
  244. {
  245. u16 addr1, addr2, data1, data2;
  246. u32 ret;
  247. addr1 = (u16) ((addr >> 16) & 0xffff); /* First HW is most significant */
  248. addr2 = (u16) (addr & 0xffff);
  249. HPI_HPIA_1 = addr1;
  250. HPI_HPIA_2 = addr2;
  251. /* printf("hpi_read_noinc: addr1=0x%x, addr2=0x%x\n", addr1, addr2); */
  252. data1 = HPI_HPID_NOINC_1;
  253. data2 = HPI_HPID_NOINC_2;
  254. /* printf("hpi_read_noinc: data1=0x%x, data2=0x%x\n", data1, data2); */
  255. ret = (((u32) data1) << 16) | (data2 & 0xffff);
  256. return ret;
  257. }
  258. /*
  259. * Host Port Interface Tests
  260. */
  261. #ifndef HPI_TEST_OSZI
  262. /* main test function */
  263. int hpi_test(void)
  264. {
  265. int err = 0;
  266. u32 i, ii, pattern, tmp;
  267. pattern = HPI_TEST_PATTERN;
  268. u32 test_data[HPI_TEST_CHUNKSIZE];
  269. u32 read_data[HPI_TEST_CHUNKSIZE];
  270. debugX(2, "hpi_test: activating hpi...");
  271. hpi_activate();
  272. debugX(2, "OK.\n");
  273. #if 0
  274. /* Dump the first 1024 bytes
  275. *
  276. */
  277. for(i=0; i<1024; i+=4) {
  278. if(i%16==0)
  279. printf("\n0x%08x: ", i);
  280. printf("0x%08x ", hpi_read_noinc(i));
  281. }
  282. #endif
  283. /* HPIA read-write test
  284. *
  285. */
  286. debugX(1, "hpi_test: starting HPIA read-write tests...\n");
  287. err |= hpi_write_addr_test(0xdeadc0de);
  288. err |= hpi_write_addr_test(0xbeefd00d);
  289. err |= hpi_write_addr_test(0xabcd1234);
  290. err |= hpi_write_addr_test(0xaaaaaaaa);
  291. if(err) {
  292. debugX(1, "hpi_test: HPIA read-write tests: *** FAILED ***\n");
  293. return -1;
  294. }
  295. debugX(1, "hpi_test: HPIA read-write tests: OK\n");
  296. /* read write test using nonincremental data regs
  297. *
  298. */
  299. debugX(1, "hpi_test: starting nonincremental tests...\n");
  300. for(i=HPI_TEST_START; i<HPI_TEST_END; i+=4) {
  301. err |= hpi_read_write_test(i, pattern);
  302. /* stolen from cmd_mem.c */
  303. if(pattern & 0x80000000) {
  304. pattern = -pattern; /* complement & increment */
  305. } else {
  306. pattern = ~pattern;
  307. }
  308. err |= hpi_read_write_test(i, pattern);
  309. if(err) {
  310. debugX(1, "hpi_test: nonincremental tests *** FAILED ***\n");
  311. return -1;
  312. }
  313. }
  314. debugX(1, "hpi_test: nonincremental test OK\n");
  315. /* read write a chunk of data using nonincremental data regs
  316. *
  317. */
  318. debugX(1, "hpi_test: starting nonincremental chunk tests...\n");
  319. pattern = HPI_TEST_PATTERN;
  320. for(i=HPI_TEST_START; i<HPI_TEST_END; i+=4) {
  321. hpi_write_noinc(i, pattern);
  322. /* stolen from cmd_mem.c */
  323. if(pattern & 0x80000000) {
  324. pattern = -pattern; /* complement & increment */
  325. } else {
  326. pattern = ~pattern;
  327. }
  328. }
  329. pattern = HPI_TEST_PATTERN;
  330. for(i=HPI_TEST_START; i<HPI_TEST_END; i+=4) {
  331. tmp = hpi_read_noinc(i);
  332. if(tmp != pattern) {
  333. debugX(1, "hpi_test: noninc chunk test *** FAILED *** @ 0x%x, written=0x%x, read=0x%x\n", i, pattern, tmp);
  334. err = -1;
  335. }
  336. /* stolen from cmd_mem.c */
  337. if(pattern & 0x80000000) {
  338. pattern = -pattern; /* complement & increment */
  339. } else {
  340. pattern = ~pattern;
  341. }
  342. }
  343. if(err)
  344. return -1;
  345. debugX(1, "hpi_test: nonincremental chunk test OK\n");
  346. #ifdef DO_TINY_TEST
  347. /* small verbose test using autoinc and nonautoinc to compare
  348. *
  349. */
  350. debugX(1, "hpi_test: tiny_autoinc_test...\n");
  351. hpi_tiny_autoinc_test();
  352. debugX(1, "hpi_test: tiny_autoinc_test done\n");
  353. #endif /* DO_TINY_TEST */
  354. /* $%& write a chunk of data using the autoincremental regs
  355. *
  356. */
  357. debugX(1, "hpi_test: starting autoinc test %d chunks with 0x%x bytes...\n",
  358. ((HPI_TEST_END - HPI_TEST_START) / HPI_TEST_CHUNKSIZE),
  359. HPI_TEST_CHUNKSIZE);
  360. for(i=HPI_TEST_START;
  361. i < ((HPI_TEST_END - HPI_TEST_START) / HPI_TEST_CHUNKSIZE);
  362. i++) {
  363. /* generate the pattern data */
  364. debugX(3, "generating pattern data: ");
  365. for(ii = 0; ii < HPI_TEST_CHUNKSIZE; ii++) {
  366. debugX(3, "0x%x ", pattern);
  367. test_data[ii] = pattern;
  368. read_data[ii] = 0x0; /* zero to be sure */
  369. /* stolen from cmd_mem.c */
  370. if(pattern & 0x80000000) {
  371. pattern = -pattern; /* complement & increment */
  372. } else {
  373. pattern = ~pattern;
  374. }
  375. }
  376. debugX(3, "done\n");
  377. debugX(2, "Writing autoinc data @ 0x%x\n", i);
  378. hpi_write_inc(i, test_data, HPI_TEST_CHUNKSIZE);
  379. debugX(2, "Reading autoinc data @ 0x%x\n", i);
  380. hpi_read_inc(i, read_data, HPI_TEST_CHUNKSIZE);
  381. /* compare */
  382. for(ii = 0; ii < HPI_TEST_CHUNKSIZE; ii++) {
  383. debugX(3, "hpi_test_autoinc: @ 0x%x, written=0x%x, read=0x%x", i+ii, test_data[ii], read_data[ii]);
  384. if(read_data[ii] != test_data[ii]) {
  385. debugX(0, "hpi_test: autoinc test @ 0x%x, written=0x%x, read=0x%x *** FAILED ***\n", i+ii, test_data[ii], read_data[ii]);
  386. return -1;
  387. }
  388. }
  389. }
  390. debugX(1, "hpi_test: autoinc test OK\n");
  391. return 0;
  392. }
  393. #else /* HPI_TEST_OSZI */
  394. int hpi_test(void)
  395. {
  396. int i;
  397. u32 read_data[TINY_AUTOINC_DATA_SIZE];
  398. unsigned int dummy_data[TINY_AUTOINC_DATA_SIZE] = {
  399. 0x11112222, 0x33334444, 0x55556666, 0x77778888,
  400. 0x9999aaaa, 0xbbbbcccc, 0xddddeeee, 0xffff1111,
  401. 0x00010002, 0x00030004, 0x00050006, 0x00070008,
  402. 0x0009000a, 0x000b000c, 0x000d000e, 0x000f0001
  403. };
  404. debugX(0, "hpi_test: activating hpi...");
  405. hpi_activate();
  406. debugX(0, "OK.\n");
  407. while(1) {
  408. led9(1);
  409. debugX(0, " writing to autoinc...\n");
  410. hpi_write_inc(TINY_AUTOINC_BASE_ADDR,
  411. dummy_data, TINY_AUTOINC_DATA_SIZE);
  412. debugX(0, " reading from autoinc...\n");
  413. hpi_read_inc(TINY_AUTOINC_BASE_ADDR,
  414. read_data, TINY_AUTOINC_DATA_SIZE);
  415. for(i=0; i < (TINY_AUTOINC_DATA_SIZE); i++) {
  416. debugX(0, " written=0x%x, read(inc)=0x%x\n",
  417. dummy_data[i], read_data[i]);
  418. }
  419. led9(0);
  420. udelay(2000000);
  421. }
  422. return 0;
  423. }
  424. #endif
  425. /* test if Host Port Address Register can be written correctly */
  426. static int hpi_write_addr_test(u32 addr)
  427. {
  428. u32 read_back;
  429. /* write address */
  430. HPI_HPIA_1 = ((u16) (addr >> 16)); /* First HW is most significant */
  431. HPI_HPIA_2 = ((u16) addr);
  432. read_back = (((u32) HPI_HPIA_1)<<16) | ((u32) HPI_HPIA_2);
  433. if(read_back == addr) {
  434. debugX(2, " hpi_write_addr_test OK: written=0x%x, read=0x%x\n",
  435. addr, read_back);
  436. return 0;
  437. } else {
  438. debugX(0, " hpi_write_addr_test *** FAILED ***: written=0x%x, read=0x%x\n",
  439. addr, read_back);
  440. return -1;
  441. }
  442. return 0;
  443. }
  444. /* test if a simple read/write sequence succeeds */
  445. static int hpi_read_write_test(u32 addr, u32 data)
  446. {
  447. u32 read_back;
  448. hpi_write_noinc(addr, data);
  449. read_back = hpi_read_noinc(addr);
  450. if(read_back == data) {
  451. debugX(2, " hpi_read_write_test: OK, addr=0x%x written=0x%x, read=0x%x\n", addr, data, read_back);
  452. return 0;
  453. } else {
  454. debugX(0, " hpi_read_write_test: *** FAILED ***, addr=0x%x written=0x%x, read=0x%x\n", addr, data, read_back);
  455. return -1;
  456. }
  457. return 0;
  458. }
  459. static int hpi_tiny_autoinc_test(void)
  460. {
  461. int i;
  462. u32 read_data[TINY_AUTOINC_DATA_SIZE];
  463. u32 read_data_noinc[TINY_AUTOINC_DATA_SIZE];
  464. unsigned int dummy_data[TINY_AUTOINC_DATA_SIZE] = {
  465. 0x11112222, 0x33334444, 0x55556666, 0x77778888,
  466. 0x9999aaaa, 0xbbbbcccc, 0xddddeeee, 0xffff1111,
  467. 0x00010002, 0x00030004, 0x00050006, 0x00070008,
  468. 0x0009000a, 0x000b000c, 0x000d000e, 0x000f0001
  469. };
  470. printf(" writing to autoinc...\n");
  471. hpi_write_inc(TINY_AUTOINC_BASE_ADDR, dummy_data, TINY_AUTOINC_DATA_SIZE);
  472. printf(" reading from autoinc...\n");
  473. hpi_read_inc(TINY_AUTOINC_BASE_ADDR, read_data, TINY_AUTOINC_DATA_SIZE);
  474. printf(" reading from noinc for comparison...\n");
  475. for(i=0; i < (TINY_AUTOINC_DATA_SIZE); i++)
  476. read_data_noinc[i] = hpi_read_noinc(TINY_AUTOINC_BASE_ADDR+i*4);
  477. for(i=0; i < (TINY_AUTOINC_DATA_SIZE); i++) {
  478. printf(" written=0x%x, read(inc)=0x%x, read(noinc)=0x%x\n",
  479. dummy_data[i], read_data[i], read_data_noinc[i]);
  480. }
  481. return 0;
  482. }
  483. #endif /* CONFIG_SPC1920_HPI_TEST */