dsp.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. //
  3. // Copyright(c) 2020 Intel Corporation. All rights reserved.
  4. //
  5. // Author: Cezary Rojewski <[email protected]>
  6. //
  7. #include <linux/devcoredump.h>
  8. #include <linux/dma-mapping.h>
  9. #include <linux/firmware.h>
  10. #include <linux/pci.h>
  11. #include <linux/pxa2xx_ssp.h>
  12. #include "core.h"
  13. #include "messages.h"
  14. #include "registers.h"
  15. static bool catpt_dma_filter(struct dma_chan *chan, void *param)
  16. {
  17. return param == chan->device->dev;
  18. }
  19. /*
  20. * Either engine 0 or 1 can be used for image loading.
  21. * Align with Windows driver equivalent and stick to engine 1.
  22. */
  23. #define CATPT_DMA_DEVID 1
  24. #define CATPT_DMA_DSP_ADDR_MASK GENMASK(31, 20)
  25. struct dma_chan *catpt_dma_request_config_chan(struct catpt_dev *cdev)
  26. {
  27. struct dma_slave_config config;
  28. struct dma_chan *chan;
  29. dma_cap_mask_t mask;
  30. int ret;
  31. dma_cap_zero(mask);
  32. dma_cap_set(DMA_MEMCPY, mask);
  33. chan = dma_request_channel(mask, catpt_dma_filter, cdev->dev);
  34. if (!chan) {
  35. dev_err(cdev->dev, "request channel failed\n");
  36. return ERR_PTR(-ENODEV);
  37. }
  38. memset(&config, 0, sizeof(config));
  39. config.direction = DMA_MEM_TO_DEV;
  40. config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
  41. config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
  42. config.src_maxburst = 16;
  43. config.dst_maxburst = 16;
  44. ret = dmaengine_slave_config(chan, &config);
  45. if (ret) {
  46. dev_err(cdev->dev, "slave config failed: %d\n", ret);
  47. dma_release_channel(chan);
  48. return ERR_PTR(ret);
  49. }
  50. return chan;
  51. }
  52. static int catpt_dma_memcpy(struct catpt_dev *cdev, struct dma_chan *chan,
  53. dma_addr_t dst_addr, dma_addr_t src_addr,
  54. size_t size)
  55. {
  56. struct dma_async_tx_descriptor *desc;
  57. enum dma_status status;
  58. int ret;
  59. desc = dmaengine_prep_dma_memcpy(chan, dst_addr, src_addr, size,
  60. DMA_CTRL_ACK);
  61. if (!desc) {
  62. dev_err(cdev->dev, "prep dma memcpy failed\n");
  63. return -EIO;
  64. }
  65. /* enable demand mode for dma channel */
  66. catpt_updatel_shim(cdev, HMDC,
  67. CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id),
  68. CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id));
  69. ret = dma_submit_error(dmaengine_submit(desc));
  70. if (ret) {
  71. dev_err(cdev->dev, "submit tx failed: %d\n", ret);
  72. goto clear_hdda;
  73. }
  74. status = dma_wait_for_async_tx(desc);
  75. ret = (status == DMA_COMPLETE) ? 0 : -EPROTO;
  76. clear_hdda:
  77. /* regardless of status, disable access to HOST memory in demand mode */
  78. catpt_updatel_shim(cdev, HMDC,
  79. CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id), 0);
  80. return ret;
  81. }
  82. int catpt_dma_memcpy_todsp(struct catpt_dev *cdev, struct dma_chan *chan,
  83. dma_addr_t dst_addr, dma_addr_t src_addr,
  84. size_t size)
  85. {
  86. return catpt_dma_memcpy(cdev, chan, dst_addr | CATPT_DMA_DSP_ADDR_MASK,
  87. src_addr, size);
  88. }
  89. int catpt_dma_memcpy_fromdsp(struct catpt_dev *cdev, struct dma_chan *chan,
  90. dma_addr_t dst_addr, dma_addr_t src_addr,
  91. size_t size)
  92. {
  93. return catpt_dma_memcpy(cdev, chan, dst_addr,
  94. src_addr | CATPT_DMA_DSP_ADDR_MASK, size);
  95. }
  96. int catpt_dmac_probe(struct catpt_dev *cdev)
  97. {
  98. struct dw_dma_chip *dmac;
  99. int ret;
  100. dmac = devm_kzalloc(cdev->dev, sizeof(*dmac), GFP_KERNEL);
  101. if (!dmac)
  102. return -ENOMEM;
  103. dmac->regs = cdev->lpe_ba + cdev->spec->host_dma_offset[CATPT_DMA_DEVID];
  104. dmac->dev = cdev->dev;
  105. dmac->irq = cdev->irq;
  106. ret = dma_coerce_mask_and_coherent(cdev->dev, DMA_BIT_MASK(31));
  107. if (ret)
  108. return ret;
  109. /*
  110. * Caller is responsible for putting device in D0 to allow
  111. * for I/O and memory access before probing DW.
  112. */
  113. ret = dw_dma_probe(dmac);
  114. if (ret)
  115. return ret;
  116. cdev->dmac = dmac;
  117. return 0;
  118. }
  119. void catpt_dmac_remove(struct catpt_dev *cdev)
  120. {
  121. /*
  122. * As do_dma_remove() juggles with pm_runtime_get_xxx() and
  123. * pm_runtime_put_xxx() while both ADSP and DW 'devices' are part of
  124. * the same module, caller makes sure pm_runtime_disable() is invoked
  125. * before removing DW to prevent postmortem resume and suspend.
  126. */
  127. dw_dma_remove(cdev->dmac);
  128. }
  129. static void catpt_dsp_set_srampge(struct catpt_dev *cdev, struct resource *sram,
  130. unsigned long mask, unsigned long new)
  131. {
  132. unsigned long old;
  133. u32 off = sram->start;
  134. u32 b = __ffs(mask);
  135. old = catpt_readl_pci(cdev, VDRTCTL0) & mask;
  136. dev_dbg(cdev->dev, "SRAMPGE [0x%08lx] 0x%08lx -> 0x%08lx",
  137. mask, old, new);
  138. if (old == new)
  139. return;
  140. catpt_updatel_pci(cdev, VDRTCTL0, mask, new);
  141. /* wait for SRAM power gating to propagate */
  142. udelay(60);
  143. /*
  144. * Dummy read as the very first access after block enable
  145. * to prevent byte loss in future operations.
  146. */
  147. for_each_clear_bit_from(b, &new, fls_long(mask)) {
  148. u8 buf[4];
  149. /* newly enabled: new bit=0 while old bit=1 */
  150. if (test_bit(b, &old)) {
  151. dev_dbg(cdev->dev, "sanitize block %ld: off 0x%08x\n",
  152. b - __ffs(mask), off);
  153. memcpy_fromio(buf, cdev->lpe_ba + off, sizeof(buf));
  154. }
  155. off += CATPT_MEMBLOCK_SIZE;
  156. }
  157. }
  158. void catpt_dsp_update_srampge(struct catpt_dev *cdev, struct resource *sram,
  159. unsigned long mask)
  160. {
  161. struct resource *res;
  162. unsigned long new = 0;
  163. /* flag all busy blocks */
  164. for (res = sram->child; res; res = res->sibling) {
  165. u32 h, l;
  166. h = (res->end - sram->start) / CATPT_MEMBLOCK_SIZE;
  167. l = (res->start - sram->start) / CATPT_MEMBLOCK_SIZE;
  168. new |= GENMASK(h, l);
  169. }
  170. /* offset value given mask's start and invert it as ON=b0 */
  171. new = ~(new << __ffs(mask)) & mask;
  172. /* disable core clock gating */
  173. catpt_updatel_pci(cdev, VDRTCTL2, CATPT_VDRTCTL2_DCLCGE, 0);
  174. catpt_dsp_set_srampge(cdev, sram, mask, new);
  175. /* enable core clock gating */
  176. catpt_updatel_pci(cdev, VDRTCTL2, CATPT_VDRTCTL2_DCLCGE,
  177. CATPT_VDRTCTL2_DCLCGE);
  178. }
  179. int catpt_dsp_stall(struct catpt_dev *cdev, bool stall)
  180. {
  181. u32 reg, val;
  182. val = stall ? CATPT_CS_STALL : 0;
  183. catpt_updatel_shim(cdev, CS1, CATPT_CS_STALL, val);
  184. return catpt_readl_poll_shim(cdev, CS1,
  185. reg, (reg & CATPT_CS_STALL) == val,
  186. 500, 10000);
  187. }
  188. static int catpt_dsp_reset(struct catpt_dev *cdev, bool reset)
  189. {
  190. u32 reg, val;
  191. val = reset ? CATPT_CS_RST : 0;
  192. catpt_updatel_shim(cdev, CS1, CATPT_CS_RST, val);
  193. return catpt_readl_poll_shim(cdev, CS1,
  194. reg, (reg & CATPT_CS_RST) == val,
  195. 500, 10000);
  196. }
  197. void lpt_dsp_pll_shutdown(struct catpt_dev *cdev, bool enable)
  198. {
  199. u32 val;
  200. val = enable ? LPT_VDRTCTL0_APLLSE : 0;
  201. catpt_updatel_pci(cdev, VDRTCTL0, LPT_VDRTCTL0_APLLSE, val);
  202. }
  203. void wpt_dsp_pll_shutdown(struct catpt_dev *cdev, bool enable)
  204. {
  205. u32 val;
  206. val = enable ? WPT_VDRTCTL2_APLLSE : 0;
  207. catpt_updatel_pci(cdev, VDRTCTL2, WPT_VDRTCTL2_APLLSE, val);
  208. }
  209. static int catpt_dsp_select_lpclock(struct catpt_dev *cdev, bool lp, bool waiti)
  210. {
  211. u32 mask, reg, val;
  212. int ret;
  213. mutex_lock(&cdev->clk_mutex);
  214. val = lp ? CATPT_CS_LPCS : 0;
  215. reg = catpt_readl_shim(cdev, CS1) & CATPT_CS_LPCS;
  216. dev_dbg(cdev->dev, "LPCS [0x%08lx] 0x%08x -> 0x%08x",
  217. CATPT_CS_LPCS, reg, val);
  218. if (reg == val) {
  219. mutex_unlock(&cdev->clk_mutex);
  220. return 0;
  221. }
  222. if (waiti) {
  223. /* wait for DSP to signal WAIT state */
  224. ret = catpt_readl_poll_shim(cdev, ISD,
  225. reg, (reg & CATPT_ISD_DCPWM),
  226. 500, 10000);
  227. if (ret) {
  228. dev_warn(cdev->dev, "await WAITI timeout\n");
  229. /* no signal - only high clock selection allowed */
  230. if (lp) {
  231. mutex_unlock(&cdev->clk_mutex);
  232. return 0;
  233. }
  234. }
  235. }
  236. ret = catpt_readl_poll_shim(cdev, CLKCTL,
  237. reg, !(reg & CATPT_CLKCTL_CFCIP),
  238. 500, 10000);
  239. if (ret)
  240. dev_warn(cdev->dev, "clock change still in progress\n");
  241. /* default to DSP core & audio fabric high clock */
  242. val |= CATPT_CS_DCS_HIGH;
  243. mask = CATPT_CS_LPCS | CATPT_CS_DCS;
  244. catpt_updatel_shim(cdev, CS1, mask, val);
  245. ret = catpt_readl_poll_shim(cdev, CLKCTL,
  246. reg, !(reg & CATPT_CLKCTL_CFCIP),
  247. 500, 10000);
  248. if (ret)
  249. dev_warn(cdev->dev, "clock change still in progress\n");
  250. /* update PLL accordingly */
  251. cdev->spec->pll_shutdown(cdev, lp);
  252. mutex_unlock(&cdev->clk_mutex);
  253. return 0;
  254. }
  255. int catpt_dsp_update_lpclock(struct catpt_dev *cdev)
  256. {
  257. struct catpt_stream_runtime *stream;
  258. list_for_each_entry(stream, &cdev->stream_list, node)
  259. if (stream->prepared)
  260. return catpt_dsp_select_lpclock(cdev, false, true);
  261. return catpt_dsp_select_lpclock(cdev, true, true);
  262. }
  263. /* bring registers to their defaults as HW won't reset itself */
  264. static void catpt_dsp_set_regs_defaults(struct catpt_dev *cdev)
  265. {
  266. int i;
  267. catpt_writel_shim(cdev, CS1, CATPT_CS_DEFAULT);
  268. catpt_writel_shim(cdev, ISC, CATPT_ISC_DEFAULT);
  269. catpt_writel_shim(cdev, ISD, CATPT_ISD_DEFAULT);
  270. catpt_writel_shim(cdev, IMC, CATPT_IMC_DEFAULT);
  271. catpt_writel_shim(cdev, IMD, CATPT_IMD_DEFAULT);
  272. catpt_writel_shim(cdev, IPCC, CATPT_IPCC_DEFAULT);
  273. catpt_writel_shim(cdev, IPCD, CATPT_IPCD_DEFAULT);
  274. catpt_writel_shim(cdev, CLKCTL, CATPT_CLKCTL_DEFAULT);
  275. catpt_writel_shim(cdev, CS2, CATPT_CS2_DEFAULT);
  276. catpt_writel_shim(cdev, LTRC, CATPT_LTRC_DEFAULT);
  277. catpt_writel_shim(cdev, HMDC, CATPT_HMDC_DEFAULT);
  278. for (i = 0; i < CATPT_SSP_COUNT; i++) {
  279. catpt_writel_ssp(cdev, i, SSCR0, CATPT_SSC0_DEFAULT);
  280. catpt_writel_ssp(cdev, i, SSCR1, CATPT_SSC1_DEFAULT);
  281. catpt_writel_ssp(cdev, i, SSSR, CATPT_SSS_DEFAULT);
  282. catpt_writel_ssp(cdev, i, SSITR, CATPT_SSIT_DEFAULT);
  283. catpt_writel_ssp(cdev, i, SSDR, CATPT_SSD_DEFAULT);
  284. catpt_writel_ssp(cdev, i, SSTO, CATPT_SSTO_DEFAULT);
  285. catpt_writel_ssp(cdev, i, SSPSP, CATPT_SSPSP_DEFAULT);
  286. catpt_writel_ssp(cdev, i, SSTSA, CATPT_SSTSA_DEFAULT);
  287. catpt_writel_ssp(cdev, i, SSRSA, CATPT_SSRSA_DEFAULT);
  288. catpt_writel_ssp(cdev, i, SSTSS, CATPT_SSTSS_DEFAULT);
  289. catpt_writel_ssp(cdev, i, SSCR2, CATPT_SSCR2_DEFAULT);
  290. catpt_writel_ssp(cdev, i, SSPSP2, CATPT_SSPSP2_DEFAULT);
  291. }
  292. }
  293. int catpt_dsp_power_down(struct catpt_dev *cdev)
  294. {
  295. u32 mask, val;
  296. /* disable core clock gating */
  297. catpt_updatel_pci(cdev, VDRTCTL2, CATPT_VDRTCTL2_DCLCGE, 0);
  298. catpt_dsp_reset(cdev, true);
  299. /* set 24Mhz clock for both SSPs */
  300. catpt_updatel_shim(cdev, CS1, CATPT_CS_SBCS(0) | CATPT_CS_SBCS(1),
  301. CATPT_CS_SBCS(0) | CATPT_CS_SBCS(1));
  302. catpt_dsp_select_lpclock(cdev, true, false);
  303. /* disable MCLK */
  304. catpt_updatel_shim(cdev, CLKCTL, CATPT_CLKCTL_SMOS, 0);
  305. catpt_dsp_set_regs_defaults(cdev);
  306. /* switch clock gating */
  307. mask = CATPT_VDRTCTL2_CGEALL & (~CATPT_VDRTCTL2_DCLCGE);
  308. val = mask & (~CATPT_VDRTCTL2_DTCGE);
  309. catpt_updatel_pci(cdev, VDRTCTL2, mask, val);
  310. /* enable DTCGE separatelly */
  311. catpt_updatel_pci(cdev, VDRTCTL2, CATPT_VDRTCTL2_DTCGE,
  312. CATPT_VDRTCTL2_DTCGE);
  313. /* SRAM power gating all */
  314. catpt_dsp_set_srampge(cdev, &cdev->dram, cdev->spec->dram_mask,
  315. cdev->spec->dram_mask);
  316. catpt_dsp_set_srampge(cdev, &cdev->iram, cdev->spec->iram_mask,
  317. cdev->spec->iram_mask);
  318. mask = cdev->spec->d3srampgd_bit | cdev->spec->d3pgd_bit;
  319. catpt_updatel_pci(cdev, VDRTCTL0, mask, cdev->spec->d3pgd_bit);
  320. catpt_updatel_pci(cdev, PMCS, PCI_PM_CTRL_STATE_MASK, PCI_D3hot);
  321. /* give hw time to drop off */
  322. udelay(50);
  323. /* enable core clock gating */
  324. catpt_updatel_pci(cdev, VDRTCTL2, CATPT_VDRTCTL2_DCLCGE,
  325. CATPT_VDRTCTL2_DCLCGE);
  326. udelay(50);
  327. return 0;
  328. }
  329. int catpt_dsp_power_up(struct catpt_dev *cdev)
  330. {
  331. u32 mask, val;
  332. /* disable core clock gating */
  333. catpt_updatel_pci(cdev, VDRTCTL2, CATPT_VDRTCTL2_DCLCGE, 0);
  334. /* switch clock gating */
  335. mask = CATPT_VDRTCTL2_CGEALL & (~CATPT_VDRTCTL2_DCLCGE);
  336. val = mask & (~CATPT_VDRTCTL2_DTCGE);
  337. catpt_updatel_pci(cdev, VDRTCTL2, mask, val);
  338. catpt_updatel_pci(cdev, PMCS, PCI_PM_CTRL_STATE_MASK, PCI_D0);
  339. /* SRAM power gating none */
  340. mask = cdev->spec->d3srampgd_bit | cdev->spec->d3pgd_bit;
  341. catpt_updatel_pci(cdev, VDRTCTL0, mask, mask);
  342. catpt_dsp_set_srampge(cdev, &cdev->dram, cdev->spec->dram_mask, 0);
  343. catpt_dsp_set_srampge(cdev, &cdev->iram, cdev->spec->iram_mask, 0);
  344. catpt_dsp_set_regs_defaults(cdev);
  345. /* restore MCLK */
  346. catpt_updatel_shim(cdev, CLKCTL, CATPT_CLKCTL_SMOS, CATPT_CLKCTL_SMOS);
  347. catpt_dsp_select_lpclock(cdev, false, false);
  348. /* set 24Mhz clock for both SSPs */
  349. catpt_updatel_shim(cdev, CS1, CATPT_CS_SBCS(0) | CATPT_CS_SBCS(1),
  350. CATPT_CS_SBCS(0) | CATPT_CS_SBCS(1));
  351. catpt_dsp_reset(cdev, false);
  352. /* enable core clock gating */
  353. catpt_updatel_pci(cdev, VDRTCTL2, CATPT_VDRTCTL2_DCLCGE,
  354. CATPT_VDRTCTL2_DCLCGE);
  355. /* generate int deassert msg to fix inversed int logic */
  356. catpt_updatel_shim(cdev, IMC, CATPT_IMC_IPCDB | CATPT_IMC_IPCCD, 0);
  357. return 0;
  358. }
  359. #define CATPT_DUMP_MAGIC 0xcd42
  360. #define CATPT_DUMP_SECTION_ID_FILE 0x00
  361. #define CATPT_DUMP_SECTION_ID_IRAM 0x01
  362. #define CATPT_DUMP_SECTION_ID_DRAM 0x02
  363. #define CATPT_DUMP_SECTION_ID_REGS 0x03
  364. #define CATPT_DUMP_HASH_SIZE 20
  365. struct catpt_dump_section_hdr {
  366. u16 magic;
  367. u8 core_id;
  368. u8 section_id;
  369. u32 size;
  370. };
  371. int catpt_coredump(struct catpt_dev *cdev)
  372. {
  373. struct catpt_dump_section_hdr *hdr;
  374. size_t dump_size, regs_size;
  375. u8 *dump, *pos;
  376. const char *eof;
  377. char *info;
  378. int i;
  379. regs_size = CATPT_SHIM_REGS_SIZE;
  380. regs_size += CATPT_DMA_COUNT * CATPT_DMA_REGS_SIZE;
  381. regs_size += CATPT_SSP_COUNT * CATPT_SSP_REGS_SIZE;
  382. dump_size = resource_size(&cdev->dram);
  383. dump_size += resource_size(&cdev->iram);
  384. dump_size += regs_size;
  385. /* account for header of each section and hash chunk */
  386. dump_size += 4 * sizeof(*hdr) + CATPT_DUMP_HASH_SIZE;
  387. dump = vzalloc(dump_size);
  388. if (!dump)
  389. return -ENOMEM;
  390. pos = dump;
  391. hdr = (struct catpt_dump_section_hdr *)pos;
  392. hdr->magic = CATPT_DUMP_MAGIC;
  393. hdr->core_id = cdev->spec->core_id;
  394. hdr->section_id = CATPT_DUMP_SECTION_ID_FILE;
  395. hdr->size = dump_size - sizeof(*hdr);
  396. pos += sizeof(*hdr);
  397. info = cdev->ipc.config.fw_info;
  398. eof = info + FW_INFO_SIZE_MAX;
  399. /* navigate to fifth info segment (fw hash) */
  400. for (i = 0; i < 4 && info < eof; i++, info++) {
  401. /* info segments are separated by space each */
  402. info = strnchr(info, eof - info, ' ');
  403. if (!info)
  404. break;
  405. }
  406. if (i == 4 && info)
  407. memcpy(pos, info, min_t(u32, eof - info, CATPT_DUMP_HASH_SIZE));
  408. pos += CATPT_DUMP_HASH_SIZE;
  409. hdr = (struct catpt_dump_section_hdr *)pos;
  410. hdr->magic = CATPT_DUMP_MAGIC;
  411. hdr->core_id = cdev->spec->core_id;
  412. hdr->section_id = CATPT_DUMP_SECTION_ID_IRAM;
  413. hdr->size = resource_size(&cdev->iram);
  414. pos += sizeof(*hdr);
  415. memcpy_fromio(pos, cdev->lpe_ba + cdev->iram.start, hdr->size);
  416. pos += hdr->size;
  417. hdr = (struct catpt_dump_section_hdr *)pos;
  418. hdr->magic = CATPT_DUMP_MAGIC;
  419. hdr->core_id = cdev->spec->core_id;
  420. hdr->section_id = CATPT_DUMP_SECTION_ID_DRAM;
  421. hdr->size = resource_size(&cdev->dram);
  422. pos += sizeof(*hdr);
  423. memcpy_fromio(pos, cdev->lpe_ba + cdev->dram.start, hdr->size);
  424. pos += hdr->size;
  425. hdr = (struct catpt_dump_section_hdr *)pos;
  426. hdr->magic = CATPT_DUMP_MAGIC;
  427. hdr->core_id = cdev->spec->core_id;
  428. hdr->section_id = CATPT_DUMP_SECTION_ID_REGS;
  429. hdr->size = regs_size;
  430. pos += sizeof(*hdr);
  431. memcpy_fromio(pos, catpt_shim_addr(cdev), CATPT_SHIM_REGS_SIZE);
  432. pos += CATPT_SHIM_REGS_SIZE;
  433. for (i = 0; i < CATPT_SSP_COUNT; i++) {
  434. memcpy_fromio(pos, catpt_ssp_addr(cdev, i),
  435. CATPT_SSP_REGS_SIZE);
  436. pos += CATPT_SSP_REGS_SIZE;
  437. }
  438. for (i = 0; i < CATPT_DMA_COUNT; i++) {
  439. memcpy_fromio(pos, catpt_dma_addr(cdev, i),
  440. CATPT_DMA_REGS_SIZE);
  441. pos += CATPT_DMA_REGS_SIZE;
  442. }
  443. dev_coredumpv(cdev->dev, dump, dump_size, GFP_KERNEL);
  444. return 0;
  445. }