Lines Matching +full:burst +full:- +full:read

1 // SPDX-License-Identifier: GPL-2.0
11 #include <linux/pci-epf.h>
20 #define DW_XDATA_DRIVER_NAME "dw-xdata-pcie"
75 return dw->rg_region.vaddr; in __dw_regs()
80 u32 burst; in dw_xdata_stop() local
82 mutex_lock(&dw->mutex); in dw_xdata_stop()
84 burst = readl(&(__dw_regs(dw)->burst_cnt)); in dw_xdata_stop()
86 if (burst & BURST_REPEAT) { in dw_xdata_stop()
87 burst &= ~(u32)BURST_REPEAT; in dw_xdata_stop()
88 writel(burst, &(__dw_regs(dw)->burst_cnt)); in dw_xdata_stop()
91 mutex_unlock(&dw->mutex); in dw_xdata_stop()
96 struct device *dev = &dw->pdev->dev; in dw_xdata_start()
102 mutex_lock(&dw->mutex); in dw_xdata_start()
105 writel(0x0, &(__dw_regs(dw)->status)); in dw_xdata_start()
107 /* Burst count register set for continuous until stopped */ in dw_xdata_start()
108 writel(BURST_REPEAT | BURST_VALUE, &(__dw_regs(dw)->burst_cnt)); in dw_xdata_start()
111 writel(PATTERN_VALUE, &(__dw_regs(dw)->pattern)); in dw_xdata_start()
117 control |= CONTROL_LENGTH(dw->max_wr_len); in dw_xdata_start()
119 control |= CONTROL_LENGTH(dw->max_rd_len); in dw_xdata_start()
121 writel(control, &(__dw_regs(dw)->control)); in dw_xdata_start()
129 status = readl(&(__dw_regs(dw)->status)); in dw_xdata_start()
131 mutex_unlock(&dw->mutex); in dw_xdata_start()
135 write ? "write" : "read"); in dw_xdata_start()
141 *data = readl(&(__dw_regs(dw)->wr_cnt_msb)); in dw_xdata_perf_meas()
143 *data |= readl(&(__dw_regs(dw)->wr_cnt_lsb)); in dw_xdata_perf_meas()
145 *data = readl(&(__dw_regs(dw)->rd_cnt_msb)); in dw_xdata_perf_meas()
147 *data |= readl(&(__dw_regs(dw)->rd_cnt_lsb)); in dw_xdata_perf_meas()
153 u64 rate = (*m1 - *m2); in dw_xdata_perf_diff()
164 struct device *dev = &dw->pdev->dev; in dw_xdata_perf()
167 mutex_lock(&dw->mutex); in dw_xdata_perf()
170 writel(0x0, &(__dw_regs(dw)->perf_control)); in dw_xdata_perf()
173 writel((u32)XPERF_CONTROL_ENABLE, &(__dw_regs(dw)->perf_control)); in dw_xdata_perf()
182 writel(0x0, &(__dw_regs(dw)->perf_control)); in dw_xdata_perf()
185 writel((u32)XPERF_CONTROL_ENABLE, &(__dw_regs(dw)->perf_control)); in dw_xdata_perf()
190 * rate = (2nd count frames - 1st count frames) / (time elapsed) in dw_xdata_perf()
192 diff = jiffies_to_nsecs(time[1] - time[0]); in dw_xdata_perf()
195 mutex_unlock(&dw->mutex); in dw_xdata_perf()
198 diff, write ? "write" : "read", *rate); in dw_xdata_perf()
268 dev_dbg(dev, "xData: requested read transfer\n"); in read_store()
278 static DEVICE_ATTR_RW(read);
291 struct device *dev = &pdev->dev; in dw_xdata_pcie_probe()
317 return -ENOMEM; in dw_xdata_pcie_probe()
320 mutex_init(&dw->mutex); in dw_xdata_pcie_probe()
322 dw->rg_region.vaddr = pcim_iomap_table(pdev)[BAR_0]; in dw_xdata_pcie_probe()
323 if (!dw->rg_region.vaddr) in dw_xdata_pcie_probe()
324 return -ENOMEM; in dw_xdata_pcie_probe()
326 dw->rg_region.paddr = pdev->resource[BAR_0].start; in dw_xdata_pcie_probe()
328 dw->max_wr_len = pcie_get_mps(pdev); in dw_xdata_pcie_probe()
329 dw->max_wr_len >>= 2; in dw_xdata_pcie_probe()
331 dw->max_rd_len = pcie_get_readrq(pdev); in dw_xdata_pcie_probe()
332 dw->max_rd_len >>= 2; in dw_xdata_pcie_probe()
334 dw->pdev = pdev; in dw_xdata_pcie_probe()
343 dw->misc_dev.name = kstrdup(name, GFP_KERNEL); in dw_xdata_pcie_probe()
344 if (!dw->misc_dev.name) { in dw_xdata_pcie_probe()
345 err = -ENOMEM; in dw_xdata_pcie_probe()
349 dw->misc_dev.minor = MISC_DYNAMIC_MINOR; in dw_xdata_pcie_probe()
350 dw->misc_dev.parent = dev; in dw_xdata_pcie_probe()
351 dw->misc_dev.groups = xdata_groups; in dw_xdata_pcie_probe()
353 writel(0x0, &(__dw_regs(dw)->RAM_addr)); in dw_xdata_pcie_probe()
354 writel(0x0, &(__dw_regs(dw)->RAM_port)); in dw_xdata_pcie_probe()
356 addr = dw->rg_region.paddr + DW_XDATA_EP_MEM_OFFSET; in dw_xdata_pcie_probe()
357 writel(lower_32_bits(addr), &(__dw_regs(dw)->addr_lsb)); in dw_xdata_pcie_probe()
358 writel(upper_32_bits(addr), &(__dw_regs(dw)->addr_msb)); in dw_xdata_pcie_probe()
362 dw->max_wr_len * 4, dw->max_rd_len * 4); in dw_xdata_pcie_probe()
368 err = misc_register(&dw->misc_dev); in dw_xdata_pcie_probe()
377 kfree(dw->misc_dev.name); in dw_xdata_pcie_probe()
390 if (sscanf(dw->misc_dev.name, DW_XDATA_DRIVER_NAME ".%d", &id) != 1) in dw_xdata_pcie_remove()
397 misc_deregister(&dw->misc_dev); in dw_xdata_pcie_remove()
398 kfree(dw->misc_dev.name); in dw_xdata_pcie_remove()