u32 num, buf_type;
u32 data, last_ram_adr, use_ram_size;
- PT_EP_REGS p_ep_regs;
+ struct ep_regs *p_ep_regs;
last_ram_adr = (D_RAM_SIZE_CTRL / sizeof(u32)) * 2;
use_ram_size = 0;
{
u32 num;
u32 data;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
if (udc->vbus_active == 0)
return; /* VBUS OFF */
/* Abort DMA */
static void _nbu2ss_ep_dma_abort(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep)
{
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
_nbu2ss_bitclr(&preg->EP_DCR[ep->epnum-1].EP_DCR1, DCR1_EPn_REQEN);
mdelay(DMA_DISABLE_TIME); /* DCR1_EPn_REQEN Clear */
{
u32 data;
u32 num;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
if (length >= sizeof(u32))
return;
u32 i;
int nret = 0;
u32 iWordLength = 0;
- USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf;
+ union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
/*------------------------------------------------------------*/
/* Read Length */
{
u32 i;
u32 iReadSize = 0;
- USB_REG_ACCESS Temp32;
- USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf;
+ union usb_reg_access Temp32;
+ union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
if ((0 < length) && (length < sizeof(u32))) {
Temp32.dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
u32 iMaxLength = EP0_PACKETSIZE;
u32 iWordLength = 0;
u32 iWriteLength = 0;
- USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf;
+ union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
/*------------------------------------------------------------*/
/* Transfer Length */
static int EP0_in_OverBytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 iRemainSize)
{
u32 i;
- USB_REG_ACCESS Temp32;
- USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf;
+ union usb_reg_access Temp32;
+ union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
if ((0 < iRemainSize) && (iRemainSize < sizeof(u32))) {
for (i = 0 ; i < iRemainSize ; i++)
u32 burst = 1;
u32 data;
int result = -EINVAL;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
if (req->dma_flag)
return 1; /* DMA is forwarded */
u32 i;
u32 data;
u32 iWordLength;
- USB_REG_ACCESS Temp32;
- USB_REG_ACCESS *pBuf32;
+ union usb_reg_access Temp32;
+ union usb_reg_access *pBuf32;
int result = 0;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
if (req->dma_flag)
return 1; /* DMA is forwarded */
return 0;
pBuffer = (u8 *)req->req.buf;
- pBuf32 = (USB_REG_ACCESS *)(pBuffer + req->req.actual);
+ pBuf32 = (union usb_reg_access *)(pBuffer + req->req.actual);
iWordLength = length / sizeof(u32);
if (iWordLength > 0) {
u32 num;
u32 iRecvLength;
int result = 1;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
if (ep->epnum == 0)
return -EINVAL;
u32 iWriteLength;
u32 data;
int result = -EINVAL;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
if (req->dma_flag)
return 1; /* DMA is forwarded */
u32 i;
u32 data;
u32 iWordLength;
- USB_REG_ACCESS Temp32;
- USB_REG_ACCESS *pBuf32 = NULL;
+ union usb_reg_access Temp32;
+ union usb_reg_access *pBuf32 = NULL;
int result = 0;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
if (req->dma_flag)
return 1; /* DMA is forwarded */
if (length > 0) {
pBuffer = (u8 *)req->req.buf;
- pBuf32 = (USB_REG_ACCESS *)(pBuffer + req->req.actual);
+ pBuf32 = (union usb_reg_access *)(pBuffer + req->req.actual);
iWordLength = length / sizeof(u32);
if (iWordLength > 0) {
u8 num, epnum;
u32 data;
struct nbu2ss_ep *ep;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
if ((ep_adrs == 0) || (ep_adrs == 0x80)) {
if (bstall) {
{
u8 epnum;
u32 data = 0, bit_data;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
epnum = ep_adrs & ~USB_ENDPOINT_DIR_MASK;
if (epnum == 0) {
u32 regdata;
int limit_cnt = 0;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
if (ep->direct == USB_DIR_IN) {
for (limit_cnt = 0
int result = 0;
u32 status;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
if (req->dma_flag)
return; /* DMA is forwarded */
u32 num;
u32 dmacnt, ep_dmacnt;
u32 mpkt;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
num = ep->epnum - 1;
/*-------------------------------------------------------------------------*/
static void _nbu2ss_fifo_flush(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep)
{
- PT_FC_REGS p = udc->p_regs;
+ struct fc_regs *p = udc->p_regs;
if (udc->vbus_active == 0)
return;
u32 epnum, int_bit;
struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc;
- PT_FC_REGS preg = udc->p_regs;
+ struct fc_regs *preg = udc->p_regs;
if (gpio_get_value(VBUS_VALUE) == 0) {
_nbu2ss_writel(&preg->USB_INT_STA, ~USB_INT_STA_RW);
struct nbu2ss_ep *ep;
struct nbu2ss_udc *udc;
unsigned long flags;
- PT_FC_REGS preg;
+ struct fc_regs *preg;
/* INFO("=== %s()\n", __func__); */
0, driver_name, udc);
/* IO Memory */
- udc->p_regs = (PT_FC_REGS)mmio_base;
+ udc->p_regs = (struct fc_regs *)mmio_base;
/* USB Function Controller Interrupt */
if (status != 0) {
/*===========================================================================*/
/* Struct */
-/*------- T_EP_REGS */
-typedef struct _T_EP_REGS {
+/*------- ep_regs */
+struct ep_regs {
u32 EP_CONTROL; /* EP Control */
u32 EP_STATUS; /* EP Status */
u32 EP_INT_ENA; /* EP Interrupt Enable */
u32 EP_LEN_DCNT; /* EP Length & DMA count */
u32 EP_READ; /* EP Read */
u32 EP_WRITE; /* EP Write */
-} T_EP_REGS, *PT_EP_REGS;
+};
-/*------- T_EP_DCR */
-typedef struct _T_EP_DCR {
+/*------- ep_dcr */
+struct ep_dcr {
u32 EP_DCR1; /* EP_DCR1 */
u32 EP_DCR2; /* EP_DCR2 */
u32 EP_TADR; /* EP_TADR */
u32 Reserved; /* Reserved */
-} T_EP_DCR, *PT_EP_DCR;
+};
/*------- Function Registers */
-typedef struct _T_FC_REGS {
+struct fc_regs {
u32 USB_CONTROL; /* (0x0000) USB Control */
u32 USB_STATUS; /* (0x0004) USB Status */
u32 USB_ADDRESS; /* (0x0008) USB Address */
u32 EP0_READ; /* (0x0038) EP0 Read */
u32 EP0_WRITE; /* (0x003C) EP0 Write */
- T_EP_REGS EP_REGS[REG_EP_NUM]; /* Endpoint Register */
+ struct ep_regs EP_REGS[REG_EP_NUM]; /* Endpoint Register */
u8 Reserved220[0x1000-0x220]; /* (0x0220:0x0FFF) Reserved */
u8 Reserved1028[0x110-0x28]; /* (0x1028:0x110F) Reserved */
- T_EP_DCR EP_DCR[REG_EP_NUM]; /* */
+ struct ep_dcr EP_DCR[REG_EP_NUM]; /* */
u8 Reserved1200[0x1000-0x200]; /* Reserved */
-
-} __aligned(32) T_FC_REGS, *PT_FC_REGS;
+} __aligned(32);
u32 curr_config; /* Current Configuration Number */
- PT_FC_REGS p_regs;
+ struct fc_regs *p_regs;
};
/* USB register access structure */
-typedef volatile union {
+union usb_reg_access {
struct {
unsigned char DATA[4];
} byte;
unsigned int dw;
-} USB_REG_ACCESS;
+};
/*-------------------------------------------------------------------------*/
#define ERR(stuff...) printk(KERN_ERR "udc: " stuff)