forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/arch/arm/mach-keystone/keystone.c
....@@ -1,16 +1,14 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Keystone2 based boards and SOC related code.
34 *
45 * Copyright 2013 Texas Instruments, Inc.
56 * Cyril Chemparathy <cyril@ti.com>
67 * Santosh Shilimkar <santosh.shillimkar@ti.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify it
9
- * under the terms and conditions of the GNU General Public License,
10
- * version 2, as published by the Free Software Foundation.
118 */
129 #include <linux/io.h>
1310 #include <linux/of.h>
11
+#include <linux/dma-mapping.h>
1412 #include <linux/init.h>
1513 #include <linux/of_platform.h>
1614 #include <linux/of_address.h>
....@@ -27,8 +25,7 @@
2725
2826 #include "keystone.h"
2927
30
-static unsigned long keystone_dma_pfn_offset __read_mostly;
31
-
28
+#ifdef CONFIG_ARM_LPAE
3229 static int keystone_platform_notifier(struct notifier_block *nb,
3330 unsigned long event, void *data)
3431 {
....@@ -41,9 +38,12 @@
4138 return NOTIFY_BAD;
4239
4340 if (!dev->of_node) {
44
- dev->dma_pfn_offset = keystone_dma_pfn_offset;
45
- dev_err(dev, "set dma_pfn_offset%08lx\n",
46
- dev->dma_pfn_offset);
41
+ int ret = dma_direct_set_offset(dev, KEYSTONE_HIGH_PHYS_START,
42
+ KEYSTONE_LOW_PHYS_START,
43
+ KEYSTONE_HIGH_PHYS_SIZE);
44
+ dev_err(dev, "set dma_offset%08llx%s\n",
45
+ KEYSTONE_HIGH_PHYS_START - KEYSTONE_LOW_PHYS_START,
46
+ ret ? " failed" : "");
4747 }
4848 return NOTIFY_OK;
4949 }
....@@ -51,14 +51,14 @@
5151 static struct notifier_block platform_nb = {
5252 .notifier_call = keystone_platform_notifier,
5353 };
54
+#endif /* CONFIG_ARM_LPAE */
5455
5556 static void __init keystone_init(void)
5657 {
57
- if (PHYS_OFFSET >= KEYSTONE_HIGH_PHYS_START) {
58
- keystone_dma_pfn_offset = PFN_DOWN(KEYSTONE_HIGH_PHYS_START -
59
- KEYSTONE_LOW_PHYS_START);
58
+#ifdef CONFIG_ARM_LPAE
59
+ if (PHYS_OFFSET >= KEYSTONE_HIGH_PHYS_START)
6060 bus_register_notifier(&platform_bus_type, &platform_nb);
61
- }
61
+#endif
6262 keystone_pm_runtime_init();
6363 }
6464