Commit fb7a7837 authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

MUSB: tusb patches 2/2 -- whitespace etc

Whitespace, indentation, and line length fixes.
Constify the gadget ep0 method table.
parent f4d3faac
...@@ -345,8 +345,7 @@ int __devinit musb_platform_init(struct musb *musb) ...@@ -345,8 +345,7 @@ int __devinit musb_platform_init(struct musb *musb)
/* NOTE: irqs are in mixed mode, not bypass to pure-musb */ /* NOTE: irqs are in mixed mode, not bypass to pure-musb */
pr_debug("DaVinci OTG revision %08x phy %03x control %02x\n", pr_debug("DaVinci OTG revision %08x phy %03x control %02x\n",
revision, revision,
musb_readl((void *__iomem) IO_ADDRESS( __raw_readl((void *__iomem) IO_ADDRESS(USBPHY_CTL_PADDR)),
USBPHY_CTL_PADDR), 0x00),
musb_readb(tibase, DAVINCI_USB_CTRL_REG)); musb_readb(tibase, DAVINCI_USB_CTRL_REG));
musb->isr = davinci_interrupt; musb->isr = davinci_interrupt;
......
...@@ -814,8 +814,8 @@ static void *musb_g_ep0_alloc_buffer(struct usb_ep *ep, unsigned bytes, ...@@ -814,8 +814,8 @@ static void *musb_g_ep0_alloc_buffer(struct usb_ep *ep, unsigned bytes,
return kmalloc(bytes, gfp_flags); return kmalloc(bytes, gfp_flags);
} }
static void musb_g_ep0_free_buffer(struct usb_ep *ep, void *address, dma_addr_t dma, static void musb_g_ep0_free_buffer(struct usb_ep *ep, void *address,
unsigned bytes) dma_addr_t dma, unsigned bytes)
{ {
kfree(address); kfree(address);
} }
...@@ -955,7 +955,7 @@ cleanup: ...@@ -955,7 +955,7 @@ cleanup:
return status; return status;
} }
struct usb_ep_ops musb_g_ep0_ops = { const struct usb_ep_ops musb_g_ep0_ops = {
.enable = musb_g_ep0_enable, .enable = musb_g_ep0_enable,
.disable = musb_g_ep0_disable, .disable = musb_g_ep0_disable,
.alloc_request = musb_alloc_request, .alloc_request = musb_alloc_request,
......
...@@ -304,10 +304,10 @@ static void txstate(struct musb *pThis, struct musb_request *req) ...@@ -304,10 +304,10 @@ static void txstate(struct musb *pThis, struct musb_request *req)
// against programming guide // against programming guide
} }
else else
wCsrVal |= (MGC_M_TXCSR_AUTOSET | wCsrVal |= (MGC_M_TXCSR_AUTOSET
MGC_M_TXCSR_DMAENAB | | MGC_M_TXCSR_DMAENAB
MGC_M_TXCSR_DMAMODE | | MGC_M_TXCSR_DMAMODE
MGC_M_TXCSR_MODE); | MGC_M_TXCSR_MODE);
wCsrVal &= ~MGC_M_TXCSR_P_UNDERRUN; wCsrVal &= ~MGC_M_TXCSR_P_UNDERRUN;
MGC_WriteCsr16(pBase, MGC_O_HDRC_TXCSR, bEnd, MGC_WriteCsr16(pBase, MGC_O_HDRC_TXCSR, bEnd,
...@@ -694,9 +694,8 @@ static void rxstate(struct musb *pThis, struct musb_request *req) ...@@ -694,9 +694,8 @@ static void rxstate(struct musb *pThis, struct musb_request *req)
} }
#endif #endif
musb_read_fifo(pEnd->hw_ep, wFifoCount, musb_read_fifo(pEnd->hw_ep, wFifoCount, (u8 *)
(u8 *) (pRequest->buf + (pRequest->buf + pRequest->actual));
pRequest->actual));
pRequest->actual += wFifoCount; pRequest->actual += wFifoCount;
/* REVISIT if we left anything in the fifo, flush /* REVISIT if we left anything in the fifo, flush
...@@ -778,9 +777,9 @@ void musb_g_rx(struct musb *pThis, u8 bEnd) ...@@ -778,9 +777,9 @@ void musb_g_rx(struct musb *pThis, u8 bEnd)
} }
if (dma && (wCsrVal & MGC_M_RXCSR_DMAENAB)) { if (dma && (wCsrVal & MGC_M_RXCSR_DMAENAB)) {
wCsrVal &= ~(MGC_M_RXCSR_AUTOCLEAR | wCsrVal &= ~(MGC_M_RXCSR_AUTOCLEAR
MGC_M_RXCSR_DMAENAB | | MGC_M_RXCSR_DMAENAB
MGC_M_RXCSR_DMAMODE); | MGC_M_RXCSR_DMAMODE);
MGC_WriteCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd, MGC_WriteCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd,
MGC_M_RXCSR_P_WZC_BITS | wCsrVal); MGC_M_RXCSR_P_WZC_BITS | wCsrVal);
...@@ -793,8 +792,9 @@ void musb_g_rx(struct musb *pThis, u8 bEnd) ...@@ -793,8 +792,9 @@ void musb_g_rx(struct musb *pThis, u8 bEnd)
#if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA) #if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA)
/* Autoclear doesn't clear RxPktRdy for short packets */ /* Autoclear doesn't clear RxPktRdy for short packets */
if ((dma->bDesiredMode == 0) || if ((dma->bDesiredMode == 0)
(dma->dwActualLength & (pEnd->wPacketSize - 1))) { || (dma->dwActualLength
& (pEnd->wPacketSize - 1))) {
/* ack the read! */ /* ack the read! */
wCsrVal &= ~MGC_M_RXCSR_RXPKTRDY; wCsrVal &= ~MGC_M_RXCSR_RXPKTRDY;
MGC_WriteCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd, wCsrVal); MGC_WriteCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd, wCsrVal);
...@@ -1602,11 +1602,13 @@ static inline void __devinit musb_g_init_endpoints(struct musb *pThis) ...@@ -1602,11 +1602,13 @@ static inline void __devinit musb_g_init_endpoints(struct musb *pThis)
count++; count++;
} else { } else {
if (hw_ep->wMaxPacketSizeTx) { if (hw_ep->wMaxPacketSizeTx) {
init_peripheral_ep(pThis, &hw_ep->ep_in, bEnd, 1); init_peripheral_ep(pThis, &hw_ep->ep_in,
bEnd, 1);
count++; count++;
} }
if (hw_ep->wMaxPacketSizeRx) { if (hw_ep->wMaxPacketSizeRx) {
init_peripheral_ep(pThis, &hw_ep->ep_out, bEnd, 0); init_peripheral_ep(pThis, &hw_ep->ep_out,
bEnd, 0);
count++; count++;
} }
} }
......
...@@ -94,7 +94,7 @@ static inline struct usb_request *next_request(struct musb_ep *ep) ...@@ -94,7 +94,7 @@ static inline struct usb_request *next_request(struct musb_ep *ep)
extern void musb_g_tx(struct musb *pThis, u8 bEnd); extern void musb_g_tx(struct musb *pThis, u8 bEnd);
extern void musb_g_rx(struct musb *pThis, u8 bEnd); extern void musb_g_rx(struct musb *pThis, u8 bEnd);
extern struct usb_ep_ops musb_g_ep0_ops; extern const struct usb_ep_ops musb_g_ep0_ops;
extern int musb_gadget_setup(struct musb *); extern int musb_gadget_setup(struct musb *);
extern void musb_gadget_cleanup(struct musb *); extern void musb_gadget_cleanup(struct musb *);
......
...@@ -757,16 +757,13 @@ static void musb_ep_program(struct musb *pThis, u8 bEnd, ...@@ -757,16 +757,13 @@ static void musb_ep_program(struct musb *pThis, u8 bEnd,
/* target addr and (for multipoint) hub addr/port */ /* target addr and (for multipoint) hub addr/port */
if (pThis->bIsMultipoint) { if (pThis->bIsMultipoint) {
musb_writeb(pBase, musb_writeb(pBase,
MGC_BUSCTL_OFFSET(bEnd, MGC_BUSCTL_OFFSET(bEnd, MGC_O_HDRC_TXFUNCADDR),
MGC_O_HDRC_TXFUNCADDR),
qh->addr_reg); qh->addr_reg);
musb_writeb(pBase, musb_writeb(pBase,
MGC_BUSCTL_OFFSET(bEnd, MGC_BUSCTL_OFFSET(bEnd, MGC_O_HDRC_TXHUBADDR),
MGC_O_HDRC_TXHUBADDR),
qh->h_addr_reg); qh->h_addr_reg);
musb_writeb(pBase, musb_writeb(pBase,
MGC_BUSCTL_OFFSET(bEnd, MGC_BUSCTL_OFFSET(bEnd, MGC_O_HDRC_TXHUBPORT),
MGC_O_HDRC_TXHUBPORT),
qh->h_port_reg); qh->h_port_reg);
} else } else
musb_writeb(pBase, MGC_O_HDRC_FADDR, qh->addr_reg); musb_writeb(pBase, MGC_O_HDRC_FADDR, qh->addr_reg);
...@@ -777,8 +774,8 @@ static void musb_ep_program(struct musb *pThis, u8 bEnd, ...@@ -777,8 +774,8 @@ static void musb_ep_program(struct musb *pThis, u8 bEnd,
qh->type_reg); qh->type_reg);
if (can_bulk_split(pThis, qh->type)) if (can_bulk_split(pThis, qh->type))
MGC_WriteCsr16(pBase, MGC_O_HDRC_TXMAXP, bEnd, MGC_WriteCsr16(pBase, MGC_O_HDRC_TXMAXP, bEnd,
wPacketSize | wPacketSize
((pEnd->wMaxPacketSizeTx / | ((pEnd->wMaxPacketSizeTx /
wPacketSize) - 1) << 11); wPacketSize) - 1) << 11);
else else
MGC_WriteCsr16(pBase, MGC_O_HDRC_TXMAXP, bEnd, MGC_WriteCsr16(pBase, MGC_O_HDRC_TXMAXP, bEnd,
...@@ -804,9 +801,9 @@ static void musb_ep_program(struct musb *pThis, u8 bEnd, ...@@ -804,9 +801,9 @@ static void musb_ep_program(struct musb *pThis, u8 bEnd,
/* clear previous state */ /* clear previous state */
wCsr = MGC_ReadCsr16(pBase, MGC_O_HDRC_TXCSR, bEnd); wCsr = MGC_ReadCsr16(pBase, MGC_O_HDRC_TXCSR, bEnd);
wCsr &= ~(MGC_M_TXCSR_AUTOSET | wCsr &= ~(MGC_M_TXCSR_AUTOSET
MGC_M_TXCSR_DMAMODE | | MGC_M_TXCSR_DMAMODE
MGC_M_TXCSR_DMAENAB); | MGC_M_TXCSR_DMAENAB);
wCsr |= MGC_M_TXCSR_MODE; wCsr |= MGC_M_TXCSR_MODE;
MGC_WriteCsr16(pBase, MGC_O_HDRC_TXCSR, bEnd, MGC_WriteCsr16(pBase, MGC_O_HDRC_TXCSR, bEnd,
wCsr | MGC_M_TXCSR_MODE); wCsr | MGC_M_TXCSR_MODE);
...@@ -820,14 +817,14 @@ static void musb_ep_program(struct musb *pThis, u8 bEnd, ...@@ -820,14 +817,14 @@ static void musb_ep_program(struct musb *pThis, u8 bEnd,
if (pDmaChannel->bDesiredMode == 0) { if (pDmaChannel->bDesiredMode == 0) {
wCsr &= ~(MGC_M_TXCSR_AUTOSET | wCsr &= ~(MGC_M_TXCSR_AUTOSET
MGC_M_TXCSR_DMAMODE); | MGC_M_TXCSR_DMAMODE);
wCsr |= (MGC_M_TXCSR_DMAENAB); wCsr |= (MGC_M_TXCSR_DMAENAB);
// against programming guide // against programming guide
} else } else
wCsr |= (MGC_M_TXCSR_AUTOSET | wCsr |= (MGC_M_TXCSR_AUTOSET
MGC_M_TXCSR_DMAENAB | | MGC_M_TXCSR_DMAENAB
MGC_M_TXCSR_DMAMODE); | MGC_M_TXCSR_DMAMODE);
MGC_WriteCsr16(pBase, MGC_O_HDRC_TXCSR, bEnd, wCsr); MGC_WriteCsr16(pBase, MGC_O_HDRC_TXCSR, bEnd, wCsr);
...@@ -891,15 +888,15 @@ static void musb_ep_program(struct musb *pThis, u8 bEnd, ...@@ -891,15 +888,15 @@ static void musb_ep_program(struct musb *pThis, u8 bEnd,
qh->segsize = wLoadCount; qh->segsize = wLoadCount;
musb_write_fifo(pEnd, wLoadCount, pBuffer); musb_write_fifo(pEnd, wLoadCount, pBuffer);
wCsr = MGC_ReadCsr16(pBase, MGC_O_HDRC_TXCSR, bEnd); wCsr = MGC_ReadCsr16(pBase, MGC_O_HDRC_TXCSR, bEnd);
wCsr &= wCsr &= ~(MGC_M_TXCSR_DMAENAB
~(MGC_M_TXCSR_DMAENAB | MGC_M_TXCSR_DMAMODE | | MGC_M_TXCSR_DMAMODE
MGC_M_TXCSR_AUTOSET); | MGC_M_TXCSR_AUTOSET);
/* write CSR */ /* write CSR */
wCsr |= MGC_M_TXCSR_MODE; wCsr |= MGC_M_TXCSR_MODE;
if (bEnd) if (bEnd)
MGC_WriteCsr16(pBase, MGC_O_HDRC_TXCSR, bEnd, MGC_WriteCsr16(pBase, MGC_O_HDRC_TXCSR,
wCsr); bEnd, wCsr);
} }
...@@ -984,14 +981,14 @@ static u8 musb_h_ep0_continue(struct musb *pThis, ...@@ -984,14 +981,14 @@ static u8 musb_h_ep0_continue(struct musb *pThis,
u16 wFifoCount = 0; u16 wFifoCount = 0;
struct musb_hw_ep *pEnd = pThis->control_ep; struct musb_hw_ep *pEnd = pThis->control_ep;
struct musb_qh *qh = pEnd->in_qh; struct musb_qh *qh = pEnd->in_qh;
struct usb_ctrlrequest *pRequest = struct usb_ctrlrequest *pRequest;
(struct usb_ctrlrequest *)pUrb->setup_packet;
pRequest = (struct usb_ctrlrequest *) pUrb->setup_packet;
if (MGC_END0_IN == pThis->bEnd0Stage) { if (MGC_END0_IN == pThis->bEnd0Stage) {
/* we are receiving from peripheral */ /* we are receiving from peripheral */
pFifoDest = pUrb->transfer_buffer + pUrb->actual_length; pFifoDest = pUrb->transfer_buffer + pUrb->actual_length;
wFifoCount = min(wCount, ((u16) wFifoCount = min(wCount, ((u16) (pUrb->transfer_buffer_length
(pUrb->transfer_buffer_length - pUrb->actual_length))); - pUrb->actual_length)));
if (wFifoCount < wCount) if (wFifoCount < wCount)
pUrb->status = -EOVERFLOW; pUrb->status = -EOVERFLOW;
...@@ -1030,15 +1027,13 @@ static u8 musb_h_ep0_continue(struct musb *pThis, ...@@ -1030,15 +1027,13 @@ static u8 musb_h_ep0_continue(struct musb *pThis,
} else if (pRequest->wLength } else if (pRequest->wLength
&& (MGC_END0_START == pThis->bEnd0Stage)) { && (MGC_END0_START == pThis->bEnd0Stage)) {
pThis->bEnd0Stage = MGC_END0_OUT; pThis->bEnd0Stage = MGC_END0_OUT;
pFifoDest = (u8 *) (pUrb->transfer_buffer + pFifoDest = (u8 *) (pUrb->transfer_buffer
pUrb->actual_length); + pUrb->actual_length);
wFifoCount = wFifoCount = min(qh->maxpacket, ((u16)
min(qh->maxpacket, (pUrb->transfer_buffer_length
((u16) - pUrb->actual_length)));
(pUrb->transfer_buffer_length - DBG(3, "Sending %d bytes to %p\n",
pUrb->actual_length))); wFifoCount, pFifoDest);
DBG(3, "Sending %d bytes to %p\n", wFifoCount,
pFifoDest);
musb_write_fifo(pEnd, wFifoCount, pFifoDest); musb_write_fifo(pEnd, wFifoCount, pFifoDest);
qh->segsize = wFifoCount; qh->segsize = wFifoCount;
...@@ -1152,13 +1147,14 @@ irqreturn_t musb_h_ep0_irq(struct musb *pThis) ...@@ -1152,13 +1147,14 @@ irqreturn_t musb_h_ep0_irq(struct musb *pThis)
/* call common logic and prepare response */ /* call common logic and prepare response */
if (musb_h_ep0_continue(pThis, wCount, pUrb)) { if (musb_h_ep0_continue(pThis, wCount, pUrb)) {
/* more packets required */ /* more packets required */
wCsrVal = (MGC_END0_IN == pThis->bEnd0Stage) ? wCsrVal = (MGC_END0_IN == pThis->bEnd0Stage)
MGC_M_CSR0_H_REQPKT : MGC_M_CSR0_TXPKTRDY; ? MGC_M_CSR0_H_REQPKT : MGC_M_CSR0_TXPKTRDY;
} else { } else {
/* data transfer complete; perform status phase */ /* data transfer complete; perform status phase */
wCsrVal = MGC_M_CSR0_H_STATUSPKT | wCsrVal = MGC_M_CSR0_H_STATUSPKT
(usb_pipeout(pUrb->pipe) ? MGC_M_CSR0_H_REQPKT : | (usb_pipeout(pUrb->pipe)
MGC_M_CSR0_TXPKTRDY); ? MGC_M_CSR0_H_REQPKT
: MGC_M_CSR0_TXPKTRDY);
/* flag status stage */ /* flag status stage */
pThis->bEnd0Stage = MGC_END0_STATUS; pThis->bEnd0Stage = MGC_END0_STATUS;
...@@ -1188,7 +1184,8 @@ done: ...@@ -1188,7 +1184,8 @@ done:
DMA Isr (transfer complete) -> TxAvail() DMA Isr (transfer complete) -> TxAvail()
- Stop DMA (~DmaEnab) (<--- Alert ... currently happens - Stop DMA (~DmaEnab) (<--- Alert ... currently happens
only in musb_cleanup_urb) only in musb_cleanup_urb)
- TxPktRdy has to be set in mode 0 or for short packets in mode 1. - TxPktRdy has to be set in mode 0 or for
short packets in mode 1.
*/ */
#endif #endif
...@@ -1457,8 +1454,8 @@ void musb_host_rx(struct musb *pThis, u8 bEnd) ...@@ -1457,8 +1454,8 @@ void musb_host_rx(struct musb *pThis, u8 bEnd)
nPipe = pUrb->pipe; nPipe = pUrb->pipe;
DBG(5, "<== hw %d rxcsr %04x, urb actual %d (+dma %zd)\n", bEnd, DBG(5, "<== hw %d rxcsr %04x, urb actual %d (+dma %zd)\n",
wRxCsrVal, pUrb->actual_length, bEnd, wRxCsrVal, pUrb->actual_length,
dma ? dma->dwActualLength : 0); dma ? dma->dwActualLength : 0);
/* check for errors, concurrent stall & unlink is not really /* check for errors, concurrent stall & unlink is not really
...@@ -1560,10 +1557,10 @@ void musb_host_rx(struct musb *pThis, u8 bEnd) ...@@ -1560,10 +1557,10 @@ void musb_host_rx(struct musb *pThis, u8 bEnd)
bDone = (pUrb->actual_length >= pUrb->transfer_buffer_length) bDone = (pUrb->actual_length >= pUrb->transfer_buffer_length)
|| (dma->dwActualLength & (qh->maxpacket - 1)); || (dma->dwActualLength & (qh->maxpacket - 1));
wVal &= ~(MGC_M_RXCSR_DMAENAB | wVal &= ~(MGC_M_RXCSR_DMAENAB
MGC_M_RXCSR_H_AUTOREQ | | MGC_M_RXCSR_H_AUTOREQ
MGC_M_RXCSR_AUTOCLEAR | | MGC_M_RXCSR_AUTOCLEAR
MGC_M_RXCSR_RXPKTRDY); | MGC_M_RXCSR_RXPKTRDY);
MGC_WriteCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd, wVal); MGC_WriteCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd, wVal);
MGC_WriteCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd, wVal); MGC_WriteCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd, wVal);
...@@ -1651,14 +1648,11 @@ void musb_host_rx(struct musb *pThis, u8 bEnd) ...@@ -1651,14 +1648,11 @@ void musb_host_rx(struct musb *pThis, u8 bEnd)
wVal = MGC_ReadCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd); wVal = MGC_ReadCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd);
wVal &= ~MGC_M_RXCSR_H_REQPKT; wVal &= ~MGC_M_RXCSR_H_REQPKT;
if (dma->bDesiredMode == 0) { if (dma->bDesiredMode == 0)
wVal &= ~MGC_M_RXCSR_H_AUTOREQ; wVal &= ~MGC_M_RXCSR_H_AUTOREQ;
wVal |= (MGC_M_RXCSR_AUTOCLEAR | else
MGC_M_RXCSR_DMAENAB); wVal |= MGC_M_RXCSR_H_AUTOREQ;
} else wVal |= MGC_M_RXCSR_AUTOCLEAR | MGC_M_RXCSR_DMAENAB;
wVal |= (MGC_M_RXCSR_H_AUTOREQ |
MGC_M_RXCSR_AUTOCLEAR |
MGC_M_RXCSR_DMAENAB);
MGC_WriteCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd, MGC_WriteCsr16(pBase, MGC_O_HDRC_RXCSR, bEnd,
MGC_M_RXCSR_H_WZC_BITS | wVal); MGC_M_RXCSR_H_WZC_BITS | wVal);
......
...@@ -306,7 +306,8 @@ dump_end_info(struct musb *pThis, u8 bEnd, char *aBuffer, unsigned max) ...@@ -306,7 +306,8 @@ dump_end_info(struct musb *pThis, u8 bEnd, char *aBuffer, unsigned max)
char tmp[16]; char tmp[16];
base = pThis->ctrl_base; base = pThis->ctrl_base;
ram = base + DAVINCI_RXCPPI_STATERAM_OFFSET(cppi); ram = DAVINCI_RXCPPI_STATERAM_OFFSET(
cppi) + base;
snprintf(tmp, sizeof tmp, "%d left, ", snprintf(tmp, sizeof tmp, "%d left, ",
musb_readl(base, musb_readl(base,
DAVINCI_RXCPPI_BUFCNT0_REG DAVINCI_RXCPPI_BUFCNT0_REG
...@@ -387,7 +388,8 @@ dump_end_info(struct musb *pThis, u8 bEnd, char *aBuffer, unsigned max) ...@@ -387,7 +388,8 @@ dump_end_info(struct musb *pThis, u8 bEnd, char *aBuffer, unsigned max)
void __iomem *ram; void __iomem *ram;
base = pThis->ctrl_base; base = pThis->ctrl_base;
ram = base + DAVINCI_TXCPPI_STATERAM_OFFSET(cppi); ram = DAVINCI_RXCPPI_STATERAM_OFFSET(
cppi) + base;
code = snprintf(buf, max, code = snprintf(buf, max,
" tx dma%d: " " tx dma%d: "
"%08x %08x, %08x %08x; " "%08x %08x, %08x %08x; "
...@@ -614,36 +616,32 @@ static int musb_proc_write(struct file *file, const char __user *buffer, ...@@ -614,36 +616,32 @@ static int musb_proc_write(struct file *file, const char __user *buffer,
switch (cmd) { switch (cmd) {
case 'C': case 'C':
if (pBase) { if (pBase) {
bReg = bReg = musb_readb(pBase, MGC_O_HDRC_POWER)
musb_readb(pBase, | MGC_M_POWER_SOFTCONN;
MGC_O_HDRC_POWER) | MGC_M_POWER_SOFTCONN;
musb_writeb(pBase, MGC_O_HDRC_POWER, bReg); musb_writeb(pBase, MGC_O_HDRC_POWER, bReg);
} }
break; break;
case 'c': case 'c':
if (pBase) { if (pBase) {
bReg = bReg = musb_readb(pBase, MGC_O_HDRC_POWER)
musb_readb(pBase, & ~MGC_M_POWER_SOFTCONN;
MGC_O_HDRC_POWER) & ~MGC_M_POWER_SOFTCONN;
musb_writeb(pBase, MGC_O_HDRC_POWER, bReg); musb_writeb(pBase, MGC_O_HDRC_POWER, bReg);
} }
break; break;
case 'I': case 'I':
if (pBase) { if (pBase) {
bReg = bReg = musb_readb(pBase, MGC_O_HDRC_POWER)
musb_readb(pBase, | MGC_M_POWER_HSENAB;
MGC_O_HDRC_POWER) | MGC_M_POWER_HSENAB;
musb_writeb(pBase, MGC_O_HDRC_POWER, bReg); musb_writeb(pBase, MGC_O_HDRC_POWER, bReg);
} }
break; break;
case 'i': case 'i':
if (pBase) { if (pBase) {
bReg = bReg = musb_readb(pBase, MGC_O_HDRC_POWER)
musb_readb(pBase, & ~MGC_M_POWER_HSENAB;
MGC_O_HDRC_POWER) & ~MGC_M_POWER_HSENAB;
musb_writeb(pBase, MGC_O_HDRC_POWER, bReg); musb_writeb(pBase, MGC_O_HDRC_POWER, bReg);
} }
break; break;
...@@ -677,8 +675,8 @@ static int musb_proc_write(struct file *file, const char __user *buffer, ...@@ -677,8 +675,8 @@ static int musb_proc_write(struct file *file, const char __user *buffer,
case 'D':{ case 'D':{
if (count > 1) { if (count > 1) {
char digits[8], *p = digits; char digits[8], *p = digits;
int i = 0, level = 0, sign = 1, len = int i = 0, level = 0, sign = 1;
min(count - 1, (unsigned long)8); int len = min(count - 1, (unsigned long)8);
copy_from_user(&digits, &buffer[1], len); copy_from_user(&digits, &buffer[1], len);
......
...@@ -364,7 +364,8 @@ void MGC_OtgMachineInputsChanged(struct otg_machine *pMachine, ...@@ -364,7 +364,8 @@ void MGC_OtgMachineInputsChanged(struct otg_machine *pMachine,
otg_state_changed(pMachine->musb, otg_state_changed(pMachine->musb,
OTG_STATE_A_WAIT_BCON); OTG_STATE_A_WAIT_BCON);
mod_timer(&pMachine->Timer, jiffies mod_timer(&pMachine->Timer, jiffies
+ msecs_to_jiffies(MGC_OTG_T_A_WAIT_BCON)); + msecs_to_jiffies(
MGC_OTG_T_A_WAIT_BCON));
} }
} }
break; break;
......
...@@ -166,7 +166,6 @@ MODULE_PARM_DESC(debug, "initial debug message level"); ...@@ -166,7 +166,6 @@ MODULE_PARM_DESC(debug, "initial debug message level");
const char musb_driver_name[] = "musb_hdrc"; const char musb_driver_name[] = "musb_hdrc";
/* this module is always GPL, the gadget might not... */
MODULE_DESCRIPTION(DRIVER_INFO); MODULE_DESCRIPTION(DRIVER_INFO);
MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -1368,8 +1367,8 @@ void musb_dma_completion(struct musb *musb, u8 bLocalEnd, u8 bTransmit) ...@@ -1368,8 +1367,8 @@ void musb_dma_completion(struct musb *musb, u8 bLocalEnd, u8 bTransmit)
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
static ssize_t musb_mode_show(struct device *dev, static ssize_t
struct device_attribute *attr, char *buf) musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
{ {
struct musb *musb = dev_to_musb(dev); struct musb *musb = dev_to_musb(dev);
unsigned long flags; unsigned long flags;
...@@ -1393,8 +1392,8 @@ static ssize_t musb_mode_show(struct device *dev, ...@@ -1393,8 +1392,8 @@ static ssize_t musb_mode_show(struct device *dev,
} }
static DEVICE_ATTR(mode, S_IRUGO, musb_mode_show, NULL); static DEVICE_ATTR(mode, S_IRUGO, musb_mode_show, NULL);
static ssize_t musb_cable_show(struct device *dev, static ssize_t
struct device_attribute *attr, char *buf) musb_cable_show(struct device *dev, struct device_attribute *attr, char *buf)
{ {
struct musb *musb = dev_to_musb(dev); struct musb *musb = dev_to_musb(dev);
char *v1= "", *v2 = "?"; char *v1= "", *v2 = "?";
......
...@@ -284,17 +284,16 @@ irqreturn_t tusb_interrupt(int irq, void *__hci, struct pt_regs *r) ...@@ -284,17 +284,16 @@ irqreturn_t tusb_interrupt(int irq, void *__hci, struct pt_regs *r)
} }
/* VBUS state change */ /* VBUS state change */
if ((int_src & TUSB_INT_SRC_VBUS_SENSE_CHNG) || if ((int_src & TUSB_INT_SRC_VBUS_SENSE_CHNG)
(int_src & TUSB_INT_SRC_USB_IP_VBUS_ERR)) || (int_src & TUSB_INT_SRC_USB_IP_VBUS_ERR)) {
{
musb->status |= MUSB_VBUS_STATUS_CHG; musb->status |= MUSB_VBUS_STATUS_CHG;
schedule_work(&musb->irq_work); schedule_work(&musb->irq_work);
#if 0 #if 0
DBG(3, "tusb: VBUS changed. VBUS state %d\n", DBG(3, "tusb: VBUS changed. VBUS state %d\n",
(otg_stat & TUSB_DEV_OTG_STAT_VBUS_SENSE) ? 1 : 0); (otg_stat & TUSB_DEV_OTG_STAT_VBUS_SENSE) ? 1 : 0);
if (!(otg_stat & TUSB_DEV_OTG_STAT_VBUS_SENSE) && if (!(otg_stat & TUSB_DEV_OTG_STAT_VBUS_SENSE)
!(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) { && !(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) {
/* VBUS went off and ID pin is down */ /* VBUS went off and ID pin is down */
DBG(3, "tusb: No VBUS, starting session\n"); DBG(3, "tusb: No VBUS, starting session\n");
/* Start session again, VBUS will be enabled */ /* Start session again, VBUS will be enabled */
...@@ -307,8 +306,9 @@ irqreturn_t tusb_interrupt(int irq, void *__hci, struct pt_regs *r) ...@@ -307,8 +306,9 @@ irqreturn_t tusb_interrupt(int irq, void *__hci, struct pt_regs *r)
/* ID pin change */ /* ID pin change */
if (int_src & TUSB_INT_SRC_ID_STATUS_CHNG) { if (int_src & TUSB_INT_SRC_ID_STATUS_CHNG) {
DBG(3, "tusb: ID pin changed. State is %d\n", DBG(3, "tusb: ID pin changed. State is %d\n",
(musb_readl(base, TUSB_DEV_OTG_STAT) & (musb_readl(base, TUSB_DEV_OTG_STAT)
TUSB_DEV_OTG_STAT_ID_STATUS) ? 1 : 0); & TUSB_DEV_OTG_STAT_ID_STATUS)
? 1 : 0);
} }
/* OTG timer expiration */ /* OTG timer expiration */
...@@ -394,8 +394,7 @@ void musb_platform_enable(struct musb * musb) ...@@ -394,8 +394,7 @@ void musb_platform_enable(struct musb * musb)
musb_writel(base, TUSB_GPIO_INT_CLEAR, 0x1ff); musb_writel(base, TUSB_GPIO_INT_CLEAR, 0x1ff);
/* Acknowledge pending interrupt(s) */ /* Acknowledge pending interrupt(s) */
musb_writel(base, TUSB_INT_SRC_CLEAR, musb_writel(base, TUSB_INT_SRC_CLEAR, ~TUSB_INT_MASK_RESERVED_BITS);
~TUSB_INT_MASK_RESERVED_BITS);
#if 0 #if 0
/* Set OTG timer for about one second */ /* Set OTG timer for about one second */
......
...@@ -187,8 +187,8 @@ static void tusb_omap_dma_cb(int lch, u16 ch_status, void *data) ...@@ -187,8 +187,8 @@ static void tusb_omap_dma_cb(int lch, u16 ch_status, void *data)
* REVISIT: This same problem may occur with other MUSB dma as well. * REVISIT: This same problem may occur with other MUSB dma as well.
* Easy to test with g_ether by pinging the MUSB board with ping -s54. * Easy to test with g_ether by pinging the MUSB board with ping -s54.
*/ */
if ((chdat->transfer_len < chdat->packet_sz) || if ((chdat->transfer_len < chdat->packet_sz)
(chdat->transfer_len % chdat->packet_sz != 0)) { || (chdat->transfer_len % chdat->packet_sz != 0)) {
u16 csr; u16 csr;
if (chdat->tx) { if (chdat->tx) {
...@@ -283,10 +283,10 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, ...@@ -283,10 +283,10 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
ch, dma_addr, transfer_len, packet_sz, rndis_mode); ch, dma_addr, transfer_len, packet_sz, rndis_mode);
/* Since we're recycling dma areas, we need to clean or invalidate */ /* Since we're recycling dma areas, we need to clean or invalidate */
if (chdat->tx) { if (chdat->tx)
consistent_sync(phys_to_virt(dma_addr), len, consistent_sync(phys_to_virt(dma_addr), len,
DMA_TO_DEVICE); DMA_TO_DEVICE);
} else else
consistent_sync(phys_to_virt(dma_addr), len, consistent_sync(phys_to_virt(dma_addr), len,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
...@@ -296,7 +296,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, ...@@ -296,7 +296,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
if (chdat->tx) { if (chdat->tx) {
dma_params.data_type = OMAP_DMA_DATA_TYPE_S32; dma_params.data_type = OMAP_DMA_DATA_TYPE_S32;
dma_params.elem_count = 8; /* 8x32-bit burst */ dma_params.elem_count = 8; /* 8x32-bit burst */
dma_params.frame_count = transfer_len / 32; /* Burst sz frame */ dma_params.frame_count = transfer_len / 32; /* Burst sz */
dma_params.src_amode = OMAP_DMA_AMODE_POST_INC; dma_params.src_amode = OMAP_DMA_AMODE_POST_INC;
dma_params.src_start = (unsigned long)dma_addr; dma_params.src_start = (unsigned long)dma_addr;
...@@ -317,7 +317,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, ...@@ -317,7 +317,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
} else { } else {
dma_params.data_type = OMAP_DMA_DATA_TYPE_S32; dma_params.data_type = OMAP_DMA_DATA_TYPE_S32;
dma_params.elem_count = 8; /* 8x32-bit burst */ dma_params.elem_count = 8; /* 8x32-bit burst */
dma_params.frame_count = transfer_len / 32; /* Burst sz frame */ dma_params.frame_count = transfer_len / 32; /* Burst sz */
dma_params.src_amode = OMAP_DMA_AMODE_DOUBLE_IDX; dma_params.src_amode = OMAP_DMA_AMODE_DOUBLE_IDX;
dma_params.src_start = (unsigned long)fifo; dma_params.src_start = (unsigned long)fifo;
...@@ -548,8 +548,7 @@ tusb_omap_dma_allocate(struct dma_controller *c, ...@@ -548,8 +548,7 @@ tusb_omap_dma_allocate(struct dma_controller *c,
goto free_dmareq; goto free_dmareq;
ret = omap_request_dma(chdat->sync_dev, dev_name, ret = omap_request_dma(chdat->sync_dev, dev_name,
tusb_omap_dma_cb, tusb_omap_dma_cb, channel, &chdat->ch);
channel, &chdat->ch);
if (ret != 0) if (ret != 0)
goto free_dmareq; goto free_dmareq;
} else if (tusb_dma->ch == -1) { } else if (tusb_dma->ch == -1) {
...@@ -558,8 +557,7 @@ tusb_omap_dma_allocate(struct dma_controller *c, ...@@ -558,8 +557,7 @@ tusb_omap_dma_allocate(struct dma_controller *c,
/* Callback data gets set later in the shared dmareq case */ /* Callback data gets set later in the shared dmareq case */
ret = omap_request_dma(tusb_dma->sync_dev, "TUSB shared", ret = omap_request_dma(tusb_dma->sync_dev, "TUSB shared",
tusb_omap_dma_cb, tusb_omap_dma_cb, NULL, &tusb_dma->ch);
NULL, &tusb_dma->ch);
if (ret != 0) if (ret != 0)
goto free_dmareq; goto free_dmareq;
...@@ -665,9 +663,9 @@ tusb_omap_dma_init(struct musb *musb, void __iomem *base) ...@@ -665,9 +663,9 @@ tusb_omap_dma_init(struct musb *musb, void __iomem *base)
musb_writel(musb->ctrl_base, TUSB_DMA_EP_MAP, 0); musb_writel(musb->ctrl_base, TUSB_DMA_EP_MAP, 0);
musb_writel(tusb_base, TUSB_DMA_REQ_CONF, musb_writel(tusb_base, TUSB_DMA_REQ_CONF,
TUSB_DMA_REQ_CONF_BURST_SIZE(2) | TUSB_DMA_REQ_CONF_BURST_SIZE(2)
TUSB_DMA_REQ_CONF_DMA_REQ_EN(0x3f) | | TUSB_DMA_REQ_CONF_DMA_REQ_EN(0x3f)
TUSB_DMA_REQ_CONF_DMA_REQ_ASSER(2)); | TUSB_DMA_REQ_CONF_DMA_REQ_ASSER(2));
tusb_dma = kzalloc(sizeof(struct tusb_omap_dma), GFP_KERNEL); tusb_dma = kzalloc(sizeof(struct tusb_omap_dma), GFP_KERNEL);
if (!tusb_dma) if (!tusb_dma)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment