| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* OMAP SSI port driver. |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. |
|---|
| 4 | 5 | * Copyright (C) 2014 Sebastian Reichel <sre@kernel.org> |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Contact: Carlos Chinea <carlos.chinea@nokia.com> |
|---|
| 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 |
|---|
| 10 | | - * version 2 as published by the Free Software Foundation. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 13 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 15 | | - * General Public License for more details. |
|---|
| 16 | | - * |
|---|
| 17 | | - * You should have received a copy of the GNU General Public License |
|---|
| 18 | | - * along with this program; if not, write to the Free Software |
|---|
| 19 | | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
|---|
| 20 | | - * 02110-1301 USA |
|---|
| 21 | 8 | */ |
|---|
| 22 | 9 | |
|---|
| 23 | 10 | #include <linux/mod_devicetable.h> |
|---|
| .. | .. |
|---|
| 57 | 44 | debugfs_remove_recursive(omap_port->dir); |
|---|
| 58 | 45 | } |
|---|
| 59 | 46 | |
|---|
| 60 | | -static int ssi_debug_port_show(struct seq_file *m, void *p __maybe_unused) |
|---|
| 47 | +static int ssi_port_regs_show(struct seq_file *m, void *p __maybe_unused) |
|---|
| 61 | 48 | { |
|---|
| 62 | 49 | struct hsi_port *port = m->private; |
|---|
| 63 | 50 | struct omap_ssi_port *omap_port = hsi_port_drvdata(port); |
|---|
| .. | .. |
|---|
| 132 | 119 | return 0; |
|---|
| 133 | 120 | } |
|---|
| 134 | 121 | |
|---|
| 135 | | -static int ssi_port_regs_open(struct inode *inode, struct file *file) |
|---|
| 136 | | -{ |
|---|
| 137 | | - return single_open(file, ssi_debug_port_show, inode->i_private); |
|---|
| 138 | | -} |
|---|
| 139 | | - |
|---|
| 140 | | -static const struct file_operations ssi_port_regs_fops = { |
|---|
| 141 | | - .open = ssi_port_regs_open, |
|---|
| 142 | | - .read = seq_read, |
|---|
| 143 | | - .llseek = seq_lseek, |
|---|
| 144 | | - .release = single_release, |
|---|
| 145 | | -}; |
|---|
| 122 | +DEFINE_SHOW_ATTRIBUTE(ssi_port_regs); |
|---|
| 146 | 123 | |
|---|
| 147 | 124 | static int ssi_div_get(void *data, u64 *val) |
|---|
| 148 | 125 | { |
|---|
| .. | .. |
|---|
| 172 | 149 | return 0; |
|---|
| 173 | 150 | } |
|---|
| 174 | 151 | |
|---|
| 175 | | -DEFINE_SIMPLE_ATTRIBUTE(ssi_sst_div_fops, ssi_div_get, ssi_div_set, "%llu\n"); |
|---|
| 152 | +DEFINE_DEBUGFS_ATTRIBUTE(ssi_sst_div_fops, ssi_div_get, ssi_div_set, "%llu\n"); |
|---|
| 176 | 153 | |
|---|
| 177 | 154 | static int ssi_debug_add_port(struct omap_ssi_port *omap_port, |
|---|
| 178 | 155 | struct dentry *dir) |
|---|
| .. | .. |
|---|
| 187 | 164 | dir = debugfs_create_dir("sst", dir); |
|---|
| 188 | 165 | if (!dir) |
|---|
| 189 | 166 | return -ENOMEM; |
|---|
| 190 | | - debugfs_create_file("divisor", S_IRUGO | S_IWUSR, dir, port, |
|---|
| 191 | | - &ssi_sst_div_fops); |
|---|
| 167 | + debugfs_create_file_unsafe("divisor", 0644, dir, port, |
|---|
| 168 | + &ssi_sst_div_fops); |
|---|
| 192 | 169 | |
|---|
| 193 | 170 | return 0; |
|---|
| 194 | 171 | } |
|---|
| .. | .. |
|---|
| 253 | 230 | if (msg->ttype == HSI_MSG_READ) { |
|---|
| 254 | 231 | err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, |
|---|
| 255 | 232 | DMA_FROM_DEVICE); |
|---|
| 256 | | - if (err < 0) { |
|---|
| 233 | + if (!err) { |
|---|
| 257 | 234 | dev_dbg(&ssi->device, "DMA map SG failed !\n"); |
|---|
| 258 | 235 | pm_runtime_put_autosuspend(omap_port->pdev); |
|---|
| 259 | | - return err; |
|---|
| 236 | + return -EIO; |
|---|
| 260 | 237 | } |
|---|
| 261 | 238 | csdp = SSI_DST_BURST_4x32_BIT | SSI_DST_MEMORY_PORT | |
|---|
| 262 | 239 | SSI_SRC_SINGLE_ACCESS0 | SSI_SRC_PERIPHERAL_PORT | |
|---|
| .. | .. |
|---|
| 270 | 247 | } else { |
|---|
| 271 | 248 | err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, |
|---|
| 272 | 249 | DMA_TO_DEVICE); |
|---|
| 273 | | - if (err < 0) { |
|---|
| 250 | + if (!err) { |
|---|
| 274 | 251 | dev_dbg(&ssi->device, "DMA map SG failed !\n"); |
|---|
| 275 | 252 | pm_runtime_put_autosuspend(omap_port->pdev); |
|---|
| 276 | | - return err; |
|---|
| 253 | + return -EIO; |
|---|
| 277 | 254 | } |
|---|
| 278 | 255 | csdp = SSI_SRC_BURST_4x32_BIT | SSI_SRC_MEMORY_PORT | |
|---|
| 279 | 256 | SSI_DST_SINGLE_ACCESS0 | SSI_DST_PERIPHERAL_PORT | |
|---|
| .. | .. |
|---|
| 1061 | 1038 | int err; |
|---|
| 1062 | 1039 | |
|---|
| 1063 | 1040 | err = platform_get_irq(pd, 0); |
|---|
| 1064 | | - if (err < 0) { |
|---|
| 1065 | | - dev_err(&port->device, "Port IRQ resource missing\n"); |
|---|
| 1041 | + if (err < 0) |
|---|
| 1066 | 1042 | return err; |
|---|
| 1067 | | - } |
|---|
| 1068 | 1043 | omap_port->irq = err; |
|---|
| 1069 | 1044 | err = devm_request_threaded_irq(&port->device, omap_port->irq, NULL, |
|---|
| 1070 | 1045 | ssi_pio_thread, IRQF_ONESHOT, "SSI PORT", port); |
|---|