hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/arm/common/sa1111.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/arch/arm/common/sa1111.c
34 *
45 * SA1111 support
56 *
67 * 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.
118 *
129 * This file contains all generic SA1111 support.
1310 *
....@@ -25,14 +22,14 @@
2522 #include <linux/platform_device.h>
2623 #include <linux/slab.h>
2724 #include <linux/spinlock.h>
28
-#include <linux/dma-mapping.h>
25
+#include <linux/dma-map-ops.h>
2926 #include <linux/clk.h>
3027 #include <linux/io.h>
3128
3229 #include <mach/hardware.h>
3330 #include <asm/mach/irq.h>
3431 #include <asm/mach-types.h>
35
-#include <asm/sizes.h>
32
+#include <linux/sizes.h>
3633
3734 #include <asm/hardware/sa1111.h>
3835
....@@ -305,10 +302,13 @@
305302 break;
306303 }
307304
308
- if (i == 8)
305
+ if (i == 8) {
309306 pr_err("Danger Will Robinson: failed to re-trigger IRQ%d\n",
310307 d->irq);
311
- return i == 8 ? -1 : 0;
308
+ return 0;
309
+ }
310
+
311
+ return 1;
312312 }
313313
314314 static int sa1111_type_irq(struct irq_data *d, unsigned int flags)
....@@ -1281,65 +1281,6 @@
12811281 return __sa1111_pll_clock(sachip) / (256 * div);
12821282 }
12831283 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);
13431284
13441285 /*
13451286 * Individual device operations.