xref: /rk3399_rockchip-uboot/arch/arm/include/asm/ehci-omap.h (revision 211aaf309cde193918f9a19b0b010acebfd80a82)
143b62393SGovindraj.R /*
243b62393SGovindraj.R  * OMAP EHCI port support
343b62393SGovindraj.R  * Based on LINUX KERNEL
443b62393SGovindraj.R  * drivers/usb/host/ehci-omap.c and drivers/mfd/omap-usb-host.c
543b62393SGovindraj.R  *
643b62393SGovindraj.R  * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com*
743b62393SGovindraj.R  * Author: Govindraj R <govindraj.raja@ti.com>
843b62393SGovindraj.R  *
9*5b8031ccSTom Rini  * SPDX-License-Identifier:	GPL-2.0
1043b62393SGovindraj.R  */
1143b62393SGovindraj.R 
1243b62393SGovindraj.R #ifndef _OMAP_COMMON_EHCI_H_
1343b62393SGovindraj.R #define _OMAP_COMMON_EHCI_H_
1443b62393SGovindraj.R 
1543b62393SGovindraj.R enum usbhs_omap_port_mode {
1643b62393SGovindraj.R 	OMAP_USBHS_PORT_MODE_UNUSED,
1743b62393SGovindraj.R 	OMAP_EHCI_PORT_MODE_PHY,
1843b62393SGovindraj.R 	OMAP_EHCI_PORT_MODE_TLL,
1943b62393SGovindraj.R 	OMAP_EHCI_PORT_MODE_HSIC,
2043b62393SGovindraj.R };
2143b62393SGovindraj.R 
2243b62393SGovindraj.R #define OMAP_HS_USB_PORTS	3
2343b62393SGovindraj.R 
2443b62393SGovindraj.R #define is_ehci_phy_mode(x)	((x) == OMAP_EHCI_PORT_MODE_PHY)
2543b62393SGovindraj.R #define is_ehci_tll_mode(x)	((x) == OMAP_EHCI_PORT_MODE_TLL)
2643b62393SGovindraj.R #define is_ehci_hsic_mode(x)	((x) == OMAP_EHCI_PORT_MODE_HSIC)
2743b62393SGovindraj.R 
2843b62393SGovindraj.R /* Values of UHH_REVISION - Note: these are not given in the TRM */
2943b62393SGovindraj.R #define OMAP_USBHS_REV1					0x00000010 /* OMAP3 */
3043b62393SGovindraj.R #define OMAP_USBHS_REV2					0x50700100 /* OMAP4 */
31d3d037aeSDan Murphy #define OMAP_USBHS_REV2_1				0x50700101 /* OMAP5 */
3243b62393SGovindraj.R 
3343b62393SGovindraj.R /* UHH Register Set */
3443b62393SGovindraj.R #define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN		(1 << 2)
3543b62393SGovindraj.R #define OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN		(1 << 3)
3643b62393SGovindraj.R #define OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN		(1 << 4)
3743b62393SGovindraj.R #define OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN		(1 << 5)
3843b62393SGovindraj.R 
3943b62393SGovindraj.R #define OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS		1
4043b62393SGovindraj.R #define OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS		(1 << 11)
4143b62393SGovindraj.R #define OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS		(1 << 12)
4243b62393SGovindraj.R #define OMAP4_UHH_HOSTCONFIG_APP_START_CLK		(1 << 31)
4343b62393SGovindraj.R 
4443b62393SGovindraj.R #define OMAP_P1_MODE_CLEAR				(3 << 16)
4543b62393SGovindraj.R #define OMAP_P1_MODE_TLL				(1 << 16)
4643b62393SGovindraj.R #define OMAP_P1_MODE_HSIC				(3 << 16)
4743b62393SGovindraj.R #define OMAP_P2_MODE_CLEAR				(3 << 18)
4843b62393SGovindraj.R #define OMAP_P2_MODE_TLL				(1 << 18)
4943b62393SGovindraj.R #define OMAP_P2_MODE_HSIC				(3 << 18)
50d3d037aeSDan Murphy #define OMAP_P3_MODE_CLEAR				(3 << 20)
5143b62393SGovindraj.R #define OMAP_P3_MODE_HSIC				(3 << 20)
5243b62393SGovindraj.R 
5343b62393SGovindraj.R /* EHCI Register Set */
5443b62393SGovindraj.R #define EHCI_INSNREG04_DISABLE_UNSUSPEND		(1 << 5)
5543b62393SGovindraj.R #define EHCI_INSNREG05_ULPI_CONTROL_SHIFT		31
5643b62393SGovindraj.R #define EHCI_INSNREG05_ULPI_PORTSEL_SHIFT		24
5743b62393SGovindraj.R #define EHCI_INSNREG05_ULPI_OPSEL_SHIFT			22
5843b62393SGovindraj.R #define EHCI_INSNREG05_ULPI_REGADD_SHIFT		16
5943b62393SGovindraj.R 
6043b62393SGovindraj.R #define OMAP_REV1_TLL_CHANNEL_COUNT			3
6143b62393SGovindraj.R #define OMAP_REV2_TLL_CHANNEL_COUNT			2
6243b62393SGovindraj.R 
6343b62393SGovindraj.R /* TLL Register Set */
6443b62393SGovindraj.R #define OMAP_TLL_CHANNEL_CONF(num)			(0x004 * num)
6543b62393SGovindraj.R #define OMAP_TLL_CHANNEL_CONF_DRVVBUS			(1 << 16)
6643b62393SGovindraj.R #define OMAP_TLL_CHANNEL_CONF_CHRGVBUS			(1 << 15)
6743b62393SGovindraj.R #define OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF		(1 << 11)
6843b62393SGovindraj.R #define OMAP_TLL_CHANNEL_CONF_CHANMODE_TRANSPARENT_UTMI	(2 << 1)
6943b62393SGovindraj.R #define OMAP_TLL_CHANNEL_CONF_CHANEN			1
7043b62393SGovindraj.R 
7143b62393SGovindraj.R struct omap_usbhs_board_data {
7243b62393SGovindraj.R 	enum usbhs_omap_port_mode port_mode[OMAP_HS_USB_PORTS];
7343b62393SGovindraj.R };
7443b62393SGovindraj.R 
7543b62393SGovindraj.R struct omap_usbtll {
7643b62393SGovindraj.R 	u32 rev;		/* 0x00 */
7743b62393SGovindraj.R 	u32 hwinfo;		/* 0x04 */
7843b62393SGovindraj.R 	u8 reserved1[0x8];
7943b62393SGovindraj.R 	u32 sysc;		/* 0x10 */
8043b62393SGovindraj.R 	u32 syss;		/* 0x14 */
8143b62393SGovindraj.R 	u32 irqst;		/* 0x18 */
8243b62393SGovindraj.R 	u32 irqen;		/* 0x1c */
8343b62393SGovindraj.R 	u8 reserved2[0x10];
8443b62393SGovindraj.R 	u32 shared_conf;	/* 0x30 */
8543b62393SGovindraj.R 	u8 reserved3[0xc];
8643b62393SGovindraj.R 	u32 channel_conf;	/* 0x40 */
8743b62393SGovindraj.R };
8843b62393SGovindraj.R 
8943b62393SGovindraj.R struct omap_uhh {
9043b62393SGovindraj.R 	u32 rev;	/* 0x00 */
9143b62393SGovindraj.R 	u32 hwinfo;	/* 0x04 */
9243b62393SGovindraj.R 	u8 reserved1[0x8];
9343b62393SGovindraj.R 	u32 sysc;	/* 0x10 */
9443b62393SGovindraj.R 	u32 syss;	/* 0x14 */
9543b62393SGovindraj.R 	u8 reserved2[0x28];
9643b62393SGovindraj.R 	u32 hostconfig;	/* 0x40 */
9743b62393SGovindraj.R 	u32 debugcsr;	/* 0x44 */
9843b62393SGovindraj.R };
9943b62393SGovindraj.R 
10043b62393SGovindraj.R struct omap_ehci {
10143b62393SGovindraj.R 	u32 hccapbase;		/* 0x00 */
10243b62393SGovindraj.R 	u32 hcsparams;		/* 0x04 */
10343b62393SGovindraj.R 	u32 hccparams;		/* 0x08 */
10443b62393SGovindraj.R 	u8 reserved1[0x04];
10543b62393SGovindraj.R 	u32 usbcmd;		/* 0x10 */
10643b62393SGovindraj.R 	u32 usbsts;		/* 0x14 */
10743b62393SGovindraj.R 	u32 usbintr;		/* 0x18 */
10843b62393SGovindraj.R 	u32 frindex;		/* 0x1c */
10943b62393SGovindraj.R 	u32 ctrldssegment;	/* 0x20 */
11043b62393SGovindraj.R 	u32 periodiclistbase;	/* 0x24 */
11143b62393SGovindraj.R 	u32 asysnclistaddr;	/* 0x28 */
11243b62393SGovindraj.R 	u8 reserved2[0x24];
11343b62393SGovindraj.R 	u32 configflag;		/* 0x50 */
11443b62393SGovindraj.R 	u32 portsc_i;		/* 0x54 */
11543b62393SGovindraj.R 	u8 reserved3[0x38];
11643b62393SGovindraj.R 	u32 insreg00;		/* 0x90 */
11743b62393SGovindraj.R 	u32 insreg01;		/* 0x94 */
11843b62393SGovindraj.R 	u32 insreg02;		/* 0x98 */
11943b62393SGovindraj.R 	u32 insreg03;		/* 0x9c */
12043b62393SGovindraj.R 	u32 insreg04;		/* 0xa0 */
12143b62393SGovindraj.R 	u32 insreg05_utmi_ulpi;	/* 0xa4 */
12243b62393SGovindraj.R 	u32 insreg06;		/* 0xa8 */
12343b62393SGovindraj.R 	u32 insreg07;		/* 0xac */
12443b62393SGovindraj.R 	u32 insreg08;		/* 0xb0 */
12543b62393SGovindraj.R };
12643b62393SGovindraj.R 
127676ae068SLucas Stach /*
128676ae068SLucas Stach  * FIXME: forward declaration of this structs needed because omap got the
129676ae068SLucas Stach  * ehci implementation backwards. move out ehci_hcd_x from board files
130676ae068SLucas Stach  */
131676ae068SLucas Stach struct ehci_hccr;
132676ae068SLucas Stach struct ehci_hcor;
133676ae068SLucas Stach 
13416297cfbSMateusz Zalega int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata,
135676ae068SLucas Stach 		       struct ehci_hccr **hccr, struct ehci_hcor **hcor);
13643b62393SGovindraj.R int omap_ehci_hcd_stop(void);
13743b62393SGovindraj.R 
13843b62393SGovindraj.R #endif /* _OMAP_COMMON_EHCI_H_ */
139