|
|
@@ -37,7 +37,7 @@
|
|
|
#include <linux/usb/phy.h>
|
|
|
#include <linux/platform_data/s3c-hsotg.h>
|
|
|
|
|
|
-#include "s3c-hsotg.h"
|
|
|
+#include "hw.h"
|
|
|
|
|
|
static const char * const s3c_hsotg_supply_names[] = {
|
|
|
"vusb_d", /* digital USB supply, 1.2V */
|
|
|
@@ -340,9 +340,8 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
|
|
|
/* set FIFO sizes to 2048/1024 */
|
|
|
|
|
|
writel(2048, hsotg->regs + GRXFSIZ);
|
|
|
- writel(GNPTXFSIZ_NPTxFStAddr(2048) |
|
|
|
- GNPTXFSIZ_NPTxFDep(1024),
|
|
|
- hsotg->regs + GNPTXFSIZ);
|
|
|
+ writel((2048 << FIFOSIZE_STARTADDR_SHIFT) |
|
|
|
+ (1024 << FIFOSIZE_DEPTH_SHIFT), hsotg->regs + GNPTXFSIZ);
|
|
|
|
|
|
/*
|
|
|
* arange all the rest of the TX FIFOs, as some versions of this
|
|
|
@@ -362,10 +361,10 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
|
|
|
|
|
|
for (ep = 1; ep <= 15; ep++) {
|
|
|
val = addr;
|
|
|
- val |= size << DPTXFSIZn_DPTxFSize_SHIFT;
|
|
|
+ val |= size << FIFOSIZE_DEPTH_SHIFT;
|
|
|
addr += size;
|
|
|
|
|
|
- writel(val, hsotg->regs + DPTXFSIZn(ep));
|
|
|
+ writel(val, hsotg->regs + DPTXFSIZN(ep));
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
@@ -373,15 +372,15 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
|
|
|
* all fifos are flushed before continuing
|
|
|
*/
|
|
|
|
|
|
- writel(GRSTCTL_TxFNum(0x10) | GRSTCTL_TxFFlsh |
|
|
|
- GRSTCTL_RxFFlsh, hsotg->regs + GRSTCTL);
|
|
|
+ writel(GRSTCTL_TXFNUM(0x10) | GRSTCTL_TXFFLSH |
|
|
|
+ GRSTCTL_RXFFLSH, hsotg->regs + GRSTCTL);
|
|
|
|
|
|
/* wait until the fifos are both flushed */
|
|
|
timeout = 100;
|
|
|
while (1) {
|
|
|
val = readl(hsotg->regs + GRSTCTL);
|
|
|
|
|
|
- if ((val & (GRSTCTL_TxFFlsh | GRSTCTL_RxFFlsh)) == 0)
|
|
|
+ if ((val & (GRSTCTL_TXFFLSH | GRSTCTL_RXFFLSH)) == 0)
|
|
|
break;
|
|
|
|
|
|
if (--timeout == 0) {
|
|
|
@@ -495,14 +494,14 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
|
|
|
* how much data is left in the fifo.
|
|
|
*/
|
|
|
|
|
|
- size_left = DxEPTSIZ_XferSize_GET(epsize);
|
|
|
+ size_left = DXEPTSIZ_XFERSIZE_GET(epsize);
|
|
|
|
|
|
/*
|
|
|
* if shared fifo, we cannot write anything until the
|
|
|
* previous data has been completely sent.
|
|
|
*/
|
|
|
if (hs_ep->fifo_load != 0) {
|
|
|
- s3c_hsotg_en_gsint(hsotg, GINTSTS_PTxFEmp);
|
|
|
+ s3c_hsotg_en_gsint(hsotg, GINTSTS_PTXFEMP);
|
|
|
return -ENOSPC;
|
|
|
}
|
|
|
|
|
|
@@ -523,7 +522,7 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
|
|
|
__func__, can_write);
|
|
|
|
|
|
if (can_write <= 0) {
|
|
|
- s3c_hsotg_en_gsint(hsotg, GINTSTS_PTxFEmp);
|
|
|
+ s3c_hsotg_en_gsint(hsotg, GINTSTS_PTXFEMP);
|
|
|
return -ENOSPC;
|
|
|
}
|
|
|
} else if (hsotg->dedicated_fifos && hs_ep->index != 0) {
|
|
|
@@ -532,16 +531,16 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
|
|
|
can_write &= 0xffff;
|
|
|
can_write *= 4;
|
|
|
} else {
|
|
|
- if (GNPTXSTS_NPTxQSpcAvail_GET(gnptxsts) == 0) {
|
|
|
+ if (GNPTXSTS_NP_TXQ_SPC_AVAIL_GET(gnptxsts) == 0) {
|
|
|
dev_dbg(hsotg->dev,
|
|
|
"%s: no queue slots available (0x%08x)\n",
|
|
|
__func__, gnptxsts);
|
|
|
|
|
|
- s3c_hsotg_en_gsint(hsotg, GINTSTS_NPTxFEmp);
|
|
|
+ s3c_hsotg_en_gsint(hsotg, GINTSTS_NPTXFEMP);
|
|
|
return -ENOSPC;
|
|
|
}
|
|
|
|
|
|
- can_write = GNPTXSTS_NPTxFSpcAvail_GET(gnptxsts);
|
|
|
+ can_write = GNPTXSTS_NP_TXF_SPC_AVAIL_GET(gnptxsts);
|
|
|
can_write *= 4; /* fifo size is in 32bit quantities. */
|
|
|
}
|
|
|
|
|
|
@@ -569,8 +568,8 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
|
|
|
/* it's needed only when we do not use dedicated fifos */
|
|
|
if (!hsotg->dedicated_fifos)
|
|
|
s3c_hsotg_en_gsint(hsotg,
|
|
|
- periodic ? GINTSTS_PTxFEmp :
|
|
|
- GINTSTS_NPTxFEmp);
|
|
|
+ periodic ? GINTSTS_PTXFEMP :
|
|
|
+ GINTSTS_NPTXFEMP);
|
|
|
}
|
|
|
|
|
|
/* see if we can write data */
|
|
|
@@ -598,8 +597,8 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg,
|
|
|
/* it's needed only when we do not use dedicated fifos */
|
|
|
if (!hsotg->dedicated_fifos)
|
|
|
s3c_hsotg_en_gsint(hsotg,
|
|
|
- periodic ? GINTSTS_PTxFEmp :
|
|
|
- GINTSTS_NPTxFEmp);
|
|
|
+ periodic ? GINTSTS_PTXFEMP :
|
|
|
+ GINTSTS_NPTXFEMP);
|
|
|
}
|
|
|
|
|
|
dev_dbg(hsotg->dev, "write %d/%d, can_write %d, done %d\n",
|
|
|
@@ -636,12 +635,12 @@ static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep)
|
|
|
unsigned maxpkt;
|
|
|
|
|
|
if (index != 0) {
|
|
|
- maxsize = DxEPTSIZ_XferSize_LIMIT + 1;
|
|
|
- maxpkt = DxEPTSIZ_PktCnt_LIMIT + 1;
|
|
|
+ maxsize = DXEPTSIZ_XFERSIZE_LIMIT + 1;
|
|
|
+ maxpkt = DXEPTSIZ_PKTCNT_LIMIT + 1;
|
|
|
} else {
|
|
|
maxsize = 64+64;
|
|
|
if (hs_ep->dir_in)
|
|
|
- maxpkt = DIEPTSIZ0_PktCnt_LIMIT + 1;
|
|
|
+ maxpkt = DIEPTSIZ0_PKTCNT_LIMIT + 1;
|
|
|
else
|
|
|
maxpkt = 2;
|
|
|
}
|
|
|
@@ -710,7 +709,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
|
|
|
/* If endpoint is stalled, we will restart request later */
|
|
|
ctrl = readl(hsotg->regs + epctrl_reg);
|
|
|
|
|
|
- if (ctrl & DxEPCTL_Stall) {
|
|
|
+ if (ctrl & DXEPCTL_STALL) {
|
|
|
dev_warn(hsotg->dev, "%s: ep%d is stalled\n", __func__, index);
|
|
|
return;
|
|
|
}
|
|
|
@@ -750,9 +749,9 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
|
|
|
|
|
|
if (dir_in && index != 0)
|
|
|
if (hs_ep->isochronous)
|
|
|
- epsize = DxEPTSIZ_MC(packets);
|
|
|
+ epsize = DXEPTSIZ_MC(packets);
|
|
|
else
|
|
|
- epsize = DxEPTSIZ_MC(1);
|
|
|
+ epsize = DXEPTSIZ_MC(1);
|
|
|
else
|
|
|
epsize = 0;
|
|
|
|
|
|
@@ -766,8 +765,8 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
|
|
|
packets++;
|
|
|
}
|
|
|
|
|
|
- epsize |= DxEPTSIZ_PktCnt(packets);
|
|
|
- epsize |= DxEPTSIZ_XferSize(length);
|
|
|
+ epsize |= DXEPTSIZ_PKTCNT(packets);
|
|
|
+ epsize |= DXEPTSIZ_XFERSIZE(length);
|
|
|
|
|
|
dev_dbg(hsotg->dev, "%s: %d@%d/%d, 0x%08x => 0x%08x\n",
|
|
|
__func__, packets, length, ureq->length, epsize, epsize_reg);
|
|
|
@@ -793,8 +792,8 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
|
|
|
__func__, &ureq->dma, dma_reg);
|
|
|
}
|
|
|
|
|
|
- ctrl |= DxEPCTL_EPEna; /* ensure ep enabled */
|
|
|
- ctrl |= DxEPCTL_USBActEp;
|
|
|
+ ctrl |= DXEPCTL_EPENA; /* ensure ep enabled */
|
|
|
+ ctrl |= DXEPCTL_USBACTEP;
|
|
|
|
|
|
dev_dbg(hsotg->dev, "setup req:%d\n", hsotg->setup);
|
|
|
|
|
|
@@ -802,7 +801,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
|
|
|
if (hsotg->setup && index == 0)
|
|
|
hsotg->setup = 0;
|
|
|
else
|
|
|
- ctrl |= DxEPCTL_CNAK; /* clear NAK set by core */
|
|
|
+ ctrl |= DXEPCTL_CNAK; /* clear NAK set by core */
|
|
|
|
|
|
|
|
|
dev_dbg(hsotg->dev, "%s: DxEPCTL=0x%08x\n", __func__, ctrl);
|
|
|
@@ -828,7 +827,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
|
|
|
* to debugging to see what is going on.
|
|
|
*/
|
|
|
if (dir_in)
|
|
|
- writel(DIEPMSK_INTknTXFEmpMsk,
|
|
|
+ writel(DIEPMSK_INTKNTXFEMPMSK,
|
|
|
hsotg->regs + DIEPINT(index));
|
|
|
|
|
|
/*
|
|
|
@@ -837,12 +836,12 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
|
|
|
*/
|
|
|
|
|
|
/* check ep is enabled */
|
|
|
- if (!(readl(hsotg->regs + epctrl_reg) & DxEPCTL_EPEna))
|
|
|
+ if (!(readl(hsotg->regs + epctrl_reg) & DXEPCTL_EPENA))
|
|
|
dev_warn(hsotg->dev,
|
|
|
- "ep%d: failed to become enabled (DxEPCTL=0x%08x)?\n",
|
|
|
+ "ep%d: failed to become enabled (DXEPCTL=0x%08x)?\n",
|
|
|
index, readl(hsotg->regs + epctrl_reg));
|
|
|
|
|
|
- dev_dbg(hsotg->dev, "%s: DxEPCTL=0x%08x\n",
|
|
|
+ dev_dbg(hsotg->dev, "%s: DXEPCTL=0x%08x\n",
|
|
|
__func__, readl(hsotg->regs + epctrl_reg));
|
|
|
|
|
|
/* enable ep interrupts */
|
|
|
@@ -1205,12 +1204,12 @@ static void s3c_hsotg_stall_ep0(struct s3c_hsotg *hsotg) {
|
|
|
*/
|
|
|
|
|
|
ctrl = readl(hsotg->regs + reg);
|
|
|
- ctrl |= DxEPCTL_Stall;
|
|
|
- ctrl |= DxEPCTL_CNAK;
|
|
|
+ ctrl |= DXEPCTL_STALL;
|
|
|
+ ctrl |= DXEPCTL_CNAK;
|
|
|
writel(ctrl, hsotg->regs + reg);
|
|
|
|
|
|
dev_dbg(hsotg->dev,
|
|
|
- "written DxEPCTL=0x%08x to %08x (DxEPCTL=0x%08x)\n",
|
|
|
+ "written DXEPCTL=0x%08x to %08x (DXEPCTL=0x%08x)\n",
|
|
|
ctrl, reg, readl(hsotg->regs + reg));
|
|
|
|
|
|
/*
|
|
|
@@ -1262,8 +1261,8 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
|
|
|
case USB_REQ_SET_ADDRESS:
|
|
|
s3c_hsotg_disconnect(hsotg);
|
|
|
dcfg = readl(hsotg->regs + DCFG);
|
|
|
- dcfg &= ~DCFG_DevAddr_MASK;
|
|
|
- dcfg |= ctrl->wValue << DCFG_DevAddr_SHIFT;
|
|
|
+ dcfg &= ~DCFG_DEVADDR_MASK;
|
|
|
+ dcfg |= ctrl->wValue << DCFG_DEVADDR_SHIFT;
|
|
|
writel(dcfg, hsotg->regs + DCFG);
|
|
|
|
|
|
dev_info(hsotg->dev, "new address %d\n", ctrl->wValue);
|
|
|
@@ -1458,7 +1457,7 @@ static void s3c_hsotg_rx_data(struct s3c_hsotg *hsotg, int ep_idx, int size)
|
|
|
int ptr;
|
|
|
|
|
|
dev_warn(hsotg->dev,
|
|
|
- "%s: FIFO %d bytes on ep%d but no req (DxEPCTl=0x%08x)\n",
|
|
|
+ "%s: FIFO %d bytes on ep%d but no req (DXEPCTl=0x%08x)\n",
|
|
|
__func__, size, ep_idx, epctl);
|
|
|
|
|
|
/* dump the data from the FIFO, we've nothing we can do */
|
|
|
@@ -1530,13 +1529,13 @@ static void s3c_hsotg_send_zlp(struct s3c_hsotg *hsotg,
|
|
|
dev_dbg(hsotg->dev, "sending zero-length packet\n");
|
|
|
|
|
|
/* issue a zero-sized packet to terminate this */
|
|
|
- writel(DxEPTSIZ_MC(1) | DxEPTSIZ_PktCnt(1) |
|
|
|
- DxEPTSIZ_XferSize(0), hsotg->regs + DIEPTSIZ(0));
|
|
|
+ writel(DXEPTSIZ_MC(1) | DXEPTSIZ_PKTCNT(1) |
|
|
|
+ DXEPTSIZ_XFERSIZE(0), hsotg->regs + DIEPTSIZ(0));
|
|
|
|
|
|
ctrl = readl(hsotg->regs + DIEPCTL0);
|
|
|
- ctrl |= DxEPCTL_CNAK; /* clear NAK set by core */
|
|
|
- ctrl |= DxEPCTL_EPEna; /* ensure ep enabled */
|
|
|
- ctrl |= DxEPCTL_USBActEp;
|
|
|
+ ctrl |= DXEPCTL_CNAK; /* clear NAK set by core */
|
|
|
+ ctrl |= DXEPCTL_EPENA; /* ensure ep enabled */
|
|
|
+ ctrl |= DXEPCTL_USBACTEP;
|
|
|
writel(ctrl, hsotg->regs + DIEPCTL0);
|
|
|
}
|
|
|
|
|
|
@@ -1557,7 +1556,7 @@ static void s3c_hsotg_handle_outdone(struct s3c_hsotg *hsotg,
|
|
|
struct s3c_hsotg_ep *hs_ep = &hsotg->eps[epnum];
|
|
|
struct s3c_hsotg_req *hs_req = hs_ep->req;
|
|
|
struct usb_request *req = &hs_req->req;
|
|
|
- unsigned size_left = DxEPTSIZ_XferSize_GET(epsize);
|
|
|
+ unsigned size_left = DXEPTSIZ_XFERSIZE_GET(epsize);
|
|
|
int result = 0;
|
|
|
|
|
|
if (!hs_req) {
|
|
|
@@ -1657,24 +1656,22 @@ static void s3c_hsotg_handle_rx(struct s3c_hsotg *hsotg)
|
|
|
|
|
|
WARN_ON(using_dma(hsotg));
|
|
|
|
|
|
- epnum = grxstsr & GRXSTS_EPNum_MASK;
|
|
|
- status = grxstsr & GRXSTS_PktSts_MASK;
|
|
|
+ epnum = grxstsr & GRXSTS_EPNUM_MASK;
|
|
|
+ status = grxstsr & GRXSTS_PKTSTS_MASK;
|
|
|
|
|
|
- size = grxstsr & GRXSTS_ByteCnt_MASK;
|
|
|
- size >>= GRXSTS_ByteCnt_SHIFT;
|
|
|
+ size = grxstsr & GRXSTS_BYTECNT_MASK;
|
|
|
+ size >>= GRXSTS_BYTECNT_SHIFT;
|
|
|
|
|
|
if (1)
|
|
|
dev_dbg(hsotg->dev, "%s: GRXSTSP=0x%08x (%d@%d)\n",
|
|
|
__func__, grxstsr, size, epnum);
|
|
|
|
|
|
-#define __status(x) ((x) >> GRXSTS_PktSts_SHIFT)
|
|
|
-
|
|
|
- switch (status >> GRXSTS_PktSts_SHIFT) {
|
|
|
- case __status(GRXSTS_PktSts_GlobalOutNAK):
|
|
|
- dev_dbg(hsotg->dev, "GlobalOutNAK\n");
|
|
|
+ switch ((status & GRXSTS_PKTSTS_MASK) >> GRXSTS_PKTSTS_SHIFT) {
|
|
|
+ case GRXSTS_PKTSTS_GLOBALOUTNAK:
|
|
|
+ dev_dbg(hsotg->dev, "GLOBALOUTNAK\n");
|
|
|
break;
|
|
|
|
|
|
- case __status(GRXSTS_PktSts_OutDone):
|
|
|
+ case GRXSTS_PKTSTS_OUTDONE:
|
|
|
dev_dbg(hsotg->dev, "OutDone (Frame=0x%08x)\n",
|
|
|
s3c_hsotg_read_frameno(hsotg));
|
|
|
|
|
|
@@ -1682,7 +1679,7 @@ static void s3c_hsotg_handle_rx(struct s3c_hsotg *hsotg)
|
|
|
s3c_hsotg_handle_outdone(hsotg, epnum, false);
|
|
|
break;
|
|
|
|
|
|
- case __status(GRXSTS_PktSts_SetupDone):
|
|
|
+ case GRXSTS_PKTSTS_SETUPDONE:
|
|
|
dev_dbg(hsotg->dev,
|
|
|
"SetupDone (Frame=0x%08x, DOPEPCTL=0x%08x)\n",
|
|
|
s3c_hsotg_read_frameno(hsotg),
|
|
|
@@ -1691,11 +1688,11 @@ static void s3c_hsotg_handle_rx(struct s3c_hsotg *hsotg)
|
|
|
s3c_hsotg_handle_outdone(hsotg, epnum, true);
|
|
|
break;
|
|
|
|
|
|
- case __status(GRXSTS_PktSts_OutRX):
|
|
|
+ case GRXSTS_PKTSTS_OUTRX:
|
|
|
s3c_hsotg_rx_data(hsotg, epnum, size);
|
|
|
break;
|
|
|
|
|
|
- case __status(GRXSTS_PktSts_SetupRX):
|
|
|
+ case GRXSTS_PKTSTS_SETUPRX:
|
|
|
dev_dbg(hsotg->dev,
|
|
|
"SetupRX (Frame=0x%08x, DOPEPCTL=0x%08x)\n",
|
|
|
s3c_hsotg_read_frameno(hsotg),
|
|
|
@@ -1761,7 +1758,7 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg,
|
|
|
hs_ep->ep.maxpacket = mps;
|
|
|
hs_ep->mc = 1;
|
|
|
} else {
|
|
|
- mpsval = mps & DxEPCTL_MPS_MASK;
|
|
|
+ mpsval = mps & DXEPCTL_MPS_MASK;
|
|
|
if (mpsval > 1024)
|
|
|
goto bad_mps;
|
|
|
mcval = ((mps >> 11) & 0x3) + 1;
|
|
|
@@ -1777,13 +1774,13 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg,
|
|
|
*/
|
|
|
|
|
|
reg = readl(regs + DIEPCTL(ep));
|
|
|
- reg &= ~DxEPCTL_MPS_MASK;
|
|
|
+ reg &= ~DXEPCTL_MPS_MASK;
|
|
|
reg |= mpsval;
|
|
|
writel(reg, regs + DIEPCTL(ep));
|
|
|
|
|
|
if (ep) {
|
|
|
reg = readl(regs + DOEPCTL(ep));
|
|
|
- reg &= ~DxEPCTL_MPS_MASK;
|
|
|
+ reg &= ~DXEPCTL_MPS_MASK;
|
|
|
reg |= mpsval;
|
|
|
writel(reg, regs + DOEPCTL(ep));
|
|
|
}
|
|
|
@@ -1804,7 +1801,7 @@ static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx)
|
|
|
int timeout;
|
|
|
int val;
|
|
|
|
|
|
- writel(GRSTCTL_TxFNum(idx) | GRSTCTL_TxFFlsh,
|
|
|
+ writel(GRSTCTL_TXFNUM(idx) | GRSTCTL_TXFFLSH,
|
|
|
hsotg->regs + GRSTCTL);
|
|
|
|
|
|
/* wait until the fifo is flushed */
|
|
|
@@ -1813,7 +1810,7 @@ static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx)
|
|
|
while (1) {
|
|
|
val = readl(hsotg->regs + GRSTCTL);
|
|
|
|
|
|
- if ((val & (GRSTCTL_TxFFlsh)) == 0)
|
|
|
+ if ((val & (GRSTCTL_TXFFLSH)) == 0)
|
|
|
break;
|
|
|
|
|
|
if (--timeout == 0) {
|
|
|
@@ -1896,7 +1893,7 @@ static void s3c_hsotg_complete_in(struct s3c_hsotg *hsotg,
|
|
|
* aligned).
|
|
|
*/
|
|
|
|
|
|
- size_left = DxEPTSIZ_XferSize_GET(epsize);
|
|
|
+ size_left = DXEPTSIZ_XFERSIZE_GET(epsize);
|
|
|
|
|
|
size_done = hs_ep->size_loaded - size_left;
|
|
|
size_done += hs_ep->last_load;
|
|
|
@@ -1963,17 +1960,17 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
|
|
|
dev_dbg(hsotg->dev, "%s: ep%d(%s) DxEPINT=0x%08x\n",
|
|
|
__func__, idx, dir_in ? "in" : "out", ints);
|
|
|
|
|
|
- if (ints & DxEPINT_XferCompl) {
|
|
|
+ if (ints & DXEPINT_XFERCOMPL) {
|
|
|
if (hs_ep->isochronous && hs_ep->interval == 1) {
|
|
|
- if (ctrl & DxEPCTL_EOFrNum)
|
|
|
- ctrl |= DxEPCTL_SetEvenFr;
|
|
|
+ if (ctrl & DXEPCTL_EOFRNUM)
|
|
|
+ ctrl |= DXEPCTL_SETEVENFR;
|
|
|
else
|
|
|
- ctrl |= DxEPCTL_SetOddFr;
|
|
|
+ ctrl |= DXEPCTL_SETODDFR;
|
|
|
writel(ctrl, hsotg->regs + epctl_reg);
|
|
|
}
|
|
|
|
|
|
dev_dbg(hsotg->dev,
|
|
|
- "%s: XferCompl: DxEPCTL=0x%08x, DxEPTSIZ=%08x\n",
|
|
|
+ "%s: XferCompl: DxEPCTL=0x%08x, DXEPTSIZ=%08x\n",
|
|
|
__func__, readl(hsotg->regs + epctl_reg),
|
|
|
readl(hsotg->regs + epsiz_reg));
|
|
|
|
|
|
@@ -1996,7 +1993,7 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (ints & DxEPINT_EPDisbld) {
|
|
|
+ if (ints & DXEPINT_EPDISBLD) {
|
|
|
dev_dbg(hsotg->dev, "%s: EPDisbld\n", __func__);
|
|
|
|
|
|
if (dir_in) {
|
|
|
@@ -2004,20 +2001,20 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
|
|
|
|
|
|
s3c_hsotg_txfifo_flush(hsotg, idx);
|
|
|
|
|
|
- if ((epctl & DxEPCTL_Stall) &&
|
|
|
- (epctl & DxEPCTL_EPType_Bulk)) {
|
|
|
+ if ((epctl & DXEPCTL_STALL) &&
|
|
|
+ (epctl & DXEPCTL_EPTYPE_BULK)) {
|
|
|
int dctl = readl(hsotg->regs + DCTL);
|
|
|
|
|
|
- dctl |= DCTL_CGNPInNAK;
|
|
|
+ dctl |= DCTL_CGNPINNAK;
|
|
|
writel(dctl, hsotg->regs + DCTL);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (ints & DxEPINT_AHBErr)
|
|
|
+ if (ints & DXEPINT_AHBERR)
|
|
|
dev_dbg(hsotg->dev, "%s: AHBErr\n", __func__);
|
|
|
|
|
|
- if (ints & DxEPINT_Setup) { /* Setup or Timeout */
|
|
|
+ if (ints & DXEPINT_SETUP) { /* Setup or Timeout */
|
|
|
dev_dbg(hsotg->dev, "%s: Setup/Timeout\n", __func__);
|
|
|
|
|
|
if (using_dma(hsotg) && idx == 0) {
|
|
|
@@ -2035,25 +2032,25 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (ints & DxEPINT_Back2BackSetup)
|
|
|
+ if (ints & DXEPINT_BACK2BACKSETUP)
|
|
|
dev_dbg(hsotg->dev, "%s: B2BSetup/INEPNakEff\n", __func__);
|
|
|
|
|
|
if (dir_in && !hs_ep->isochronous) {
|
|
|
/* not sure if this is important, but we'll clear it anyway */
|
|
|
- if (ints & DIEPMSK_INTknTXFEmpMsk) {
|
|
|
+ if (ints & DIEPMSK_INTKNTXFEMPMSK) {
|
|
|
dev_dbg(hsotg->dev, "%s: ep%d: INTknTXFEmpMsk\n",
|
|
|
__func__, idx);
|
|
|
}
|
|
|
|
|
|
/* this probably means something bad is happening */
|
|
|
- if (ints & DIEPMSK_INTknEPMisMsk) {
|
|
|
+ if (ints & DIEPMSK_INTKNEPMISMSK) {
|
|
|
dev_warn(hsotg->dev, "%s: ep%d: INTknEP\n",
|
|
|
__func__, idx);
|
|
|
}
|
|
|
|
|
|
/* FIFO has space or is empty (see GAHBCFG) */
|
|
|
if (hsotg->dedicated_fifos &&
|
|
|
- ints & DIEPMSK_TxFIFOEmpty) {
|
|
|
+ ints & DIEPMSK_TXFIFOEMPTY) {
|
|
|
dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n",
|
|
|
__func__, idx);
|
|
|
if (!using_dma(hsotg))
|
|
|
@@ -2089,21 +2086,21 @@ static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg)
|
|
|
*/
|
|
|
|
|
|
/* catch both EnumSpd_FS and EnumSpd_FS48 */
|
|
|
- switch (dsts & DSTS_EnumSpd_MASK) {
|
|
|
- case DSTS_EnumSpd_FS:
|
|
|
- case DSTS_EnumSpd_FS48:
|
|
|
+ switch (dsts & DSTS_ENUMSPD_MASK) {
|
|
|
+ case DSTS_ENUMSPD_FS:
|
|
|
+ case DSTS_ENUMSPD_FS48:
|
|
|
hsotg->gadget.speed = USB_SPEED_FULL;
|
|
|
ep0_mps = EP0_MPS_LIMIT;
|
|
|
ep_mps = 1023;
|
|
|
break;
|
|
|
|
|
|
- case DSTS_EnumSpd_HS:
|
|
|
+ case DSTS_ENUMSPD_HS:
|
|
|
hsotg->gadget.speed = USB_SPEED_HIGH;
|
|
|
ep0_mps = EP0_MPS_LIMIT;
|
|
|
ep_mps = 1024;
|
|
|
break;
|
|
|
|
|
|
- case DSTS_EnumSpd_LS:
|
|
|
+ case DSTS_ENUMSPD_LS:
|
|
|
hsotg->gadget.speed = USB_SPEED_LOW;
|
|
|
/*
|
|
|
* note, we don't actually support LS in this driver at the
|
|
|
@@ -2226,9 +2223,9 @@ static void s3c_hsotg_irq_fifoempty(struct s3c_hsotg *hsotg, bool periodic)
|
|
|
}
|
|
|
|
|
|
/* IRQ flags which will trigger a retry around the IRQ loop */
|
|
|
-#define IRQ_RETRY_MASK (GINTSTS_NPTxFEmp | \
|
|
|
- GINTSTS_PTxFEmp | \
|
|
|
- GINTSTS_RxFLvl)
|
|
|
+#define IRQ_RETRY_MASK (GINTSTS_NPTXFEMP | \
|
|
|
+ GINTSTS_PTXFEMP | \
|
|
|
+ GINTSTS_RXFLVL)
|
|
|
|
|
|
/**
|
|
|
* s3c_hsotg_corereset - issue softreset to the core
|
|
|
@@ -2244,14 +2241,14 @@ static int s3c_hsotg_corereset(struct s3c_hsotg *hsotg)
|
|
|
dev_dbg(hsotg->dev, "resetting core\n");
|
|
|
|
|
|
/* issue soft reset */
|
|
|
- writel(GRSTCTL_CSftRst, hsotg->regs + GRSTCTL);
|
|
|
+ writel(GRSTCTL_CSFTRST, hsotg->regs + GRSTCTL);
|
|
|
|
|
|
timeout = 10000;
|
|
|
do {
|
|
|
grstctl = readl(hsotg->regs + GRSTCTL);
|
|
|
- } while ((grstctl & GRSTCTL_CSftRst) && timeout-- > 0);
|
|
|
+ } while ((grstctl & GRSTCTL_CSFTRST) && timeout-- > 0);
|
|
|
|
|
|
- if (grstctl & GRSTCTL_CSftRst) {
|
|
|
+ if (grstctl & GRSTCTL_CSFTRST) {
|
|
|
dev_err(hsotg->dev, "Failed to get CSftRst asserted\n");
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
@@ -2268,7 +2265,7 @@ static int s3c_hsotg_corereset(struct s3c_hsotg *hsotg)
|
|
|
return -ETIMEDOUT;
|
|
|
}
|
|
|
|
|
|
- if (!(grstctl & GRSTCTL_AHBIdle))
|
|
|
+ if (!(grstctl & GRSTCTL_AHBIDLE))
|
|
|
continue;
|
|
|
|
|
|
break; /* reset done */
|
|
|
@@ -2294,14 +2291,14 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
|
|
|
*/
|
|
|
|
|
|
/* set the PLL on, remove the HNP/SRP and set the PHY */
|
|
|
- writel(hsotg->phyif | GUSBCFG_TOutCal(7) |
|
|
|
+ writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
|
|
|
(0x5 << 10), hsotg->regs + GUSBCFG);
|
|
|
|
|
|
s3c_hsotg_init_fifo(hsotg);
|
|
|
|
|
|
- __orr32(hsotg->regs + DCTL, DCTL_SftDiscon);
|
|
|
+ __orr32(hsotg->regs + DCTL, DCTL_SFTDISCON);
|
|
|
|
|
|
- writel(1 << 18 | DCFG_DevSpd_HS, hsotg->regs + DCFG);
|
|
|
+ writel(1 << 18 | DCFG_DEVSPD_HS, hsotg->regs + DCFG);
|
|
|
|
|
|
/* Clear any pending OTG interrupts */
|
|
|
writel(0xffffffff, hsotg->regs + GOTGINT);
|
|
|
@@ -2309,21 +2306,21 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
|
|
|
/* Clear any pending interrupts */
|
|
|
writel(0xffffffff, hsotg->regs + GINTSTS);
|
|
|
|
|
|
- writel(GINTSTS_ErlySusp | GINTSTS_SessReqInt |
|
|
|
- GINTSTS_GOUTNakEff | GINTSTS_GINNakEff |
|
|
|
- GINTSTS_ConIDStsChng | GINTSTS_USBRst |
|
|
|
- GINTSTS_EnumDone | GINTSTS_OTGInt |
|
|
|
- GINTSTS_USBSusp | GINTSTS_WkUpInt,
|
|
|
- hsotg->regs + GINTMSK);
|
|
|
+ writel(GINTSTS_ERLYSUSP | GINTSTS_SESSREQINT |
|
|
|
+ GINTSTS_GOUTNAKEFF | GINTSTS_GINNAKEFF |
|
|
|
+ GINTSTS_CONIDSTSCHNG | GINTSTS_USBRST |
|
|
|
+ GINTSTS_ENUMDONE | GINTSTS_OTGINT |
|
|
|
+ GINTSTS_USBSUSP | GINTSTS_WKUPINT,
|
|
|
+ hsotg->regs + GINTMSK);
|
|
|
|
|
|
if (using_dma(hsotg))
|
|
|
- writel(GAHBCFG_GlblIntrEn | GAHBCFG_DMAEn |
|
|
|
- GAHBCFG_HBstLen_Incr4,
|
|
|
+ writel(GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN |
|
|
|
+ GAHBCFG_HBSTLEN_INCR4,
|
|
|
hsotg->regs + GAHBCFG);
|
|
|
else
|
|
|
- writel(((hsotg->dedicated_fifos) ? (GAHBCFG_NPTxFEmpLvl |
|
|
|
- GAHBCFG_PTxFEmpLvl) : 0) |
|
|
|
- GAHBCFG_GlblIntrEn,
|
|
|
+ writel(((hsotg->dedicated_fifos) ? (GAHBCFG_NP_TXF_EMP_LVL |
|
|
|
+ GAHBCFG_P_TXF_EMP_LVL) : 0) |
|
|
|
+ GAHBCFG_GLBL_INTR_EN,
|
|
|
hsotg->regs + GAHBCFG);
|
|
|
|
|
|
/*
|
|
|
@@ -2332,22 +2329,22 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
|
|
|
* interrupts.
|
|
|
*/
|
|
|
|
|
|
- writel(((hsotg->dedicated_fifos) ? DIEPMSK_TxFIFOEmpty |
|
|
|
- DIEPMSK_INTknTXFEmpMsk : 0) |
|
|
|
- DIEPMSK_EPDisbldMsk | DIEPMSK_XferComplMsk |
|
|
|
- DIEPMSK_TimeOUTMsk | DIEPMSK_AHBErrMsk |
|
|
|
- DIEPMSK_INTknEPMisMsk,
|
|
|
- hsotg->regs + DIEPMSK);
|
|
|
+ writel(((hsotg->dedicated_fifos) ? DIEPMSK_TXFIFOEMPTY |
|
|
|
+ DIEPMSK_INTKNTXFEMPMSK : 0) |
|
|
|
+ DIEPMSK_EPDISBLDMSK | DIEPMSK_XFERCOMPLMSK |
|
|
|
+ DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
|
|
|
+ DIEPMSK_INTKNEPMISMSK,
|
|
|
+ hsotg->regs + DIEPMSK);
|
|
|
|
|
|
/*
|
|
|
* don't need XferCompl, we get that from RXFIFO in slave mode. In
|
|
|
* DMA mode we may need this.
|
|
|
*/
|
|
|
- writel((using_dma(hsotg) ? (DIEPMSK_XferComplMsk |
|
|
|
- DIEPMSK_TimeOUTMsk) : 0) |
|
|
|
- DOEPMSK_EPDisbldMsk | DOEPMSK_AHBErrMsk |
|
|
|
- DOEPMSK_SetupMsk,
|
|
|
- hsotg->regs + DOEPMSK);
|
|
|
+ writel((using_dma(hsotg) ? (DIEPMSK_XFERCOMPLMSK |
|
|
|
+ DIEPMSK_TIMEOUTMSK) : 0) |
|
|
|
+ DOEPMSK_EPDISBLDMSK | DOEPMSK_AHBERRMSK |
|
|
|
+ DOEPMSK_SETUPMSK,
|
|
|
+ hsotg->regs + DOEPMSK);
|
|
|
|
|
|
writel(0, hsotg->regs + DAINTMSK);
|
|
|
|
|
|
@@ -2356,7 +2353,7 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
|
|
|
readl(hsotg->regs + DOEPCTL0));
|
|
|
|
|
|
/* enable in and out endpoint interrupts */
|
|
|
- s3c_hsotg_en_gsint(hsotg, GINTSTS_OEPInt | GINTSTS_IEPInt);
|
|
|
+ s3c_hsotg_en_gsint(hsotg, GINTSTS_OEPINT | GINTSTS_IEPINT);
|
|
|
|
|
|
/*
|
|
|
* Enable the RXFIFO when in slave mode, as this is how we collect
|
|
|
@@ -2364,15 +2361,15 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
|
|
|
* things we cannot process, so do not use it.
|
|
|
*/
|
|
|
if (!using_dma(hsotg))
|
|
|
- s3c_hsotg_en_gsint(hsotg, GINTSTS_RxFLvl);
|
|
|
+ s3c_hsotg_en_gsint(hsotg, GINTSTS_RXFLVL);
|
|
|
|
|
|
/* Enable interrupts for EP0 in and out */
|
|
|
s3c_hsotg_ctrl_epint(hsotg, 0, 0, 1);
|
|
|
s3c_hsotg_ctrl_epint(hsotg, 0, 1, 1);
|
|
|
|
|
|
- __orr32(hsotg->regs + DCTL, DCTL_PWROnPrgDone);
|
|
|
+ __orr32(hsotg->regs + DCTL, DCTL_PWRONPRGDONE);
|
|
|
udelay(10); /* see openiboot */
|
|
|
- __bic32(hsotg->regs + DCTL, DCTL_PWROnPrgDone);
|
|
|
+ __bic32(hsotg->regs + DCTL, DCTL_PWRONPRGDONE);
|
|
|
|
|
|
dev_dbg(hsotg->dev, "DCTL=0x%08x\n", readl(hsotg->regs + DCTL));
|
|
|
|
|
|
@@ -2382,17 +2379,17 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
|
|
|
*/
|
|
|
|
|
|
/* set to read 1 8byte packet */
|
|
|
- writel(DxEPTSIZ_MC(1) | DxEPTSIZ_PktCnt(1) |
|
|
|
- DxEPTSIZ_XferSize(8), hsotg->regs + DOEPTSIZ0);
|
|
|
+ writel(DXEPTSIZ_MC(1) | DXEPTSIZ_PKTCNT(1) |
|
|
|
+ DXEPTSIZ_XFERSIZE(8), hsotg->regs + DOEPTSIZ0);
|
|
|
|
|
|
writel(s3c_hsotg_ep0_mps(hsotg->eps[0].ep.maxpacket) |
|
|
|
- DxEPCTL_CNAK | DxEPCTL_EPEna |
|
|
|
- DxEPCTL_USBActEp,
|
|
|
+ DXEPCTL_CNAK | DXEPCTL_EPENA |
|
|
|
+ DXEPCTL_USBACTEP,
|
|
|
hsotg->regs + DOEPCTL0);
|
|
|
|
|
|
/* enable, but don't activate EP0in */
|
|
|
writel(s3c_hsotg_ep0_mps(hsotg->eps[0].ep.maxpacket) |
|
|
|
- DxEPCTL_USBActEp, hsotg->regs + DIEPCTL0);
|
|
|
+ DXEPCTL_USBACTEP, hsotg->regs + DIEPCTL0);
|
|
|
|
|
|
s3c_hsotg_enqueue_setup(hsotg);
|
|
|
|
|
|
@@ -2401,14 +2398,14 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg)
|
|
|
readl(hsotg->regs + DOEPCTL0));
|
|
|
|
|
|
/* clear global NAKs */
|
|
|
- writel(DCTL_CGOUTNak | DCTL_CGNPInNAK,
|
|
|
+ writel(DCTL_CGOUTNAK | DCTL_CGNPINNAK,
|
|
|
hsotg->regs + DCTL);
|
|
|
|
|
|
/* must be at-least 3ms to allow bus to see disconnect */
|
|
|
mdelay(3);
|
|
|
|
|
|
/* remove the soft-disconnect and let's go */
|
|
|
- __bic32(hsotg->regs + DCTL, DCTL_SftDiscon);
|
|
|
+ __bic32(hsotg->regs + DCTL, DCTL_SFTDISCON);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -2433,7 +2430,7 @@ static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
|
|
|
|
|
|
gintsts &= gintmsk;
|
|
|
|
|
|
- if (gintsts & GINTSTS_OTGInt) {
|
|
|
+ if (gintsts & GINTSTS_OTGINT) {
|
|
|
u32 otgint = readl(hsotg->regs + GOTGINT);
|
|
|
|
|
|
dev_info(hsotg->dev, "OTGInt: %08x\n", otgint);
|
|
|
@@ -2441,34 +2438,34 @@ static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
|
|
|
writel(otgint, hsotg->regs + GOTGINT);
|
|
|
}
|
|
|
|
|
|
- if (gintsts & GINTSTS_SessReqInt) {
|
|
|
+ if (gintsts & GINTSTS_SESSREQINT) {
|
|
|
dev_dbg(hsotg->dev, "%s: SessReqInt\n", __func__);
|
|
|
- writel(GINTSTS_SessReqInt, hsotg->regs + GINTSTS);
|
|
|
+ writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS);
|
|
|
}
|
|
|
|
|
|
- if (gintsts & GINTSTS_EnumDone) {
|
|
|
- writel(GINTSTS_EnumDone, hsotg->regs + GINTSTS);
|
|
|
+ if (gintsts & GINTSTS_ENUMDONE) {
|
|
|
+ writel(GINTSTS_ENUMDONE, hsotg->regs + GINTSTS);
|
|
|
|
|
|
s3c_hsotg_irq_enumdone(hsotg);
|
|
|
}
|
|
|
|
|
|
- if (gintsts & GINTSTS_ConIDStsChng) {
|
|
|
+ if (gintsts & GINTSTS_CONIDSTSCHNG) {
|
|
|
dev_dbg(hsotg->dev, "ConIDStsChg (DSTS=0x%08x, GOTCTL=%08x)\n",
|
|
|
readl(hsotg->regs + DSTS),
|
|
|
readl(hsotg->regs + GOTGCTL));
|
|
|
|
|
|
- writel(GINTSTS_ConIDStsChng, hsotg->regs + GINTSTS);
|
|
|
+ writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS);
|
|
|
}
|
|
|
|
|
|
- if (gintsts & (GINTSTS_OEPInt | GINTSTS_IEPInt)) {
|
|
|
+ if (gintsts & (GINTSTS_OEPINT | GINTSTS_IEPINT)) {
|
|
|
u32 daint = readl(hsotg->regs + DAINT);
|
|
|
u32 daintmsk = readl(hsotg->regs + DAINTMSK);
|
|
|
u32 daint_out, daint_in;
|
|
|
int ep;
|
|
|
|
|
|
daint &= daintmsk;
|
|
|
- daint_out = daint >> DAINT_OutEP_SHIFT;
|
|
|
- daint_in = daint & ~(daint_out << DAINT_OutEP_SHIFT);
|
|
|
+ daint_out = daint >> DAINT_OUTEP_SHIFT;
|
|
|
+ daint_in = daint & ~(daint_out << DAINT_OUTEP_SHIFT);
|
|
|
|
|
|
dev_dbg(hsotg->dev, "%s: daint=%08x\n", __func__, daint);
|
|
|
|
|
|
@@ -2483,7 +2480,7 @@ static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (gintsts & GINTSTS_USBRst) {
|
|
|
+ if (gintsts & GINTSTS_USBRST) {
|
|
|
|
|
|
u32 usb_status = readl(hsotg->regs + GOTGCTL);
|
|
|
|
|
|
@@ -2491,7 +2488,7 @@ static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
|
|
|
dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n",
|
|
|
readl(hsotg->regs + GNPTXSTS));
|
|
|
|
|
|
- writel(GINTSTS_USBRst, hsotg->regs + GINTSTS);
|
|
|
+ writel(GINTSTS_USBRST, hsotg->regs + GINTSTS);
|
|
|
|
|
|
if (usb_status & GOTGCTL_BSESVLD) {
|
|
|
if (time_after(jiffies, hsotg->last_rst +
|
|
|
@@ -2508,7 +2505,7 @@ static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
|
|
|
|
|
|
/* check both FIFOs */
|
|
|
|
|
|
- if (gintsts & GINTSTS_NPTxFEmp) {
|
|
|
+ if (gintsts & GINTSTS_NPTXFEMP) {
|
|
|
dev_dbg(hsotg->dev, "NPTxFEmp\n");
|
|
|
|
|
|
/*
|
|
|
@@ -2517,20 +2514,20 @@ static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
|
|
|
* it needs re-enabling
|
|
|
*/
|
|
|
|
|
|
- s3c_hsotg_disable_gsint(hsotg, GINTSTS_NPTxFEmp);
|
|
|
+ s3c_hsotg_disable_gsint(hsotg, GINTSTS_NPTXFEMP);
|
|
|
s3c_hsotg_irq_fifoempty(hsotg, false);
|
|
|
}
|
|
|
|
|
|
- if (gintsts & GINTSTS_PTxFEmp) {
|
|
|
+ if (gintsts & GINTSTS_PTXFEMP) {
|
|
|
dev_dbg(hsotg->dev, "PTxFEmp\n");
|
|
|
|
|
|
/* See note in GINTSTS_NPTxFEmp */
|
|
|
|
|
|
- s3c_hsotg_disable_gsint(hsotg, GINTSTS_PTxFEmp);
|
|
|
+ s3c_hsotg_disable_gsint(hsotg, GINTSTS_PTXFEMP);
|
|
|
s3c_hsotg_irq_fifoempty(hsotg, true);
|
|
|
}
|
|
|
|
|
|
- if (gintsts & GINTSTS_RxFLvl) {
|
|
|
+ if (gintsts & GINTSTS_RXFLVL) {
|
|
|
/*
|
|
|
* note, since GINTSTS_RxFLvl doubles as FIFO-not-empty,
|
|
|
* we need to retry s3c_hsotg_handle_rx if this is still
|
|
|
@@ -2540,28 +2537,28 @@ static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
|
|
|
s3c_hsotg_handle_rx(hsotg);
|
|
|
}
|
|
|
|
|
|
- if (gintsts & GINTSTS_ModeMis) {
|
|
|
+ if (gintsts & GINTSTS_MODEMIS) {
|
|
|
dev_warn(hsotg->dev, "warning, mode mismatch triggered\n");
|
|
|
- writel(GINTSTS_ModeMis, hsotg->regs + GINTSTS);
|
|
|
+ writel(GINTSTS_MODEMIS, hsotg->regs + GINTSTS);
|
|
|
}
|
|
|
|
|
|
- if (gintsts & GINTSTS_USBSusp) {
|
|
|
+ if (gintsts & GINTSTS_USBSUSP) {
|
|
|
dev_info(hsotg->dev, "GINTSTS_USBSusp\n");
|
|
|
- writel(GINTSTS_USBSusp, hsotg->regs + GINTSTS);
|
|
|
+ writel(GINTSTS_USBSUSP, hsotg->regs + GINTSTS);
|
|
|
|
|
|
call_gadget(hsotg, suspend);
|
|
|
}
|
|
|
|
|
|
- if (gintsts & GINTSTS_WkUpInt) {
|
|
|
+ if (gintsts & GINTSTS_WKUPINT) {
|
|
|
dev_info(hsotg->dev, "GINTSTS_WkUpIn\n");
|
|
|
- writel(GINTSTS_WkUpInt, hsotg->regs + GINTSTS);
|
|
|
+ writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
|
|
|
|
|
|
call_gadget(hsotg, resume);
|
|
|
}
|
|
|
|
|
|
- if (gintsts & GINTSTS_ErlySusp) {
|
|
|
+ if (gintsts & GINTSTS_ERLYSUSP) {
|
|
|
dev_dbg(hsotg->dev, "GINTSTS_ErlySusp\n");
|
|
|
- writel(GINTSTS_ErlySusp, hsotg->regs + GINTSTS);
|
|
|
+ writel(GINTSTS_ERLYSUSP, hsotg->regs + GINTSTS);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
@@ -2570,18 +2567,18 @@ static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
|
|
|
* the occurrence.
|
|
|
*/
|
|
|
|
|
|
- if (gintsts & GINTSTS_GOUTNakEff) {
|
|
|
+ if (gintsts & GINTSTS_GOUTNAKEFF) {
|
|
|
dev_info(hsotg->dev, "GOUTNakEff triggered\n");
|
|
|
|
|
|
- writel(DCTL_CGOUTNak, hsotg->regs + DCTL);
|
|
|
+ writel(DCTL_CGOUTNAK, hsotg->regs + DCTL);
|
|
|
|
|
|
s3c_hsotg_dump(hsotg);
|
|
|
}
|
|
|
|
|
|
- if (gintsts & GINTSTS_GINNakEff) {
|
|
|
+ if (gintsts & GINTSTS_GINNAKEFF) {
|
|
|
dev_info(hsotg->dev, "GINNakEff triggered\n");
|
|
|
|
|
|
- writel(DCTL_CGNPInNAK, hsotg->regs + DCTL);
|
|
|
+ writel(DCTL_CGNPINNAK, hsotg->regs + DCTL);
|
|
|
|
|
|
s3c_hsotg_dump(hsotg);
|
|
|
}
|
|
|
@@ -2645,14 +2642,14 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
|
|
|
|
|
|
spin_lock_irqsave(&hsotg->lock, flags);
|
|
|
|
|
|
- epctrl &= ~(DxEPCTL_EPType_MASK | DxEPCTL_MPS_MASK);
|
|
|
- epctrl |= DxEPCTL_MPS(mps);
|
|
|
+ epctrl &= ~(DXEPCTL_EPTYPE_MASK | DXEPCTL_MPS_MASK);
|
|
|
+ epctrl |= DXEPCTL_MPS(mps);
|
|
|
|
|
|
/*
|
|
|
* mark the endpoint as active, otherwise the core may ignore
|
|
|
* transactions entirely for this endpoint
|
|
|
*/
|
|
|
- epctrl |= DxEPCTL_USBActEp;
|
|
|
+ epctrl |= DXEPCTL_USBACTEP;
|
|
|
|
|
|
/*
|
|
|
* set the NAK status on the endpoint, otherwise we might try and
|
|
|
@@ -2661,7 +2658,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
|
|
|
* size register hasn't been set.
|
|
|
*/
|
|
|
|
|
|
- epctrl |= DxEPCTL_SNAK;
|
|
|
+ epctrl |= DXEPCTL_SNAK;
|
|
|
|
|
|
/* update the endpoint state */
|
|
|
s3c_hsotg_set_ep_maxpacket(hsotg, hs_ep->index, mps);
|
|
|
@@ -2677,15 +2674,15 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
|
|
|
|
|
|
switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
|
|
|
case USB_ENDPOINT_XFER_ISOC:
|
|
|
- epctrl |= DxEPCTL_EPType_Iso;
|
|
|
- epctrl |= DxEPCTL_SetEvenFr;
|
|
|
+ epctrl |= DXEPCTL_EPTYPE_ISO;
|
|
|
+ epctrl |= DXEPCTL_SETEVENFR;
|
|
|
hs_ep->isochronous = 1;
|
|
|
if (dir_in)
|
|
|
hs_ep->periodic = 1;
|
|
|
break;
|
|
|
|
|
|
case USB_ENDPOINT_XFER_BULK:
|
|
|
- epctrl |= DxEPCTL_EPType_Bulk;
|
|
|
+ epctrl |= DXEPCTL_EPTYPE_BULK;
|
|
|
break;
|
|
|
|
|
|
case USB_ENDPOINT_XFER_INT:
|
|
|
@@ -2698,14 +2695,14 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
|
|
|
*/
|
|
|
|
|
|
hs_ep->periodic = 1;
|
|
|
- epctrl |= DxEPCTL_TxFNum(index);
|
|
|
+ epctrl |= DXEPCTL_TXFNUM(index);
|
|
|
}
|
|
|
|
|
|
- epctrl |= DxEPCTL_EPType_Intterupt;
|
|
|
+ epctrl |= DXEPCTL_EPTYPE_INTERRUPT;
|
|
|
break;
|
|
|
|
|
|
case USB_ENDPOINT_XFER_CONTROL:
|
|
|
- epctrl |= DxEPCTL_EPType_Control;
|
|
|
+ epctrl |= DXEPCTL_EPTYPE_CONTROL;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
@@ -2714,11 +2711,11 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
|
|
|
* a unique tx-fifo even if it is non-periodic.
|
|
|
*/
|
|
|
if (dir_in && hsotg->dedicated_fifos)
|
|
|
- epctrl |= DxEPCTL_TxFNum(index);
|
|
|
+ epctrl |= DXEPCTL_TXFNUM(index);
|
|
|
|
|
|
/* for non control endpoints, set PID to D0 */
|
|
|
if (index)
|
|
|
- epctrl |= DxEPCTL_SetD0PID;
|
|
|
+ epctrl |= DXEPCTL_SETD0PID;
|
|
|
|
|
|
dev_dbg(hsotg->dev, "%s: write DxEPCTL=0x%08x\n",
|
|
|
__func__, epctrl);
|
|
|
@@ -2763,9 +2760,9 @@ static int s3c_hsotg_ep_disable(struct usb_ep *ep)
|
|
|
|
|
|
|
|
|
ctrl = readl(hsotg->regs + epctrl_reg);
|
|
|
- ctrl &= ~DxEPCTL_EPEna;
|
|
|
- ctrl &= ~DxEPCTL_USBActEp;
|
|
|
- ctrl |= DxEPCTL_SNAK;
|
|
|
+ ctrl &= ~DXEPCTL_EPENA;
|
|
|
+ ctrl &= ~DXEPCTL_USBACTEP;
|
|
|
+ ctrl |= DXEPCTL_SNAK;
|
|
|
|
|
|
dev_dbg(hsotg->dev, "%s: DxEPCTL=0x%08x\n", __func__, ctrl);
|
|
|
writel(ctrl, hsotg->regs + epctrl_reg);
|
|
|
@@ -2852,15 +2849,15 @@ static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value)
|
|
|
epctl = readl(hs->regs + epreg);
|
|
|
|
|
|
if (value) {
|
|
|
- epctl |= DxEPCTL_Stall + DxEPCTL_SNAK;
|
|
|
- if (epctl & DxEPCTL_EPEna)
|
|
|
- epctl |= DxEPCTL_EPDis;
|
|
|
+ epctl |= DXEPCTL_STALL + DXEPCTL_SNAK;
|
|
|
+ if (epctl & DXEPCTL_EPENA)
|
|
|
+ epctl |= DXEPCTL_EPDIS;
|
|
|
} else {
|
|
|
- epctl &= ~DxEPCTL_Stall;
|
|
|
- xfertype = epctl & DxEPCTL_EPType_MASK;
|
|
|
- if (xfertype == DxEPCTL_EPType_Bulk ||
|
|
|
- xfertype == DxEPCTL_EPType_Intterupt)
|
|
|
- epctl |= DxEPCTL_SetD0PID;
|
|
|
+ epctl &= ~DXEPCTL_STALL;
|
|
|
+ xfertype = epctl & DXEPCTL_EPTYPE_MASK;
|
|
|
+ if (xfertype == DXEPCTL_EPTYPE_BULK ||
|
|
|
+ xfertype == DXEPCTL_EPTYPE_INTERRUPT)
|
|
|
+ epctl |= DXEPCTL_SETD0PID;
|
|
|
}
|
|
|
|
|
|
writel(epctl, hs->regs + epreg);
|
|
|
@@ -2869,13 +2866,13 @@ static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value)
|
|
|
epctl = readl(hs->regs + epreg);
|
|
|
|
|
|
if (value)
|
|
|
- epctl |= DxEPCTL_Stall;
|
|
|
+ epctl |= DXEPCTL_STALL;
|
|
|
else {
|
|
|
- epctl &= ~DxEPCTL_Stall;
|
|
|
- xfertype = epctl & DxEPCTL_EPType_MASK;
|
|
|
- if (xfertype == DxEPCTL_EPType_Bulk ||
|
|
|
- xfertype == DxEPCTL_EPType_Intterupt)
|
|
|
- epctl |= DxEPCTL_SetD0PID;
|
|
|
+ epctl &= ~DXEPCTL_STALL;
|
|
|
+ xfertype = epctl & DXEPCTL_EPTYPE_MASK;
|
|
|
+ if (xfertype == DXEPCTL_EPTYPE_BULK ||
|
|
|
+ xfertype == DXEPCTL_EPTYPE_INTERRUPT)
|
|
|
+ epctl |= DXEPCTL_SETD0PID;
|
|
|
}
|
|
|
|
|
|
writel(epctl, hs->regs + epreg);
|
|
|
@@ -2965,22 +2962,22 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg)
|
|
|
{
|
|
|
/* unmask subset of endpoint interrupts */
|
|
|
|
|
|
- writel(DIEPMSK_TimeOUTMsk | DIEPMSK_AHBErrMsk |
|
|
|
- DIEPMSK_EPDisbldMsk | DIEPMSK_XferComplMsk,
|
|
|
- hsotg->regs + DIEPMSK);
|
|
|
+ writel(DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
|
|
|
+ DIEPMSK_EPDISBLDMSK | DIEPMSK_XFERCOMPLMSK,
|
|
|
+ hsotg->regs + DIEPMSK);
|
|
|
|
|
|
- writel(DOEPMSK_SetupMsk | DOEPMSK_AHBErrMsk |
|
|
|
- DOEPMSK_EPDisbldMsk | DOEPMSK_XferComplMsk,
|
|
|
- hsotg->regs + DOEPMSK);
|
|
|
+ writel(DOEPMSK_SETUPMSK | DOEPMSK_AHBERRMSK |
|
|
|
+ DOEPMSK_EPDISBLDMSK | DOEPMSK_XFERCOMPLMSK,
|
|
|
+ hsotg->regs + DOEPMSK);
|
|
|
|
|
|
writel(0, hsotg->regs + DAINTMSK);
|
|
|
|
|
|
/* Be in disconnected state until gadget is registered */
|
|
|
- __orr32(hsotg->regs + DCTL, DCTL_SftDiscon);
|
|
|
+ __orr32(hsotg->regs + DCTL, DCTL_SFTDISCON);
|
|
|
|
|
|
if (0) {
|
|
|
/* post global nak until we're ready */
|
|
|
- writel(DCTL_SGNPInNAK | DCTL_SGOUTNak,
|
|
|
+ writel(DCTL_SGNPINNAK | DCTL_SGOUTNAK,
|
|
|
hsotg->regs + DCTL);
|
|
|
}
|
|
|
|
|
|
@@ -2993,10 +2990,10 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg)
|
|
|
s3c_hsotg_init_fifo(hsotg);
|
|
|
|
|
|
/* set the PLL on, remove the HNP/SRP and set the PHY */
|
|
|
- writel(GUSBCFG_PHYIf16 | GUSBCFG_TOutCal(7) | (0x5 << 10),
|
|
|
+ writel(GUSBCFG_PHYIF16 | GUSBCFG_TOUTCAL(7) | (0x5 << 10),
|
|
|
hsotg->regs + GUSBCFG);
|
|
|
|
|
|
- writel(using_dma(hsotg) ? GAHBCFG_DMAEn : 0x0,
|
|
|
+ writel(using_dma(hsotg) ? GAHBCFG_DMA_EN : 0x0,
|
|
|
hsotg->regs + GAHBCFG);
|
|
|
}
|
|
|
|
|
|
@@ -3187,8 +3184,8 @@ static void s3c_hsotg_initep(struct s3c_hsotg *hsotg,
|
|
|
* code is changed to make each endpoint's direction changeable.
|
|
|
*/
|
|
|
|
|
|
- ptxfifo = readl(hsotg->regs + DPTXFSIZn(epnum));
|
|
|
- hs_ep->fifo_size = DPTXFSIZn_DPTxFSize_GET(ptxfifo) * 4;
|
|
|
+ ptxfifo = readl(hsotg->regs + DPTXFSIZN(epnum));
|
|
|
+ hs_ep->fifo_size = FIFOSIZE_DEPTH_GET(ptxfifo) * 4;
|
|
|
|
|
|
/*
|
|
|
* if we're using dma, we need to set the next-endpoint pointer
|
|
|
@@ -3196,7 +3193,7 @@ static void s3c_hsotg_initep(struct s3c_hsotg *hsotg,
|
|
|
*/
|
|
|
|
|
|
if (using_dma(hsotg)) {
|
|
|
- u32 next = DxEPCTL_NextEp((epnum + 1) % 15);
|
|
|
+ u32 next = DXEPCTL_NEXTEP((epnum + 1) % 15);
|
|
|
writel(next, hsotg->regs + DIEPCTL(epnum));
|
|
|
writel(next, hsotg->regs + DOEPCTL(epnum));
|
|
|
}
|
|
|
@@ -3250,10 +3247,10 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg)
|
|
|
/* show periodic fifo settings */
|
|
|
|
|
|
for (idx = 1; idx <= 15; idx++) {
|
|
|
- val = readl(regs + DPTXFSIZn(idx));
|
|
|
+ val = readl(regs + DPTXFSIZN(idx));
|
|
|
dev_info(dev, "DPTx[%d] FSize=%d, StAddr=0x%08x\n", idx,
|
|
|
- val >> DPTXFSIZn_DPTxFSize_SHIFT,
|
|
|
- val & DPTXFSIZn_DPTxFStAddr_MASK);
|
|
|
+ val >> FIFOSIZE_DEPTH_SHIFT,
|
|
|
+ val & FIFOSIZE_STARTADDR_MASK);
|
|
|
}
|
|
|
|
|
|
for (idx = 0; idx < 15; idx++) {
|
|
|
@@ -3368,17 +3365,17 @@ static int fifo_show(struct seq_file *seq, void *v)
|
|
|
|
|
|
val = readl(regs + GNPTXFSIZ);
|
|
|
seq_printf(seq, "NPTXFIFO: Size %d, Start 0x%08x\n",
|
|
|
- val >> GNPTXFSIZ_NPTxFDep_SHIFT,
|
|
|
- val & GNPTXFSIZ_NPTxFStAddr_MASK);
|
|
|
+ val >> FIFOSIZE_DEPTH_SHIFT,
|
|
|
+ val & FIFOSIZE_DEPTH_MASK);
|
|
|
|
|
|
seq_puts(seq, "\nPeriodic TXFIFOs:\n");
|
|
|
|
|
|
for (idx = 1; idx <= 15; idx++) {
|
|
|
- val = readl(regs + DPTXFSIZn(idx));
|
|
|
+ val = readl(regs + DPTXFSIZN(idx));
|
|
|
|
|
|
seq_printf(seq, "\tDPTXFIFO%2d: Size %d, Start 0x%08x\n", idx,
|
|
|
- val >> DPTXFSIZn_DPTxFSize_SHIFT,
|
|
|
- val & DPTXFSIZn_DPTxFStAddr_MASK);
|
|
|
+ val >> FIFOSIZE_DEPTH_SHIFT,
|
|
|
+ val & FIFOSIZE_STARTADDR_MASK);
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
@@ -3662,14 +3659,14 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
|
|
|
}
|
|
|
|
|
|
/* Set default UTMI width */
|
|
|
- hsotg->phyif = GUSBCFG_PHYIf16;
|
|
|
+ hsotg->phyif = GUSBCFG_PHYIF16;
|
|
|
|
|
|
/*
|
|
|
* If using the generic PHY framework, check if the PHY bus
|
|
|
* width is 8-bit and set the phyif appropriately.
|
|
|
*/
|
|
|
if (hsotg->phy && (phy_get_bus_width(phy) == 8))
|
|
|
- hsotg->phyif = GUSBCFG_PHYIf8;
|
|
|
+ hsotg->phyif = GUSBCFG_PHYIF8;
|
|
|
|
|
|
if (hsotg->phy)
|
|
|
phy_init(hsotg->phy);
|