hpi.c 15 KB

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