Skip to content

Commit

Permalink
Merge branch 'fixes' into for-greg
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Balbi committed Aug 15, 2011
2 parents ce7e906 + 6193d69 commit 200b018
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 33 deletions.
1 change: 1 addition & 0 deletions drivers/usb/gadget/f_phonet.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
config_ep_by_speed(gadget, f, fp->out_ep)) {
fp->in_ep->desc = NULL;
fp->out_ep->desc = NULL;
spin_unlock(&port->lock);
return -EINVAL;
}
usb_ep_enable(fp->out_ep);
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/musb/blackfin.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/prefetch.h>

#include <asm/cacheflush.h>

Expand Down
26 changes: 17 additions & 9 deletions drivers/usb/musb/cppi_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ static int cppi_controller_stop(struct dma_controller *c)
struct cppi *controller;
void __iomem *tibase;
int i;
struct musb *musb;

controller = container_of(c, struct cppi, controller);
musb = controller->musb;

tibase = controller->tibase;
/* DISABLE INDIVIDUAL CHANNEL Interrupts */
Expand Down Expand Up @@ -289,9 +291,11 @@ cppi_channel_allocate(struct dma_controller *c,
u8 index;
struct cppi_channel *cppi_ch;
void __iomem *tibase;
struct musb *musb;

controller = container_of(c, struct cppi, controller);
tibase = controller->tibase;
musb = controller->musb;

/* ep0 doesn't use DMA; remember cppi indices are 0..N-1 */
index = ep->epnum - 1;
Expand Down Expand Up @@ -339,7 +343,8 @@ static void cppi_channel_release(struct dma_channel *channel)
c = container_of(channel, struct cppi_channel, channel);
tibase = c->controller->tibase;
if (!c->hw_ep)
dev_dbg(musb->controller, "releasing idle DMA channel %p\n", c);
dev_dbg(c->controller->musb->controller,
"releasing idle DMA channel %p\n", c);
else if (!c->transmit)
core_rxirq_enable(tibase, c->index + 1);

Expand All @@ -357,10 +362,11 @@ cppi_dump_rx(int level, struct cppi_channel *c, const char *tag)

musb_ep_select(base, c->index + 1);

DBG(level, "RX DMA%d%s: %d left, csr %04x, "
"%08x H%08x S%08x C%08x, "
"B%08x L%08x %08x .. %08x"
"\n",
dev_dbg(c->controller->musb->controller,
"RX DMA%d%s: %d left, csr %04x, "
"%08x H%08x S%08x C%08x, "
"B%08x L%08x %08x .. %08x"
"\n",
c->index, tag,
musb_readl(c->controller->tibase,
DAVINCI_RXCPPI_BUFCNT0_REG + 4 * c->index),
Expand All @@ -387,10 +393,11 @@ cppi_dump_tx(int level, struct cppi_channel *c, const char *tag)

musb_ep_select(base, c->index + 1);

DBG(level, "TX DMA%d%s: csr %04x, "
"H%08x S%08x C%08x %08x, "
"F%08x L%08x .. %08x"
"\n",
dev_dbg(c->controller->musb->controller,
"TX DMA%d%s: csr %04x, "
"H%08x S%08x C%08x %08x, "
"F%08x L%08x .. %08x"
"\n",
c->index, tag,
musb_readw(c->hw_ep->regs, MUSB_TXCSR),

Expand Down Expand Up @@ -1022,6 +1029,7 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch)
int i;
dma_addr_t safe2ack;
void __iomem *regs = rx->hw_ep->regs;
struct musb *musb = cppi->musb;

cppi_dump_rx(6, rx, "/K");

Expand Down
12 changes: 8 additions & 4 deletions drivers/usb/musb/musb_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ enum musb_g_ep0_state {
#endif

/* TUSB mapping: "flat" plus ep0 special cases */
#if defined(CONFIG_USB_MUSB_TUSB6010)
#if defined(CONFIG_USB_MUSB_TUSB6010) || \
defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
#define musb_ep_select(_mbase, _epnum) \
musb_writeb((_mbase), MUSB_INDEX, (_epnum))
#define MUSB_EP_OFFSET MUSB_TUSB_OFFSET
Expand Down Expand Up @@ -241,7 +242,8 @@ struct musb_hw_ep {
void __iomem *fifo;
void __iomem *regs;

#ifdef CONFIG_USB_MUSB_TUSB6010
#if defined(CONFIG_USB_MUSB_TUSB6010) || \
defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
void __iomem *conf;
#endif

Expand All @@ -258,7 +260,8 @@ struct musb_hw_ep {
struct dma_channel *tx_channel;
struct dma_channel *rx_channel;

#ifdef CONFIG_USB_MUSB_TUSB6010
#if defined(CONFIG_USB_MUSB_TUSB6010) || \
defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
/* TUSB has "asynchronous" and "synchronous" dma modes */
dma_addr_t fifo_async;
dma_addr_t fifo_sync;
Expand Down Expand Up @@ -356,7 +359,8 @@ struct musb {
void __iomem *ctrl_base;
void __iomem *mregs;

#ifdef CONFIG_USB_MUSB_TUSB6010
#if defined(CONFIG_USB_MUSB_TUSB6010) || \
defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
dma_addr_t async;
dma_addr_t sync;
void __iomem *sync_va;
Expand Down
4 changes: 3 additions & 1 deletion drivers/usb/musb/musb_gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1856,14 +1856,16 @@ int __init musb_gadget_setup(struct musb *musb)

return 0;
err:
musb->g.dev.parent = NULL;
device_unregister(&musb->g.dev);
return status;
}

void musb_gadget_cleanup(struct musb *musb)
{
usb_del_gadget_udc(&musb->g);
device_unregister(&musb->g.dev);
if (musb->g.dev.parent)
device_unregister(&musb->g.dev);
}

/*
Expand Down
6 changes: 4 additions & 2 deletions drivers/usb/musb/musb_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@
#define MUSB_TESTMODE 0x0F /* 8 bit */

/* Get offset for a given FIFO from musb->mregs */
#ifdef CONFIG_USB_MUSB_TUSB6010
#if defined(CONFIG_USB_MUSB_TUSB6010) || \
defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
#define MUSB_FIFO_OFFSET(epnum) (0x200 + ((epnum) * 0x20))
#else
#define MUSB_FIFO_OFFSET(epnum) (0x20 + ((epnum) * 4))
Expand Down Expand Up @@ -295,7 +296,8 @@
#define MUSB_FLAT_OFFSET(_epnum, _offset) \
(0x100 + (0x10*(_epnum)) + (_offset))

#ifdef CONFIG_USB_MUSB_TUSB6010
#if defined(CONFIG_USB_MUSB_TUSB6010) || \
defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
/* TUSB6010 EP0 configuration register is special */
#define MUSB_TUSB_OFFSET(_epnum, _offset) \
(0x10 + _offset)
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/musb/tusb6010.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/prefetch.h>
#include <linux/usb.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/musb/tusb6010_omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <plat/mux.h>

#include "musb_core.h"
#include "tusb6010.h"

#define to_chdat(c) ((struct tusb_omap_dma_ch *)(c)->private_data)

Expand Down
38 changes: 21 additions & 17 deletions drivers/usb/musb/ux500_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ static void ux500_tx_work(struct work_struct *data)
struct musb *musb = hw_ep->musb;
unsigned long flags;

DBG(4, "DMA tx transfer done on hw_ep=%d\n", hw_ep->epnum);
dev_dbg(musb->controller, "DMA tx transfer done on hw_ep=%d\n",
hw_ep->epnum);

spin_lock_irqsave(&musb->lock, flags);
ux500_channel->channel.actual_len = ux500_channel->cur_len;
Expand All @@ -84,7 +85,8 @@ static void ux500_rx_work(struct work_struct *data)
struct musb *musb = hw_ep->musb;
unsigned long flags;

DBG(4, "DMA rx transfer done on hw_ep=%d\n", hw_ep->epnum);
dev_dbg(musb->controller, "DMA rx transfer done on hw_ep=%d\n",
hw_ep->epnum);

spin_lock_irqsave(&musb->lock, flags);
ux500_channel->channel.actual_len = ux500_channel->cur_len;
Expand Down Expand Up @@ -116,9 +118,11 @@ static bool ux500_configure_channel(struct dma_channel *channel,
enum dma_slave_buswidth addr_width;
dma_addr_t usb_fifo_addr = (MUSB_FIFO_OFFSET(hw_ep->epnum) +
ux500_channel->controller->phy_base);
struct musb *musb = ux500_channel->controller->private_data;

DBG(4, "packet_sz=%d, mode=%d, dma_addr=0x%x, len=%d is_tx=%d\n",
packet_sz, mode, dma_addr, len, ux500_channel->is_tx);
dev_dbg(musb->controller,
"packet_sz=%d, mode=%d, dma_addr=0x%x, len=%d is_tx=%d\n",
packet_sz, mode, dma_addr, len, ux500_channel->is_tx);

ux500_channel->cur_len = len;

Expand All @@ -133,15 +137,13 @@ static bool ux500_configure_channel(struct dma_channel *channel,
DMA_SLAVE_BUSWIDTH_4_BYTES;

slave_conf.direction = direction;
if (direction == DMA_FROM_DEVICE) {
slave_conf.src_addr = usb_fifo_addr;
slave_conf.src_addr_width = addr_width;
slave_conf.src_maxburst = 16;
} else {
slave_conf.dst_addr = usb_fifo_addr;
slave_conf.dst_addr_width = addr_width;
slave_conf.dst_maxburst = 16;
}
slave_conf.src_addr = usb_fifo_addr;
slave_conf.src_addr_width = addr_width;
slave_conf.src_maxburst = 16;
slave_conf.dst_addr = usb_fifo_addr;
slave_conf.dst_addr_width = addr_width;
slave_conf.dst_maxburst = 16;

dma_chan->device->device_control(dma_chan, DMA_SLAVE_CONFIG,
(unsigned long) &slave_conf);

Expand All @@ -166,6 +168,7 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c,
struct ux500_dma_controller *controller = container_of(c,
struct ux500_dma_controller, controller);
struct ux500_dma_channel *ux500_channel = NULL;
struct musb *musb = controller->private_data;
u8 ch_num = hw_ep->epnum - 1;
u32 max_ch;

Expand All @@ -192,7 +195,7 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c,
ux500_channel->hw_ep = hw_ep;
ux500_channel->is_allocated = 1;

DBG(7, "hw_ep=%d, is_tx=0x%x, channel=%d\n",
dev_dbg(musb->controller, "hw_ep=%d, is_tx=0x%x, channel=%d\n",
hw_ep->epnum, is_tx, ch_num);

return &(ux500_channel->channel);
Expand All @@ -201,8 +204,9 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c,
static void ux500_dma_channel_release(struct dma_channel *channel)
{
struct ux500_dma_channel *ux500_channel = channel->private_data;
struct musb *musb = ux500_channel->controller->private_data;

DBG(7, "channel=%d\n", ux500_channel->ch_num);
dev_dbg(musb->controller, "channel=%d\n", ux500_channel->ch_num);

if (ux500_channel->is_allocated) {
ux500_channel->is_allocated = 0;
Expand Down Expand Up @@ -252,8 +256,8 @@ static int ux500_dma_channel_abort(struct dma_channel *channel)
void __iomem *epio = musb->endpoints[ux500_channel->hw_ep->epnum].regs;
u16 csr;

DBG(4, "channel=%d, is_tx=%d\n", ux500_channel->ch_num,
ux500_channel->is_tx);
dev_dbg(musb->controller, "channel=%d, is_tx=%d\n",
ux500_channel->ch_num, ux500_channel->is_tx);

if (channel->status == MUSB_DMA_STATUS_BUSY) {
if (ux500_channel->is_tx) {
Expand Down

0 comments on commit 200b018

Please sign in to comment.