// SPDX-License-Identifier: GPL-2.0 /* * otg.c - ChipIdea USB IP core OTG driver * * Copyright (C) 2013 Freescale Semiconductor, Inc. * * Author: Peter Chen */ /* * This file mainly handles otgsc register, OTG fsm operations for HNP and SRP * are also included. */ #include <linux/usb/otg.h> #include <linux/usb/gadget.h> #include <linux/usb/chipidea.h> #include "ci.h" #include "bits.h" #include "otg.h" #include "otg_fsm.h" /** * hw_read_otgsc - returns otgsc register bits value. * @ci: the controller * @mask: bitfield mask */ u32 hw_read_otgsc(struct ci_hdrc *ci, u32 mask) { … } /** * hw_write_otgsc - updates target bits of OTGSC register. * @ci: the controller * @mask: bitfield mask * @data: to be written */ void hw_write_otgsc(struct ci_hdrc *ci, u32 mask, u32 data) { … } /** * ci_otg_role - pick role based on ID pin state * @ci: the controller */ enum ci_role ci_otg_role(struct ci_hdrc *ci) { … } void ci_handle_vbus_change(struct ci_hdrc *ci) { … } /** * hw_wait_vbus_lower_bsv - When we switch to device mode, the vbus value * should be lower than OTGSC_BSV before connecting * to host. * * @ci: the controller * * This function returns an error code if timeout */ static int hw_wait_vbus_lower_bsv(struct ci_hdrc *ci) { … } void ci_handle_id_switch(struct ci_hdrc *ci) { … } /** * ci_otg_work - perform otg (vbus/id) event handle * @work: work struct */ static void ci_otg_work(struct work_struct *work) { … } /** * ci_hdrc_otg_init - initialize otg struct * @ci: the controller */ int ci_hdrc_otg_init(struct ci_hdrc *ci) { … } /** * ci_hdrc_otg_destroy - destroy otg struct * @ci: the controller */ void ci_hdrc_otg_destroy(struct ci_hdrc *ci) { … }