.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * linux/arch/arm/common/sa1111.c |
---|
3 | 4 | * |
---|
4 | 5 | * SA1111 support |
---|
5 | 6 | * |
---|
6 | 7 | * Original code by John Dorsey |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License version 2 as |
---|
10 | | - * published by the Free Software Foundation. |
---|
11 | 8 | * |
---|
12 | 9 | * This file contains all generic SA1111 support. |
---|
13 | 10 | * |
---|
.. | .. |
---|
25 | 22 | #include <linux/platform_device.h> |
---|
26 | 23 | #include <linux/slab.h> |
---|
27 | 24 | #include <linux/spinlock.h> |
---|
28 | | -#include <linux/dma-mapping.h> |
---|
| 25 | +#include <linux/dma-map-ops.h> |
---|
29 | 26 | #include <linux/clk.h> |
---|
30 | 27 | #include <linux/io.h> |
---|
31 | 28 | |
---|
32 | 29 | #include <mach/hardware.h> |
---|
33 | 30 | #include <asm/mach/irq.h> |
---|
34 | 31 | #include <asm/mach-types.h> |
---|
35 | | -#include <asm/sizes.h> |
---|
| 32 | +#include <linux/sizes.h> |
---|
36 | 33 | |
---|
37 | 34 | #include <asm/hardware/sa1111.h> |
---|
38 | 35 | |
---|
.. | .. |
---|
305 | 302 | break; |
---|
306 | 303 | } |
---|
307 | 304 | |
---|
308 | | - if (i == 8) |
---|
| 305 | + if (i == 8) { |
---|
309 | 306 | pr_err("Danger Will Robinson: failed to re-trigger IRQ%d\n", |
---|
310 | 307 | d->irq); |
---|
311 | | - return i == 8 ? -1 : 0; |
---|
| 308 | + return 0; |
---|
| 309 | + } |
---|
| 310 | + |
---|
| 311 | + return 1; |
---|
312 | 312 | } |
---|
313 | 313 | |
---|
314 | 314 | static int sa1111_type_irq(struct irq_data *d, unsigned int flags) |
---|
.. | .. |
---|
1281 | 1281 | return __sa1111_pll_clock(sachip) / (256 * div); |
---|
1282 | 1282 | } |
---|
1283 | 1283 | EXPORT_SYMBOL(sa1111_get_audio_rate); |
---|
1284 | | - |
---|
1285 | | -void sa1111_set_io_dir(struct sa1111_dev *sadev, |
---|
1286 | | - unsigned int bits, unsigned int dir, |
---|
1287 | | - unsigned int sleep_dir) |
---|
1288 | | -{ |
---|
1289 | | - struct sa1111 *sachip = sa1111_chip_driver(sadev); |
---|
1290 | | - unsigned long flags; |
---|
1291 | | - unsigned int val; |
---|
1292 | | - void __iomem *gpio = sachip->base + SA1111_GPIO; |
---|
1293 | | - |
---|
1294 | | -#define MODIFY_BITS(port, mask, dir) \ |
---|
1295 | | - if (mask) { \ |
---|
1296 | | - val = readl_relaxed(port); \ |
---|
1297 | | - val &= ~(mask); \ |
---|
1298 | | - val |= (dir) & (mask); \ |
---|
1299 | | - writel_relaxed(val, port); \ |
---|
1300 | | - } |
---|
1301 | | - |
---|
1302 | | - spin_lock_irqsave(&sachip->lock, flags); |
---|
1303 | | - MODIFY_BITS(gpio + SA1111_GPIO_PADDR, bits & 15, dir); |
---|
1304 | | - MODIFY_BITS(gpio + SA1111_GPIO_PBDDR, (bits >> 8) & 255, dir >> 8); |
---|
1305 | | - MODIFY_BITS(gpio + SA1111_GPIO_PCDDR, (bits >> 16) & 255, dir >> 16); |
---|
1306 | | - |
---|
1307 | | - MODIFY_BITS(gpio + SA1111_GPIO_PASDR, bits & 15, sleep_dir); |
---|
1308 | | - MODIFY_BITS(gpio + SA1111_GPIO_PBSDR, (bits >> 8) & 255, sleep_dir >> 8); |
---|
1309 | | - MODIFY_BITS(gpio + SA1111_GPIO_PCSDR, (bits >> 16) & 255, sleep_dir >> 16); |
---|
1310 | | - spin_unlock_irqrestore(&sachip->lock, flags); |
---|
1311 | | -} |
---|
1312 | | -EXPORT_SYMBOL(sa1111_set_io_dir); |
---|
1313 | | - |
---|
1314 | | -void sa1111_set_io(struct sa1111_dev *sadev, unsigned int bits, unsigned int v) |
---|
1315 | | -{ |
---|
1316 | | - struct sa1111 *sachip = sa1111_chip_driver(sadev); |
---|
1317 | | - unsigned long flags; |
---|
1318 | | - unsigned int val; |
---|
1319 | | - void __iomem *gpio = sachip->base + SA1111_GPIO; |
---|
1320 | | - |
---|
1321 | | - spin_lock_irqsave(&sachip->lock, flags); |
---|
1322 | | - MODIFY_BITS(gpio + SA1111_GPIO_PADWR, bits & 15, v); |
---|
1323 | | - MODIFY_BITS(gpio + SA1111_GPIO_PBDWR, (bits >> 8) & 255, v >> 8); |
---|
1324 | | - MODIFY_BITS(gpio + SA1111_GPIO_PCDWR, (bits >> 16) & 255, v >> 16); |
---|
1325 | | - spin_unlock_irqrestore(&sachip->lock, flags); |
---|
1326 | | -} |
---|
1327 | | -EXPORT_SYMBOL(sa1111_set_io); |
---|
1328 | | - |
---|
1329 | | -void sa1111_set_sleep_io(struct sa1111_dev *sadev, unsigned int bits, unsigned int v) |
---|
1330 | | -{ |
---|
1331 | | - struct sa1111 *sachip = sa1111_chip_driver(sadev); |
---|
1332 | | - unsigned long flags; |
---|
1333 | | - unsigned int val; |
---|
1334 | | - void __iomem *gpio = sachip->base + SA1111_GPIO; |
---|
1335 | | - |
---|
1336 | | - spin_lock_irqsave(&sachip->lock, flags); |
---|
1337 | | - MODIFY_BITS(gpio + SA1111_GPIO_PASSR, bits & 15, v); |
---|
1338 | | - MODIFY_BITS(gpio + SA1111_GPIO_PBSSR, (bits >> 8) & 255, v >> 8); |
---|
1339 | | - MODIFY_BITS(gpio + SA1111_GPIO_PCSSR, (bits >> 16) & 255, v >> 16); |
---|
1340 | | - spin_unlock_irqrestore(&sachip->lock, flags); |
---|
1341 | | -} |
---|
1342 | | -EXPORT_SYMBOL(sa1111_set_sleep_io); |
---|
1343 | 1284 | |
---|
1344 | 1285 | /* |
---|
1345 | 1286 | * Individual device operations. |
---|