Commit 312887fa authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

musb_hdrc: Some more cleanup

Some more cleanup:

 - Primarily move from TRUE and FALSE to use "bool", "true", "false"
 - Some whitespace and longline cleanup
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
parent e7b6b5b6
...@@ -52,8 +52,7 @@ static inline void cpu_drain_writebuffer(void) ...@@ -52,8 +52,7 @@ static inline void cpu_drain_writebuffer(void)
#endif #endif
} }
static inline struct cppi_descriptor * static inline struct cppi_descriptor *cppi_bd_alloc(struct cppi_channel *c)
cppi_bd_alloc(struct cppi_channel *c)
{ {
struct cppi_descriptor *bd = c->bdPoolHead; struct cppi_descriptor *bd = c->bdPoolHead;
...@@ -147,11 +146,11 @@ static int __init cppi_controller_start(struct dma_controller *c) ...@@ -147,11 +146,11 @@ static int __init cppi_controller_start(struct dma_controller *c)
/* do whatever is necessary to start controller */ /* do whatever is necessary to start controller */
for (i = 0; i < ARRAY_SIZE(controller->txCppi); i++) { for (i = 0; i < ARRAY_SIZE(controller->txCppi); i++) {
controller->txCppi[i].transmit = TRUE; controller->txCppi[i].transmit = true;
controller->txCppi[i].chNo = i; controller->txCppi[i].chNo = i;
} }
for (i = 0; i < ARRAY_SIZE(controller->rxCppi); i++) { for (i = 0; i < ARRAY_SIZE(controller->rxCppi); i++) {
controller->rxCppi[i].transmit = FALSE; controller->rxCppi[i].transmit = false;
controller->rxCppi[i].chNo = i; controller->rxCppi[i].chNo = i;
} }
...@@ -996,7 +995,7 @@ static int cppi_channel_program(struct dma_channel *pChannel, ...@@ -996,7 +995,7 @@ static int cppi_channel_program(struct dma_channel *pChannel,
else else
cppi_next_rx_segment(musb, otgChannel, mode); cppi_next_rx_segment(musb, otgChannel, mode);
return TRUE; return true;
} }
static int cppi_rx_scan(struct cppi *cppi, unsigned ch) static int cppi_rx_scan(struct cppi *cppi, unsigned ch)
......
...@@ -33,10 +33,10 @@ ...@@ -33,10 +33,10 @@
struct cppi_descriptor { struct cppi_descriptor {
/* Hardware Overlay */ /* Hardware Overlay */
u32 hNext; /**< Next(hardware) Buffer Descriptor Pointer */ u32 hNext; /* Next(hardware) Buffer Descriptor Pointer */
u32 buffPtr; /**<Buffer Pointer (dma_addr_t) */ u32 buffPtr; /* Buffer Pointer (dma_addr_t) */
u32 bOffBLen; /**<Buffer_offset16,buffer_length16 */ u32 bOffBLen; /* Buffer_offset16,buffer_length16 */
u32 hOptions; /**<Option fields for SOP,EOP etc*/ u32 hOptions; /* Option fields for SOP,EOP etc*/
struct cppi_descriptor *next; struct cppi_descriptor *next;
dma_addr_t dma; /* address of this descriptor */ dma_addr_t dma; /* address of this descriptor */
...@@ -46,7 +46,6 @@ struct cppi_descriptor { ...@@ -46,7 +46,6 @@ struct cppi_descriptor {
} __attribute__ ((aligned(CPPI_DESCRIPTOR_ALIGN))); } __attribute__ ((aligned(CPPI_DESCRIPTOR_ALIGN)));
/* forward declaration for CppiDmaController structure */
struct cppi; struct cppi;
/** /**
...@@ -66,7 +65,7 @@ struct cppi_channel { ...@@ -66,7 +65,7 @@ struct cppi_channel {
/* which direction of which endpoint? */ /* which direction of which endpoint? */
struct musb_hw_ep *hw_ep; struct musb_hw_ep *hw_ep;
u8 transmit; bool transmit;
u8 chNo; u8 chNo;
/* DMA modes: RNDIS or "transparent" */ /* DMA modes: RNDIS or "transparent" */
......
...@@ -299,7 +299,7 @@ void musb_otg_timer_func(unsigned long data) ...@@ -299,7 +299,7 @@ void musb_otg_timer_func(unsigned long data)
spin_lock_irqsave(&musb->lock, flags); spin_lock_irqsave(&musb->lock, flags);
if (musb->xceiv.state == OTG_STATE_B_WAIT_ACON) { if (musb->xceiv.state == OTG_STATE_B_WAIT_ACON) {
DBG(1, "HNP: B_WAIT_ACON timeout, going back to B_PERIPHERAL\n"); DBG(1, "HNP: B_WAIT_ACON timeout; back to B_PERIPHERAL\n");
musb_g_disconnect(musb); musb_g_disconnect(musb);
musb->xceiv.state = OTG_STATE_B_PERIPHERAL; musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
musb->is_active = 0; musb->is_active = 0;
...@@ -434,7 +434,8 @@ static irqreturn_t musb_stage0_irq(struct musb * musb, u8 int_usb, ...@@ -434,7 +434,8 @@ static irqreturn_t musb_stage0_irq(struct musb * musb, u8 int_usb,
* not get a disconnect irq... * not get a disconnect irq...
*/ */
if ((devctl & MUSB_DEVCTL_VBUS) if ((devctl & MUSB_DEVCTL_VBUS)
!= (3 << MUSB_DEVCTL_VBUS_SHIFT)) { != (3 << MUSB_DEVCTL_VBUS_SHIFT)
) {
musb->int_usb |= MUSB_INTR_DISCONNECT; musb->int_usb |= MUSB_INTR_DISCONNECT;
musb->int_usb &= ~MUSB_INTR_SUSPEND; musb->int_usb &= ~MUSB_INTR_SUSPEND;
break; break;
...@@ -582,7 +583,7 @@ static irqreturn_t musb_stage0_irq(struct musb * musb, u8 int_usb, ...@@ -582,7 +583,7 @@ static irqreturn_t musb_stage0_irq(struct musb * musb, u8 int_usb,
switch (musb->xceiv.state) { switch (musb->xceiv.state) {
case OTG_STATE_B_PERIPHERAL: case OTG_STATE_B_PERIPHERAL:
if (int_usb & MUSB_INTR_SUSPEND) { if (int_usb & MUSB_INTR_SUSPEND) {
DBG(1, "HNP: SUSPEND and CONNECT, now b_host\n"); DBG(1, "HNP: SUSPEND+CONNECT, now b_host\n");
musb->xceiv.state = OTG_STATE_B_HOST; musb->xceiv.state = OTG_STATE_B_HOST;
hcd->self.is_b_host = 1; hcd->self.is_b_host = 1;
int_usb &= ~MUSB_INTR_SUSPEND; int_usb &= ~MUSB_INTR_SUSPEND;
...@@ -615,14 +616,14 @@ static irqreturn_t musb_stage0_irq(struct musb * musb, u8 int_usb, ...@@ -615,14 +616,14 @@ static irqreturn_t musb_stage0_irq(struct musb * musb, u8 int_usb,
/* /*
* Looks like non-HS BABBLE can be ignored, but * Looks like non-HS BABBLE can be ignored, but
* HS BABBLE is an error condition. For HS the solution * HS BABBLE is an error condition. For HS the solution
* is to avoid babble in the first place and fix whatever * is to avoid babble in the first place and fix what
* causes BABBLE. When HS BABBLE happens we can only stop * caused BABBLE. When HS BABBLE happens we can only
* the session. * stop the session.
*/ */
if (devctl & (MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV)) if (devctl & (MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV))
DBG(1, "BABBLE devctl: %02x\n", devctl); DBG(1, "BABBLE devctl: %02x\n", devctl);
else { else {
ERR("Stopping host session because of babble\n"); ERR("Stopping host session -- babble\n");
musb_writeb(mbase, MUSB_DEVCTL, 0); musb_writeb(mbase, MUSB_DEVCTL, 0);
} }
} else if (is_peripheral_capable()) { } else if (is_peripheral_capable()) {
...@@ -1088,7 +1089,7 @@ fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, ...@@ -1088,7 +1089,7 @@ fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep,
hw_ep->tx_double_buffered = hw_ep->rx_double_buffered; hw_ep->tx_double_buffered = hw_ep->rx_double_buffered;
hw_ep->max_packet_sz_tx = maxpacket; hw_ep->max_packet_sz_tx = maxpacket;
hw_ep->is_shared_fifo = TRUE; hw_ep->is_shared_fifo = true;
break; break;
} }
...@@ -1214,11 +1215,11 @@ static int __init ep_config_from_hw(struct musb *musb) ...@@ -1214,11 +1215,11 @@ static int __init ep_config_from_hw(struct musb *musb)
/* shared TX/RX FIFO? */ /* shared TX/RX FIFO? */
if ((reg & 0xf0) == 0xf0) { if ((reg & 0xf0) == 0xf0) {
hw_ep->max_packet_sz_rx = hw_ep->max_packet_sz_tx; hw_ep->max_packet_sz_rx = hw_ep->max_packet_sz_tx;
hw_ep->is_shared_fifo = TRUE; hw_ep->is_shared_fifo = true;
continue; continue;
} else { } else {
hw_ep->max_packet_sz_rx = 1 << ((reg & 0xf0) >> 4); hw_ep->max_packet_sz_rx = 1 << ((reg & 0xf0) >> 4);
hw_ep->is_shared_fifo = FALSE; hw_ep->is_shared_fifo = false;
} }
/* FIXME set up hw_ep->{rx,tx}_double_buffered */ /* FIXME set up hw_ep->{rx,tx}_double_buffered */
...@@ -1277,7 +1278,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) ...@@ -1277,7 +1278,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)
if (reg & MUSB_CONFIGDATA_MPRXE) { if (reg & MUSB_CONFIGDATA_MPRXE) {
strcat(aInfo, ", bulk combine"); strcat(aInfo, ", bulk combine");
#ifdef C_MP_RX #ifdef C_MP_RX
musb->bulk_combine = TRUE; musb->bulk_combine = true;
#else #else
strcat(aInfo, " (X)"); /* no driver support */ strcat(aInfo, " (X)"); /* no driver support */
#endif #endif
...@@ -1285,7 +1286,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) ...@@ -1285,7 +1286,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)
if (reg & MUSB_CONFIGDATA_MPTXE) { if (reg & MUSB_CONFIGDATA_MPTXE) {
strcat(aInfo, ", bulk split"); strcat(aInfo, ", bulk split");
#ifdef C_MP_TX #ifdef C_MP_TX
musb->bulk_split = TRUE; musb->bulk_split = true;
#else #else
strcat(aInfo, " (X)"); /* no driver support */ strcat(aInfo, " (X)"); /* no driver support */
#endif #endif
......
...@@ -164,13 +164,6 @@ static inline void musb_host_rx(struct musb *m, u8 e) {} ...@@ -164,13 +164,6 @@ static inline void musb_host_rx(struct musb *m, u8 e) {}
/****************************** CONSTANTS ********************************/ /****************************** CONSTANTS ********************************/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef MUSB_C_NUM_EPS #ifndef MUSB_C_NUM_EPS
#define MUSB_C_NUM_EPS ((u8)16) #define MUSB_C_NUM_EPS ((u8)16)
#endif #endif
...@@ -209,8 +202,8 @@ enum musb_g_ep0_state { ...@@ -209,8 +202,8 @@ enum musb_g_ep0_state {
* directly with the "flat" model, or after setting up an index register. * directly with the "flat" model, or after setting up an index register.
*/ */
#if defined(CONFIG_ARCH_DAVINCI) || defined(CONFIG_ARCH_OMAP2430) || \ #if defined(CONFIG_ARCH_DAVINCI) || defined(CONFIG_ARCH_OMAP2430) \
defined(CONFIG_ARCH_OMAP3430) || defined(CONFIG_ARCH_OMAP3430)
/* REVISIT indexed access seemed to /* REVISIT indexed access seemed to
* misbehave (on DaVinci) for at least peripheral IN ... * misbehave (on DaVinci) for at least peripheral IN ...
*/ */
...@@ -238,9 +231,9 @@ enum musb_g_ep0_state { ...@@ -238,9 +231,9 @@ enum musb_g_ep0_state {
/****************************** FUNCTIONS ********************************/ /****************************** FUNCTIONS ********************************/
#define MUSB_HST_MODE(_musb)\ #define MUSB_HST_MODE(_musb)\
{ (_musb)->is_host=TRUE; } { (_musb)->is_host = true; }
#define MUSB_DEV_MODE(_musb) \ #define MUSB_DEV_MODE(_musb) \
{ (_musb)->is_host=FALSE; } { (_musb)->is_host = false; }
#define test_devctl_hst_mode(_x) \ #define test_devctl_hst_mode(_x) \
(musb_readb((_x)->mregs, MUSB_DEVCTL)&MUSB_DEVCTL_HM) (musb_readb((_x)->mregs, MUSB_DEVCTL)&MUSB_DEVCTL_HM)
...@@ -267,9 +260,9 @@ struct musb_hw_ep { ...@@ -267,9 +260,9 @@ struct musb_hw_ep {
u8 epnum; u8 epnum;
/* hardware configuration, possibly dynamic */ /* hardware configuration, possibly dynamic */
u8 is_shared_fifo; bool is_shared_fifo;
u8 tx_double_buffered; bool tx_double_buffered;
u8 rx_double_buffered; bool rx_double_buffered;
u16 max_packet_sz_tx; u16 max_packet_sz_tx;
u16 max_packet_sz_rx; u16 max_packet_sz_rx;
...@@ -393,11 +386,12 @@ struct musb { ...@@ -393,11 +386,12 @@ struct musb {
u8 min_power; /* vbus for periph, in mA/2 */ u8 min_power; /* vbus for periph, in mA/2 */
bool is_host;
/* active means connected and not suspended */ /* active means connected and not suspended */
unsigned is_active:1; unsigned is_active:1;
unsigned is_multipoint:1; unsigned is_multipoint:1;
unsigned is_host:1;
unsigned ignore_disconnect:1; /* during bus resets */ unsigned ignore_disconnect:1; /* during bus resets */
int a_wait_bcon; /* VBUS timeout in msecs */ int a_wait_bcon; /* VBUS timeout in msecs */
...@@ -413,16 +407,11 @@ struct musb { ...@@ -413,16 +407,11 @@ struct musb {
#ifdef C_MP_RX #ifdef C_MP_RX
unsigned bulk_combine:1; unsigned bulk_combine:1;
/* REVISIT allegedly doesn't work reliably */
#if 0
#define can_bulk_combine(musb,type) \ #define can_bulk_combine(musb,type) \
(((type) == USB_ENDPOINT_XFER_BULK) && (musb)->bulk_combine) (((type) == USB_ENDPOINT_XFER_BULK) && (musb)->bulk_combine)
#else #else
#define can_bulk_combine(musb,type) 0 #define can_bulk_combine(musb,type) 0
#endif #endif
#else
#define can_bulk_combine(musb,type) 0
#endif
#ifdef CONFIG_USB_GADGET_MUSB_HDRC #ifdef CONFIG_USB_GADGET_MUSB_HDRC
/* is_suspended means USB B_PERIPHERAL suspend */ /* is_suspended means USB B_PERIPHERAL suspend */
...@@ -475,10 +464,8 @@ extern const char musb_driver_name[]; ...@@ -475,10 +464,8 @@ extern const char musb_driver_name[];
extern void musb_start(struct musb *musb); extern void musb_start(struct musb *musb);
extern void musb_stop(struct musb *musb); extern void musb_stop(struct musb *musb);
extern void musb_write_fifo(struct musb_hw_ep *ep, extern void musb_write_fifo(struct musb_hw_ep *ep, u16 len, const u8 * src);
u16 len, const u8 * src); extern void musb_read_fifo(struct musb_hw_ep *ep, u16 len, u8 * dst);
extern void musb_read_fifo(struct musb_hw_ep *ep,
u16 len, u8 * dst);
extern void musb_load_testpacket(struct musb *); extern void musb_load_testpacket(struct musb *);
...@@ -507,13 +494,12 @@ extern int musb_platform_exit(struct musb *musb); ...@@ -507,13 +494,12 @@ extern int musb_platform_exit(struct musb *musb);
struct proc_dir_entry; struct proc_dir_entry;
#if (MUSB_DEBUG > 0) && defined(MUSB_CONFIG_PROC_FS) #if (MUSB_DEBUG > 0) && defined(MUSB_CONFIG_PROC_FS)
extern struct proc_dir_entry *musb_debug_create(char *name, extern struct proc_dir_entry *musb_debug_create(char *name, struct musb *data);
struct musb *data);
extern void musb_debug_delete(char *name, struct musb *data); extern void musb_debug_delete(char *name, struct musb *data);
#else #else
static inline struct proc_dir_entry *musb_debug_create(char *name, static inline struct proc_dir_entry *
struct musb *data) musb_debug_create(char *name, struct musb *data)
{ {
return NULL; return NULL;
} }
......
...@@ -106,7 +106,7 @@ struct dma_controller; ...@@ -106,7 +106,7 @@ struct dma_controller;
* transaction (typically representing many USB maximum-sized packets) * transaction (typically representing many USB maximum-sized packets)
* @actual_len: how many bytes have been transferred * @actual_len: how many bytes have been transferred
* @status: current channel status (updated e.g. on interrupt) * @status: current channel status (updated e.g. on interrupt)
* @desired_mode: TRUE if mode 1 is desired; FALSE if mode 0 is desired * @desired_mode: true if mode 1 is desired; false if mode 0 is desired
* *
* channels are associated with an endpoint for the duration of at least * channels are associated with an endpoint for the duration of at least
* one usb transfer. * one usb transfer.
...@@ -117,7 +117,7 @@ struct dma_channel { ...@@ -117,7 +117,7 @@ struct dma_channel {
size_t max_len; size_t max_len;
size_t actual_len; size_t actual_len;
enum dma_channel_status status; enum dma_channel_status status;
u8 desired_mode; bool desired_mode;
}; };
/* /*
......
...@@ -635,7 +635,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -635,7 +635,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
* that last pckate should trigger an overflow fault.) But in mode 1, * that last pckate should trigger an overflow fault.) But in mode 1,
* we don't get DMA completion interrrupt for short packets. * we don't get DMA completion interrrupt for short packets.
* *
* Theoretically, we could enable DMAReq interrupt (MUSB_RXCSR_DMAMODE = 1), * Theoretically, we could enable DMAReq irq (MUSB_RXCSR_DMAMODE = 1),
* to get endpoint interrupt on every DMA req, but that didn't seem * to get endpoint interrupt on every DMA req, but that didn't seem
* to work reliably. * to work reliably.
* *
...@@ -649,14 +649,13 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -649,14 +649,13 @@ static void rxstate(struct musb *musb, struct musb_request *req)
// csr |= MUSB_RXCSR_DMAMODE; // csr |= MUSB_RXCSR_DMAMODE;
/* this special sequence (enabling and then /* this special sequence (enabling and then
disabling MUSB_RXCSR_DMAMODE) is required * disabling MUSB_RXCSR_DMAMODE) is required
to get DMAReq to activate * to get DMAReq to activate
*/ */
musb_writew(epio, MUSB_RXCSR, musb_writew(epio, MUSB_RXCSR,
csr | MUSB_RXCSR_DMAMODE); csr | MUSB_RXCSR_DMAMODE);
#endif #endif
musb_writew(epio, MUSB_RXCSR, musb_writew(epio, MUSB_RXCSR, csr);
csr);
if (request->actual < request->length) { if (request->actual < request->length) {
int transfer_size = 0; int transfer_size = 0;
...@@ -683,7 +682,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -683,7 +682,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
if (use_dma) if (use_dma)
return; return;
} }
#endif /* Mentor's USB */ #endif /* Mentor's DMA */
fifo_count = request->length - request->actual; fifo_count = request->length - request->actual;
DBG(3, "%s OUT/RX pio fifo %d/%d, maxpacket %d\n", DBG(3, "%s OUT/RX pio fifo %d/%d, maxpacket %d\n",
...@@ -705,7 +704,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) ...@@ -705,7 +704,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
channel->desired_mode, channel->desired_mode,
dma_addr, dma_addr,
fifo_count); fifo_count);
if (ret == TRUE) if (ret)
return; return;
} }
#endif #endif
...@@ -1492,14 +1491,6 @@ static int musb_gadget_vbus_session(struct usb_gadget *gadget, int is_active) ...@@ -1492,14 +1491,6 @@ static int musb_gadget_vbus_session(struct usb_gadget *gadget, int is_active)
return -EINVAL; return -EINVAL;
} }
static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
{
/* FIXME -- delegate to otg_transciever logic */
DBG(2, "<= vbus_draw %u =>\n", mA);
return 0;
}
#endif #endif
static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
...@@ -1775,8 +1766,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) ...@@ -1775,8 +1766,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
} }
EXPORT_SYMBOL(usb_gadget_register_driver); EXPORT_SYMBOL(usb_gadget_register_driver);
static void static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver)
stop_activity(struct musb *musb, struct usb_gadget_driver *driver)
{ {
int i; int i;
struct musb_hw_ep *hw_ep; struct musb_hw_ep *hw_ep;
......
...@@ -170,8 +170,7 @@ static int service_tx_status_request( ...@@ -170,8 +170,7 @@ static int service_tx_status_request(
* Context: caller holds controller lock * Context: caller holds controller lock
*/ */
static int static int
service_in_request(struct musb *musb, service_in_request(struct musb *musb, const struct usb_ctrlrequest *ctrlrequest)
const struct usb_ctrlrequest *ctrlrequest)
{ {
int handled = 0; /* not handled */ int handled = 0; /* not handled */
...@@ -240,7 +239,7 @@ __acquires(musb->lock) ...@@ -240,7 +239,7 @@ __acquires(musb->lock)
switch (ctrlrequest->bRequest) { switch (ctrlrequest->bRequest) {
case USB_REQ_SET_ADDRESS: case USB_REQ_SET_ADDRESS:
/* change it after the status stage */ /* change it after the status stage */
musb->set_address = TRUE; musb->set_address = true;
musb->address = (u8) (ctrlrequest->wValue & 0x7f); musb->address = (u8) (ctrlrequest->wValue & 0x7f);
handled = 1; handled = 1;
break; break;
...@@ -334,7 +333,7 @@ __acquires(musb->lock) ...@@ -334,7 +333,7 @@ __acquires(musb->lock)
/* enter test mode after irq */ /* enter test mode after irq */
if (handled > 0) if (handled > 0)
musb->test_mode = TRUE; musb->test_mode = true;
break; break;
#ifdef CONFIG_USB_MUSB_OTG #ifdef CONFIG_USB_MUSB_OTG
case USB_DEVICE_B_HNP_ENABLE: case USB_DEVICE_B_HNP_ENABLE:
...@@ -560,7 +559,7 @@ musb_read_setup(struct musb *musb, struct usb_ctrlrequest *req) ...@@ -560,7 +559,7 @@ musb_read_setup(struct musb *musb, struct usb_ctrlrequest *req)
* the TX FIFO right away, and give the controller a moment * the TX FIFO right away, and give the controller a moment
* to switch modes... * to switch modes...
*/ */
musb->set_address = FALSE; musb->set_address = false;
musb->ackpend = MUSB_CSR0_P_SVDRXPKTRDY; musb->ackpend = MUSB_CSR0_P_SVDRXPKTRDY;
if (req->wLength == 0) { if (req->wLength == 0) {
if (req->bRequestType & USB_DIR_IN) if (req->bRequestType & USB_DIR_IN)
...@@ -578,8 +577,7 @@ musb_read_setup(struct musb *musb, struct usb_ctrlrequest *req) ...@@ -578,8 +577,7 @@ musb_read_setup(struct musb *musb, struct usb_ctrlrequest *req)
} }
static int static int
forward_to_driver(struct musb *musb, forward_to_driver(struct musb *musb, const struct usb_ctrlrequest *ctrlrequest)
const struct usb_ctrlrequest *ctrlrequest)
__releases(musb->lock) __releases(musb->lock)
__acquires(musb->lock) __acquires(musb->lock)
{ {
...@@ -663,7 +661,7 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb) ...@@ -663,7 +661,7 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)
* is done we won't see the next packet. * is done we won't see the next packet.
*/ */
if (musb->set_address) { if (musb->set_address) {
musb->set_address = FALSE; musb->set_address = false;
musb_writeb(mbase, MUSB_FADDR, musb->address); musb_writeb(mbase, MUSB_FADDR, musb->address);
} }
...@@ -897,8 +895,7 @@ cleanup: ...@@ -897,8 +895,7 @@ cleanup:
return status; return status;
} }
static int static int musb_g_ep0_dequeue(struct usb_ep *ep, struct usb_request *req)
musb_g_ep0_dequeue(struct usb_ep *ep, struct usb_request *req)
{ {
/* we just won't support this */ /* we just won't support this */
return -EINVAL; return -EINVAL;
......
...@@ -311,7 +311,8 @@ __acquires(musb->lock) ...@@ -311,7 +311,8 @@ __acquires(musb->lock)
} }
/* for bulk/interrupt endpoints only */ /* for bulk/interrupt endpoints only */
static inline void musb_save_toggle(struct musb_hw_ep *ep, int is_in, struct urb *urb) static inline void
musb_save_toggle(struct musb_hw_ep *ep, int is_in, struct urb *urb)
{ {
struct usb_device *udev = urb->dev; struct usb_device *udev = urb->dev;
u16 csr; u16 csr;
...@@ -466,13 +467,13 @@ static inline u16 musb_h_flush_rxfifo(struct musb_hw_ep *hw_ep, u16 csr) ...@@ -466,13 +467,13 @@ static inline u16 musb_h_flush_rxfifo(struct musb_hw_ep *hw_ep, u16 csr)
/* /*
* PIO RX for a packet (or part of it). * PIO RX for a packet (or part of it).
*/ */
static u8 musb_host_packet_rx(struct musb *musb, struct urb *urb, static bool
u8 epnum, u8 iso_err) musb_host_packet_rx(struct musb *musb, struct urb *urb, u8 epnum, u8 iso_err)
{ {
u16 rx_count; u16 rx_count;
u8 *buf; u8 *buf;
u16 csr; u16 csr;
u8 done = FALSE; bool done = false;
u32 length; u32 length;
int do_flush = 0; int do_flush = 0;
struct musb_hw_ep *hw_ep = musb->endpoints + epnum; struct musb_hw_ep *hw_ep = musb->endpoints + epnum;
...@@ -940,12 +941,11 @@ static void musb_ep_program(struct musb *musb, u8 epnum, ...@@ -940,12 +941,11 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
/* /*
* Service the default endpoint (ep0) as host. * Service the default endpoint (ep0) as host.
* Return TRUE until it's time to start the status stage. * Return true until it's time to start the status stage.
*/ */
static int musb_h_ep0_continue(struct musb *musb, static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb)
u16 len, struct urb *urb)
{ {
int more = FALSE; bool more = false;
u8 *fifo_dest = NULL; u8 *fifo_dest = NULL;
u16 fifo_count = 0; u16 fifo_count = 0;
struct musb_hw_ep *hw_ep = musb->control_ep; struct musb_hw_ep *hw_ep = musb->control_ep;
...@@ -969,7 +969,7 @@ static int musb_h_ep0_continue(struct musb *musb, ...@@ -969,7 +969,7 @@ static int musb_h_ep0_continue(struct musb *musb,
*/ */
} else if (urb->actual_length < } else if (urb->actual_length <
urb->transfer_buffer_length) urb->transfer_buffer_length)
more = TRUE; more = true;
break; break;
case MUSB_EP0_START: case MUSB_EP0_START:
request = (struct usb_ctrlrequest *) urb->setup_packet; request = (struct usb_ctrlrequest *) urb->setup_packet;
...@@ -980,12 +980,12 @@ static int musb_h_ep0_continue(struct musb *musb, ...@@ -980,12 +980,12 @@ static int musb_h_ep0_continue(struct musb *musb,
} else if (request->bRequestType & USB_DIR_IN) { } else if (request->bRequestType & USB_DIR_IN) {
DBG(4, "start IN-DATA\n"); DBG(4, "start IN-DATA\n");
musb->ep0_stage = MUSB_EP0_IN; musb->ep0_stage = MUSB_EP0_IN;
more = TRUE; more = true;
break; break;
} else { } else {
DBG(4, "start OUT-DATA\n"); DBG(4, "start OUT-DATA\n");
musb->ep0_stage = MUSB_EP0_OUT; musb->ep0_stage = MUSB_EP0_OUT;
more = TRUE; more = true;
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
case MUSB_EP0_OUT: case MUSB_EP0_OUT:
...@@ -1001,7 +1001,7 @@ static int musb_h_ep0_continue(struct musb *musb, ...@@ -1001,7 +1001,7 @@ static int musb_h_ep0_continue(struct musb *musb,
musb_write_fifo(hw_ep, fifo_count, fifo_dest); musb_write_fifo(hw_ep, fifo_count, fifo_dest);
urb->actual_length += fifo_count; urb->actual_length += fifo_count;
more = TRUE; more = true;
} }
break; break;
default: default:
...@@ -1027,7 +1027,7 @@ irqreturn_t musb_h_ep0_irq(struct musb *musb) ...@@ -1027,7 +1027,7 @@ irqreturn_t musb_h_ep0_irq(struct musb *musb)
struct musb_hw_ep *hw_ep = musb->control_ep; struct musb_hw_ep *hw_ep = musb->control_ep;
void __iomem *epio = hw_ep->regs; void __iomem *epio = hw_ep->regs;
struct musb_qh *qh = hw_ep->in_qh; struct musb_qh *qh = hw_ep->in_qh;
u8 complete = FALSE; bool complete = false;
irqreturn_t retval = IRQ_NONE; irqreturn_t retval = IRQ_NONE;
/* ep0 only has one queue, "in" */ /* ep0 only has one queue, "in" */
...@@ -1045,7 +1045,7 @@ irqreturn_t musb_h_ep0_irq(struct musb *musb) ...@@ -1045,7 +1045,7 @@ irqreturn_t musb_h_ep0_irq(struct musb *musb)
/* if we just did status stage, we are done */ /* if we just did status stage, we are done */
if (MUSB_EP0_STATUS == musb->ep0_stage) { if (MUSB_EP0_STATUS == musb->ep0_stage) {
retval = IRQ_HANDLED; retval = IRQ_HANDLED;
complete = TRUE; complete = true;
} }
/* prepare status */ /* prepare status */
...@@ -1076,7 +1076,7 @@ irqreturn_t musb_h_ep0_irq(struct musb *musb) ...@@ -1076,7 +1076,7 @@ irqreturn_t musb_h_ep0_irq(struct musb *musb)
retval = IRQ_HANDLED; retval = IRQ_HANDLED;
if (urb) if (urb)
urb->status = status; urb->status = status;
complete = TRUE; complete = true;
/* use the proper sequence to abort the transfer */ /* use the proper sequence to abort the transfer */
if (csr & MUSB_CSR0_H_REQPKT) { if (csr & MUSB_CSR0_H_REQPKT) {
...@@ -1165,7 +1165,7 @@ done: ...@@ -1165,7 +1165,7 @@ done:
void musb_host_tx(struct musb *musb, u8 epnum) void musb_host_tx(struct musb *musb, u8 epnum)
{ {
int pipe; int pipe;
u8 done = FALSE; bool done = false;
u16 tx_csr; u16 tx_csr;
size_t wLength = 0; size_t wLength = 0;
u8 *buf = NULL; u8 *buf = NULL;
...@@ -1247,7 +1247,7 @@ void musb_host_tx(struct musb *musb, u8 epnum) ...@@ -1247,7 +1247,7 @@ void musb_host_tx(struct musb *musb, u8 epnum)
musb_writew(epio, MUSB_TXCSR, tx_csr); musb_writew(epio, MUSB_TXCSR, tx_csr);
musb_writeb(epio, MUSB_TXINTERVAL, 0); musb_writeb(epio, MUSB_TXINTERVAL, 0);
done = TRUE; done = true;
} }
/* second cppi case */ /* second cppi case */
...@@ -1271,22 +1271,22 @@ void musb_host_tx(struct musb *musb, u8 epnum) ...@@ -1271,22 +1271,22 @@ void musb_host_tx(struct musb *musb, u8 epnum)
d = urb->iso_frame_desc + qh->iso_idx; d = urb->iso_frame_desc + qh->iso_idx;
d->actual_length = qh->segsize; d->actual_length = qh->segsize;
if (++qh->iso_idx >= urb->number_of_packets) { if (++qh->iso_idx >= urb->number_of_packets) {
done = TRUE; done = true;
} else if (!dma) { } else if (!dma) {
d++; d++;
buf = urb->transfer_buffer + d->offset; buf = urb->transfer_buffer + d->offset;
wLength = d->length; wLength = d->length;
} }
} else if (dma) { } else if (dma) {
done = TRUE; done = true;
} else { } else {
/* see if we need to send more data, or ZLP */ /* see if we need to send more data, or ZLP */
if (qh->segsize < qh->maxpacket) if (qh->segsize < qh->maxpacket)
done = TRUE; done = true;
else if (qh->offset == urb->transfer_buffer_length else if (qh->offset == urb->transfer_buffer_length
&& !(urb-> transfer_flags && !(urb-> transfer_flags
& URB_ZERO_PACKET)) & URB_ZERO_PACKET))
done = TRUE; done = true;
if (!done) { if (!done) {
buf = urb->transfer_buffer buf = urb->transfer_buffer
+ qh->offset; + qh->offset;
...@@ -1300,7 +1300,7 @@ void musb_host_tx(struct musb *musb, u8 epnum) ...@@ -1300,7 +1300,7 @@ void musb_host_tx(struct musb *musb, u8 epnum)
* so we must abort this transfer after cleanup * so we must abort this transfer after cleanup
*/ */
if (urb->status != -EINPROGRESS) { if (urb->status != -EINPROGRESS) {
done = TRUE; done = true;
if (status == 0) if (status == 0)
status = urb->status; status = urb->status;
} }
...@@ -1387,8 +1387,8 @@ void musb_host_rx(struct musb *musb, u8 epnum) ...@@ -1387,8 +1387,8 @@ void musb_host_rx(struct musb *musb, u8 epnum)
void __iomem *mbase = musb->mregs; void __iomem *mbase = musb->mregs;
int pipe; int pipe;
u16 rx_csr, val; u16 rx_csr, val;
u8 iso_err = FALSE; bool iso_err = false;
u8 done = FALSE; bool done = false;
u32 status; u32 status;
struct dma_channel *dma; struct dma_channel *dma;
...@@ -1452,7 +1452,7 @@ void musb_host_rx(struct musb *musb, u8 epnum) ...@@ -1452,7 +1452,7 @@ void musb_host_rx(struct musb *musb, u8 epnum)
} else { } else {
DBG(4, "RX end %d ISO data error\n", epnum); DBG(4, "RX end %d ISO data error\n", epnum);
/* packet error reported later */ /* packet error reported later */
iso_err = TRUE; iso_err = true;
} }
} }
...@@ -1466,7 +1466,7 @@ void musb_host_rx(struct musb *musb, u8 epnum) ...@@ -1466,7 +1466,7 @@ void musb_host_rx(struct musb *musb, u8 epnum)
} }
musb_h_flush_rxfifo(hw_ep, 0); musb_h_flush_rxfifo(hw_ep, 0);
musb_writeb(epio, MUSB_RXINTERVAL, 0); musb_writeb(epio, MUSB_RXINTERVAL, 0);
done = TRUE; done = true;
goto finish; goto finish;
} }
...@@ -1494,7 +1494,7 @@ void musb_host_rx(struct musb *musb, u8 epnum) ...@@ -1494,7 +1494,7 @@ void musb_host_rx(struct musb *musb, u8 epnum)
dma->status = MUSB_DMA_STATUS_CORE_ABORT; dma->status = MUSB_DMA_STATUS_CORE_ABORT;
(void) musb->dma_controller->channel_abort(dma); (void) musb->dma_controller->channel_abort(dma);
xfer_len = dma->actual_len; xfer_len = dma->actual_len;
done = TRUE; done = true;
} }
DBG(2, "RXCSR%d %04x, reqpkt, len %zd%s\n", epnum, rx_csr, DBG(2, "RXCSR%d %04x, reqpkt, len %zd%s\n", epnum, rx_csr,
...@@ -1533,7 +1533,7 @@ void musb_host_rx(struct musb *musb, u8 epnum) ...@@ -1533,7 +1533,7 @@ void musb_host_rx(struct musb *musb, u8 epnum)
musb_readw(epio, MUSB_RXCSR), musb_readw(epio, MUSB_RXCSR),
musb_readw(epio, MUSB_RXCOUNT)); musb_readw(epio, MUSB_RXCOUNT));
#else #else
done = TRUE; done = true;
#endif #endif
} else if (urb->status == -EINPROGRESS) { } else if (urb->status == -EINPROGRESS) {
/* if no errors, be sure a packet is ready for unloading */ /* if no errors, be sure a packet is ready for unloading */
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include "musb_core.h" #include "musb_core.h"
static void musb_port_suspend(struct musb *musb, u8 bSuspend) static void musb_port_suspend(struct musb *musb, bool do_suspend)
{ {
u8 power; u8 power;
void __iomem *mbase = musb->mregs; void __iomem *mbase = musb->mregs;
...@@ -60,7 +60,7 @@ static void musb_port_suspend(struct musb *musb, u8 bSuspend) ...@@ -60,7 +60,7 @@ static void musb_port_suspend(struct musb *musb, u8 bSuspend)
* SE0 changing to connect (J) or wakeup (K) states. * SE0 changing to connect (J) or wakeup (K) states.
*/ */
power = musb_readb(mbase, MUSB_POWER); power = musb_readb(mbase, MUSB_POWER);
if (bSuspend) { if (do_suspend) {
int retries = 10000; int retries = 10000;
power &= ~MUSB_POWER_RESUME; power &= ~MUSB_POWER_RESUME;
...@@ -110,14 +110,14 @@ static void musb_port_suspend(struct musb *musb, u8 bSuspend) ...@@ -110,14 +110,14 @@ static void musb_port_suspend(struct musb *musb, u8 bSuspend)
} }
} }
static void musb_port_reset(struct musb *musb, u8 bReset) static void musb_port_reset(struct musb *musb, bool do_reset)
{ {
u8 power; u8 power;
void __iomem *mbase = musb->mregs; void __iomem *mbase = musb->mregs;
#ifdef CONFIG_USB_MUSB_OTG #ifdef CONFIG_USB_MUSB_OTG
if (musb->xceiv.state == OTG_STATE_B_IDLE) { if (musb->xceiv.state == OTG_STATE_B_IDLE) {
DBG(2, "HNP: Returning from HNP, not resetting hub as b_idle\n"); DBG(2, "HNP: Returning from HNP; no hub reset from b_idle\n");
musb->port1_status &= ~USB_PORT_STAT_RESET; musb->port1_status &= ~USB_PORT_STAT_RESET;
return; return;
} }
...@@ -130,7 +130,7 @@ static void musb_port_reset(struct musb *musb, u8 bReset) ...@@ -130,7 +130,7 @@ static void musb_port_reset(struct musb *musb, u8 bReset)
* the appropriate amount of time has passed * the appropriate amount of time has passed
*/ */
power = musb_readb(mbase, MUSB_POWER); power = musb_readb(mbase, MUSB_POWER);
if (bReset) { if (do_reset) {
/* /*
* If RESUME is set, we must make sure it stays minimum 20 ms. * If RESUME is set, we must make sure it stays minimum 20 ms.
...@@ -147,7 +147,7 @@ static void musb_port_reset(struct musb *musb, u8 bReset) ...@@ -147,7 +147,7 @@ static void musb_port_reset(struct musb *musb, u8 bReset)
msleep(1); msleep(1);
} }
musb->ignore_disconnect = TRUE; musb->ignore_disconnect = true;
power &= 0xf0; power &= 0xf0;
musb_writeb(mbase, MUSB_POWER, musb_writeb(mbase, MUSB_POWER,
power | MUSB_POWER_RESET); power | MUSB_POWER_RESET);
...@@ -160,7 +160,7 @@ static void musb_port_reset(struct musb *musb, u8 bReset) ...@@ -160,7 +160,7 @@ static void musb_port_reset(struct musb *musb, u8 bReset)
musb_writeb(mbase, MUSB_POWER, musb_writeb(mbase, MUSB_POWER,
power & ~MUSB_POWER_RESET); power & ~MUSB_POWER_RESET);
musb->ignore_disconnect = FALSE; musb->ignore_disconnect = false;
power = musb_readb(mbase, MUSB_POWER); power = musb_readb(mbase, MUSB_POWER);
if (power & MUSB_POWER_HSMODE) { if (power & MUSB_POWER_HSMODE) {
...@@ -255,7 +255,7 @@ int musb_hub_control( ...@@ -255,7 +255,7 @@ int musb_hub_control(
case USB_PORT_FEAT_ENABLE: case USB_PORT_FEAT_ENABLE:
break; break;
case USB_PORT_FEAT_SUSPEND: case USB_PORT_FEAT_SUSPEND:
musb_port_suspend(musb, FALSE); musb_port_suspend(musb, false);
break; break;
case USB_PORT_FEAT_POWER: case USB_PORT_FEAT_POWER:
if (!(is_otg_enabled(musb) && hcd->self.is_b_host)) if (!(is_otg_enabled(musb) && hcd->self.is_b_host))
...@@ -303,7 +303,7 @@ int musb_hub_control( ...@@ -303,7 +303,7 @@ int musb_hub_control(
/* finish RESET signaling? */ /* finish RESET signaling? */
if ((musb->port1_status & USB_PORT_STAT_RESET) if ((musb->port1_status & USB_PORT_STAT_RESET)
&& time_after(jiffies, musb->rh_timer)) && time_after(jiffies, musb->rh_timer))
musb_port_reset(musb, FALSE); musb_port_reset(musb, false);
/* finish RESUME signaling? */ /* finish RESUME signaling? */
if ((musb->port1_status & MUSB_PORT_STAT_RESUME) if ((musb->port1_status & MUSB_PORT_STAT_RESUME)
...@@ -330,7 +330,8 @@ int musb_hub_control( ...@@ -330,7 +330,8 @@ int musb_hub_control(
musb->xceiv.state = OTG_STATE_A_HOST; musb->xceiv.state = OTG_STATE_A_HOST;
} }
put_unaligned(cpu_to_le32(musb->port1_status & ~MUSB_PORT_STAT_RESUME), put_unaligned(cpu_to_le32(musb->port1_status
& ~MUSB_PORT_STAT_RESUME),
(__le32 *) buf); (__le32 *) buf);
/* port change status is more interesting */ /* port change status is more interesting */
...@@ -357,10 +358,10 @@ int musb_hub_control( ...@@ -357,10 +358,10 @@ int musb_hub_control(
musb_start(musb); musb_start(musb);
break; break;
case USB_PORT_FEAT_RESET: case USB_PORT_FEAT_RESET:
musb_port_reset(musb, TRUE); musb_port_reset(musb, true);
break; break;
case USB_PORT_FEAT_SUSPEND: case USB_PORT_FEAT_SUSPEND:
musb_port_suspend(musb, TRUE); musb_port_suspend(musb, true);
break; break;
case USB_PORT_FEAT_TEST: case USB_PORT_FEAT_TEST:
if (unlikely(is_host_active(musb))) if (unlikely(is_host_active(musb)))
...@@ -390,7 +391,8 @@ int musb_hub_control( ...@@ -390,7 +391,8 @@ int musb_hub_control(
temp = MUSB_TEST_FORCE_HOST temp = MUSB_TEST_FORCE_HOST
| MUSB_TEST_FORCE_HS; | MUSB_TEST_FORCE_HS;
musb_writeb(musb->mregs, MUSB_DEVCTL, MUSB_DEVCTL_SESSION); musb_writeb(musb->mregs, MUSB_DEVCTL,
MUSB_DEVCTL_SESSION);
break; break;
case 6: case 6:
pr_debug("TEST_FIFO_ACCESS\n"); pr_debug("TEST_FIFO_ACCESS\n");
......
...@@ -114,7 +114,7 @@ static int dma_controller_stop(struct dma_controller *c) ...@@ -114,7 +114,7 @@ static int dma_controller_stop(struct dma_controller *c)
for (bBit = 0; bBit < MUSB_HSDMA_CHANNELS; bBit++) { for (bBit = 0; bBit < MUSB_HSDMA_CHANNELS; bBit++) {
if (controller->bmUsedChannels & (1 << bBit)) { if (controller->bmUsedChannels & (1 << bBit)) {
pChannel = &(controller->aChannel[bBit].Channel); pChannel = &controller->aChannel[bBit].Channel;
dma_channel_release(pChannel); dma_channel_release(pChannel);
if (!controller->bmUsedChannels) if (!controller->bmUsedChannels)
...@@ -125,7 +125,7 @@ static int dma_controller_stop(struct dma_controller *c) ...@@ -125,7 +125,7 @@ static int dma_controller_stop(struct dma_controller *c)
return 0; return 0;
} }
static struct dma_channel* dma_channel_allocate(struct dma_controller *c, static struct dma_channel *dma_channel_allocate(struct dma_controller *c,
struct musb_hw_ep *hw_ep, u8 transmit) struct musb_hw_ep *hw_ep, u8 transmit)
{ {
u8 bBit; u8 bBit;
...@@ -186,25 +186,26 @@ static void configure_channel(struct dma_channel *pChannel, ...@@ -186,25 +186,26 @@ static void configure_channel(struct dma_channel *pChannel,
if (mode) { if (mode) {
csr |= 1 << MUSB_HSDMA_MODE1_SHIFT; csr |= 1 << MUSB_HSDMA_MODE1_SHIFT;
if (len < packet_sz) { BUG_ON(len < packet_sz);
return FALSE;
}
if (packet_sz >= 64) { if (packet_sz >= 64) {
csr |= csr |= MUSB_HSDMA_BURSTMODE_INCR16
MUSB_HSDMA_BURSTMODE_INCR16 << MUSB_HSDMA_BURSTMODE_SHIFT; << MUSB_HSDMA_BURSTMODE_SHIFT;
} else if (packet_sz >= 32) { } else if (packet_sz >= 32) {
csr |= csr |= MUSB_HSDMA_BURSTMODE_INCR8
MUSB_HSDMA_BURSTMODE_INCR8 << MUSB_HSDMA_BURSTMODE_SHIFT; << MUSB_HSDMA_BURSTMODE_SHIFT;
} else if (packet_sz >= 16) { } else if (packet_sz >= 16) {
csr |= csr |= MUSB_HSDMA_BURSTMODE_INCR4
MUSB_HSDMA_BURSTMODE_INCR4 << MUSB_HSDMA_BURSTMODE_SHIFT; << MUSB_HSDMA_BURSTMODE_SHIFT;
} }
} }
csr |= (pImplChannel->epnum << MUSB_HSDMA_ENDPOINT_SHIFT) csr |= (pImplChannel->epnum << MUSB_HSDMA_ENDPOINT_SHIFT)
| (1 << MUSB_HSDMA_ENABLE_SHIFT) | (1 << MUSB_HSDMA_ENABLE_SHIFT)
| (1 << MUSB_HSDMA_IRQENABLE_SHIFT) | (1 << MUSB_HSDMA_IRQENABLE_SHIFT)
| (pImplChannel->transmit ? (1 << MUSB_HSDMA_TRANSMIT_SHIFT) : 0); | (pImplChannel->transmit
? (1 << MUSB_HSDMA_TRANSMIT_SHIFT)
: 0);
/* address/count */ /* address/count */
musb_writel(mbase, musb_writel(mbase,
...@@ -241,14 +242,12 @@ static int dma_channel_program(struct dma_channel * pChannel, ...@@ -241,14 +242,12 @@ static int dma_channel_program(struct dma_channel * pChannel,
pImplChannel->wMaxPacketSize = packet_sz; pImplChannel->wMaxPacketSize = packet_sz;
pChannel->status = MUSB_DMA_STATUS_BUSY; pChannel->status = MUSB_DMA_STATUS_BUSY;
if ((mode == 1) && (len >= packet_sz)) { if ((mode == 1) && (len >= packet_sz))
configure_channel(pChannel, packet_sz, 1, dma_addr, configure_channel(pChannel, packet_sz, 1, dma_addr, len);
len); else
} else configure_channel(pChannel, packet_sz, 0, dma_addr, len);
configure_channel(pChannel, packet_sz, 0, dma_addr,
len);
return TRUE; return true;
} }
static int dma_channel_abort(struct dma_channel *pChannel) static int dma_channel_abort(struct dma_channel *pChannel)
...@@ -283,11 +282,14 @@ static int dma_channel_abort(struct dma_channel *pChannel) ...@@ -283,11 +282,14 @@ static int dma_channel_abort(struct dma_channel *pChannel)
} }
musb_writew(mbase, musb_writew(mbase,
MUSB_HSDMA_CHANNEL_OFFSET(bChannel, MUSB_HSDMA_CONTROL), 0); MUSB_HSDMA_CHANNEL_OFFSET(bChannel, MUSB_HSDMA_CONTROL),
0);
musb_writel(mbase, musb_writel(mbase,
MUSB_HSDMA_CHANNEL_OFFSET(bChannel, MUSB_HSDMA_ADDRESS), 0); MUSB_HSDMA_CHANNEL_OFFSET(bChannel, MUSB_HSDMA_ADDRESS),
0);
musb_writel(mbase, musb_writel(mbase,
MUSB_HSDMA_CHANNEL_OFFSET(bChannel, MUSB_HSDMA_COUNT), 0); MUSB_HSDMA_CHANNEL_OFFSET(bChannel, MUSB_HSDMA_COUNT),
0);
pChannel->status = MUSB_DMA_STATUS_FREE; pChannel->status = MUSB_DMA_STATUS_FREE;
} }
...@@ -321,23 +323,23 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) ...@@ -321,23 +323,23 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data)
MUSB_HSDMA_CHANNEL_OFFSET(bChannel, MUSB_HSDMA_CHANNEL_OFFSET(bChannel,
MUSB_HSDMA_CONTROL)); MUSB_HSDMA_CONTROL));
if (csr & (1 << MUSB_HSDMA_BUSERROR_SHIFT)) { if (csr & (1 << MUSB_HSDMA_BUSERROR_SHIFT))
pImplChannel->Channel.status = pImplChannel->Channel.status =
MUSB_DMA_STATUS_BUS_ABORT; MUSB_DMA_STATUS_BUS_ABORT;
} else { else {
dwAddress = musb_readl(mbase, dwAddress = musb_readl(mbase,
MUSB_HSDMA_CHANNEL_OFFSET( MUSB_HSDMA_CHANNEL_OFFSET(
bChannel, bChannel,
MUSB_HSDMA_ADDRESS)); MUSB_HSDMA_ADDRESS));
pChannel->actual_len = pChannel->actual_len = dwAddress
dwAddress - pImplChannel->dwStartAddress; - pImplChannel->dwStartAddress;
DBG(2, "ch %p, 0x%x -> 0x%x (%d / %d) %s\n", DBG(2, "ch %p, 0x%x -> 0x%x (%d / %d) %s\n",
pChannel, pImplChannel->dwStartAddress, pChannel, pImplChannel->dwStartAddress,
dwAddress, pChannel->actual_len, dwAddress, pChannel->actual_len,
pImplChannel->len, pImplChannel->len,
(pChannel->actual_len < (pChannel->actual_len
pImplChannel->len) ? < pImplChannel->len) ?
"=> reconfig 0": "=> complete"); "=> reconfig 0": "=> complete");
u8 devctl = musb_readb(mbase, u8 devctl = musb_readb(mbase,
...@@ -355,8 +357,9 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) ...@@ -355,8 +357,9 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data)
/* Send out the packet */ /* Send out the packet */
musb_ep_select(mbase, musb_ep_select(mbase,
pImplChannel->epnum); pImplChannel->epnum);
musb_writew(mbase, musb_writew(mbase, MUSB_EP_OFFSET(
MUSB_EP_OFFSET(pImplChannel->epnum,MUSB_TXCSR), pImplChannel->epnum,
MUSB_TXCSR),
MUSB_TXCSR_TXPKTRDY); MUSB_TXCSR_TXPKTRDY);
} else } else
musb_dma_completion( musb_dma_completion(
......
...@@ -251,7 +251,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, ...@@ -251,7 +251,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
s8 sync_dev; s8 sync_dev;
if (unlikely(dma_addr & 0x1) || (len < 32) || (len > packet_sz)) if (unlikely(dma_addr & 0x1) || (len < 32) || (len > packet_sz))
return FALSE; return false;
/* /*
* HW issue #10: Async dma will eventually corrupt the XFR_SIZE * HW issue #10: Async dma will eventually corrupt the XFR_SIZE
...@@ -260,7 +260,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, ...@@ -260,7 +260,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
* register is corrupt, and we won't know if the DMA worked. * register is corrupt, and we won't know if the DMA worked.
*/ */
if (dma_addr & 0x2) if (dma_addr & 0x2)
return FALSE; return false;
chdat->transfer_len = len & ~0x1f; chdat->transfer_len = len & ~0x1f;
...@@ -276,14 +276,14 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, ...@@ -276,14 +276,14 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
} else { } else {
if (tusb_omap_use_shared_dmareq(chdat) != 0) { if (tusb_omap_use_shared_dmareq(chdat) != 0) {
DBG(3, "could not get dma for ep%i\n", chdat->epnum); DBG(3, "could not get dma for ep%i\n", chdat->epnum);
return FALSE; return false;
} }
if (tusb_dma->ch < 0) { if (tusb_dma->ch < 0) {
/* REVISIT: This should get blocked earlier, happens /* REVISIT: This should get blocked earlier, happens
* with MSC ErrorRecoveryTest * with MSC ErrorRecoveryTest
*/ */
WARN_ON(1); WARN_ON(1);
return FALSE; return false;
} }
ch = tusb_dma->ch; ch = tusb_dma->ch;
...@@ -411,7 +411,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz, ...@@ -411,7 +411,7 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len)); TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len));
} }
return TRUE; return true;
} }
static int tusb_omap_dma_abort(struct dma_channel *channel) static int tusb_omap_dma_abort(struct dma_channel *channel)
......
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