blob: a6c12212a9b0cabe4a86dc47114b4d6e33b8fceb [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Lukasz Majewskiac3c8312011-10-27 10:36:46 +02002/*
Marek Vasutf1be9cb2015-12-04 02:51:20 +01003 * drivers/usb/gadget/dwc2_udc.h
Marek Vasut4a7629a2015-12-04 02:55:37 +01004 * Designware DWC2 on-chip full/high speed USB device controllers
Lukasz Majewskiac3c8312011-10-27 10:36:46 +02005 * Copyright (C) 2005 for Samsung Electronics
Lukasz Majewskiac3c8312011-10-27 10:36:46 +02006 */
7
Marek Vasutf1be9cb2015-12-04 02:51:20 +01008#ifndef __DWC2_USB_GADGET
9#define __DWC2_USB_GADGET
Lukasz Majewskiac3c8312011-10-27 10:36:46 +020010
Lukasz Majewskiac3c8312011-10-27 10:36:46 +020011#define PHY0_SLEEP (1 << 5)
Patrice Chotard00f3fc62019-03-29 15:42:20 +010012#define DWC2_MAX_HW_ENDPOINTS 16
Lukasz Majewskiac3c8312011-10-27 10:36:46 +020013
Marek Vasut6939aca2015-12-04 02:23:29 +010014struct dwc2_plat_otg_data {
Xu Ziyuan1ecf3e42016-07-14 14:52:32 +080015 void *priv;
16 int phy_of_node;
Lukasz Majewskiac3c8312011-10-27 10:36:46 +020017 int (*phy_control)(int on);
Philipp Tomsich32dfa5d2018-12-06 01:26:39 +010018 uintptr_t regs_phy;
Philipp Tomsichd2a5af82017-06-06 15:42:29 +020019 uintptr_t regs_otg;
Lukasz Majewskiac3c8312011-10-27 10:36:46 +020020 unsigned int usb_phy_ctrl;
21 unsigned int usb_flags;
Marek Vasut80300882014-11-04 04:23:25 +010022 unsigned int usb_gusbcfg;
Xu Ziyuanb729dc02016-07-14 14:52:33 +080023 unsigned int rx_fifo_sz;
24 unsigned int np_tx_fifo_sz;
25 unsigned int tx_fifo_sz;
Patrice Chotard00f3fc62019-03-29 15:42:20 +010026 unsigned int tx_fifo_sz_array[DWC2_MAX_HW_ENDPOINTS];
27 unsigned char tx_fifo_sz_nb;
Patrick Delaunay0c42d1d2019-03-29 15:42:17 +010028 bool force_b_session_valid;
Patrick Delaunaye014cb62019-03-29 15:42:21 +010029 bool activate_stm_id_vb_detection;
Lukasz Majewskiac3c8312011-10-27 10:36:46 +020030};
Marek Vasut0b907502015-12-04 01:36:36 +010031
Marek Vasut01b61fa2015-12-04 02:26:33 +010032int dwc2_udc_probe(struct dwc2_plat_otg_data *pdata);
Marek Vasut0b907502015-12-04 01:36:36 +010033
Patrick Delaunaye2ad7792019-03-29 15:42:18 +010034int dwc2_udc_B_session_valid(struct udevice *dev);
35
Marek Vasutf1be9cb2015-12-04 02:51:20 +010036#endif /* __DWC2_USB_GADGET */