18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2011 Marvell International Ltd. All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __MV_U3D_H
78c2ecf20Sopenharmony_ci#define __MV_U3D_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define MV_U3D_EP_CONTEXT_ALIGNMENT	32
108c2ecf20Sopenharmony_ci#define MV_U3D_TRB_ALIGNMENT	16
118c2ecf20Sopenharmony_ci#define MV_U3D_DMA_BOUNDARY	4096
128c2ecf20Sopenharmony_ci#define MV_U3D_EP0_MAX_PKT_SIZE	512
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* ep0 transfer state */
158c2ecf20Sopenharmony_ci#define MV_U3D_WAIT_FOR_SETUP		0
168c2ecf20Sopenharmony_ci#define MV_U3D_DATA_STATE_XMIT		1
178c2ecf20Sopenharmony_ci#define MV_U3D_DATA_STATE_NEED_ZLP	2
188c2ecf20Sopenharmony_ci#define MV_U3D_WAIT_FOR_OUT_STATUS	3
198c2ecf20Sopenharmony_ci#define MV_U3D_DATA_STATE_RECV		4
208c2ecf20Sopenharmony_ci#define MV_U3D_STATUS_STAGE		5
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define MV_U3D_EP_MAX_LENGTH_TRANSFER	0x10000
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/* USB3 Interrupt Status */
258c2ecf20Sopenharmony_ci#define MV_U3D_USBINT_SETUP		0x00000001
268c2ecf20Sopenharmony_ci#define MV_U3D_USBINT_RX_COMPLETE	0x00000002
278c2ecf20Sopenharmony_ci#define MV_U3D_USBINT_TX_COMPLETE	0x00000004
288c2ecf20Sopenharmony_ci#define MV_U3D_USBINT_UNDER_RUN	0x00000008
298c2ecf20Sopenharmony_ci#define MV_U3D_USBINT_RXDESC_ERR	0x00000010
308c2ecf20Sopenharmony_ci#define MV_U3D_USBINT_TXDESC_ERR	0x00000020
318c2ecf20Sopenharmony_ci#define MV_U3D_USBINT_RX_TRB_COMPLETE	0x00000040
328c2ecf20Sopenharmony_ci#define MV_U3D_USBINT_TX_TRB_COMPLETE	0x00000080
338c2ecf20Sopenharmony_ci#define MV_U3D_USBINT_VBUS_VALID	0x00010000
348c2ecf20Sopenharmony_ci#define MV_U3D_USBINT_STORAGE_CMD_FULL	0x00020000
358c2ecf20Sopenharmony_ci#define MV_U3D_USBINT_LINK_CHG		0x01000000
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/* USB3 Interrupt Enable */
388c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_SETUP		0x00000001
398c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_RX_COMPLETE		0x00000002
408c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_TX_COMPLETE		0x00000004
418c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_UNDER_RUN		0x00000008
428c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_RXDESC_ERR		0x00000010
438c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_TXDESC_ERR		0x00000020
448c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_RX_TRB_COMPLETE	0x00000040
458c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_TX_TRB_COMPLETE	0x00000080
468c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_RX_BUFFER_ERR	0x00000100
478c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_VBUS_VALID		0x00010000
488c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_STORAGE_CMD_FULL	0x00020000
498c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_LINK_CHG		0x01000000
508c2ecf20Sopenharmony_ci#define MV_U3D_INTR_ENABLE_PRIME_STATUS	0x02000000
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* USB3 Link Change */
538c2ecf20Sopenharmony_ci#define MV_U3D_LINK_CHANGE_LINK_UP		0x00000001
548c2ecf20Sopenharmony_ci#define MV_U3D_LINK_CHANGE_SUSPEND		0x00000002
558c2ecf20Sopenharmony_ci#define MV_U3D_LINK_CHANGE_RESUME		0x00000004
568c2ecf20Sopenharmony_ci#define MV_U3D_LINK_CHANGE_WRESET		0x00000008
578c2ecf20Sopenharmony_ci#define MV_U3D_LINK_CHANGE_HRESET		0x00000010
588c2ecf20Sopenharmony_ci#define MV_U3D_LINK_CHANGE_VBUS_INVALID	0x00000020
598c2ecf20Sopenharmony_ci#define MV_U3D_LINK_CHANGE_INACT		0x00000040
608c2ecf20Sopenharmony_ci#define MV_U3D_LINK_CHANGE_DISABLE_AFTER_U0	0x00000080
618c2ecf20Sopenharmony_ci#define MV_U3D_LINK_CHANGE_U1			0x00000100
628c2ecf20Sopenharmony_ci#define MV_U3D_LINK_CHANGE_U2			0x00000200
638c2ecf20Sopenharmony_ci#define MV_U3D_LINK_CHANGE_U3			0x00000400
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/* bridge setting */
668c2ecf20Sopenharmony_ci#define MV_U3D_BRIDGE_SETTING_VBUS_VALID	(1 << 16)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci/* Command Register Bit Masks */
698c2ecf20Sopenharmony_ci#define MV_U3D_CMD_RUN_STOP		0x00000001
708c2ecf20Sopenharmony_ci#define MV_U3D_CMD_CTRL_RESET		0x00000002
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci/* ep control register */
738c2ecf20Sopenharmony_ci#define MV_U3D_EPXCR_EP_TYPE_CONTROL		0
748c2ecf20Sopenharmony_ci#define MV_U3D_EPXCR_EP_TYPE_ISOC		1
758c2ecf20Sopenharmony_ci#define MV_U3D_EPXCR_EP_TYPE_BULK		2
768c2ecf20Sopenharmony_ci#define MV_U3D_EPXCR_EP_TYPE_INT		3
778c2ecf20Sopenharmony_ci#define MV_U3D_EPXCR_EP_ENABLE_SHIFT		4
788c2ecf20Sopenharmony_ci#define MV_U3D_EPXCR_MAX_BURST_SIZE_SHIFT	12
798c2ecf20Sopenharmony_ci#define MV_U3D_EPXCR_MAX_PACKET_SIZE_SHIFT	16
808c2ecf20Sopenharmony_ci#define MV_U3D_USB_BULK_BURST_OUT		6
818c2ecf20Sopenharmony_ci#define MV_U3D_USB_BULK_BURST_IN		14
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci#define MV_U3D_EPXCR_EP_FLUSH		(1 << 7)
848c2ecf20Sopenharmony_ci#define MV_U3D_EPXCR_EP_HALT		(1 << 1)
858c2ecf20Sopenharmony_ci#define MV_U3D_EPXCR_EP_INIT		(1)
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* TX/RX Status Register */
888c2ecf20Sopenharmony_ci#define MV_U3D_XFERSTATUS_COMPLETE_SHIFT	24
898c2ecf20Sopenharmony_ci#define MV_U3D_COMPLETE_INVALID	0
908c2ecf20Sopenharmony_ci#define MV_U3D_COMPLETE_SUCCESS	1
918c2ecf20Sopenharmony_ci#define MV_U3D_COMPLETE_BUFF_ERR	2
928c2ecf20Sopenharmony_ci#define MV_U3D_COMPLETE_SHORT_PACKET	3
938c2ecf20Sopenharmony_ci#define MV_U3D_COMPLETE_TRB_ERR	5
948c2ecf20Sopenharmony_ci#define MV_U3D_XFERSTATUS_TRB_LENGTH_MASK	(0xFFFFFF)
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci#define MV_U3D_USB_LINK_BYPASS_VBUS	0x8
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define MV_U3D_LTSSM_PHY_INIT_DONE		0x80000000
998c2ecf20Sopenharmony_ci#define MV_U3D_LTSSM_NEVER_GO_COMPLIANCE	0x40000000
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci#define MV_U3D_USB3_OP_REGS_OFFSET	0x100
1028c2ecf20Sopenharmony_ci#define MV_U3D_USB3_PHY_OFFSET		0xB800
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci#define DCS_ENABLE	0x1
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* timeout */
1078c2ecf20Sopenharmony_ci#define MV_U3D_RESET_TIMEOUT		10000
1088c2ecf20Sopenharmony_ci#define MV_U3D_FLUSH_TIMEOUT		100000
1098c2ecf20Sopenharmony_ci#define MV_U3D_OWN_TIMEOUT		10000
1108c2ecf20Sopenharmony_ci#define LOOPS_USEC_SHIFT	4
1118c2ecf20Sopenharmony_ci#define LOOPS_USEC		(1 << LOOPS_USEC_SHIFT)
1128c2ecf20Sopenharmony_ci#define LOOPS(timeout)		((timeout) >> LOOPS_USEC_SHIFT)
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci/* ep direction */
1158c2ecf20Sopenharmony_ci#define MV_U3D_EP_DIR_IN		1
1168c2ecf20Sopenharmony_ci#define MV_U3D_EP_DIR_OUT		0
1178c2ecf20Sopenharmony_ci#define mv_u3d_ep_dir(ep)	(((ep)->ep_num == 0) ? \
1188c2ecf20Sopenharmony_ci				((ep)->u3d->ep0_dir) : ((ep)->direction))
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* usb capability registers */
1218c2ecf20Sopenharmony_cistruct mv_u3d_cap_regs {
1228c2ecf20Sopenharmony_ci	u32	rsvd[5];
1238c2ecf20Sopenharmony_ci	u32	dboff;	/* doorbell register offset */
1248c2ecf20Sopenharmony_ci	u32	rtsoff;	/* runtime register offset */
1258c2ecf20Sopenharmony_ci	u32	vuoff;	/* vendor unique register offset */
1268c2ecf20Sopenharmony_ci};
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci/* operation registers */
1298c2ecf20Sopenharmony_cistruct mv_u3d_op_regs {
1308c2ecf20Sopenharmony_ci	u32	usbcmd;		/* Command register */
1318c2ecf20Sopenharmony_ci	u32	rsvd1[11];
1328c2ecf20Sopenharmony_ci	u32	dcbaapl;	/* Device Context Base Address low register */
1338c2ecf20Sopenharmony_ci	u32	dcbaaph;	/* Device Context Base Address high register */
1348c2ecf20Sopenharmony_ci	u32	rsvd2[243];
1358c2ecf20Sopenharmony_ci	u32	portsc;		/* port status and control register*/
1368c2ecf20Sopenharmony_ci	u32	portlinkinfo;	/* port link info register*/
1378c2ecf20Sopenharmony_ci	u32	rsvd3[9917];
1388c2ecf20Sopenharmony_ci	u32	doorbell;	/* doorbell register */
1398c2ecf20Sopenharmony_ci};
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci/* control endpoint enable registers */
1428c2ecf20Sopenharmony_cistruct epxcr {
1438c2ecf20Sopenharmony_ci	u32	epxoutcr0;	/* ep out control 0 register */
1448c2ecf20Sopenharmony_ci	u32	epxoutcr1;	/* ep out control 1 register */
1458c2ecf20Sopenharmony_ci	u32	epxincr0;	/* ep in control 0 register */
1468c2ecf20Sopenharmony_ci	u32	epxincr1;	/* ep in control 1 register */
1478c2ecf20Sopenharmony_ci};
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci/* transfer status registers */
1508c2ecf20Sopenharmony_cistruct xferstatus {
1518c2ecf20Sopenharmony_ci	u32	curdeqlo;	/* current TRB pointer low */
1528c2ecf20Sopenharmony_ci	u32	curdeqhi;	/* current TRB pointer high */
1538c2ecf20Sopenharmony_ci	u32	statuslo;	/* transfer status low */
1548c2ecf20Sopenharmony_ci	u32	statushi;	/* transfer status high */
1558c2ecf20Sopenharmony_ci};
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/* vendor unique control registers */
1588c2ecf20Sopenharmony_cistruct mv_u3d_vuc_regs {
1598c2ecf20Sopenharmony_ci	u32	ctrlepenable;	/* control endpoint enable register */
1608c2ecf20Sopenharmony_ci	u32	setuplock;	/* setup lock register */
1618c2ecf20Sopenharmony_ci	u32	endcomplete;	/* endpoint transfer complete register */
1628c2ecf20Sopenharmony_ci	u32	intrcause;	/* interrupt cause register */
1638c2ecf20Sopenharmony_ci	u32	intrenable;	/* interrupt enable register */
1648c2ecf20Sopenharmony_ci	u32	trbcomplete;	/* TRB complete register */
1658c2ecf20Sopenharmony_ci	u32	linkchange;	/* link change register */
1668c2ecf20Sopenharmony_ci	u32	rsvd1[5];
1678c2ecf20Sopenharmony_ci	u32	trbunderrun;	/* TRB underrun register */
1688c2ecf20Sopenharmony_ci	u32	rsvd2[43];
1698c2ecf20Sopenharmony_ci	u32	bridgesetting;	/* bridge setting register */
1708c2ecf20Sopenharmony_ci	u32	rsvd3[7];
1718c2ecf20Sopenharmony_ci	struct xferstatus	txst[16];	/* TX status register */
1728c2ecf20Sopenharmony_ci	struct xferstatus	rxst[16];	/* RX status register */
1738c2ecf20Sopenharmony_ci	u32	ltssm;		/* LTSSM control register */
1748c2ecf20Sopenharmony_ci	u32	pipe;		/* PIPE control register */
1758c2ecf20Sopenharmony_ci	u32	linkcr0;	/* link control 0 register */
1768c2ecf20Sopenharmony_ci	u32	linkcr1;	/* link control 1 register */
1778c2ecf20Sopenharmony_ci	u32	rsvd6[60];
1788c2ecf20Sopenharmony_ci	u32	mib0;		/* MIB0 counter register */
1798c2ecf20Sopenharmony_ci	u32	usblink;	/* usb link control register */
1808c2ecf20Sopenharmony_ci	u32	ltssmstate;	/* LTSSM state register */
1818c2ecf20Sopenharmony_ci	u32	linkerrorcause;	/* link error cause register */
1828c2ecf20Sopenharmony_ci	u32	rsvd7[60];
1838c2ecf20Sopenharmony_ci	u32	devaddrtiebrkr;	/* device address and tie breaker */
1848c2ecf20Sopenharmony_ci	u32	itpinfo0;	/* ITP info 0 register */
1858c2ecf20Sopenharmony_ci	u32	itpinfo1;	/* ITP info 1 register */
1868c2ecf20Sopenharmony_ci	u32	rsvd8[61];
1878c2ecf20Sopenharmony_ci	struct epxcr	epcr[16];	/* ep control register */
1888c2ecf20Sopenharmony_ci	u32	rsvd9[64];
1898c2ecf20Sopenharmony_ci	u32	phyaddr;	/* PHY address register */
1908c2ecf20Sopenharmony_ci	u32	phydata;	/* PHY data register */
1918c2ecf20Sopenharmony_ci};
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci/* Endpoint context structure */
1948c2ecf20Sopenharmony_cistruct mv_u3d_ep_context {
1958c2ecf20Sopenharmony_ci	u32	rsvd0;
1968c2ecf20Sopenharmony_ci	u32	rsvd1;
1978c2ecf20Sopenharmony_ci	u32	trb_addr_lo;		/* TRB address low 32 bit */
1988c2ecf20Sopenharmony_ci	u32	trb_addr_hi;		/* TRB address high 32 bit */
1998c2ecf20Sopenharmony_ci	u32	rsvd2;
2008c2ecf20Sopenharmony_ci	u32	rsvd3;
2018c2ecf20Sopenharmony_ci	struct usb_ctrlrequest setup_buffer;	/* setup data buffer */
2028c2ecf20Sopenharmony_ci};
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/* TRB control data structure */
2058c2ecf20Sopenharmony_cistruct mv_u3d_trb_ctrl {
2068c2ecf20Sopenharmony_ci	u32	own:1;		/* owner of TRB */
2078c2ecf20Sopenharmony_ci	u32	rsvd1:3;
2088c2ecf20Sopenharmony_ci	u32	chain:1;	/* associate this TRB with the
2098c2ecf20Sopenharmony_ci				next TRB on the Ring */
2108c2ecf20Sopenharmony_ci	u32	ioc:1;		/* interrupt on complete */
2118c2ecf20Sopenharmony_ci	u32	rsvd2:4;
2128c2ecf20Sopenharmony_ci	u32	type:6;		/* TRB type */
2138c2ecf20Sopenharmony_ci#define TYPE_NORMAL	1
2148c2ecf20Sopenharmony_ci#define TYPE_DATA	3
2158c2ecf20Sopenharmony_ci#define TYPE_LINK	6
2168c2ecf20Sopenharmony_ci	u32	dir:1;		/* Working at data stage of control endpoint
2178c2ecf20Sopenharmony_ci				operation. 0 is OUT and 1 is IN. */
2188c2ecf20Sopenharmony_ci	u32	rsvd3:15;
2198c2ecf20Sopenharmony_ci};
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci/* TRB data structure
2228c2ecf20Sopenharmony_ci * For multiple TRB, all the TRBs' physical address should be continuous.
2238c2ecf20Sopenharmony_ci */
2248c2ecf20Sopenharmony_cistruct mv_u3d_trb_hw {
2258c2ecf20Sopenharmony_ci	u32	buf_addr_lo;	/* data buffer address low 32 bit */
2268c2ecf20Sopenharmony_ci	u32	buf_addr_hi;	/* data buffer address high 32 bit */
2278c2ecf20Sopenharmony_ci	u32	trb_len;	/* transfer length */
2288c2ecf20Sopenharmony_ci	struct mv_u3d_trb_ctrl	ctrl;	/* TRB control data */
2298c2ecf20Sopenharmony_ci};
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci/* TRB structure */
2328c2ecf20Sopenharmony_cistruct mv_u3d_trb {
2338c2ecf20Sopenharmony_ci	struct mv_u3d_trb_hw *trb_hw;	/* point to the trb_hw structure */
2348c2ecf20Sopenharmony_ci	dma_addr_t trb_dma;		/* dma address for this trb_hw */
2358c2ecf20Sopenharmony_ci	struct list_head trb_list;	/* trb list */
2368c2ecf20Sopenharmony_ci};
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci/* device data structure */
2398c2ecf20Sopenharmony_cistruct mv_u3d {
2408c2ecf20Sopenharmony_ci	struct usb_gadget		gadget;
2418c2ecf20Sopenharmony_ci	struct usb_gadget_driver	*driver;
2428c2ecf20Sopenharmony_ci	spinlock_t			lock;	/* device lock */
2438c2ecf20Sopenharmony_ci	struct completion		*done;
2448c2ecf20Sopenharmony_ci	struct device			*dev;
2458c2ecf20Sopenharmony_ci	int				irq;
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci	/* usb controller registers */
2488c2ecf20Sopenharmony_ci	struct mv_u3d_cap_regs __iomem	*cap_regs;
2498c2ecf20Sopenharmony_ci	struct mv_u3d_op_regs __iomem	*op_regs;
2508c2ecf20Sopenharmony_ci	struct mv_u3d_vuc_regs __iomem	*vuc_regs;
2518c2ecf20Sopenharmony_ci	void __iomem			*phy_regs;
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci	unsigned int			max_eps;
2548c2ecf20Sopenharmony_ci	struct mv_u3d_ep_context	*ep_context;
2558c2ecf20Sopenharmony_ci	size_t				ep_context_size;
2568c2ecf20Sopenharmony_ci	dma_addr_t			ep_context_dma;
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci	struct dma_pool			*trb_pool; /* for TRB data structure */
2598c2ecf20Sopenharmony_ci	struct mv_u3d_ep		*eps;
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci	struct mv_u3d_req		*status_req; /* ep0 status request */
2628c2ecf20Sopenharmony_ci	struct usb_ctrlrequest		local_setup_buff; /* store setup data*/
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci	unsigned int		resume_state;	/* USB state to resume */
2658c2ecf20Sopenharmony_ci	unsigned int		usb_state;	/* USB current state */
2668c2ecf20Sopenharmony_ci	unsigned int		ep0_state;	/* Endpoint zero state */
2678c2ecf20Sopenharmony_ci	unsigned int		ep0_dir;
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci	unsigned int		dev_addr;	/* device address */
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci	unsigned int		errors;
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_ci	unsigned		softconnect:1;
2748c2ecf20Sopenharmony_ci	unsigned		vbus_active:1;	/* vbus is active or not */
2758c2ecf20Sopenharmony_ci	unsigned		remote_wakeup:1; /* support remote wakeup */
2768c2ecf20Sopenharmony_ci	unsigned		clock_gating:1;	/* clock gating or not */
2778c2ecf20Sopenharmony_ci	unsigned		active:1;	/* udc is active or not */
2788c2ecf20Sopenharmony_ci	unsigned		vbus_valid_detect:1; /* udc vbus detection */
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci	struct mv_usb_addon_irq *vbus;
2818c2ecf20Sopenharmony_ci	unsigned int		power;
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci	struct clk		*clk;
2848c2ecf20Sopenharmony_ci};
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci/* endpoint data structure */
2878c2ecf20Sopenharmony_cistruct mv_u3d_ep {
2888c2ecf20Sopenharmony_ci	struct usb_ep		ep;
2898c2ecf20Sopenharmony_ci	struct mv_u3d		*u3d;
2908c2ecf20Sopenharmony_ci	struct list_head	queue;	/* ep request queued hardware */
2918c2ecf20Sopenharmony_ci	struct list_head	req_list; /* list of ep request */
2928c2ecf20Sopenharmony_ci	struct mv_u3d_ep_context	*ep_context; /* ep context */
2938c2ecf20Sopenharmony_ci	u32			direction;
2948c2ecf20Sopenharmony_ci	char			name[14];
2958c2ecf20Sopenharmony_ci	u32			processing; /* there is ep request
2968c2ecf20Sopenharmony_ci						queued on haredware */
2978c2ecf20Sopenharmony_ci	spinlock_t		req_lock; /* ep lock */
2988c2ecf20Sopenharmony_ci	unsigned		wedge:1;
2998c2ecf20Sopenharmony_ci	unsigned		enabled:1;
3008c2ecf20Sopenharmony_ci	unsigned		ep_type:2;
3018c2ecf20Sopenharmony_ci	unsigned		ep_num:8;
3028c2ecf20Sopenharmony_ci};
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci/* request data structure */
3058c2ecf20Sopenharmony_cistruct mv_u3d_req {
3068c2ecf20Sopenharmony_ci	struct usb_request	req;
3078c2ecf20Sopenharmony_ci	struct mv_u3d_ep	*ep;
3088c2ecf20Sopenharmony_ci	struct list_head	queue;	/* ep requst queued on hardware */
3098c2ecf20Sopenharmony_ci	struct list_head	list;	/* ep request list */
3108c2ecf20Sopenharmony_ci	struct list_head	trb_list; /* trb list of a request */
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci	struct mv_u3d_trb	*trb_head; /* point to first trb of a request */
3138c2ecf20Sopenharmony_ci	unsigned		trb_count; /* TRB number in the chain */
3148c2ecf20Sopenharmony_ci	unsigned		chain;	   /* TRB chain or not */
3158c2ecf20Sopenharmony_ci};
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci#endif
318