// SPDX-License-Identifier: GPL-2.0 /* * Cadence USBSS and USBSSP DRD Driver. * * Copyright (C) 2018-2020 Cadence. * Copyright (C) 2019 Texas Instruments * * Author: Pawel Laszczak <[email protected]> * Roger Quadros <[email protected]> * */ #include <linux/kernel.h> #include <linux/interrupt.h> #include <linux/delay.h> #include <linux/iopoll.h> #include <linux/usb/otg.h> #include "drd.h" #include "core.h" /** * cdns_set_mode - change mode of OTG Core * @cdns: pointer to context structure * @mode: selected mode from cdns_role * * Returns 0 on success otherwise negative errno */ static int cdns_set_mode(struct cdns *cdns, enum usb_dr_mode mode) { … } int cdns_get_id(struct cdns *cdns) { … } int cdns_get_vbus(struct cdns *cdns) { … } void cdns_clear_vbus(struct cdns *cdns) { … } EXPORT_SYMBOL_GPL(…); void cdns_set_vbus(struct cdns *cdns) { … } EXPORT_SYMBOL_GPL(…); bool cdns_is_host(struct cdns *cdns) { … } bool cdns_is_device(struct cdns *cdns) { … } /** * cdns_otg_disable_irq - Disable all OTG interrupts * @cdns: Pointer to controller context structure */ static void cdns_otg_disable_irq(struct cdns *cdns) { … } /** * cdns_otg_enable_irq - enable id and sess_valid interrupts * @cdns: Pointer to controller context structure */ static void cdns_otg_enable_irq(struct cdns *cdns) { … } /** * cdns_drd_host_on - start host. * @cdns: Pointer to controller context structure. * * Returns 0 on success otherwise negative errno. */ int cdns_drd_host_on(struct cdns *cdns) { … } /** * cdns_drd_host_off - stop host. * @cdns: Pointer to controller context structure. */ void cdns_drd_host_off(struct cdns *cdns) { … } /** * cdns_drd_gadget_on - start gadget. * @cdns: Pointer to controller context structure. * * Returns 0 on success otherwise negative errno */ int cdns_drd_gadget_on(struct cdns *cdns) { … } EXPORT_SYMBOL_GPL(…); /** * cdns_drd_gadget_off - stop gadget. * @cdns: Pointer to controller context structure. */ void cdns_drd_gadget_off(struct cdns *cdns) { … } EXPORT_SYMBOL_GPL(…); /** * cdns_init_otg_mode - initialize drd controller * @cdns: Pointer to controller context structure * * Returns 0 on success otherwise negative errno */ static int cdns_init_otg_mode(struct cdns *cdns) { … } /** * cdns_drd_update_mode - initialize mode of operation * @cdns: Pointer to controller context structure * * Returns 0 on success otherwise negative errno */ int cdns_drd_update_mode(struct cdns *cdns) { … } static irqreturn_t cdns_drd_thread_irq(int irq, void *data) { … } /** * cdns_drd_irq - interrupt handler for OTG events * * @irq: irq number for cdns core device * @data: structure of cdns * * Returns IRQ_HANDLED or IRQ_NONE */ static irqreturn_t cdns_drd_irq(int irq, void *data) { … } int cdns_drd_init(struct cdns *cdns) { … } int cdns_drd_exit(struct cdns *cdns) { … } /* Indicate the cdns3 core was power lost before */ bool cdns_power_is_lost(struct cdns *cdns) { … } EXPORT_SYMBOL_GPL(…);