Commit a5c7363b authored by Tony Lindgren's avatar Tony Lindgren

musb_hdrc: Search and replace wPacketSize with packet_sz

Search and replace wPacketSize with packet_sz
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent c5d52007
...@@ -205,7 +205,7 @@ static inline int max_ep_writesize(struct musb *musb, struct musb_ep *ep) ...@@ -205,7 +205,7 @@ static inline int max_ep_writesize(struct musb *musb, struct musb_ep *ep)
if (can_bulk_split(musb, ep->type)) if (can_bulk_split(musb, ep->type))
return ep->hw_ep->max_packet_sz_tx; return ep->hw_ep->max_packet_sz_tx;
else else
return ep->wPacketSize; return ep->packet_sz;
} }
...@@ -287,7 +287,7 @@ static void txstate(struct musb *musb, struct musb_request *req) ...@@ -287,7 +287,7 @@ static void txstate(struct musb *musb, struct musb_request *req)
} }
DBG(4, "hw_ep%d, maxpacket %d, fifo count %d, txcsr %03x\n", DBG(4, "hw_ep%d, maxpacket %d, fifo count %d, txcsr %03x\n",
epnum, musb_ep->wPacketSize, fifo_count, epnum, musb_ep->packet_sz, fifo_count,
csr); csr);
#ifndef CONFIG_USB_INVENTRA_FIFO #ifndef CONFIG_USB_INVENTRA_FIFO
...@@ -305,13 +305,13 @@ static void txstate(struct musb *musb, struct musb_request *req) ...@@ -305,13 +305,13 @@ static void txstate(struct musb *musb, struct musb_request *req)
/* setup DMA, then program endpoint CSR */ /* setup DMA, then program endpoint CSR */
request_size = min(request->length, request_size = min(request->length,
musb_ep->dma->max_len); musb_ep->dma->max_len);
if (request_size <= musb_ep->wPacketSize) if (request_size <= musb_ep->packet_sz)
musb_ep->dma->desired_mode = 0; musb_ep->dma->desired_mode = 0;
else else
musb_ep->dma->desired_mode = 1; musb_ep->dma->desired_mode = 1;
use_dma = use_dma && c->channel_program( use_dma = use_dma && c->channel_program(
musb_ep->dma, musb_ep->wPacketSize, musb_ep->dma, musb_ep->packet_sz,
musb_ep->dma->desired_mode, musb_ep->dma->desired_mode,
request->dma, request_size); request->dma, request_size);
if (use_dma) { if (use_dma) {
...@@ -359,7 +359,7 @@ static void txstate(struct musb *musb, struct musb_request *req) ...@@ -359,7 +359,7 @@ static void txstate(struct musb *musb, struct musb_request *req)
* except for the last-packet-is-already-short case. * except for the last-packet-is-already-short case.
*/ */
use_dma = use_dma && c->channel_program( use_dma = use_dma && c->channel_program(
musb_ep->dma, musb_ep->wPacketSize, musb_ep->dma, musb_ep->packet_sz,
0, 0,
request->dma, request->dma,
request->length); request->length);
...@@ -372,7 +372,7 @@ static void txstate(struct musb *musb, struct musb_request *req) ...@@ -372,7 +372,7 @@ static void txstate(struct musb *musb, struct musb_request *req)
} }
#elif defined(CONFIG_USB_TUSB_OMAP_DMA) #elif defined(CONFIG_USB_TUSB_OMAP_DMA)
use_dma = use_dma && c->channel_program( use_dma = use_dma && c->channel_program(
musb_ep->dma, musb_ep->wPacketSize, musb_ep->dma, musb_ep->packet_sz,
request->zero, request->zero,
request->dma, request->dma,
request->length); request->length);
...@@ -483,13 +483,13 @@ void musb_g_tx(struct musb *musb, u8 epnum) ...@@ -483,13 +483,13 @@ void musb_g_tx(struct musb *musb, u8 epnum)
if ((request->zero if ((request->zero
&& request->length && request->length
&& (request->length && (request->length
% musb_ep->wPacketSize) % musb_ep->packet_sz)
== 0) == 0)
#ifdef CONFIG_USB_INVENTRA_DMA #ifdef CONFIG_USB_INVENTRA_DMA
|| (is_dma && || (is_dma &&
((!dma->desired_mode) || ((!dma->desired_mode) ||
(request->actual & (request->actual &
(musb_ep->wPacketSize - 1)))) (musb_ep->packet_sz - 1))))
#endif #endif
) { ) {
/* on dma completion, fifo may not /* on dma completion, fifo may not
...@@ -578,7 +578,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -578,7 +578,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out;
void __iomem *epio = musb->endpoints[epnum].regs; void __iomem *epio = musb->endpoints[epnum].regs;
u16 fifo_count = 0; u16 fifo_count = 0;
u16 len = musb_ep->wPacketSize; u16 len = musb_ep->packet_sz;
csr = musb_readw(epio, MGC_O_HDRC_RXCSR); csr = musb_readw(epio, MGC_O_HDRC_RXCSR);
...@@ -592,7 +592,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -592,7 +592,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
* faults will be handled correctly. * faults will be handled correctly.
*/ */
if (c->channel_program(channel, if (c->channel_program(channel,
musb_ep->wPacketSize, musb_ep->packet_sz,
!request->short_not_ok, !request->short_not_ok,
request->dma + request->actual, request->dma + request->actual,
request->length - request->actual)) { request->length - request->actual)) {
...@@ -665,14 +665,14 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -665,14 +665,14 @@ static void rxstate(struct musb *musb, struct musb_request *req)
#else #else
transfer_size = len; transfer_size = len;
#endif #endif
if (transfer_size <= musb_ep->wPacketSize) if (transfer_size <= musb_ep->packet_sz)
musb_ep->dma->desired_mode = 0; musb_ep->dma->desired_mode = 0;
else else
musb_ep->dma->desired_mode = 1; musb_ep->dma->desired_mode = 1;
use_dma = c->channel_program( use_dma = c->channel_program(
channel, channel,
musb_ep->wPacketSize, musb_ep->packet_sz,
channel->desired_mode, channel->desired_mode,
request->dma request->dma
+ request->actual, + request->actual,
...@@ -688,7 +688,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -688,7 +688,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
DBG(3, "%s OUT/RX pio fifo %d/%d, maxpacket %d\n", DBG(3, "%s OUT/RX pio fifo %d/%d, maxpacket %d\n",
musb_ep->end_point.name, musb_ep->end_point.name,
len, fifo_count, len, fifo_count,
musb_ep->wPacketSize); musb_ep->packet_sz);
fifo_count = min(len, fifo_count); fifo_count = min(len, fifo_count);
...@@ -700,7 +700,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -700,7 +700,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
int ret; int ret;
ret = c->channel_program(channel, ret = c->channel_program(channel,
musb_ep->wPacketSize, musb_ep->packet_sz,
channel->desired_mode, channel->desired_mode,
dma_addr, dma_addr,
fifo_count); fifo_count);
...@@ -725,7 +725,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -725,7 +725,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
} }
/* reach the end or short packet detected */ /* reach the end or short packet detected */
if (request->actual == request->length || len < musb_ep->wPacketSize) if (request->actual == request->length || len < musb_ep->packet_sz)
musb_g_giveback(musb_ep, request, 0); musb_g_giveback(musb_ep, request, 0);
} }
...@@ -807,7 +807,7 @@ void musb_g_rx(struct musb *musb, u8 epnum) ...@@ -807,7 +807,7 @@ void musb_g_rx(struct musb *musb, u8 epnum)
/* Autoclear doesn't clear RxPktRdy for short packets */ /* Autoclear doesn't clear RxPktRdy for short packets */
if ((dma->desired_mode == 0) if ((dma->desired_mode == 0)
|| (dma->actual_len || (dma->actual_len
& (musb_ep->wPacketSize - 1))) { & (musb_ep->packet_sz - 1))) {
/* ack the read! */ /* ack the read! */
csr &= ~MGC_M_RXCSR_RXPKTRDY; csr &= ~MGC_M_RXCSR_RXPKTRDY;
musb_writew(epio, MGC_O_HDRC_RXCSR, csr); musb_writew(epio, MGC_O_HDRC_RXCSR, csr);
...@@ -816,7 +816,7 @@ void musb_g_rx(struct musb *musb, u8 epnum) ...@@ -816,7 +816,7 @@ void musb_g_rx(struct musb *musb, u8 epnum)
/* incomplete, and not short? wait for next IN packet */ /* incomplete, and not short? wait for next IN packet */
if ((request->actual < request->length) if ((request->actual < request->length)
&& (musb_ep->dma->actual_len && (musb_ep->dma->actual_len
== musb_ep->wPacketSize)) == musb_ep->packet_sz))
goto done; goto done;
#endif #endif
musb_g_giveback(musb_ep, request, 0); musb_g_giveback(musb_ep, request, 0);
...@@ -887,7 +887,7 @@ static int musb_gadget_enable(struct usb_ep *ep, ...@@ -887,7 +887,7 @@ static int musb_gadget_enable(struct usb_ep *ep,
tmp = le16_to_cpu(desc->wMaxPacketSize); tmp = le16_to_cpu(desc->wMaxPacketSize);
if (tmp & ~0x07ff) if (tmp & ~0x07ff)
goto fail; goto fail;
musb_ep->wPacketSize = tmp; musb_ep->packet_sz = tmp;
/* enable the interrupts for the endpoint, set the endpoint /* enable the interrupts for the endpoint, set the endpoint
* packet size (or fail), set the mode, clear the fifo * packet size (or fail), set the mode, clear the fifo
...@@ -983,7 +983,7 @@ static int musb_gadget_enable(struct usb_ep *ep, ...@@ -983,7 +983,7 @@ static int musb_gadget_enable(struct usb_ep *ep,
}; s; }), }; s; }),
musb_ep->is_in ? "IN" : "OUT", musb_ep->is_in ? "IN" : "OUT",
musb_ep->dma ? "dma, " : "", musb_ep->dma ? "dma, " : "",
musb_ep->wPacketSize); musb_ep->packet_sz);
schedule_work(&musb->irq_work); schedule_work(&musb->irq_work);
......
...@@ -67,7 +67,7 @@ struct musb_ep { ...@@ -67,7 +67,7 @@ struct musb_ep {
/* ... when enabled/disabled ... */ /* ... when enabled/disabled ... */
u8 type; u8 type;
u8 is_in; u8 is_in;
u16 wPacketSize; u16 packet_sz;
const struct usb_endpoint_descriptor *desc; const struct usb_endpoint_descriptor *desc;
struct dma_channel *dma; struct dma_channel *dma;
......
...@@ -634,14 +634,14 @@ static void musb_ep_program(struct musb *musb, u8 epnum, ...@@ -634,14 +634,14 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
struct musb_hw_ep *hw_ep = musb->endpoints + epnum; struct musb_hw_ep *hw_ep = musb->endpoints + epnum;
void __iomem *epio = hw_ep->regs; void __iomem *epio = hw_ep->regs;
struct musb_qh *qh; struct musb_qh *qh;
u16 wPacketSize; u16 packet_sz;
if (!is_out || hw_ep->is_shared_fifo) if (!is_out || hw_ep->is_shared_fifo)
qh = hw_ep->in_qh; qh = hw_ep->in_qh;
else else
qh = hw_ep->out_qh; qh = hw_ep->out_qh;
wPacketSize = qh->maxpacket; packet_sz = qh->maxpacket;
DBG(3, "%s hw%d urb %p spd%d dev%d ep%d%s " DBG(3, "%s hw%d urb %p spd%d dev%d ep%d%s "
"h_addr%02x h_port%02x bytes %d\n", "h_addr%02x h_port%02x bytes %d\n",
...@@ -739,12 +739,12 @@ static void musb_ep_program(struct musb *musb, u8 epnum, ...@@ -739,12 +739,12 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
musb_writeb(epio, MGC_O_HDRC_TXTYPE, qh->type_reg); musb_writeb(epio, MGC_O_HDRC_TXTYPE, qh->type_reg);
if (can_bulk_split(musb, qh->type)) if (can_bulk_split(musb, qh->type))
musb_writew(epio, MGC_O_HDRC_TXMAXP, musb_writew(epio, MGC_O_HDRC_TXMAXP,
wPacketSize packet_sz
| ((hw_ep->max_packet_sz_tx / | ((hw_ep->max_packet_sz_tx /
wPacketSize) - 1) << 11); packet_sz) - 1) << 11);
else else
musb_writew(epio, MGC_O_HDRC_TXMAXP, musb_writew(epio, MGC_O_HDRC_TXMAXP,
wPacketSize); packet_sz);
musb_writeb(epio, MGC_O_HDRC_TXINTERVAL, qh->intv_reg); musb_writeb(epio, MGC_O_HDRC_TXINTERVAL, qh->intv_reg);
} else { } else {
musb_writeb(epio, MGC_O_HDRC_NAKLIMIT0, qh->intv_reg); musb_writeb(epio, MGC_O_HDRC_NAKLIMIT0, qh->intv_reg);
...@@ -757,7 +757,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum, ...@@ -757,7 +757,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
wLoadCount = min((u32) hw_ep->max_packet_sz_tx, wLoadCount = min((u32) hw_ep->max_packet_sz_tx,
dwLength); dwLength);
else else
wLoadCount = min((u32) wPacketSize, dwLength); wLoadCount = min((u32) packet_sz, dwLength);
#ifdef CONFIG_USB_INVENTRA_DMA #ifdef CONFIG_USB_INVENTRA_DMA
if (pDmaChannel) { if (pDmaChannel) {
...@@ -773,7 +773,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum, ...@@ -773,7 +773,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
qh->segsize = min(dwLength, pDmaChannel->max_len); qh->segsize = min(dwLength, pDmaChannel->max_len);
if (qh->segsize <= wPacketSize) if (qh->segsize <= packet_sz)
pDmaChannel->desired_mode = 0; pDmaChannel->desired_mode = 0;
else else
pDmaChannel->desired_mode = 1; pDmaChannel->desired_mode = 1;
...@@ -792,7 +792,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum, ...@@ -792,7 +792,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
musb_writew(epio, MGC_O_HDRC_TXCSR, wCsr); musb_writew(epio, MGC_O_HDRC_TXCSR, wCsr);
bDmaOk = dma_controller->channel_program( bDmaOk = dma_controller->channel_program(
pDmaChannel, wPacketSize, pDmaChannel, packet_sz,
pDmaChannel->desired_mode, pDmaChannel->desired_mode,
pUrb->transfer_dma, pUrb->transfer_dma,
qh->segsize); qh->segsize);
...@@ -831,7 +831,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum, ...@@ -831,7 +831,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
* to identify the zero-length-final-packet case. * to identify the zero-length-final-packet case.
*/ */
bDmaOk = dma_controller->channel_program( bDmaOk = dma_controller->channel_program(
pDmaChannel, wPacketSize, pDmaChannel, packet_sz,
(pUrb->transfer_flags (pUrb->transfer_flags
& URB_ZERO_PACKET) & URB_ZERO_PACKET)
== URB_ZERO_PACKET, == URB_ZERO_PACKET,
...@@ -916,7 +916,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum, ...@@ -916,7 +916,7 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
* errors, we dare not queue multiple transfers. * errors, we dare not queue multiple transfers.
*/ */
bDmaOk = dma_controller->channel_program( bDmaOk = dma_controller->channel_program(
pDmaChannel, wPacketSize, pDmaChannel, packet_sz,
!(pUrb->transfer_flags !(pUrb->transfer_flags
& URB_SHORT_NOT_OK), & URB_SHORT_NOT_OK),
pUrb->transfer_dma, pUrb->transfer_dma,
......
...@@ -171,7 +171,7 @@ static void dma_channel_release(struct dma_channel *pChannel) ...@@ -171,7 +171,7 @@ static void dma_channel_release(struct dma_channel *pChannel)
} }
static void configure_channel(struct dma_channel *pChannel, static void configure_channel(struct dma_channel *pChannel,
u16 wPacketSize, u8 mode, u16 packet_sz, u8 mode,
dma_addr_t dma_addr, u32 dwLength) dma_addr_t dma_addr, u32 dwLength)
{ {
struct musb_dma_channel *pImplChannel = struct musb_dma_channel *pImplChannel =
...@@ -182,20 +182,20 @@ static void configure_channel(struct dma_channel *pChannel, ...@@ -182,20 +182,20 @@ static void configure_channel(struct dma_channel *pChannel,
u16 wCsr = 0; u16 wCsr = 0;
DBG(4, "%p, pkt_sz %d, addr 0x%x, len %d, mode %d\n", DBG(4, "%p, pkt_sz %d, addr 0x%x, len %d, mode %d\n",
pChannel, wPacketSize, dma_addr, dwLength, mode); pChannel, packet_sz, dma_addr, dwLength, mode);
if (mode) { if (mode) {
wCsr |= 1 << MGC_S_HSDMA_MODE1; wCsr |= 1 << MGC_S_HSDMA_MODE1;
if (dwLength < wPacketSize) { if (dwLength < packet_sz) {
return FALSE; return FALSE;
} }
if (wPacketSize >= 64) { if (packet_sz >= 64) {
wCsr |= wCsr |=
MGC_HSDMA_BURSTMODE_INCR16 << MGC_S_HSDMA_BURSTMODE; MGC_HSDMA_BURSTMODE_INCR16 << MGC_S_HSDMA_BURSTMODE;
} else if (wPacketSize >= 32) { } else if (packet_sz >= 32) {
wCsr |= wCsr |=
MGC_HSDMA_BURSTMODE_INCR8 << MGC_S_HSDMA_BURSTMODE; MGC_HSDMA_BURSTMODE_INCR8 << MGC_S_HSDMA_BURSTMODE;
} else if (wPacketSize >= 16) { } else if (packet_sz >= 16) {
wCsr |= wCsr |=
MGC_HSDMA_BURSTMODE_INCR4 << MGC_S_HSDMA_BURSTMODE; MGC_HSDMA_BURSTMODE_INCR4 << MGC_S_HSDMA_BURSTMODE;
} }
...@@ -221,7 +221,7 @@ static void configure_channel(struct dma_channel *pChannel, ...@@ -221,7 +221,7 @@ static void configure_channel(struct dma_channel *pChannel,
} }
static int dma_channel_program(struct dma_channel * pChannel, static int dma_channel_program(struct dma_channel * pChannel,
u16 wPacketSize, u8 mode, u16 packet_sz, u8 mode,
dma_addr_t dma_addr, u32 dwLength) dma_addr_t dma_addr, u32 dwLength)
{ {
struct musb_dma_channel *pImplChannel = struct musb_dma_channel *pImplChannel =
...@@ -230,7 +230,7 @@ static int dma_channel_program(struct dma_channel * pChannel, ...@@ -230,7 +230,7 @@ static int dma_channel_program(struct dma_channel * pChannel,
DBG(2, "ep%d-%s pkt_sz %d, dma_addr 0x%x length %d, mode %d\n", DBG(2, "ep%d-%s pkt_sz %d, dma_addr 0x%x length %d, mode %d\n",
pImplChannel->epnum, pImplChannel->epnum,
pImplChannel->bTransmit ? "Tx" : "Rx", pImplChannel->bTransmit ? "Tx" : "Rx",
wPacketSize, dma_addr, dwLength, mode); packet_sz, dma_addr, dwLength, mode);
BUG_ON(pChannel->status == MGC_DMA_STATUS_UNKNOWN || BUG_ON(pChannel->status == MGC_DMA_STATUS_UNKNOWN ||
pChannel->status == MGC_DMA_STATUS_BUSY); pChannel->status == MGC_DMA_STATUS_BUSY);
...@@ -238,14 +238,14 @@ static int dma_channel_program(struct dma_channel * pChannel, ...@@ -238,14 +238,14 @@ static int dma_channel_program(struct dma_channel * pChannel,
pChannel->actual_len = 0; pChannel->actual_len = 0;
pImplChannel->dwStartAddress = dma_addr; pImplChannel->dwStartAddress = dma_addr;
pImplChannel->len = dwLength; pImplChannel->len = dwLength;
pImplChannel->wMaxPacketSize = wPacketSize; pImplChannel->wMaxPacketSize = packet_sz;
pChannel->status = MGC_DMA_STATUS_BUSY; pChannel->status = MGC_DMA_STATUS_BUSY;
if ((mode == 1) && (dwLength >= wPacketSize)) { if ((mode == 1) && (dwLength >= packet_sz)) {
configure_channel(pChannel, wPacketSize, 1, dma_addr, configure_channel(pChannel, packet_sz, 1, dma_addr,
dwLength); dwLength);
} else } else
configure_channel(pChannel, wPacketSize, 0, dma_addr, configure_channel(pChannel, packet_sz, 0, dma_addr,
dwLength); dwLength);
return TRUE; return TRUE;
......
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