// SPDX-License-Identifier: GPL-2.0 /* * Cadence USBSS and USBSSP DRD Driver. * * Copyright (C) 2018-2019 Cadence. * Copyright (C) 2017-2018 NXP * Copyright (C) 2019 Texas Instruments * * Author: Peter Chen <[email protected]> * Pawel Laszczak <[email protected]> * Roger Quadros <[email protected]> */ #include <linux/dma-mapping.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/pm_runtime.h> #include "core.h" #include "host-export.h" #include "drd.h" static int cdns_idle_init(struct cdns *cdns); static int cdns_role_start(struct cdns *cdns, enum usb_role role) { … } static void cdns_role_stop(struct cdns *cdns) { … } static void cdns_exit_roles(struct cdns *cdns) { … } /** * cdns_core_init_role - initialize role of operation * @cdns: Pointer to cdns structure * * Returns 0 on success otherwise negative errno */ static int cdns_core_init_role(struct cdns *cdns) { … } /** * cdns_hw_role_state_machine - role switch state machine based on hw events. * @cdns: Pointer to controller structure. * * Returns next role to be entered based on hw events. */ static enum usb_role cdns_hw_role_state_machine(struct cdns *cdns) { … } static int cdns_idle_role_start(struct cdns *cdns) { … } static void cdns_idle_role_stop(struct cdns *cdns) { … } static int cdns_idle_init(struct cdns *cdns) { … } /** * cdns_hw_role_switch - switch roles based on HW state * @cdns: controller */ int cdns_hw_role_switch(struct cdns *cdns) { … } /** * cdns_role_get - get current role of controller. * * @sw: pointer to USB role switch structure * * Returns role */ static enum usb_role cdns_role_get(struct usb_role_switch *sw) { … } /** * cdns_role_set - set current role of controller. * * @sw: pointer to USB role switch structure * @role: the previous role * Handles below events: * - Role switch for dual-role devices * - USB_ROLE_GADGET <--> USB_ROLE_NONE for peripheral-only devices */ static int cdns_role_set(struct usb_role_switch *sw, enum usb_role role) { … } /** * cdns_wakeup_irq - interrupt handler for wakeup events * @irq: irq number for cdns3/cdnsp core device * @data: structure of cdns * * Returns IRQ_HANDLED or IRQ_NONE */ static irqreturn_t cdns_wakeup_irq(int irq, void *data) { … } /** * cdns_init - probe for cdns3/cdnsp core device * @cdns: Pointer to cdns structure. * * Returns 0 on success otherwise negative errno */ int cdns_init(struct cdns *cdns) { … } EXPORT_SYMBOL_GPL(…); /** * cdns_remove - unbind drd driver and clean up * @cdns: Pointer to cdns structure. * * Returns 0 on success otherwise negative errno */ int cdns_remove(struct cdns *cdns) { … } EXPORT_SYMBOL_GPL(…); #ifdef CONFIG_PM_SLEEP int cdns_suspend(struct cdns *cdns) { … } EXPORT_SYMBOL_GPL(…); int cdns_resume(struct cdns *cdns) { … } EXPORT_SYMBOL_GPL(…); void cdns_set_active(struct cdns *cdns, u8 set_active) { … } EXPORT_SYMBOL_GPL(…); #endif /* CONFIG_PM_SLEEP */ MODULE_AUTHOR(…) …; MODULE_AUTHOR(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;