struct s3c_hsotg_req *req;
struct dentry *debugfs;
- spinlock_t lock;
unsigned long total_data;
unsigned int size_loaded;
struct usb_gadget_driver *driver;
struct s3c_hsotg_plat *plat;
+ spinlock_t lock;
+
void __iomem *regs;
int irq;
struct clk *clk;
ep->name, req, req->length, req->buf, req->no_interrupt,
req->zero, req->short_not_ok);
+ spin_lock_irqsave(&hs->lock, irqflags);
+
/* initialise status of the request */
INIT_LIST_HEAD(&hs_req->queue);
req->actual = 0;
return ret;
}
- spin_lock_irqsave(&hs_ep->lock, irqflags);
-
first = list_empty(&hs_ep->queue);
list_add_tail(&hs_req->queue, &hs_ep->queue);
if (first)
s3c_hsotg_start_req(hs, hs_ep, hs_req, false);
- spin_unlock_irqrestore(&hs_ep->lock, irqflags);
+ spin_unlock_irqrestore(&hs->lock, irqflags);
return 0;
}
*/
if (hs_req->req.complete) {
- spin_unlock(&hs_ep->lock);
+ spin_unlock(&hsotg->lock);
hs_req->req.complete(&hs_ep->ep, &hs_req->req);
- spin_lock(&hs_ep->lock);
+ spin_lock(&hsotg->lock);
}
/*
{
unsigned long flags;
- spin_lock_irqsave(&hs_ep->lock, flags);
+ spin_lock_irqsave(&hsotg->lock, flags);
s3c_hsotg_complete_request(hsotg, hs_ep, hs_req, result);
- spin_unlock_irqrestore(&hs_ep->lock, flags);
+ spin_unlock_irqrestore(&hsotg->lock, flags);
}
/**
int max_req;
int read_ptr;
+ spin_lock(&hsotg->lock);
+
if (!hs_req) {
u32 epctl = readl(hsotg->regs + DOEPCTL(ep_idx));
int ptr;
for (ptr = 0; ptr < size; ptr += 4)
(void)readl(fifo);
+ spin_unlock(&hsotg->lock);
return;
}
- spin_lock(&hs_ep->lock);
-
to_read = size;
read_ptr = hs_req->req.actual;
max_req = hs_req->req.length - read_ptr;
*/
readsl(fifo, hs_req->req.buf + read_ptr, to_read);
- spin_unlock(&hs_ep->lock);
+ spin_unlock(&hsotg->lock);
}
/**
struct s3c_hsotg_req *req, *treq;
unsigned long flags;
- spin_lock_irqsave(&ep->lock, flags);
+ spin_lock_irqsave(&hsotg->lock, flags);
list_for_each_entry_safe(req, treq, &ep->queue, queue) {
/*
result);
}
- spin_unlock_irqrestore(&ep->lock, flags);
+ spin_unlock_irqrestore(&hsotg->lock, flags);
}
#define call_gadget(_hs, _entry) \
dev_dbg(hsotg->dev, "%s: read DxEPCTL=0x%08x from 0x%08x\n",
__func__, epctrl, epctrl_reg);
- spin_lock_irqsave(&hs_ep->lock, flags);
+ spin_lock_irqsave(&hsotg->lock, flags);
epctrl &= ~(DxEPCTL_EPType_MASK | DxEPCTL_MPS_MASK);
epctrl |= DxEPCTL_MPS(mps);
s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1);
out:
- spin_unlock_irqrestore(&hs_ep->lock, flags);
+ spin_unlock_irqrestore(&hsotg->lock, flags);
return ret;
}
/* terminate all requests with shutdown */
kill_all_requests(hsotg, hs_ep, -ESHUTDOWN, false);
- spin_lock_irqsave(&hs_ep->lock, flags);
+ spin_lock_irqsave(&hsotg->lock, flags);
ctrl = readl(hsotg->regs + epctrl_reg);
ctrl &= ~DxEPCTL_EPEna;
/* disable endpoint interrupts */
s3c_hsotg_ctrl_epint(hsotg, hs_ep->index, hs_ep->dir_in, 0);
- spin_unlock_irqrestore(&hs_ep->lock, flags);
+ spin_unlock_irqrestore(&hsotg->lock, flags);
return 0;
}
dev_info(hs->dev, "ep_dequeue(%p,%p)\n", ep, req);
- spin_lock_irqsave(&hs_ep->lock, flags);
+ spin_lock_irqsave(&hs->lock, flags);
if (!on_list(hs_ep, hs_req)) {
- spin_unlock_irqrestore(&hs_ep->lock, flags);
+ spin_unlock_irqrestore(&hs->lock, flags);
return -EINVAL;
}
s3c_hsotg_complete_request(hs, hs_ep, hs_req, -ECONNRESET);
- spin_unlock_irqrestore(&hs_ep->lock, flags);
+ spin_unlock_irqrestore(&hs->lock, flags);
return 0;
}
dev_info(hs->dev, "%s(ep %p %s, %d)\n", __func__, ep, ep->name, value);
- spin_lock_irqsave(&hs_ep->lock, irqflags);
+ spin_lock_irqsave(&hs->lock, irqflags);
/* write both IN and OUT control registers */
writel(epctl, hs->regs + epreg);
- spin_unlock_irqrestore(&hs_ep->lock, irqflags);
+ spin_unlock_irqrestore(&hs->lock, irqflags);
return 0;
}
INIT_LIST_HEAD(&hs_ep->queue);
INIT_LIST_HEAD(&hs_ep->ep.ep_list);
- spin_lock_init(&hs_ep->lock);
-
/* add to the list of endpoints known by the gadget driver */
if (epnum)
list_add_tail(&hs_ep->ep.ep_list, &hsotg->gadget.ep_list);
seq_printf(seq, "request list (%p,%p):\n",
ep->queue.next, ep->queue.prev);
- spin_lock_irqsave(&ep->lock, flags);
+ spin_lock_irqsave(&hsotg->lock, flags);
list_for_each_entry(req, &ep->queue, queue) {
if (--show_limit < 0) {
req->req.actual, req->req.status);
}
- spin_unlock_irqrestore(&ep->lock, flags);
+ spin_unlock_irqrestore(&hsotg->lock, flags);
return 0;
}
goto err_clk;
}
+ spin_lock_init(&hsotg->lock);
+
hsotg->irq = ret;
ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0,