blob: aa37e957b47c74bc8e725db87ec82f7c4bbbcbbe [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Lukasz Majewski38517a72011-10-27 10:36:46 +02002/*
Marek Vasut5d5716e2015-12-04 02:51:20 +01003 * drivers/usb/gadget/dwc2_udc.h
Marek Vasute179ced2015-12-04 02:55:37 +01004 * Designware DWC2 on-chip full/high speed USB device controllers
Lukasz Majewski38517a72011-10-27 10:36:46 +02005 * Copyright (C) 2005 for Samsung Electronics
Lukasz Majewski38517a72011-10-27 10:36:46 +02006 */
7
Marek Vasut5d5716e2015-12-04 02:51:20 +01008#ifndef __DWC2_USB_GADGET
9#define __DWC2_USB_GADGET
Lukasz Majewski38517a72011-10-27 10:36:46 +020010
Kever Yange76943c2019-10-16 17:13:31 +080011#include <dm/ofnode.h>
12
Lukasz Majewski38517a72011-10-27 10:36:46 +020013#define PHY0_SLEEP (1 << 5)
Patrice Chotard763bb102019-03-29 15:42:20 +010014#define DWC2_MAX_HW_ENDPOINTS 16
Lukasz Majewski38517a72011-10-27 10:36:46 +020015
Marek Vasutc0982872015-12-04 02:23:29 +010016struct dwc2_plat_otg_data {
Xu Ziyuanfab33572016-07-14 14:52:32 +080017 void *priv;
Kever Yange76943c2019-10-16 17:13:31 +080018 ofnode phy_of_node;
Lukasz Majewski38517a72011-10-27 10:36:46 +020019 int (*phy_control)(int on);
Philipp Tomsich63162722018-12-06 01:26:39 +010020 uintptr_t regs_phy;
Philipp Tomsich92693b52017-06-06 15:42:29 +020021 uintptr_t regs_otg;
Lukasz Majewski38517a72011-10-27 10:36:46 +020022 unsigned int usb_phy_ctrl;
23 unsigned int usb_flags;
Marek Vasut481a11c2014-11-04 04:23:25 +010024 unsigned int usb_gusbcfg;
Xu Ziyuan47117882016-07-14 14:52:33 +080025 unsigned int rx_fifo_sz;
26 unsigned int np_tx_fifo_sz;
27 unsigned int tx_fifo_sz;
Patrice Chotard763bb102019-03-29 15:42:20 +010028 unsigned int tx_fifo_sz_array[DWC2_MAX_HW_ENDPOINTS];
29 unsigned char tx_fifo_sz_nb;
Patrick Delaunay0fdd0bc2019-03-29 15:42:17 +010030 bool force_b_session_valid;
Patrick Delaunay5739ef22020-10-15 14:49:37 +020031 bool force_vbus_detection;
Patrick Delaunay931e9d72019-03-29 15:42:21 +010032 bool activate_stm_id_vb_detection;
Lukasz Majewski38517a72011-10-27 10:36:46 +020033};
Marek Vasut2c12ff02015-12-04 01:36:36 +010034
Marek Vasuta4bb9b32015-12-04 02:26:33 +010035int dwc2_udc_probe(struct dwc2_plat_otg_data *pdata);
Marek Vasut2c12ff02015-12-04 01:36:36 +010036
Patrick Delaunay2d761602019-03-29 15:42:18 +010037int dwc2_udc_B_session_valid(struct udevice *dev);
38
Marek Vasut5d5716e2015-12-04 02:51:20 +010039#endif /* __DWC2_USB_GADGET */