mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Fix for RUTX platform
This commit is contained in:
parent
ccdb64ad45
commit
59bc57d5d5
7254 changed files with 1810270 additions and 7 deletions
|
@ -0,0 +1,231 @@
|
|||
/*
|
||||
* (C) Copyright 2009
|
||||
* Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __DW_UDC_H
|
||||
#define __DW_UDC_H
|
||||
|
||||
/*
|
||||
* Defines for USBD
|
||||
*
|
||||
* The udc_ahb controller has three AHB slaves:
|
||||
*
|
||||
* 1. THe UDC registers
|
||||
* 2. The plug detect
|
||||
* 3. The RX/TX FIFO
|
||||
*/
|
||||
|
||||
#define MAX_ENDPOINTS 16
|
||||
|
||||
struct udc_endp_regs {
|
||||
u32 endp_cntl;
|
||||
u32 endp_status;
|
||||
u32 endp_bsorfn;
|
||||
u32 endp_maxpacksize;
|
||||
u32 reserved_1;
|
||||
u32 endp_desc_point;
|
||||
u32 reserved_2;
|
||||
u32 write_done;
|
||||
};
|
||||
|
||||
/* Endpoint Control Register definitions */
|
||||
|
||||
#define ENDP_CNTL_STALL 0x00000001
|
||||
#define ENDP_CNTL_FLUSH 0x00000002
|
||||
#define ENDP_CNTL_SNOOP 0x00000004
|
||||
#define ENDP_CNTL_POLL 0x00000008
|
||||
#define ENDP_CNTL_CONTROL 0x00000000
|
||||
#define ENDP_CNTL_ISO 0x00000010
|
||||
#define ENDP_CNTL_BULK 0x00000020
|
||||
#define ENDP_CNTL_INT 0x00000030
|
||||
#define ENDP_CNTL_NAK 0x00000040
|
||||
#define ENDP_CNTL_SNAK 0x00000080
|
||||
#define ENDP_CNTL_CNAK 0x00000100
|
||||
#define ENDP_CNTL_RRDY 0x00000200
|
||||
|
||||
/* Endpoint Satus Register definitions */
|
||||
|
||||
#define ENDP_STATUS_PIDMSK 0x0000000f
|
||||
#define ENDP_STATUS_OUTMSK 0x00000030
|
||||
#define ENDP_STATUS_OUT_NONE 0x00000000
|
||||
#define ENDP_STATUS_OUT_DATA 0x00000010
|
||||
#define ENDP_STATUS_OUT_SETUP 0x00000020
|
||||
#define ENDP_STATUS_IN 0x00000040
|
||||
#define ENDP_STATUS_BUFFNAV 0x00000080
|
||||
#define ENDP_STATUS_FATERR 0x00000100
|
||||
#define ENDP_STATUS_HOSTBUSERR 0x00000200
|
||||
#define ENDP_STATUS_TDC 0x00000400
|
||||
#define ENDP_STATUS_RXPKTMSK 0x003ff800
|
||||
|
||||
struct udc_regs {
|
||||
struct udc_endp_regs in_regs[MAX_ENDPOINTS];
|
||||
struct udc_endp_regs out_regs[MAX_ENDPOINTS];
|
||||
u32 dev_conf;
|
||||
u32 dev_cntl;
|
||||
u32 dev_stat;
|
||||
u32 dev_int;
|
||||
u32 dev_int_mask;
|
||||
u32 endp_int;
|
||||
u32 endp_int_mask;
|
||||
u32 reserved_3[0x39];
|
||||
u32 reserved_4; /* offset 0x500 */
|
||||
u32 udc_endp_reg[MAX_ENDPOINTS];
|
||||
};
|
||||
|
||||
/* Device Configuration Register definitions */
|
||||
|
||||
#define DEV_CONF_HS_SPEED 0x00000000
|
||||
#define DEV_CONF_LS_SPEED 0x00000002
|
||||
#define DEV_CONF_FS_SPEED 0x00000003
|
||||
#define DEV_CONF_REMWAKEUP 0x00000004
|
||||
#define DEV_CONF_SELFPOW 0x00000008
|
||||
#define DEV_CONF_SYNCFRAME 0x00000010
|
||||
#define DEV_CONF_PHYINT_8 0x00000020
|
||||
#define DEV_CONF_PHYINT_16 0x00000000
|
||||
#define DEV_CONF_UTMI_BIDIR 0x00000040
|
||||
#define DEV_CONF_STATUS_STALL 0x00000080
|
||||
|
||||
/* Device Control Register definitions */
|
||||
|
||||
#define DEV_CNTL_RESUME 0x00000001
|
||||
#define DEV_CNTL_TFFLUSH 0x00000002
|
||||
#define DEV_CNTL_RXDMAEN 0x00000004
|
||||
#define DEV_CNTL_TXDMAEN 0x00000008
|
||||
#define DEV_CNTL_DESCRUPD 0x00000010
|
||||
#define DEV_CNTL_BIGEND 0x00000020
|
||||
#define DEV_CNTL_BUFFILL 0x00000040
|
||||
#define DEV_CNTL_TSHLDEN 0x00000080
|
||||
#define DEV_CNTL_BURSTEN 0x00000100
|
||||
#define DEV_CNTL_DMAMODE 0x00000200
|
||||
#define DEV_CNTL_SOFTDISCONNECT 0x00000400
|
||||
#define DEV_CNTL_SCALEDOWN 0x00000800
|
||||
#define DEV_CNTL_BURSTLENU 0x00010000
|
||||
#define DEV_CNTL_BURSTLENMSK 0x00ff0000
|
||||
#define DEV_CNTL_TSHLDLENU 0x01000000
|
||||
#define DEV_CNTL_TSHLDLENMSK 0xff000000
|
||||
|
||||
/* Device Status Register definitions */
|
||||
|
||||
#define DEV_STAT_CFG 0x0000000f
|
||||
#define DEV_STAT_INTF 0x000000f0
|
||||
#define DEV_STAT_ALT 0x00000f00
|
||||
#define DEV_STAT_SUSP 0x00001000
|
||||
#define DEV_STAT_ENUM 0x00006000
|
||||
#define DEV_STAT_ENUM_SPEED_HS 0x00000000
|
||||
#define DEV_STAT_ENUM_SPEED_FS 0x00002000
|
||||
#define DEV_STAT_ENUM_SPEED_LS 0x00004000
|
||||
#define DEV_STAT_RXFIFO_EMPTY 0x00008000
|
||||
#define DEV_STAT_PHY_ERR 0x00010000
|
||||
#define DEV_STAT_TS 0xf0000000
|
||||
|
||||
/* Device Interrupt Register definitions */
|
||||
|
||||
#define DEV_INT_MSK 0x0000007f
|
||||
#define DEV_INT_SETCFG 0x00000001
|
||||
#define DEV_INT_SETINTF 0x00000002
|
||||
#define DEV_INT_INACTIVE 0x00000004
|
||||
#define DEV_INT_USBRESET 0x00000008
|
||||
#define DEV_INT_SUSPUSB 0x00000010
|
||||
#define DEV_INT_SOF 0x00000020
|
||||
#define DEV_INT_ENUM 0x00000040
|
||||
|
||||
/* Endpoint Interrupt Register definitions */
|
||||
|
||||
#define ENDP0_INT_CTRLIN 0x00000001
|
||||
#define ENDP1_INT_BULKIN 0x00000002
|
||||
#define ENDP_INT_NONISOIN_MSK 0x0000AAAA
|
||||
#define ENDP2_INT_BULKIN 0x00000004
|
||||
#define ENDP0_INT_CTRLOUT 0x00010000
|
||||
#define ENDP1_INT_BULKOUT 0x00020000
|
||||
#define ENDP2_INT_BULKOUT 0x00040000
|
||||
#define ENDP_INT_NONISOOUT_MSK 0x55540000
|
||||
|
||||
/* Endpoint Register definitions */
|
||||
#define ENDP_EPDIR_OUT 0x00000000
|
||||
#define ENDP_EPDIR_IN 0x00000010
|
||||
#define ENDP_EPTYPE_CNTL 0x0
|
||||
#define ENDP_EPTYPE_ISO 0x1
|
||||
#define ENDP_EPTYPE_BULK 0x2
|
||||
#define ENDP_EPTYPE_INT 0x3
|
||||
|
||||
/*
|
||||
* Defines for Plug Detect
|
||||
*/
|
||||
|
||||
struct plug_regs {
|
||||
u32 plug_state;
|
||||
u32 plug_pending;
|
||||
};
|
||||
|
||||
/* Plug State Register definitions */
|
||||
#define PLUG_STATUS_EN 0x1
|
||||
#define PLUG_STATUS_ATTACHED 0x2
|
||||
#define PLUG_STATUS_PHY_RESET 0x4
|
||||
#define PLUG_STATUS_PHY_MODE 0x8
|
||||
|
||||
/*
|
||||
* Defines for UDC FIFO (Slave Mode)
|
||||
*/
|
||||
struct udcfifo_regs {
|
||||
u32 *fifo_p;
|
||||
};
|
||||
|
||||
/*
|
||||
* USBTTY definitions
|
||||
*/
|
||||
#define EP0_MAX_PACKET_SIZE 64
|
||||
#define UDC_INT_ENDPOINT 1
|
||||
#define UDC_INT_PACKET_SIZE 64
|
||||
#define UDC_OUT_ENDPOINT 2
|
||||
#define UDC_BULK_PACKET_SIZE 64
|
||||
#define UDC_BULK_HS_PACKET_SIZE 512
|
||||
#define UDC_IN_ENDPOINT 3
|
||||
#define UDC_OUT_PACKET_SIZE 64
|
||||
#define UDC_IN_PACKET_SIZE 64
|
||||
|
||||
/*
|
||||
* UDC endpoint definitions
|
||||
*/
|
||||
#define UDC_EP0 0
|
||||
#define UDC_EP1 1
|
||||
#define UDC_EP2 2
|
||||
#define UDC_EP3 3
|
||||
|
||||
/*
|
||||
* Function declarations
|
||||
*/
|
||||
|
||||
void udc_irq(void);
|
||||
|
||||
void udc_set_nak(int epid);
|
||||
void udc_unset_nak(int epid);
|
||||
int udc_endpoint_write(struct usb_endpoint_instance *endpoint);
|
||||
int udc_init(void);
|
||||
void udc_enable(struct usb_device_instance *device);
|
||||
void udc_disable(void);
|
||||
void udc_connect(void);
|
||||
void udc_disconnect(void);
|
||||
void udc_startup_events(struct usb_device_instance *device);
|
||||
void udc_setup_ep(struct usb_device_instance *device, unsigned int ep,
|
||||
struct usb_endpoint_instance *endpoint);
|
||||
|
||||
#endif /* __DW_UDC_H */
|
262
root/package/utils/sysupgrade-helper/src/include/usb/ehci-fsl.h
Normal file
262
root/package/utils/sysupgrade-helper/src/include/usb/ehci-fsl.h
Normal file
|
@ -0,0 +1,262 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2009 Freescale Semiconductor, Inc
|
||||
* Copyright (c) 2005 MontaVista Software
|
||||
* Copyright (c) 2008 Excito Elektronik i Sk=E5ne AB
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _EHCI_FSL_H
|
||||
#define _EHCI_FSL_H
|
||||
|
||||
#include <asm/processor.h>
|
||||
|
||||
/* Global offsets */
|
||||
#define FSL_SKIP_PCI 0x100
|
||||
|
||||
/* offsets for the non-ehci registers in the FSL SOC USB controller */
|
||||
#define FSL_SOC_USB_ULPIVP 0x170
|
||||
#define FSL_SOC_USB_PORTSC1 0x184
|
||||
#define PORT_PTS_MSK (3 << 30)
|
||||
#define PORT_PTS_UTMI (0 << 30)
|
||||
#define PORT_PTS_ULPI (2 << 30)
|
||||
#define PORT_PTS_SERIAL (3 << 30)
|
||||
#define PORT_PTS_PTW (1 << 28)
|
||||
#define PORT_PFSC (1 << 24) /* Defined on Page 39-44 of the mpc5151 ERM */
|
||||
#define PORT_PTS_PHCD (1 << 23)
|
||||
#define PORT_PP (1 << 12)
|
||||
#define PORT_PR (1 << 8)
|
||||
|
||||
/* USBMODE Register bits */
|
||||
#define CM_IDLE (0 << 0)
|
||||
#define CM_RESERVED (1 << 0)
|
||||
#define CM_DEVICE (2 << 0)
|
||||
#define CM_HOST (3 << 0)
|
||||
#define ES_BE (1 << 2) /* Big Endian Select, default is LE */
|
||||
#define USBMODE_RESERVED_2 (0 << 2)
|
||||
#define SLOM (1 << 3)
|
||||
#define SDIS (1 << 4)
|
||||
|
||||
/* CONTROL Register bits */
|
||||
#define ULPI_INT_EN (1 << 0)
|
||||
#define WU_INT_EN (1 << 1)
|
||||
#define USB_EN (1 << 2)
|
||||
#define LSF_EN (1 << 3)
|
||||
#define KEEP_OTG_ON (1 << 4)
|
||||
#define OTG_PORT (1 << 5)
|
||||
#define REFSEL_12MHZ (0 << 6)
|
||||
#define REFSEL_16MHZ (1 << 6)
|
||||
#define REFSEL_48MHZ (2 << 6)
|
||||
#define PLL_RESET (1 << 8)
|
||||
#define UTMI_PHY_EN (1 << 9)
|
||||
#define PHY_CLK_SEL_UTMI (0 << 10)
|
||||
#define PHY_CLK_SEL_ULPI (1 << 10)
|
||||
#define CLKIN_SEL_USB_CLK (0 << 11)
|
||||
#define CLKIN_SEL_USB_CLK2 (1 << 11)
|
||||
#define CLKIN_SEL_SYS_CLK (2 << 11)
|
||||
#define CLKIN_SEL_SYS_CLK2 (3 << 11)
|
||||
#define RESERVED_18 (0 << 13)
|
||||
#define RESERVED_17 (0 << 14)
|
||||
#define RESERVED_16 (0 << 15)
|
||||
#define WU_INT (1 << 16)
|
||||
#define PHY_CLK_VALID (1 << 17)
|
||||
|
||||
#define FSL_SOC_USB_PORTSC2 0x188
|
||||
|
||||
/* OTG Status Control Register bits */
|
||||
#define FSL_SOC_USB_OTGSC 0x1a4
|
||||
#define CTRL_VBUS_DISCHARGE (0x1<<0)
|
||||
#define CTRL_VBUS_CHARGE (0x1<<1)
|
||||
#define CTRL_OTG_TERMINATION (0x1<<3)
|
||||
#define CTRL_DATA_PULSING (0x1<<4)
|
||||
#define CTRL_ID_PULL_EN (0x1<<5)
|
||||
#define HA_DATA_PULSE (0x1<<6)
|
||||
#define HA_BA (0x1<<7)
|
||||
#define STS_USB_ID (0x1<<8)
|
||||
#define STS_A_VBUS_VALID (0x1<<9)
|
||||
#define STS_A_SESSION_VALID (0x1<<10)
|
||||
#define STS_B_SESSION_VALID (0x1<<11)
|
||||
#define STS_B_SESSION_END (0x1<<12)
|
||||
#define STS_1MS_TOGGLE (0x1<<13)
|
||||
#define STS_DATA_PULSING (0x1<<14)
|
||||
#define INTSTS_USB_ID (0x1<<16)
|
||||
#define INTSTS_A_VBUS_VALID (0x1<<17)
|
||||
#define INTSTS_A_SESSION_VALID (0x1<<18)
|
||||
#define INTSTS_B_SESSION_VALID (0x1<<19)
|
||||
#define INTSTS_B_SESSION_END (0x1<<20)
|
||||
#define INTSTS_1MS (0x1<<21)
|
||||
#define INTSTS_DATA_PULSING (0x1<<22)
|
||||
#define INTR_USB_ID_EN (0x1<<24)
|
||||
#define INTR_A_VBUS_VALID_EN (0x1<<25)
|
||||
#define INTR_A_SESSION_VALID_EN (0x1<<26)
|
||||
#define INTR_B_SESSION_VALID_EN (0x1<<27)
|
||||
#define INTR_B_SESSION_END_EN (0x1<<28)
|
||||
#define INTR_1MS_TIMER_EN (0x1<<29)
|
||||
#define INTR_DATA_PULSING_EN (0x1<<30)
|
||||
#define INTSTS_MASK (0x00ff0000)
|
||||
|
||||
/* USBCMD Bits of interest */
|
||||
#define EHCI_FSL_USBCMD_RST (1 << 1)
|
||||
#define EHCI_FSL_USBCMD_RS (1 << 0)
|
||||
|
||||
#define INTERRUPT_ENABLE_BITS_MASK \
|
||||
(INTR_USB_ID_EN | \
|
||||
INTR_1MS_TIMER_EN | \
|
||||
INTR_A_VBUS_VALID_EN | \
|
||||
INTR_A_SESSION_VALID_EN | \
|
||||
INTR_B_SESSION_VALID_EN | \
|
||||
INTR_B_SESSION_END_EN | \
|
||||
INTR_DATA_PULSING_EN)
|
||||
|
||||
#define INTERRUPT_STATUS_BITS_MASK \
|
||||
(INTSTS_USB_ID | \
|
||||
INTR_1MS_TIMER_EN | \
|
||||
INTSTS_A_VBUS_VALID | \
|
||||
INTSTS_A_SESSION_VALID | \
|
||||
INTSTS_B_SESSION_VALID | \
|
||||
INTSTS_B_SESSION_END | \
|
||||
INTSTS_DATA_PULSING)
|
||||
|
||||
#define FSL_SOC_USB_USBMODE 0x1a8
|
||||
|
||||
#define USBGENCTRL 0x200 /* NOTE: big endian */
|
||||
#define GC_WU_INT_CLR (1 << 5) /* Wakeup int clear */
|
||||
#define GC_ULPI_SEL (1 << 4) /* ULPI i/f select (usb0 only)*/
|
||||
#define GC_PPP (1 << 3) /* Port Power Polarity */
|
||||
#define GC_PFP (1 << 2) /* Power Fault Polarity */
|
||||
#define GC_WU_ULPI_EN (1 << 1) /* Wakeup on ULPI event */
|
||||
#define GC_WU_IE (1 << 1) /* Wakeup interrupt enable */
|
||||
|
||||
#define ISIPHYCTRL 0x204 /* NOTE: big endian */
|
||||
#define PHYCTRL_PHYE (1 << 4) /* On-chip UTMI PHY enable */
|
||||
#define PHYCTRL_BSENH (1 << 3) /* Bit Stuff Enable High */
|
||||
#define PHYCTRL_BSEN (1 << 2) /* Bit Stuff Enable */
|
||||
#define PHYCTRL_LSFE (1 << 1) /* Line State Filter Enable */
|
||||
#define PHYCTRL_PXE (1 << 0) /* PHY oscillator enable */
|
||||
|
||||
#define FSL_SOC_USB_SNOOP1 0x400 /* NOTE: big-endian */
|
||||
#define FSL_SOC_USB_SNOOP2 0x404 /* NOTE: big-endian */
|
||||
#define FSL_SOC_USB_AGECNTTHRSH 0x408 /* NOTE: big-endian */
|
||||
#define FSL_SOC_USB_PRICTRL 0x40c /* NOTE: big-endian */
|
||||
#define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */
|
||||
#define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */
|
||||
#define SNOOP_SIZE_2GB 0x1e
|
||||
|
||||
/* System Clock Control Register */
|
||||
#define MPC83XX_SCCR_USB_MASK 0x00f00000
|
||||
#define MPC83XX_SCCR_USB_DRCM_11 0x00300000
|
||||
#define MPC83XX_SCCR_USB_DRCM_01 0x00100000
|
||||
#define MPC83XX_SCCR_USB_DRCM_10 0x00200000
|
||||
|
||||
#if defined(CONFIG_MPC83xx)
|
||||
#define CONFIG_SYS_FSL_USB_ADDR CONFIG_SYS_MPC83xx_USB_ADDR
|
||||
#elif defined(CONFIG_MPC85xx)
|
||||
#define CONFIG_SYS_FSL_USB_ADDR CONFIG_SYS_MPC85xx_USB_ADDR
|
||||
#elif defined(CONFIG_MPC512X)
|
||||
#define CONFIG_SYS_FSL_USB_ADDR CONFIG_SYS_MPC512x_USB_ADDR
|
||||
#endif
|
||||
|
||||
/*
|
||||
* USB Registers
|
||||
*/
|
||||
struct usb_ehci {
|
||||
u32 id; /* 0x000 - Identification register */
|
||||
u32 hwgeneral; /* 0x004 - General hardware parameters */
|
||||
u32 hwhost; /* 0x008 - Host hardware parameters */
|
||||
u32 hwdevice; /* 0x00C - Device hardware parameters */
|
||||
u32 hwtxbuf; /* 0x010 - TX buffer hardware parameters */
|
||||
u32 hwrxbuf; /* 0x014 - RX buffer hardware parameters */
|
||||
u8 res1[0x68];
|
||||
u32 gptimer0_ld; /* 0x080 - General Purpose Timer 0 load value */
|
||||
u32 gptimer0_ctrl; /* 0x084 - General Purpose Timer 0 control */
|
||||
u32 gptimer1_ld; /* 0x088 - General Purpose Timer 1 load value */
|
||||
u32 gptimer1_ctrl; /* 0x08C - General Purpose Timer 1 control */
|
||||
u32 sbuscfg; /* 0x090 - System Bus Interface Control */
|
||||
u8 res2[0x6C];
|
||||
u8 caplength; /* 0x100 - Capability Register Length */
|
||||
u8 res3[0x1];
|
||||
u16 hciversion; /* 0x102 - Host Interface Version */
|
||||
u32 hcsparams; /* 0x104 - Host Structural Parameters */
|
||||
u32 hccparams; /* 0x108 - Host Capability Parameters */
|
||||
u8 res4[0x14];
|
||||
u32 dciversion; /* 0x120 - Device Interface Version */
|
||||
u32 dciparams; /* 0x124 - Device Controller Params */
|
||||
u8 res5[0x18];
|
||||
u32 usbcmd; /* 0x140 - USB Command */
|
||||
u32 usbsts; /* 0x144 - USB Status */
|
||||
u32 usbintr; /* 0x148 - USB Interrupt Enable */
|
||||
u32 frindex; /* 0x14C - USB Frame Index */
|
||||
u8 res6[0x4];
|
||||
u32 perlistbase; /* 0x154 - Periodic List Base
|
||||
- USB Device Address */
|
||||
u32 ep_list_addr; /* 0x158 - Next Asynchronous List
|
||||
- End Point Address */
|
||||
u8 res7[0x4];
|
||||
u32 burstsize; /* 0x160 - Programmable Burst Size */
|
||||
#define FSL_EHCI_TXPBURST(X) ((X) << 8)
|
||||
#define FSL_EHCI_RXPBURST(X) (X)
|
||||
u32 txfilltuning; /* 0x164 - Host TT Transmit
|
||||
pre-buffer packet tuning */
|
||||
u8 res8[0x8];
|
||||
u32 ulpi_viewpoint; /* 0x170 - ULPI Reister Access */
|
||||
u8 res9[0xc];
|
||||
u32 config_flag; /* 0x180 - Configured Flag Register */
|
||||
u32 portsc; /* 0x184 - Port status/control */
|
||||
u8 res10[0x1C];
|
||||
u32 otgsc; /* 0x1a4 - Oo-The-Go status and control */
|
||||
u32 usbmode; /* 0x1a8 - USB Device Mode */
|
||||
u32 epsetupstat; /* 0x1ac - End Point Setup Status */
|
||||
u32 epprime; /* 0x1b0 - End Point Init Status */
|
||||
u32 epflush; /* 0x1b4 - End Point De-initlialize */
|
||||
u32 epstatus; /* 0x1b8 - End Point Status */
|
||||
u32 epcomplete; /* 0x1bc - End Point Complete */
|
||||
u32 epctrl0; /* 0x1c0 - End Point Control 0 */
|
||||
u32 epctrl1; /* 0x1c4 - End Point Control 1 */
|
||||
u32 epctrl2; /* 0x1c8 - End Point Control 2 */
|
||||
u32 epctrl3; /* 0x1cc - End Point Control 3 */
|
||||
u32 epctrl4; /* 0x1d0 - End Point Control 4 */
|
||||
u32 epctrl5; /* 0x1d4 - End Point Control 5 */
|
||||
u8 res11[0x28];
|
||||
u32 usbgenctrl; /* 0x200 - USB General Control */
|
||||
u32 isiphyctrl; /* 0x204 - On-Chip PHY Control */
|
||||
u8 res12[0x1F8];
|
||||
u32 snoop1; /* 0x400 - Snoop 1 */
|
||||
u32 snoop2; /* 0x404 - Snoop 2 */
|
||||
u32 age_cnt_limit; /* 0x408 - Age Count Threshold */
|
||||
u32 prictrl; /* 0x40c - Priority Control */
|
||||
u32 sictrl; /* 0x410 - System Interface Control */
|
||||
u8 res13[0xEC];
|
||||
u32 control; /* 0x500 - Control */
|
||||
u8 res14[0xafc];
|
||||
};
|
||||
|
||||
/*
|
||||
* For MXC SOCs
|
||||
*/
|
||||
#define MXC_EHCI_POWER_PINS_ENABLED (1 << 5)
|
||||
#define MXC_EHCI_TTL_ENABLED (1 << 6)
|
||||
#define MXC_EHCI_INTERNAL_PHY (1 << 7)
|
||||
|
||||
/* Board-specific initialization */
|
||||
int board_ehci_hcd_init(int port);
|
||||
|
||||
/* CPU-specific abstracted-out IOMUX init */
|
||||
#ifdef CONFIG_MX51
|
||||
void setup_iomux_usb_h1(void);
|
||||
void setup_iomux_usb_h2(void);
|
||||
#endif
|
||||
|
||||
#endif /* _EHCI_FSL_H */
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Samsung Electronics
|
||||
* Lukasz Majewski <l.majewski@samsung.com>
|
||||
*
|
||||
* This is a Linux kernel compatibility layer for USB Gadget
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __LIN_COMPAT_H__
|
||||
#define __LIN_COMPAT_H__
|
||||
|
||||
#include <linux/compat.h>
|
||||
|
||||
/* common */
|
||||
#define spin_lock_init(...)
|
||||
#define spin_lock(...)
|
||||
#define spin_lock_irqsave(lock, flags) do { debug("%lu\n", flags); } while (0)
|
||||
#define spin_unlock(...)
|
||||
#define spin_unlock_irqrestore(lock, flags) do {flags = 0; } while (0)
|
||||
#define disable_irq(...)
|
||||
#define enable_irq(...)
|
||||
|
||||
#define mutex_init(...)
|
||||
#define mutex_lock(...)
|
||||
#define mutex_unlock(...)
|
||||
|
||||
#define GFP_KERNEL 0
|
||||
|
||||
#define IRQ_HANDLED 1
|
||||
|
||||
#define ENOTSUPP 524 /* Operation is not supported */
|
||||
|
||||
#define BITS_PER_BYTE 8
|
||||
#define BITS_TO_LONGS(nr) \
|
||||
DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
|
||||
#define DECLARE_BITMAP(name, bits) \
|
||||
unsigned long name[BITS_TO_LONGS(bits)]
|
||||
|
||||
#define small_const_nbits(nbits) \
|
||||
(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
|
||||
|
||||
static inline void bitmap_zero(unsigned long *dst, int nbits)
|
||||
{
|
||||
if (small_const_nbits(nbits))
|
||||
*dst = 0UL;
|
||||
else {
|
||||
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
||||
memset(dst, 0, len);
|
||||
}
|
||||
}
|
||||
|
||||
#define dma_cache_maint(addr, size, mode) cache_flush()
|
||||
void cache_flush(void);
|
||||
|
||||
#endif /* __LIN_COMPAT_H__ */
|
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
* Copyright (C) 2006 Bryan O'Donoghue, CodeHermit
|
||||
* bodonoghue@codehermit.ie
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <commproc.h>
|
||||
|
||||
/* Mode Register */
|
||||
#define USMOD_EN 0x01
|
||||
#define USMOD_HOST 0x02
|
||||
#define USMOD_TEST 0x04
|
||||
#define USMOD_SFTE 0x08
|
||||
#define USMOD_RESUME 0x40
|
||||
#define USMOD_LSS 0x80
|
||||
|
||||
/* Endpoint Registers */
|
||||
#define USEP_RHS_NORM 0x00
|
||||
#define USEP_RHS_IGNORE 0x01
|
||||
#define USEP_RHS_NAK 0x02
|
||||
#define USEP_RHS_STALL 0x03
|
||||
|
||||
#define USEP_THS_NORM 0x00
|
||||
#define USEP_THS_IGNORE 0x04
|
||||
#define USEP_THS_NAK 0x08
|
||||
#define USEP_THS_STALL 0x0C
|
||||
|
||||
#define USEP_RTE 0x10
|
||||
#define USEP_MF 0x20
|
||||
|
||||
#define USEP_TM_CONTROL 0x00
|
||||
#define USEP_TM_INT 0x100
|
||||
#define USEP_TM_BULK 0x200
|
||||
#define USEP_TM_ISO 0x300
|
||||
|
||||
/* Command Register */
|
||||
#define USCOM_EP0 0x00
|
||||
#define USCOM_EP1 0x01
|
||||
#define USCOM_EP2 0x02
|
||||
#define USCOM_EP3 0x03
|
||||
|
||||
#define USCOM_FLUSH 0x40
|
||||
#define USCOM_STR 0x80
|
||||
|
||||
/* Event Register */
|
||||
#define USB_E_RXB 0x0001
|
||||
#define USB_E_TXB 0x0002
|
||||
#define USB_E_BSY 0x0004
|
||||
#define USB_E_SOF 0x0008
|
||||
#define USB_E_TXE1 0x0010
|
||||
#define USB_E_TXE2 0x0020
|
||||
#define USB_E_TXE3 0x0040
|
||||
#define USB_E_TXE4 0x0080
|
||||
#define USB_TX_ERRMASK (USB_E_TXE1|USB_E_TXE2|USB_E_TXE3|USB_E_TXE4)
|
||||
#define USB_E_IDLE 0x0100
|
||||
#define USB_E_RESET 0x0200
|
||||
|
||||
/* Mask Register */
|
||||
#define USBS_IDLE 0x01
|
||||
|
||||
/* RX Buffer Descriptor */
|
||||
#define RX_BD_OV 0x02
|
||||
#define RX_BD_CR 0x04
|
||||
#define RX_BD_AB 0x08
|
||||
#define RX_BD_NO 0x10
|
||||
#define RX_BD_PID_DATA0 0x00
|
||||
#define RX_BD_PID_DATA1 0x40
|
||||
#define RX_BD_PID_SETUP 0x80
|
||||
#define RX_BD_F 0x400
|
||||
#define RX_BD_L 0x800
|
||||
#define RX_BD_I 0x1000
|
||||
#define RX_BD_W 0x2000
|
||||
#define RX_BD_E 0x8000
|
||||
|
||||
/* Useful masks */
|
||||
#define RX_BD_PID_BITMASK (RX_BD_PID_DATA1 | RX_BD_PID_SETUP)
|
||||
#define STALL_BITMASK (USEP_THS_STALL | USEP_RHS_STALL)
|
||||
#define NAK_BITMASK (USEP_THS_NAK | USEP_RHS_NAK)
|
||||
#define CBD_TX_BITMASK (TX_BD_R | TX_BD_L | TX_BD_TC | TX_BD_I | TX_BD_CNF)
|
||||
|
||||
/* TX Buffer Descriptor */
|
||||
#define TX_BD_UN 0x02
|
||||
#define TX_BD_TO 0x04
|
||||
#define TX_BD_NO_PID 0x00
|
||||
#define TX_BD_PID_DATA0 0x80
|
||||
#define TX_BD_PID_DATA1 0xC0
|
||||
#define TX_BD_CNF 0x200
|
||||
#define TX_BD_TC 0x400
|
||||
#define TX_BD_L 0x800
|
||||
#define TX_BD_I 0x1000
|
||||
#define TX_BD_W 0x2000
|
||||
#define TX_BD_R 0x8000
|
||||
|
||||
/* Implementation specific defines */
|
||||
|
||||
#define EP_MIN_PACKET_SIZE 0x08
|
||||
#define MAX_ENDPOINTS 0x04
|
||||
#define FIFO_SIZE 0x10
|
||||
#define EP_MAX_PKT FIFO_SIZE
|
||||
#define TX_RING_SIZE 0x04
|
||||
#define RX_RING_SIZE 0x06
|
||||
#define USB_MAX_PKT 0x40
|
||||
#define TOGGLE_TX_PID(x) x= ((~x)&0x40)|0x80
|
||||
#define TOGGLE_RX_PID(x) x^= 0x40
|
||||
#define EP_ATTACHED 0x01 /* Endpoint has a urb attached or not */
|
||||
#define EP_SEND_ZLP 0x02 /* Send ZLP y/n ? */
|
||||
|
||||
#define PROFF_USB 0x00000000
|
||||
#define CPM_USB_BASE 0x00000A00
|
||||
|
||||
/* UDC device defines */
|
||||
#define EP0_MAX_PACKET_SIZE EP_MAX_PKT
|
||||
#define UDC_OUT_ENDPOINT 0x02
|
||||
#define UDC_OUT_PACKET_SIZE EP_MIN_PACKET_SIZE
|
||||
#define UDC_IN_ENDPOINT 0x03
|
||||
#define UDC_IN_PACKET_SIZE EP_MIN_PACKET_SIZE
|
||||
#define UDC_INT_ENDPOINT 0x01
|
||||
#define UDC_INT_PACKET_SIZE UDC_IN_PACKET_SIZE
|
||||
#define UDC_BULK_PACKET_SIZE EP_MIN_PACKET_SIZE
|
||||
|
||||
struct mpc8xx_ep {
|
||||
struct urb * urb;
|
||||
unsigned char pid;
|
||||
unsigned char sc;
|
||||
volatile cbd_t * prx;
|
||||
};
|
||||
|
||||
typedef struct mpc8xx_usb{
|
||||
char usmod; /* Mode Register */
|
||||
char usaddr; /* Slave Address Register */
|
||||
char uscom; /* Command Register */
|
||||
char res1; /* Reserved */
|
||||
ushort usep[4];
|
||||
ulong res2; /* Reserved */
|
||||
ushort usber; /* Event Register */
|
||||
ushort res3; /* Reserved */
|
||||
ushort usbmr; /* Mask Register */
|
||||
char res4; /* Reserved */
|
||||
char usbs; /* Status Register */
|
||||
char res5[8]; /* Reserved */
|
||||
}usb_t;
|
||||
|
||||
typedef struct mpc8xx_parameter_ram{
|
||||
ushort ep0ptr; /* Endpoint Pointer Register 0 */
|
||||
ushort ep1ptr; /* Endpoint Pointer Register 1 */
|
||||
ushort ep2ptr; /* Endpoint Pointer Register 2 */
|
||||
ushort ep3ptr; /* Endpoint Pointer Register 3 */
|
||||
uint rstate; /* Receive state */
|
||||
uint rptr; /* Receive internal data pointer */
|
||||
ushort frame_n; /* Frame number */
|
||||
ushort rbcnt; /* Receive byte count */
|
||||
uint rtemp; /* Receive temp cp use only */
|
||||
uint rxusb; /* Rx Data Temp */
|
||||
ushort rxuptr; /* Rx microcode return address temp */
|
||||
}usb_pram_t;
|
||||
|
||||
typedef struct endpoint_parameter_block_pointer{
|
||||
ushort rbase; /* RxBD base address */
|
||||
ushort tbase; /* TxBD base address */
|
||||
char rfcr; /* Rx Function code */
|
||||
char tfcr; /* Tx Function code */
|
||||
ushort mrblr; /* Maximum Receive Buffer Length */
|
||||
ushort rbptr; /* RxBD pointer Next Buffer Descriptor */
|
||||
ushort tbptr; /* TxBD pointer Next Buffer Descriptor */
|
||||
ulong tstate; /* Transmit internal state */
|
||||
ulong tptr; /* Transmit internal data pointer */
|
||||
ushort tcrc; /* Transmit temp CRC */
|
||||
ushort tbcnt; /* Transmit internal bye count */
|
||||
ulong ttemp; /* Tx temp */
|
||||
ushort txuptr; /* Tx microcode return address */
|
||||
ushort res1; /* Reserved */
|
||||
}usb_epb_t;
|
||||
|
||||
typedef enum mpc8xx_udc_state{
|
||||
STATE_NOT_READY,
|
||||
STATE_ERROR,
|
||||
STATE_READY,
|
||||
}mpc8xx_udc_state_t;
|
||||
|
||||
/* Declarations */
|
||||
int udc_init(void);
|
||||
void udc_irq(void);
|
||||
int udc_endpoint_write(struct usb_endpoint_instance *endpoint);
|
||||
void udc_setup_ep(struct usb_device_instance *device, unsigned int ep,
|
||||
struct usb_endpoint_instance *endpoint);
|
||||
void udc_connect(void);
|
||||
void udc_disconnect(void);
|
||||
void udc_enable(struct usb_device_instance *device);
|
||||
void udc_disable(void);
|
||||
void udc_startup_events(struct usb_device_instance *device);
|
||||
|
||||
/* Flow control */
|
||||
void udc_set_nak(int epid);
|
||||
void udc_unset_nak (int epid);
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (c) 2009 Wind River Systems, Inc.
|
||||
* Tom Rix <Tom.Rix@windriver.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef __MUSB_UDC_H__
|
||||
#define __MUSB_UDC_H__
|
||||
|
||||
#include <usbdevice.h>
|
||||
|
||||
/* UDC level routines */
|
||||
void udc_irq(void);
|
||||
void udc_set_nak(int ep_num);
|
||||
void udc_unset_nak(int ep_num);
|
||||
int udc_endpoint_write(struct usb_endpoint_instance *endpoint);
|
||||
void udc_setup_ep(struct usb_device_instance *device, unsigned int id,
|
||||
struct usb_endpoint_instance *endpoint);
|
||||
void udc_connect(void);
|
||||
void udc_disconnect(void);
|
||||
void udc_enable(struct usb_device_instance *device);
|
||||
void udc_disable(void);
|
||||
void udc_startup_events(struct usb_device_instance *device);
|
||||
int udc_init(void);
|
||||
|
||||
/* usbtty */
|
||||
#ifdef CONFIG_USB_TTY
|
||||
|
||||
#define EP0_MAX_PACKET_SIZE 64 /* MUSB_EP0_FIFOSIZE */
|
||||
#define UDC_INT_ENDPOINT 1
|
||||
#define UDC_INT_PACKET_SIZE 64
|
||||
#define UDC_OUT_ENDPOINT 2
|
||||
#define UDC_OUT_PACKET_SIZE 64
|
||||
#define UDC_IN_ENDPOINT 3
|
||||
#define UDC_IN_PACKET_SIZE 64
|
||||
#define UDC_BULK_PACKET_SIZE 64
|
||||
|
||||
#endif /* CONFIG_USB_TTY */
|
||||
|
||||
#endif /* __MUSB_UDC_H__ */
|
151
root/package/utils/sysupgrade-helper/src/include/usb/mv_udc.h
Normal file
151
root/package/utils/sysupgrade-helper/src/include/usb/mv_udc.h
Normal file
|
@ -0,0 +1,151 @@
|
|||
/*
|
||||
* Copyright 2011, Marvell Semiconductor Inc.
|
||||
* Lei Wen <leiwen@marvell.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __MV_UDC_H__
|
||||
#define __MV_UDC_H__
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/errno.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
#include <linux/usb/gadget.h>
|
||||
|
||||
/* Endpoint 0 states */
|
||||
#define EP0_IDLE 0
|
||||
#define EP0_IN_DATA 1
|
||||
#define EP0_OUT_DATA 2
|
||||
#define EP0_XFER_COMPLETE 3
|
||||
|
||||
|
||||
/* Endpoint parameters */
|
||||
#define MAX_ENDPOINTS 4
|
||||
#define EP_MAX_PACKET_SIZE 0x200
|
||||
|
||||
#define EP0_MAX_PACKET_SIZE 64
|
||||
#define UDC_OUT_ENDPOINT 0x02
|
||||
#define UDC_OUT_PACKET_SIZE EP_MAX_PACKET_SIZE
|
||||
#define UDC_IN_ENDPOINT 0x01
|
||||
#define UDC_IN_PACKET_SIZE EP_MAX_PACKET_SIZE
|
||||
#define UDC_INT_ENDPOINT 0x05
|
||||
#define UDC_INT_PACKET_SIZE EP_MAX_PACKET_SIZE
|
||||
#define UDC_BULK_PACKET_SIZE EP_MAX_PACKET_SIZE
|
||||
|
||||
#define NUM_ENDPOINTS 6
|
||||
#define REQ_COUNT 12
|
||||
struct mv_ep {
|
||||
struct usb_ep ep;
|
||||
struct usb_request req;
|
||||
struct list_head queue;
|
||||
const struct usb_endpoint_descriptor *desc;
|
||||
};
|
||||
|
||||
struct mv_udc {
|
||||
u32 pad0[80];
|
||||
#define MICRO_8FRAME 0x8
|
||||
#define USBCMD_ITC(x) (((x > 0xff) ? 0xff : x) << 16)
|
||||
#define USBCMD_FS2 (1 << 15)
|
||||
#define USBCMD_RST (1 << 1)
|
||||
#define USBCMD_RUN (1)
|
||||
u32 usbcmd; /* 0x140 */
|
||||
#define STS_SLI (1 << 8)
|
||||
#define STS_URI (1 << 6)
|
||||
#define STS_PCI (1 << 2)
|
||||
#define STS_UEI (1 << 1)
|
||||
#define STS_UI (1 << 0)
|
||||
u32 usbsts; /* 0x144 */
|
||||
u32 pad1[3];
|
||||
u32 devaddr; /* 0x154 */
|
||||
u32 epinitaddr; /* 0x158 */
|
||||
u32 pad2[10];
|
||||
#define PTS_ENABLE 2
|
||||
#define PTS(x) ((x & 0x3) << 30)
|
||||
#define PFSC (1 << 24)
|
||||
u32 portsc; /* 0x184 */
|
||||
u32 pad3[8];
|
||||
#define USBMODE_DEVICE 2
|
||||
u32 usbmode; /* 0x1a8 */
|
||||
u32 epstat; /* 0x1ac */
|
||||
#define EPT_TX(x) (1 << ((x & 0xffff) + 16))
|
||||
#define EPT_RX(x) (1 << (x & 0xffff))
|
||||
u32 epprime; /* 0x1b0 */
|
||||
u32 epflush; /* 0x1b4 */
|
||||
u32 pad4;
|
||||
u32 epcomp; /* 0x1bc */
|
||||
#define CTRL_TXE (1 << 23)
|
||||
#define CTRL_TXR (1 << 22)
|
||||
#define CTRL_RXE (1 << 7)
|
||||
#define CTRL_RXR (1 << 6)
|
||||
#define CTRL_TXT_BULK (2 << 18)
|
||||
#define CTRL_RXT_BULK (2 << 2)
|
||||
u32 epctrl[16]; /* 0x1c0 */
|
||||
};
|
||||
|
||||
struct mv_drv {
|
||||
struct usb_gadget gadget;
|
||||
struct usb_gadget_driver *driver;
|
||||
struct mv_udc *udc;
|
||||
};
|
||||
|
||||
struct ept_queue_head {
|
||||
unsigned config;
|
||||
unsigned current; /* read-only */
|
||||
|
||||
unsigned next;
|
||||
unsigned info;
|
||||
unsigned page0;
|
||||
unsigned page1;
|
||||
unsigned page2;
|
||||
unsigned page3;
|
||||
unsigned page4;
|
||||
unsigned reserved_0;
|
||||
|
||||
unsigned char setup_data[8];
|
||||
|
||||
unsigned reserved_1;
|
||||
unsigned reserved_2;
|
||||
unsigned reserved_3;
|
||||
unsigned reserved_4;
|
||||
};
|
||||
|
||||
#define CONFIG_MAX_PKT(n) ((n) << 16)
|
||||
#define CONFIG_ZLT (1 << 29) /* stop on zero-len xfer */
|
||||
#define CONFIG_IOS (1 << 15) /* IRQ on setup */
|
||||
|
||||
struct ept_queue_item {
|
||||
unsigned next;
|
||||
unsigned info;
|
||||
unsigned page0;
|
||||
unsigned page1;
|
||||
unsigned page2;
|
||||
unsigned page3;
|
||||
unsigned page4;
|
||||
unsigned reserved;
|
||||
};
|
||||
|
||||
#define TERMINATE 1
|
||||
#define INFO_BYTES(n) ((n) << 16)
|
||||
#define INFO_IOC (1 << 15)
|
||||
#define INFO_ACTIVE (1 << 7)
|
||||
#define INFO_HALTED (1 << 6)
|
||||
#define INFO_BUFFER_ERROR (1 << 5)
|
||||
#define INFO_TX_ERROR (1 << 3)
|
||||
|
||||
extern int usb_lowlevel_init(int index, void **controller);
|
||||
#endif /* __MV_UDC_H__ */
|
|
@ -0,0 +1,193 @@
|
|||
/*
|
||||
* (C) Copyright 2003
|
||||
* Gerry Hamel, geh@ti.com, Texas Instruments
|
||||
*
|
||||
* Based on
|
||||
* linux/drivers/usb/device/bi/omap.h
|
||||
* Register definitions for TI OMAP1510 USB bus interface driver
|
||||
*
|
||||
* Author: MontaVista Software, Inc.
|
||||
* source@mvista.com
|
||||
*
|
||||
* 2003 (c) MontaVista Software, Inc. This file is licensed under
|
||||
* the terms of the GNU General Public License version 2. This program
|
||||
* is licensed "as is" without any warranty of any kind, whether express
|
||||
* or implied.
|
||||
*/
|
||||
|
||||
#ifndef __USBDCORE_OMAP1510_H__
|
||||
#define __USBDCORE_OMAP1510_H__
|
||||
|
||||
|
||||
/*
|
||||
* 13.2 MPU Register Map
|
||||
*/
|
||||
|
||||
/* Table 13-1. USB Function Module Registers (endpoint) */
|
||||
#define UDC_BASE 0xFFFB4000
|
||||
#define UDC_OFFSET(offset) (UDC_BASE + (offset))
|
||||
#define UDC_REV UDC_OFFSET(0x0) /* Revision */
|
||||
#define UDC_EP_NUM UDC_OFFSET(0x4) /* Endpoint selection */
|
||||
#define UDC_DATA UDC_OFFSET(0x08) /* Data */
|
||||
#define UDC_CTRL UDC_OFFSET(0x0C) /* Control */
|
||||
#define UDC_STAT_FLG UDC_OFFSET(0x10) /* Status flag */
|
||||
#define UDC_RXFSTAT UDC_OFFSET(0x14) /* Receive FIFO status */
|
||||
#define UDC_SYSCON1 UDC_OFFSET(0x18) /* System configuration 1 */
|
||||
#define UDC_SYSCON2 UDC_OFFSET(0x1C) /* System configuration 2 */
|
||||
#define UDC_DEVSTAT UDC_OFFSET(0x20) /* Device status */
|
||||
#define UDC_SOF UDC_OFFSET(0x24) /* Start of frame */
|
||||
#define UDC_IRQ_EN UDC_OFFSET(0x28) /* Interrupt enable */
|
||||
#define UDC_DMA_IRQ_EN UDC_OFFSET(0x2C) /* DMA interrupt enable */
|
||||
#define UDC_IRQ_SRC UDC_OFFSET(0x30) /* Interrupt source */
|
||||
#define UDC_EPN_STAT UDC_OFFSET(0x34) /* Endpoint interrupt status */
|
||||
#define UDC_DMAN_STAT UDC_OFFSET(0x3C) /* DMA endpoint interrupt status */
|
||||
|
||||
/* IRQ_EN register fields */
|
||||
#define UDC_Sof_IE (1 << 7) /* Start-of-frame interrupt enabled */
|
||||
#define UDC_EPn_RX_IE (1 << 5) /* Receive endpoint interrupt enabled */
|
||||
#define UDC_EPn_TX_IE (1 << 4) /* Transmit endpoint interrupt enabled */
|
||||
#define UDC_DS_Chg_IE (1 << 3) /* Device state changed interrupt enabled */
|
||||
#define UDC_EP0_IE (1 << 0) /* EP0 transaction interrupt enabled */
|
||||
|
||||
/* IRQ_SRC register fields */
|
||||
#define UDC_TXn_Done (1 << 10) /* Transmit DMA channel n done */
|
||||
#define UDC_RXn_Cnt (1 << 9) /* Receive DMA channel n transactions count */
|
||||
#define UDC_RXn_EOT (1 << 8) /* Receive DMA channel n end of transfer */
|
||||
#define UDC_SOF_Flg (1 << 7) /* Start-of-frame interrupt flag */
|
||||
#define UDC_EPn_RX (1 << 5) /* Endpoint n OUT transaction */
|
||||
#define UDC_EPn_TX (1 << 4) /* Endpoint n IN transaction */
|
||||
#define UDC_DS_Chg (1 << 3) /* Device state changed */
|
||||
#define UDC_Setup (1 << 2) /* Setup transaction */
|
||||
#define UDC_EP0_RX (1 << 1) /* EP0 OUT transaction */
|
||||
#define UDC_EP0_TX (1 << 0) /* EP0 IN transaction */
|
||||
|
||||
/* DEVSTAT register fields, 14.2.9 */
|
||||
#define UDC_R_WK_OK (1 << 6) /* Remote wakeup granted */
|
||||
#define UDC_USB_Reset (1 << 5) /* USB reset signalling is active */
|
||||
#define UDC_SUS (1 << 4) /* Suspended state */
|
||||
#define UDC_CFG (1 << 3) /* Configured state */
|
||||
#define UDC_ADD (1 << 2) /* Addressed state */
|
||||
#define UDC_DEF (1 << 1) /* Default state */
|
||||
#define UDC_ATT (1 << 0) /* Attached state */
|
||||
|
||||
/* SYSCON1 register fields */
|
||||
#define UDC_Cfg_Lock (1 << 8) /* Device configuration locked */
|
||||
#define UDC_Nak_En (1 << 4) /* NAK enable */
|
||||
#define UDC_Self_Pwr (1 << 2) /* Device is self-powered */
|
||||
#define UDC_Soff_Dis (1 << 1) /* Shutoff disabled */
|
||||
#define UDC_Pullup_En (1 << 0) /* External pullup enabled */
|
||||
|
||||
/* SYSCON2 register fields */
|
||||
#define UDC_Rmt_Wkp (1 << 6) /* Remote wakeup */
|
||||
#define UDC_Stall_Cmd (1 << 5) /* Stall endpoint */
|
||||
#define UDC_Dev_Cfg (1 << 3) /* Device configured */
|
||||
#define UDC_Clr_Cfg (1 << 2) /* Clear configured */
|
||||
|
||||
/*
|
||||
* Select and enable endpoints
|
||||
*/
|
||||
|
||||
/* Table 13-1. USB Function Module Registers (endpoint configuration) */
|
||||
#define UDC_EPBASE UDC_OFFSET(0x80) /* Endpoints base address */
|
||||
#define UDC_EP0 UDC_EPBASE /* Control endpoint configuration */
|
||||
#define UDC_EP_RX_BASE UDC_OFFSET(0x84) /* Receive endpoints base address */
|
||||
#define UDC_EP_RX(endpoint) (UDC_EP_RX_BASE + ((endpoint) - 1) * 4)
|
||||
#define UDC_EP_TX_BASE UDC_OFFSET(0xC4) /* Transmit endpoints base address */
|
||||
#define UDC_EP_TX(endpoint) (UDC_EP_TX_BASE + ((endpoint) - 1) * 4)
|
||||
|
||||
/* EP_NUM register fields */
|
||||
#define UDC_Setup_Sel (1 << 6) /* Setup FIFO select */
|
||||
#define UDC_EP_Sel (1 << 5) /* TX/RX FIFO select */
|
||||
#define UDC_EP_Dir (1 << 4) /* Endpoint direction */
|
||||
|
||||
/* CTRL register fields */
|
||||
#define UDC_Clr_Halt (1 << 7) /* Clear halt endpoint */
|
||||
#define UDC_Set_Halt (1 << 6) /* Set halt endpoint */
|
||||
#define UDC_Set_FIFO_En (1 << 2) /* Set FIFO enable */
|
||||
#define UDC_Clr_EP (1 << 1) /* Clear endpoint */
|
||||
#define UDC_Reset_EP (1 << 0) /* Reset endpoint */
|
||||
|
||||
/* STAT_FLG register fields */
|
||||
#define UDC_Miss_In (1 << 14)
|
||||
#define UDC_Data_Flush (1 << 13)
|
||||
#define UDC_ISO_Err (1 << 12)
|
||||
#define UDC_ISO_FIFO_Empty (1 << 9)
|
||||
#define UDC_ISO_FIFO_Full (1 << 8)
|
||||
#define UDC_EP_Halted (1 << 6)
|
||||
#define UDC_STALL (1 << 5)
|
||||
#define UDC_NAK (1 << 4)
|
||||
#define UDC_ACK (1 << 3)
|
||||
#define UDC_FIFO_En (1 << 2)
|
||||
#define UDC_Non_ISO_FIFO_Empty (1 << 1)
|
||||
#define UDC_Non_ISO_FIFO_Full (1 << 0)
|
||||
|
||||
/* EPn_RX register fields */
|
||||
#define UDC_EPn_RX_Valid (1 << 15) /* valid */
|
||||
#define UDC_EPn_RX_Db (1 << 14) /* double-buffer */
|
||||
#define UDC_EPn_RX_Iso (1 << 11) /* isochronous */
|
||||
|
||||
/* EPn_TX register fields */
|
||||
#define UDC_EPn_TX_Valid (1 << 15) /* valid */
|
||||
#define UDC_EPn_TX_Db (1 << 14) /* double-buffer */
|
||||
#define UDC_EPn_TX_Iso (1 << 11) /* isochronous */
|
||||
|
||||
#define EP0_PACKETSIZE 0x40
|
||||
|
||||
/* physical to logical endpoint mapping
|
||||
* Physical endpoints are an index into device->bus->endpoint_array.
|
||||
* Logical endpoints are endpoints 0 to 15 IN and OUT as defined in
|
||||
* the USB specification.
|
||||
*
|
||||
* physical ep logical ep direction endpoint_address
|
||||
* 0 0 IN and OUT 0x00
|
||||
* 1 to 15 1 to 15 OUT 0x01 to 0x0f
|
||||
* 16 to 30 1 to 15 IN 0x81 to 0x8f
|
||||
*/
|
||||
#define PHYS_EP_TO_EP_ADDR(ep) (((ep) < 16) ? (ep) : (((ep) - 15) | 0x80))
|
||||
#define EP_ADDR_TO_PHYS_EP(a) (((a) & 0x80) ? (((a) & ~0x80) + 15) : (a))
|
||||
|
||||
/* MOD_CONF_CTRL_0 bits (FIXME: move to board hardware.h ?) */
|
||||
#define CONF_MOD_USB_W2FC_VBUS_MODE_R (1 << 17)
|
||||
|
||||
/* Other registers (may be) related to USB */
|
||||
|
||||
#define CLOCK_CTRL (0xFFFE0830)
|
||||
#define APLL_CTRL (0xFFFE084C)
|
||||
#define DPLL_CTRL (0xFFFE083C)
|
||||
#define SOFT_REQ (0xFFFE0834)
|
||||
#define STATUS_REQ (0xFFFE0840)
|
||||
|
||||
/* FUNC_MUX_CTRL_0 bits related to USB */
|
||||
#define UDC_VBUS_CTRL (1 << 19)
|
||||
#define UDC_VBUS_MODE (1 << 18)
|
||||
|
||||
/* OMAP Endpoint parameters */
|
||||
#define EP0_MAX_PACKET_SIZE 64
|
||||
#define UDC_OUT_ENDPOINT 2
|
||||
#define UDC_OUT_PACKET_SIZE 64
|
||||
#define UDC_IN_ENDPOINT 1
|
||||
#define UDC_IN_PACKET_SIZE 64
|
||||
#define UDC_INT_ENDPOINT 5
|
||||
#define UDC_INT_PACKET_SIZE 16
|
||||
#define UDC_BULK_PACKET_SIZE 16
|
||||
|
||||
void udc_irq (void);
|
||||
/* Flow control */
|
||||
void udc_set_nak(int epid);
|
||||
void udc_unset_nak (int epid);
|
||||
|
||||
/* Higher level functions for abstracting away from specific device */
|
||||
int udc_endpoint_write(struct usb_endpoint_instance *endpoint);
|
||||
|
||||
int udc_init (void);
|
||||
|
||||
void udc_enable(struct usb_device_instance *device);
|
||||
void udc_disable(void);
|
||||
|
||||
void udc_connect(void);
|
||||
void udc_disconnect(void);
|
||||
|
||||
void udc_startup_events(struct usb_device_instance *device);
|
||||
void udc_setup_ep(struct usb_device_instance *device, unsigned int ep, struct usb_endpoint_instance *endpoint);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* PXA27x register declarations and HCD data structures
|
||||
*
|
||||
* Copyright (C) 2007 Rodolfo Giometti <giometti@linux.it>
|
||||
* Copyright (C) 2007 Eurotech S.p.A. <info@eurotech.it>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __PXA270X_UDC_H__
|
||||
#define __PXA270X_UDC_H__
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
/* Endpoint 0 states */
|
||||
#define EP0_IDLE 0
|
||||
#define EP0_IN_DATA 1
|
||||
#define EP0_OUT_DATA 2
|
||||
#define EP0_XFER_COMPLETE 3
|
||||
|
||||
|
||||
/* Endpoint parameters */
|
||||
#define MAX_ENDPOINTS 4
|
||||
#define EP_MAX_PACKET_SIZE 64
|
||||
|
||||
#define EP0_MAX_PACKET_SIZE 16
|
||||
#define UDC_OUT_ENDPOINT 0x02
|
||||
#define UDC_OUT_PACKET_SIZE EP_MAX_PACKET_SIZE
|
||||
#define UDC_IN_ENDPOINT 0x01
|
||||
#define UDC_IN_PACKET_SIZE EP_MAX_PACKET_SIZE
|
||||
#define UDC_INT_ENDPOINT 0x05
|
||||
#define UDC_INT_PACKET_SIZE EP_MAX_PACKET_SIZE
|
||||
#define UDC_BULK_PACKET_SIZE EP_MAX_PACKET_SIZE
|
||||
|
||||
void udc_irq(void);
|
||||
/* Flow control */
|
||||
void udc_set_nak(int epid);
|
||||
void udc_unset_nak(int epid);
|
||||
|
||||
/* Higher level functions for abstracting away from specific device */
|
||||
int udc_endpoint_write(struct usb_endpoint_instance *endpoint);
|
||||
|
||||
int udc_init(void);
|
||||
|
||||
void udc_enable(struct usb_device_instance *device);
|
||||
void udc_disable(void);
|
||||
|
||||
void udc_connect(void);
|
||||
void udc_disconnect(void);
|
||||
|
||||
void udc_startup_events(struct usb_device_instance *device);
|
||||
void udc_setup_ep(struct usb_device_instance *device,
|
||||
unsigned int ep, struct usb_endpoint_instance *endpoint);
|
||||
|
||||
#endif
|
127
root/package/utils/sysupgrade-helper/src/include/usb/s3c_udc.h
Normal file
127
root/package/utils/sysupgrade-helper/src/include/usb/s3c_udc.h
Normal file
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* drivers/usb/gadget/s3c_udc.h
|
||||
* Samsung S3C on-chip full/high speed USB device controllers
|
||||
* Copyright (C) 2005 for Samsung Electronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __S3C_USB_GADGET
|
||||
#define __S3C_USB_GADGET
|
||||
|
||||
#include <asm/errno.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
#include <linux/usb/gadget.h>
|
||||
#include <linux/list.h>
|
||||
#include <usb/lin_gadget_compat.h>
|
||||
|
||||
#define PHY0_SLEEP (1 << 5)
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* DMA bounce buffer size, 16K is enough even for mass storage */
|
||||
#define DMA_BUFFER_SIZE (4096*4)
|
||||
|
||||
#define EP0_FIFO_SIZE 64
|
||||
#define EP_FIFO_SIZE 512
|
||||
#define EP_FIFO_SIZE2 1024
|
||||
/* ep0-control, ep1in-bulk, ep2out-bulk, ep3in-int */
|
||||
#define S3C_MAX_ENDPOINTS 4
|
||||
#define S3C_MAX_HW_ENDPOINTS 16
|
||||
|
||||
#define WAIT_FOR_SETUP 0
|
||||
#define DATA_STATE_XMIT 1
|
||||
#define DATA_STATE_NEED_ZLP 2
|
||||
#define WAIT_FOR_OUT_STATUS 3
|
||||
#define DATA_STATE_RECV 4
|
||||
#define WAIT_FOR_COMPLETE 5
|
||||
#define WAIT_FOR_OUT_COMPLETE 6
|
||||
#define WAIT_FOR_IN_COMPLETE 7
|
||||
#define WAIT_FOR_NULL_COMPLETE 8
|
||||
|
||||
#define TEST_J_SEL 0x1
|
||||
#define TEST_K_SEL 0x2
|
||||
#define TEST_SE0_NAK_SEL 0x3
|
||||
#define TEST_PACKET_SEL 0x4
|
||||
#define TEST_FORCE_ENABLE_SEL 0x5
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* IO
|
||||
*/
|
||||
|
||||
enum ep_type {
|
||||
ep_control, ep_bulk_in, ep_bulk_out, ep_interrupt
|
||||
};
|
||||
|
||||
struct s3c_ep {
|
||||
struct usb_ep ep;
|
||||
struct s3c_udc *dev;
|
||||
|
||||
const struct usb_endpoint_descriptor *desc;
|
||||
struct list_head queue;
|
||||
unsigned long pio_irqs;
|
||||
int len;
|
||||
void *dma_buf;
|
||||
|
||||
u8 stopped;
|
||||
u8 bEndpointAddress;
|
||||
u8 bmAttributes;
|
||||
|
||||
enum ep_type ep_type;
|
||||
int fifo_num;
|
||||
};
|
||||
|
||||
struct s3c_request {
|
||||
struct usb_request req;
|
||||
struct list_head queue;
|
||||
};
|
||||
|
||||
struct s3c_udc {
|
||||
struct usb_gadget gadget;
|
||||
struct usb_gadget_driver *driver;
|
||||
|
||||
struct s3c_plat_otg_data *pdata;
|
||||
|
||||
void *dma_buf[S3C_MAX_ENDPOINTS+1];
|
||||
dma_addr_t dma_addr[S3C_MAX_ENDPOINTS+1];
|
||||
|
||||
int ep0state;
|
||||
struct s3c_ep ep[S3C_MAX_ENDPOINTS];
|
||||
|
||||
unsigned char usb_address;
|
||||
|
||||
unsigned req_pending:1, req_std:1;
|
||||
};
|
||||
|
||||
extern struct s3c_udc *the_controller;
|
||||
|
||||
#define ep_is_in(EP) (((EP)->bEndpointAddress&USB_DIR_IN) == USB_DIR_IN)
|
||||
#define ep_index(EP) ((EP)->bEndpointAddress&0xF)
|
||||
#define ep_maxpacket(EP) ((EP)->ep.maxpacket)
|
||||
|
||||
extern void otg_phy_init(struct s3c_udc *dev);
|
||||
extern void otg_phy_off(struct s3c_udc *dev);
|
||||
|
||||
extern void s3c_udc_ep_set_stall(struct s3c_ep *ep);
|
||||
extern int s3c_udc_probe(struct s3c_plat_otg_data *pdata);
|
||||
|
||||
struct s3c_plat_otg_data {
|
||||
int (*phy_control)(int on);
|
||||
unsigned int regs_phy;
|
||||
unsigned int regs_otg;
|
||||
unsigned int usb_phy_ctrl;
|
||||
unsigned int usb_flags;
|
||||
};
|
||||
#endif
|
310
root/package/utils/sysupgrade-helper/src/include/usb/ulpi.h
Normal file
310
root/package/utils/sysupgrade-helper/src/include/usb/ulpi.h
Normal file
|
@ -0,0 +1,310 @@
|
|||
/*
|
||||
* Generic ULPI interface.
|
||||
*
|
||||
* Copyright (C) 2011 Jana Rapava <fermata7@gmail.com>
|
||||
* Copyright (C) 2011 CompuLab, Ltd. <www.compulab.co.il>
|
||||
*
|
||||
* Authors: Jana Rapava <fermata7@gmail.com>
|
||||
* Igor Grinberg <grinberg@compulab.co.il>
|
||||
*
|
||||
* Register offsets taken from:
|
||||
* linux/include/linux/usb/ulpi.h
|
||||
*
|
||||
* Original Copyrights follow:
|
||||
* Copyright (C) 2010 Nokia Corporation
|
||||
*
|
||||
* This software is distributed under the terms of the GNU General
|
||||
* Public License ("GPL") as published by the Free Software Foundation,
|
||||
* version 2 of that License.
|
||||
*/
|
||||
|
||||
#ifndef __USB_ULPI_H__
|
||||
#define __USB_ULPI_H__
|
||||
|
||||
#define ULPI_ERROR (1 << 8) /* overflow from any register value */
|
||||
|
||||
#ifndef CONFIG_USB_ULPI_TIMEOUT
|
||||
#define CONFIG_USB_ULPI_TIMEOUT 1000 /* timeout in us */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ulpi view port address and
|
||||
* Port_number that can be passed.
|
||||
* Any additional data to be passed can
|
||||
* be extended from this structure
|
||||
*/
|
||||
struct ulpi_viewport {
|
||||
u32 viewport_addr;
|
||||
u32 port_num;
|
||||
};
|
||||
|
||||
/*
|
||||
* Initialize the ULPI transciever and check the interface integrity.
|
||||
* @ulpi_vp - structure containing ULPI viewport data
|
||||
*
|
||||
* returns 0 on success, ULPI_ERROR on failure.
|
||||
*/
|
||||
int ulpi_init(struct ulpi_viewport *ulpi_vp);
|
||||
|
||||
/*
|
||||
* Select transceiver speed.
|
||||
* @speed - ULPI_FC_HIGH_SPEED, ULPI_FC_FULL_SPEED (default),
|
||||
* ULPI_FC_LOW_SPEED, ULPI_FC_FS4LS
|
||||
* returns 0 on success, ULPI_ERROR on failure.
|
||||
*/
|
||||
int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, unsigned speed);
|
||||
|
||||
/*
|
||||
* Enable/disable VBUS.
|
||||
* @ext_power - external VBUS supply is used (default is false)
|
||||
* @ext_indicator - external VBUS over-current indicator is used
|
||||
*
|
||||
* returns 0 on success, ULPI_ERROR on failure.
|
||||
*/
|
||||
int ulpi_enable_vbus(struct ulpi_viewport *ulpi_vp,
|
||||
int on, int ext_power, int ext_ind);
|
||||
|
||||
/*
|
||||
* Enable/disable pull-down resistors on D+ and D- USB lines.
|
||||
*
|
||||
* returns 0 on success, ULPI_ERROR on failure.
|
||||
*/
|
||||
int ulpi_set_pd(struct ulpi_viewport *ulpi_vp, int enable);
|
||||
|
||||
/*
|
||||
* Select OpMode.
|
||||
* @opmode - ULPI_FC_OPMODE_NORMAL (default), ULPI_FC_OPMODE_NONDRIVING,
|
||||
* ULPI_FC_OPMODE_DISABLE_NRZI, ULPI_FC_OPMODE_NOSYNC_NOEOP
|
||||
*
|
||||
* returns 0 on success, ULPI_ERROR on failure.
|
||||
*/
|
||||
int ulpi_opmode_sel(struct ulpi_viewport *ulpi_vp, unsigned opmode);
|
||||
|
||||
/*
|
||||
* Switch to Serial Mode.
|
||||
* @smode - ULPI_IFACE_6_PIN_SERIAL_MODE or ULPI_IFACE_3_PIN_SERIAL_MODE
|
||||
*
|
||||
* returns 0 on success, ULPI_ERROR on failure.
|
||||
*
|
||||
* Notes:
|
||||
* Switches immediately to Serial Mode.
|
||||
* To return from Serial Mode, STP line needs to be asserted.
|
||||
*/
|
||||
int ulpi_serial_mode_enable(struct ulpi_viewport *ulpi_vp, unsigned smode);
|
||||
|
||||
/*
|
||||
* Put PHY into low power mode.
|
||||
*
|
||||
* returns 0 on success, ULPI_ERROR on failure.
|
||||
*
|
||||
* Notes:
|
||||
* STP line must be driven low to keep the PHY in suspend.
|
||||
* To resume the PHY, STP line needs to be asserted.
|
||||
*/
|
||||
int ulpi_suspend(struct ulpi_viewport *ulpi_vp);
|
||||
|
||||
/*
|
||||
* Reset the transceiver. ULPI interface and registers are not affected.
|
||||
*
|
||||
* returns 0 on success, ULPI_ERROR on failure.
|
||||
*/
|
||||
int ulpi_reset(struct ulpi_viewport *ulpi_vp);
|
||||
|
||||
|
||||
/* ULPI access methods below must be implemented for each ULPI viewport. */
|
||||
|
||||
/*
|
||||
* Write to the ULPI PHY register via the viewport.
|
||||
* @reg - the ULPI register (one of the fields in struct ulpi_regs).
|
||||
* @value - the value - only 8 lower bits are used, others ignored.
|
||||
*
|
||||
* returns 0 on success, ULPI_ERROR on failure.
|
||||
*/
|
||||
int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value);
|
||||
|
||||
/*
|
||||
* Read the ULPI PHY register content via the viewport.
|
||||
* @reg - the ULPI register (one of the fields in struct ulpi_regs).
|
||||
*
|
||||
* returns register content on success, ULPI_ERROR on failure.
|
||||
*/
|
||||
u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg);
|
||||
|
||||
/*
|
||||
* Wait for the reset to complete.
|
||||
* The Link must not attempt to access the PHY until the reset has
|
||||
* completed and DIR line is de-asserted.
|
||||
*/
|
||||
int ulpi_reset_wait(struct ulpi_viewport *ulpi_vp);
|
||||
|
||||
/* Access Extended Register Set (indicator) */
|
||||
#define ACCESS_EXT_REGS_OFFSET 0x2f /* read-write */
|
||||
/* Vendor-specific */
|
||||
#define VENDOR_SPEC_OFFSET 0x30
|
||||
|
||||
/*
|
||||
* Extended Register Set
|
||||
*
|
||||
* Addresses 0x00-0x3F map directly to Immediate Register Set.
|
||||
* Addresses 0x40-0x7F are reserved.
|
||||
* Addresses 0x80-0xff are vendor-specific.
|
||||
*/
|
||||
#define EXT_VENDOR_SPEC_OFFSET 0x80
|
||||
|
||||
/* ULPI registers, bits and offsets definitions */
|
||||
struct ulpi_regs {
|
||||
/* Vendor ID and Product ID: 0x00 - 0x03 Read-only */
|
||||
u8 vendor_id_low;
|
||||
u8 vendor_id_high;
|
||||
u8 product_id_low;
|
||||
u8 product_id_high;
|
||||
/* Function Control: 0x04 - 0x06 Read */
|
||||
u8 function_ctrl; /* 0x04 Write */
|
||||
u8 function_ctrl_set; /* 0x05 Set */
|
||||
u8 function_ctrl_clear; /* 0x06 Clear */
|
||||
/* Interface Control: 0x07 - 0x09 Read */
|
||||
u8 iface_ctrl; /* 0x07 Write */
|
||||
u8 iface_ctrl_set; /* 0x08 Set */
|
||||
u8 iface_ctrl_clear; /* 0x09 Clear */
|
||||
/* OTG Control: 0x0A - 0x0C Read */
|
||||
u8 otg_ctrl; /* 0x0A Write */
|
||||
u8 otg_ctrl_set; /* 0x0B Set */
|
||||
u8 otg_ctrl_clear; /* 0x0C Clear */
|
||||
/* USB Interrupt Enable Rising: 0x0D - 0x0F Read */
|
||||
u8 usb_ie_rising; /* 0x0D Write */
|
||||
u8 usb_ie_rising_set; /* 0x0E Set */
|
||||
u8 usb_ie_rising_clear; /* 0x0F Clear */
|
||||
/* USB Interrupt Enable Falling: 0x10 - 0x12 Read */
|
||||
u8 usb_ie_falling; /* 0x10 Write */
|
||||
u8 usb_ie_falling_set; /* 0x11 Set */
|
||||
u8 usb_ie_falling_clear; /* 0x12 Clear */
|
||||
/* USB Interrupt Status: 0x13 Read-only */
|
||||
u8 usb_int_status;
|
||||
/* USB Interrupt Latch: 0x14 Read-only with auto-clear */
|
||||
u8 usb_int_latch;
|
||||
/* Debug: 0x15 Read-only */
|
||||
u8 debug;
|
||||
/* Scratch Register: 0x16 - 0x18 Read */
|
||||
u8 scratch; /* 0x16 Write */
|
||||
u8 scratch_set; /* 0x17 Set */
|
||||
u8 scratch_clear; /* 0x18 Clear */
|
||||
/*
|
||||
* Optional Carkit registers:
|
||||
* Carkit Control: 0x19 - 0x1B Read
|
||||
*/
|
||||
u8 carkit_ctrl; /* 0x19 Write */
|
||||
u8 carkit_ctrl_set; /* 0x1A Set */
|
||||
u8 carkit_ctrl_clear; /* 0x1B Clear */
|
||||
/* Carkit Interrupt Delay: 0x1C Read, Write */
|
||||
u8 carkit_int_delay;
|
||||
/* Carkit Interrupt Enable: 0x1D - 0x1F Read */
|
||||
u8 carkit_ie; /* 0x1D Write */
|
||||
u8 carkit_ie_set; /* 0x1E Set */
|
||||
u8 carkit_ie_clear; /* 0x1F Clear */
|
||||
/* Carkit Interrupt Status: 0x20 Read-only */
|
||||
u8 carkit_int_status;
|
||||
/* Carkit Interrupt Latch: 0x21 Read-only with auto-clear */
|
||||
u8 carkit_int_latch;
|
||||
/* Carkit Pulse Control: 0x22 - 0x24 Read */
|
||||
u8 carkit_pulse_ctrl; /* 0x22 Write */
|
||||
u8 carkit_pulse_ctrl_set; /* 0x23 Set */
|
||||
u8 carkit_pulse_ctrl_clear; /* 0x24 Clear */
|
||||
/*
|
||||
* Other optional registers:
|
||||
* Transmit Positive Width: 0x25 Read, Write
|
||||
*/
|
||||
u8 transmit_pos_width;
|
||||
/* Transmit Negative Width: 0x26 Read, Write */
|
||||
u8 transmit_neg_width;
|
||||
/* Receive Polarity Recovery: 0x27 Read, Write */
|
||||
u8 recv_pol_recovery;
|
||||
/*
|
||||
* Addresses 0x28 - 0x2E are reserved, so we use offsets
|
||||
* for immediate registers with higher addresses
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
* Register Bits
|
||||
*/
|
||||
|
||||
/* Function Control */
|
||||
#define ULPI_FC_XCVRSEL_MASK (3 << 0)
|
||||
#define ULPI_FC_HIGH_SPEED (0 << 0)
|
||||
#define ULPI_FC_FULL_SPEED (1 << 0)
|
||||
#define ULPI_FC_LOW_SPEED (2 << 0)
|
||||
#define ULPI_FC_FS4LS (3 << 0)
|
||||
#define ULPI_FC_TERMSELECT (1 << 2)
|
||||
#define ULPI_FC_OPMODE_MASK (3 << 3)
|
||||
#define ULPI_FC_OPMODE_NORMAL (0 << 3)
|
||||
#define ULPI_FC_OPMODE_NONDRIVING (1 << 3)
|
||||
#define ULPI_FC_OPMODE_DISABLE_NRZI (2 << 3)
|
||||
#define ULPI_FC_OPMODE_NOSYNC_NOEOP (3 << 3)
|
||||
#define ULPI_FC_RESET (1 << 5)
|
||||
#define ULPI_FC_SUSPENDM (1 << 6)
|
||||
|
||||
/* Interface Control */
|
||||
#define ULPI_IFACE_6_PIN_SERIAL_MODE (1 << 0)
|
||||
#define ULPI_IFACE_3_PIN_SERIAL_MODE (1 << 1)
|
||||
#define ULPI_IFACE_CARKITMODE (1 << 2)
|
||||
#define ULPI_IFACE_CLOCKSUSPENDM (1 << 3)
|
||||
#define ULPI_IFACE_AUTORESUME (1 << 4)
|
||||
#define ULPI_IFACE_EXTVBUS_COMPLEMENT (1 << 5)
|
||||
#define ULPI_IFACE_PASSTHRU (1 << 6)
|
||||
#define ULPI_IFACE_PROTECT_IFC_DISABLE (1 << 7)
|
||||
|
||||
/* OTG Control */
|
||||
#define ULPI_OTG_ID_PULLUP (1 << 0)
|
||||
#define ULPI_OTG_DP_PULLDOWN (1 << 1)
|
||||
#define ULPI_OTG_DM_PULLDOWN (1 << 2)
|
||||
#define ULPI_OTG_DISCHRGVBUS (1 << 3)
|
||||
#define ULPI_OTG_CHRGVBUS (1 << 4)
|
||||
#define ULPI_OTG_DRVVBUS (1 << 5)
|
||||
#define ULPI_OTG_DRVVBUS_EXT (1 << 6)
|
||||
#define ULPI_OTG_EXTVBUSIND (1 << 7)
|
||||
|
||||
/*
|
||||
* USB Interrupt Enable Rising,
|
||||
* USB Interrupt Enable Falling,
|
||||
* USB Interrupt Status and
|
||||
* USB Interrupt Latch
|
||||
*/
|
||||
#define ULPI_INT_HOST_DISCONNECT (1 << 0)
|
||||
#define ULPI_INT_VBUS_VALID (1 << 1)
|
||||
#define ULPI_INT_SESS_VALID (1 << 2)
|
||||
#define ULPI_INT_SESS_END (1 << 3)
|
||||
#define ULPI_INT_IDGRD (1 << 4)
|
||||
|
||||
/* Debug */
|
||||
#define ULPI_DEBUG_LINESTATE0 (1 << 0)
|
||||
#define ULPI_DEBUG_LINESTATE1 (1 << 1)
|
||||
|
||||
/* Carkit Control */
|
||||
#define ULPI_CARKIT_CTRL_CARKITPWR (1 << 0)
|
||||
#define ULPI_CARKIT_CTRL_IDGNDDRV (1 << 1)
|
||||
#define ULPI_CARKIT_CTRL_TXDEN (1 << 2)
|
||||
#define ULPI_CARKIT_CTRL_RXDEN (1 << 3)
|
||||
#define ULPI_CARKIT_CTRL_SPKLEFTEN (1 << 4)
|
||||
#define ULPI_CARKIT_CTRL_SPKRIGHTEN (1 << 5)
|
||||
#define ULPI_CARKIT_CTRL_MICEN (1 << 6)
|
||||
|
||||
/* Carkit Interrupt Enable */
|
||||
#define ULPI_CARKIT_INT_EN_IDFLOAT_RISE (1 << 0)
|
||||
#define ULPI_CARKIT_INT_EN_IDFLOAT_FALL (1 << 1)
|
||||
#define ULPI_CARKIT_INT_EN_CARINTDET (1 << 2)
|
||||
#define ULPI_CARKIT_INT_EN_DP_RISE (1 << 3)
|
||||
#define ULPI_CARKIT_INT_EN_DP_FALL (1 << 4)
|
||||
|
||||
/* Carkit Interrupt Status and Latch */
|
||||
#define ULPI_CARKIT_INT_IDFLOAT (1 << 0)
|
||||
#define ULPI_CARKIT_INT_CARINTDET (1 << 1)
|
||||
#define ULPI_CARKIT_INT_DP (1 << 2)
|
||||
|
||||
/* Carkit Pulse Control*/
|
||||
#define ULPI_CARKIT_PLS_CTRL_TXPLSEN (1 << 0)
|
||||
#define ULPI_CARKIT_PLS_CTRL_RXPLSEN (1 << 1)
|
||||
#define ULPI_CARKIT_PLS_CTRL_SPKRLEFT_BIASEN (1 << 2)
|
||||
#define ULPI_CARKIT_PLS_CTRL_SPKRRIGHT_BIASEN (1 << 3)
|
||||
|
||||
|
||||
#endif /* __USB_ULPI_H__ */
|
Loading…
Add table
Add a link
Reference in a new issue