forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/arch/arm/mach-omap1/usb.c
....@@ -1,27 +1,15 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Platform level USB initialization for FS USB OTG controller on omap1
34 *
45 * Copyright (C) 2004 Texas Instruments, Inc.
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
196 */
207
218 #include <linux/module.h>
229 #include <linux/kernel.h>
2310 #include <linux/init.h>
2411 #include <linux/platform_device.h>
12
+#include <linux/dma-mapping.h>
2513 #include <linux/io.h>
2614
2715 #include <asm/irq.h>
....@@ -555,6 +543,25 @@
555543 /* ULPD_APLL_CTRL */
556544 #define APLL_NDPLL_SWITCH (1 << 0)
557545
546
+static int omap_1510_usb_ohci_notifier(struct notifier_block *nb,
547
+ unsigned long event, void *data)
548
+{
549
+ struct device *dev = data;
550
+
551
+ if (event != BUS_NOTIFY_ADD_DEVICE)
552
+ return NOTIFY_DONE;
553
+
554
+ if (strncmp(dev_name(dev), "ohci", 4) == 0 &&
555
+ dma_direct_set_offset(dev, PHYS_OFFSET, OMAP1510_LB_OFFSET,
556
+ (u64)-1))
557
+ WARN_ONCE(1, "failed to set DMA offset\n");
558
+ return NOTIFY_OK;
559
+}
560
+
561
+static struct notifier_block omap_1510_usb_ohci_nb = {
562
+ .notifier_call = omap_1510_usb_ohci_notifier,
563
+};
564
+
558565 static void __init omap_1510_usb_init(struct omap_usb_config *config)
559566 {
560567 unsigned int val;
....@@ -613,6 +620,8 @@
613620 if (config->register_host) {
614621 int status;
615622
623
+ bus_register_notifier(&platform_bus_type,
624
+ &omap_1510_usb_ohci_nb);
616625 ohci_device.dev.platform_data = config;
617626 status = platform_device_register(&ohci_device);
618627 if (status)