From: Arnaud Mandy <ext-arnaud.2.mandy@xxxxxxxxx> This patch: - cleans musbhsdma defines - enables burst mode for both dma modes - mode1 should only be enabled if upper layer tells usi to do so. - rely on the mode set by musb_gadget.c or musb_host.c and don't branch again Signed-off-by: Arnaud Mandy <ext-arnaud.2.mandy@xxxxxxxxx> Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxx> --- drivers/usb/musb/musbhsdma.c | 37 ++++++++++++++----------------------- drivers/usb/musb/musbhsdma.h | 20 ++++++++++---------- 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index 927abf0..7472a02 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c @@ -128,27 +128,21 @@ static void configure_channel(struct dma_channel *channel, DBG(4, "%p, pkt_sz %d, addr 0x%x, len %d, mode %d\n", channel, packet_sz, dma_addr, len, mode); - if (mode) { - csr |= 1 << MUSB_HSDMA_MODE1_SHIFT; - BUG_ON(len < packet_sz); - - if (packet_sz >= 64) { - csr |= MUSB_HSDMA_BURSTMODE_INCR16 - << MUSB_HSDMA_BURSTMODE_SHIFT; - } else if (packet_sz >= 32) { - csr |= MUSB_HSDMA_BURSTMODE_INCR8 - << MUSB_HSDMA_BURSTMODE_SHIFT; - } else if (packet_sz >= 16) { - csr |= MUSB_HSDMA_BURSTMODE_INCR4 - << MUSB_HSDMA_BURSTMODE_SHIFT; - } - } + if (mode) + csr |= MUSB_HSDMA_MODE1; + + if (packet_sz >= 64) + csr |= MUSB_HSDMA_BURSTMODE_INCR16; + else if (packet_sz >= 32) + csr |= MUSB_HSDMA_BURSTMODE_INCR8; + else if (packet_sz >= 16) + csr |= MUSB_HSDMA_BURSTMODE_INCR4; csr |= (musb_channel->epnum << MUSB_HSDMA_ENDPOINT_SHIFT) - | (1 << MUSB_HSDMA_ENABLE_SHIFT) - | (1 << MUSB_HSDMA_IRQENABLE_SHIFT) + | MUSB_HSDMA_ENABLE + | MUSB_HSDMA_IRQENABLE | (musb_channel->transmit - ? (1 << MUSB_HSDMA_TRANSMIT_SHIFT) + ? MUSB_HSDMA_TRANSMIT : 0); if (musb_channel->transmit) @@ -201,10 +195,7 @@ static int dma_channel_program(struct dma_channel *channel, musb_channel->max_packet_sz = packet_sz; channel->status = MUSB_DMA_STATUS_BUSY; - if ((mode == 1) && (len >= packet_sz)) - configure_channel(channel, packet_sz, 1, dma_addr, len); - else - configure_channel(channel, packet_sz, 0, dma_addr, len); + configure_channel(channel, packet_sz, mode, dma_addr, len); return true; } @@ -299,7 +290,7 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) MUSB_HSDMA_CHANNEL_OFFSET(bchannel, MUSB_HSDMA_CONTROL)); - if (csr & (1 << MUSB_HSDMA_BUSERROR_SHIFT)) { + if (csr & MUSB_HSDMA_BUSERROR) { musb_channel->channel.status = MUSB_DMA_STATUS_BUS_ABORT; } else { diff --git a/drivers/usb/musb/musbhsdma.h b/drivers/usb/musb/musbhsdma.h index df87863..463d09d 100644 --- a/drivers/usb/musb/musbhsdma.h +++ b/drivers/usb/musb/musbhsdma.h @@ -110,18 +110,18 @@ static inline void musb_write_hsdma_count(void __iomem *mbase, #endif /* CONFIG_BLACKFIN */ /* control register (16-bit): */ -#define MUSB_HSDMA_ENABLE_SHIFT 0 -#define MUSB_HSDMA_TRANSMIT_SHIFT 1 -#define MUSB_HSDMA_MODE1_SHIFT 2 -#define MUSB_HSDMA_IRQENABLE_SHIFT 3 +#define MUSB_HSDMA_ENABLE (1 << 0) +#define MUSB_HSDMA_TRANSMIT (1 << 1) +#define MUSB_HSDMA_MODE1 (1 << 2) +#define MUSB_HSDMA_IRQENABLE (1 << 3) #define MUSB_HSDMA_ENDPOINT_SHIFT 4 -#define MUSB_HSDMA_BUSERROR_SHIFT 8 +#define MUSB_HSDMA_BUSERROR (1 << 8) + #define MUSB_HSDMA_BURSTMODE_SHIFT 9 -#define MUSB_HSDMA_BURSTMODE (3 << MUSB_HSDMA_BURSTMODE_SHIFT) -#define MUSB_HSDMA_BURSTMODE_UNSPEC 0 -#define MUSB_HSDMA_BURSTMODE_INCR4 1 -#define MUSB_HSDMA_BURSTMODE_INCR8 2 -#define MUSB_HSDMA_BURSTMODE_INCR16 3 +#define MUSB_HSDMA_BURSTMODE_UNSPEC (0 << MUSB_HSDMA_BURSTMODE_SHIFT) +#define MUSB_HSDMA_BURSTMODE_INCR4 (1 << MUSB_HSDMA_BURSTMODE_SHIFT) +#define MUSB_HSDMA_BURSTMODE_INCR8 (2 << MUSB_HSDMA_BURSTMODE_SHIFT) +#define MUSB_HSDMA_BURSTMODE_INCR16 (3 << MUSB_HSDMA_BURSTMODE_SHIFT) #define MUSB_HSDMA_CHANNELS 8 -- 1.6.6.rc0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html