| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Platform level USB initialization for FS USB OTG controller on omap1 |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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 |
|---|
| 19 | 6 | */ |
|---|
| 20 | 7 | |
|---|
| 21 | 8 | #include <linux/module.h> |
|---|
| 22 | 9 | #include <linux/kernel.h> |
|---|
| 23 | 10 | #include <linux/init.h> |
|---|
| 24 | 11 | #include <linux/platform_device.h> |
|---|
| 12 | +#include <linux/dma-mapping.h> |
|---|
| 25 | 13 | #include <linux/io.h> |
|---|
| 26 | 14 | |
|---|
| 27 | 15 | #include <asm/irq.h> |
|---|
| .. | .. |
|---|
| 555 | 543 | /* ULPD_APLL_CTRL */ |
|---|
| 556 | 544 | #define APLL_NDPLL_SWITCH (1 << 0) |
|---|
| 557 | 545 | |
|---|
| 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 | + |
|---|
| 558 | 565 | static void __init omap_1510_usb_init(struct omap_usb_config *config) |
|---|
| 559 | 566 | { |
|---|
| 560 | 567 | unsigned int val; |
|---|
| .. | .. |
|---|
| 613 | 620 | if (config->register_host) { |
|---|
| 614 | 621 | int status; |
|---|
| 615 | 622 | |
|---|
| 623 | + bus_register_notifier(&platform_bus_type, |
|---|
| 624 | + &omap_1510_usb_ohci_nb); |
|---|
| 616 | 625 | ohci_device.dev.platform_data = config; |
|---|
| 617 | 626 | status = platform_device_register(&ohci_device); |
|---|
| 618 | 627 | if (status) |
|---|