hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/mfd/intel-lpss.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Intel Sunrisepoint LPSS core support.
34 *
....@@ -7,10 +8,6 @@
78 * Mika Westerberg <mika.westerberg@linux.intel.com>
89 * Heikki Krogerus <heikki.krogerus@linux.intel.com>
910 * Jarkko Nikula <jarkko.nikula@linux.intel.com>
10
- *
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License version 2 as
13
- * published by the Free Software Foundation.
1411 */
1512
1613 #include <linux/clk.h>
....@@ -18,6 +15,7 @@
1815 #include <linux/clk-provider.h>
1916 #include <linux/debugfs.h>
2017 #include <linux/idr.h>
18
+#include <linux/io.h>
2119 #include <linux/ioport.h>
2220 #include <linux/kernel.h>
2321 #include <linux/module.h>
....@@ -27,6 +25,8 @@
2725 #include <linux/property.h>
2826 #include <linux/seq_file.h>
2927 #include <linux/io-64-nonatomic-lo-hi.h>
28
+
29
+#include <linux/dma/idma64.h>
3030
3131 #include "intel-lpss.h"
3232
....@@ -47,10 +47,10 @@
4747 #define LPSS_PRIV_IDLELTR 0x14
4848
4949 #define LPSS_PRIV_LTR_REQ BIT(15)
50
-#define LPSS_PRIV_LTR_SCALE_MASK 0xc00
51
-#define LPSS_PRIV_LTR_SCALE_1US 0x800
52
-#define LPSS_PRIV_LTR_SCALE_32US 0xc00
53
-#define LPSS_PRIV_LTR_VALUE_MASK 0x3ff
50
+#define LPSS_PRIV_LTR_SCALE_MASK GENMASK(11, 10)
51
+#define LPSS_PRIV_LTR_SCALE_1US (2 << 10)
52
+#define LPSS_PRIV_LTR_SCALE_32US (3 << 10)
53
+#define LPSS_PRIV_LTR_VALUE_MASK GENMASK(9, 0)
5454
5555 #define LPSS_PRIV_SSP_REG 0x20
5656 #define LPSS_PRIV_SSP_REG_DIS_DMA_FIN BIT(0)
....@@ -59,8 +59,8 @@
5959
6060 #define LPSS_PRIV_CAPS 0xfc
6161 #define LPSS_PRIV_CAPS_NO_IDMA BIT(8)
62
+#define LPSS_PRIV_CAPS_TYPE_MASK GENMASK(7, 4)
6263 #define LPSS_PRIV_CAPS_TYPE_SHIFT 4
63
-#define LPSS_PRIV_CAPS_TYPE_MASK (0xf << LPSS_PRIV_CAPS_TYPE_SHIFT)
6464
6565 /* This matches the type field in CAPS register */
6666 enum intel_lpss_dev_type {
....@@ -96,8 +96,6 @@
9696 DEFINE_RES_IRQ(0),
9797 };
9898
99
-#define LPSS_IDMA64_DRIVER_NAME "idma64"
100
-
10199 /*
102100 * Cells needs to be ordered so that the iDMA is created first. This is
103101 * because we need to be sure the DMA is available when the host controller
....@@ -129,17 +127,6 @@
129127
130128 static DEFINE_IDA(intel_lpss_devid_ida);
131129 static struct dentry *intel_lpss_debugfs;
132
-
133
-static int intel_lpss_request_dma_module(const char *name)
134
-{
135
- static bool intel_lpss_dma_requested;
136
-
137
- if (intel_lpss_dma_requested)
138
- return 0;
139
-
140
- intel_lpss_dma_requested = true;
141
- return request_module("%s", name);
142
-}
143130
144131 static void intel_lpss_cache_ltr(struct intel_lpss *lpss)
145132 {
....@@ -431,16 +418,6 @@
431418 dev_warn(dev, "Failed to create debugfs entries\n");
432419
433420 if (intel_lpss_has_idma(lpss)) {
434
- /*
435
- * Ensure the DMA driver is loaded before the host
436
- * controller device appears, so that the host controller
437
- * driver can request its DMA channels as early as
438
- * possible.
439
- *
440
- * If the DMA module is not there that's OK as well.
441
- */
442
- intel_lpss_request_dma_module(LPSS_IDMA64_DRIVER_NAME);
443
-
444421 ret = mfd_add_devices(dev, lpss->devid, &intel_lpss_idma64_cell,
445422 1, info->mem, info->irq, NULL);
446423 if (ret)
....@@ -556,3 +533,11 @@
556533 MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@linux.intel.com>");
557534 MODULE_DESCRIPTION("Intel LPSS core driver");
558535 MODULE_LICENSE("GPL v2");
536
+/*
537
+ * Ensure the DMA driver is loaded before the host controller device appears,
538
+ * so that the host controller driver can request its DMA channels as early
539
+ * as possible.
540
+ *
541
+ * If the DMA module is not there that's OK as well.
542
+ */
543
+MODULE_SOFTDEP("pre: platform:" LPSS_IDMA64_DRIVER_NAME);