| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2013-2014 Renesas Electronics Europe Ltd. |
|---|
| 3 | 4 | * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de> |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of version 2 of the GNU General Public License as |
|---|
| 7 | | - * published by the Free Software Foundation. |
|---|
| 8 | 5 | */ |
|---|
| 9 | 6 | |
|---|
| 10 | 7 | #include <linux/bitmap.h> |
|---|
| .. | .. |
|---|
| 147 | 144 | * @async_tx: dmaengine object |
|---|
| 148 | 145 | * @user_wait: waiting for a user ack |
|---|
| 149 | 146 | * @length: total transfer length |
|---|
| 147 | + * @chan: associated DMAC channel |
|---|
| 150 | 148 | * @sg: list of hardware descriptors, represented by struct nbpf_link_desc |
|---|
| 151 | 149 | * @node: member in channel descriptor lists |
|---|
| 152 | 150 | */ |
|---|
| .. | .. |
|---|
| 177 | 175 | /** |
|---|
| 178 | 176 | * struct nbpf_channel - one DMAC channel |
|---|
| 179 | 177 | * @dma_chan: standard dmaengine channel object |
|---|
| 178 | + * @tasklet: channel specific tasklet used for callbacks |
|---|
| 180 | 179 | * @base: register address base |
|---|
| 181 | 180 | * @nbpf: DMAC |
|---|
| 182 | 181 | * @name: IRQ name |
|---|
| 183 | 182 | * @irq: IRQ number |
|---|
| 184 | | - * @slave_addr: address for slave DMA |
|---|
| 185 | | - * @slave_width:slave data size in bytes |
|---|
| 186 | | - * @slave_burst:maximum slave burst size in bytes |
|---|
| 183 | + * @slave_src_addr: source address for slave DMA |
|---|
| 184 | + * @slave_src_width: source slave data size in bytes |
|---|
| 185 | + * @slave_src_burst: maximum source slave burst size in bytes |
|---|
| 186 | + * @slave_dst_addr: destination address for slave DMA |
|---|
| 187 | + * @slave_dst_width: destination slave data size in bytes |
|---|
| 188 | + * @slave_dst_burst: maximum destination slave burst size in bytes |
|---|
| 187 | 189 | * @terminal: DMA terminal, assigned to this channel |
|---|
| 188 | 190 | * @dmarq_cfg: DMA request line configuration - high / low, edge / level for NBPF_CHAN_CFG |
|---|
| 189 | 191 | * @flags: configuration flags from DT |
|---|
| .. | .. |
|---|
| 194 | 196 | * @active: list of descriptors, scheduled for processing |
|---|
| 195 | 197 | * @done: list of completed descriptors, waiting post-processing |
|---|
| 196 | 198 | * @desc_page: list of additionally allocated descriptor pages - if any |
|---|
| 199 | + * @running: linked descriptor of running transaction |
|---|
| 200 | + * @paused: are translations on this channel paused? |
|---|
| 197 | 201 | */ |
|---|
| 198 | 202 | struct nbpf_channel { |
|---|
| 199 | 203 | struct dma_chan dma_chan; |
|---|
| .. | .. |
|---|
| 479 | 483 | |
|---|
| 480 | 484 | default: |
|---|
| 481 | 485 | pr_warn("%s(): invalid bus width %u\n", __func__, width); |
|---|
| 482 | | - /* fall through */ |
|---|
| 486 | + fallthrough; |
|---|
| 483 | 487 | case DMA_SLAVE_BUSWIDTH_1_BYTE: |
|---|
| 484 | 488 | size = burst; |
|---|
| 485 | 489 | } |
|---|
| .. | .. |
|---|
| 1095 | 1099 | if (!dchan) |
|---|
| 1096 | 1100 | return NULL; |
|---|
| 1097 | 1101 | |
|---|
| 1098 | | - dev_dbg(dchan->device->dev, "Entry %s(%s)\n", __func__, |
|---|
| 1099 | | - dma_spec->np->name); |
|---|
| 1102 | + dev_dbg(dchan->device->dev, "Entry %s(%pOFn)\n", __func__, |
|---|
| 1103 | + dma_spec->np); |
|---|
| 1100 | 1104 | |
|---|
| 1101 | 1105 | chan = nbpf_to_chan(dchan); |
|---|
| 1102 | 1106 | |
|---|
| .. | .. |
|---|
| 1109 | 1113 | return dchan; |
|---|
| 1110 | 1114 | } |
|---|
| 1111 | 1115 | |
|---|
| 1112 | | -static void nbpf_chan_tasklet(unsigned long data) |
|---|
| 1116 | +static void nbpf_chan_tasklet(struct tasklet_struct *t) |
|---|
| 1113 | 1117 | { |
|---|
| 1114 | | - struct nbpf_channel *chan = (struct nbpf_channel *)data; |
|---|
| 1118 | + struct nbpf_channel *chan = from_tasklet(chan, t, tasklet); |
|---|
| 1115 | 1119 | struct nbpf_desc *desc, *tmp; |
|---|
| 1116 | 1120 | struct dmaengine_desc_callback cb; |
|---|
| 1117 | 1121 | |
|---|
| .. | .. |
|---|
| 1256 | 1260 | |
|---|
| 1257 | 1261 | snprintf(chan->name, sizeof(chan->name), "nbpf %d", n); |
|---|
| 1258 | 1262 | |
|---|
| 1259 | | - tasklet_init(&chan->tasklet, nbpf_chan_tasklet, (unsigned long)chan); |
|---|
| 1263 | + tasklet_setup(&chan->tasklet, nbpf_chan_tasklet); |
|---|
| 1260 | 1264 | ret = devm_request_irq(dma_dev->dev, chan->irq, |
|---|
| 1261 | 1265 | nbpf_chan_irq, IRQF_SHARED, |
|---|
| 1262 | 1266 | chan->name, chan); |
|---|
| .. | .. |
|---|
| 1494 | 1498 | #ifdef CONFIG_PM |
|---|
| 1495 | 1499 | static int nbpf_runtime_suspend(struct device *dev) |
|---|
| 1496 | 1500 | { |
|---|
| 1497 | | - struct nbpf_device *nbpf = platform_get_drvdata(to_platform_device(dev)); |
|---|
| 1501 | + struct nbpf_device *nbpf = dev_get_drvdata(dev); |
|---|
| 1498 | 1502 | clk_disable_unprepare(nbpf->clk); |
|---|
| 1499 | 1503 | return 0; |
|---|
| 1500 | 1504 | } |
|---|
| 1501 | 1505 | |
|---|
| 1502 | 1506 | static int nbpf_runtime_resume(struct device *dev) |
|---|
| 1503 | 1507 | { |
|---|
| 1504 | | - struct nbpf_device *nbpf = platform_get_drvdata(to_platform_device(dev)); |
|---|
| 1508 | + struct nbpf_device *nbpf = dev_get_drvdata(dev); |
|---|
| 1505 | 1509 | return clk_prepare_enable(nbpf->clk); |
|---|
| 1506 | 1510 | } |
|---|
| 1507 | 1511 | #endif |
|---|