hpi.c 15 KB

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