Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325884
b: refs/heads/master
c: c4846a1
h: refs/heads/master
v: v3
  • Loading branch information
Roland Stigge authored and Felipe Balbi committed Aug 31, 2012
1 parent 66abf88 commit 6dca015
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 78ca9139736f059b70bd797b01227271e0efa681
refs/heads/master: c4846a1807fc6138e2f010d65757feb4b7b0c2cf
55 changes: 29 additions & 26 deletions trunk/drivers/usb/gadget/lpc32xx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2608,10 +2608,9 @@ static void nop_release(struct device *dev)
/* nothing to free */
}

static struct lpc32xx_udc controller = {
static const struct lpc32xx_udc controller_template = {
.gadget = {
.ops = &lpc32xx_udc_ops,
.ep0 = &controller.ep[0].ep,
.name = driver_name,
.dev = {
.init_name = "gadget",
Expand All @@ -2623,7 +2622,6 @@ static struct lpc32xx_udc controller = {
.name = "ep0",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 64,
.hwep_num_base = 0,
.hwep_num = 0, /* Can be 0 or 1, has special handling */
Expand All @@ -2635,7 +2633,6 @@ static struct lpc32xx_udc controller = {
.name = "ep1-int",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 64,
.hwep_num_base = 2,
.hwep_num = 0, /* 2 or 3, will be set later */
Expand All @@ -2647,7 +2644,6 @@ static struct lpc32xx_udc controller = {
.name = "ep2-bulk",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 64,
.hwep_num_base = 4,
.hwep_num = 0, /* 4 or 5, will be set later */
Expand All @@ -2659,7 +2655,6 @@ static struct lpc32xx_udc controller = {
.name = "ep3-iso",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 1023,
.hwep_num_base = 6,
.hwep_num = 0, /* 6 or 7, will be set later */
Expand All @@ -2671,7 +2666,6 @@ static struct lpc32xx_udc controller = {
.name = "ep4-int",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 64,
.hwep_num_base = 8,
.hwep_num = 0, /* 8 or 9, will be set later */
Expand All @@ -2683,7 +2677,6 @@ static struct lpc32xx_udc controller = {
.name = "ep5-bulk",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 64,
.hwep_num_base = 10,
.hwep_num = 0, /* 10 or 11, will be set later */
Expand All @@ -2695,7 +2688,6 @@ static struct lpc32xx_udc controller = {
.name = "ep6-iso",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 1023,
.hwep_num_base = 12,
.hwep_num = 0, /* 12 or 13, will be set later */
Expand All @@ -2707,7 +2699,6 @@ static struct lpc32xx_udc controller = {
.name = "ep7-int",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 64,
.hwep_num_base = 14,
.hwep_num = 0,
Expand All @@ -2719,7 +2710,6 @@ static struct lpc32xx_udc controller = {
.name = "ep8-bulk",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 64,
.hwep_num_base = 16,
.hwep_num = 0,
Expand All @@ -2731,7 +2721,6 @@ static struct lpc32xx_udc controller = {
.name = "ep9-iso",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 1023,
.hwep_num_base = 18,
.hwep_num = 0,
Expand All @@ -2743,7 +2732,6 @@ static struct lpc32xx_udc controller = {
.name = "ep10-int",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 64,
.hwep_num_base = 20,
.hwep_num = 0,
Expand All @@ -2755,7 +2743,6 @@ static struct lpc32xx_udc controller = {
.name = "ep11-bulk",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 64,
.hwep_num_base = 22,
.hwep_num = 0,
Expand All @@ -2767,7 +2754,6 @@ static struct lpc32xx_udc controller = {
.name = "ep12-iso",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 1023,
.hwep_num_base = 24,
.hwep_num = 0,
Expand All @@ -2779,7 +2765,6 @@ static struct lpc32xx_udc controller = {
.name = "ep13-int",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 64,
.hwep_num_base = 26,
.hwep_num = 0,
Expand All @@ -2791,7 +2776,6 @@ static struct lpc32xx_udc controller = {
.name = "ep14-bulk",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 64,
.hwep_num_base = 28,
.hwep_num = 0,
Expand All @@ -2803,7 +2787,6 @@ static struct lpc32xx_udc controller = {
.name = "ep15-bulk",
.ops = &lpc32xx_ep_ops,
},
.udc = &controller,
.maxpacket = 1023,
.hwep_num_base = 30,
.hwep_num = 0,
Expand Down Expand Up @@ -3090,12 +3073,21 @@ static u64 lpc32xx_usbd_dmamask = ~(u32) 0x7F;
static int __init lpc32xx_udc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct lpc32xx_udc *udc = &controller;
struct lpc32xx_udc *udc;
int retval, i;
struct resource *res;
dma_addr_t dma_handle;
struct device_node *isp1301_node;

udc = kzalloc(sizeof(*udc), GFP_KERNEL);
if (!udc)
return -ENOMEM;

memcpy(udc, &controller_template, sizeof(*udc));
for (i = 0; i <= 15; i++)
udc->ep[i].udc = udc;
udc->gadget.ep0 = &udc->ep[0].ep;

/* init software state */
udc->gadget.dev.parent = dev;
udc->pdev = pdev;
Expand All @@ -3110,8 +3102,10 @@ static int __init lpc32xx_udc_probe(struct platform_device *pdev)
}

udc->isp1301_i2c_client = isp1301_get_client(isp1301_node);
if (!udc->isp1301_i2c_client)
return -EPROBE_DEFER;
if (!udc->isp1301_i2c_client) {
retval = -EPROBE_DEFER;
goto phy_fail;
}

dev_info(udc->dev, "ISP1301 I2C device at address 0x%x\n",
udc->isp1301_i2c_client->addr);
Expand All @@ -3130,8 +3124,10 @@ static int __init lpc32xx_udc_probe(struct platform_device *pdev)
* IORESOURCE_IRQ, USB transceiver interrupt number
*/
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENXIO;
if (!res) {
retval = -ENXIO;
goto resource_fail;
}

spin_lock_init(&udc->lock);

Expand All @@ -3141,15 +3137,17 @@ static int __init lpc32xx_udc_probe(struct platform_device *pdev)
if (udc->udp_irq[i] < 0) {
dev_err(udc->dev,
"irq resource %d not available!\n", i);
return udc->udp_irq[i];
retval = udc->udp_irq[i];
goto irq_fail;
}
}

udc->io_p_start = res->start;
udc->io_p_size = resource_size(res);
if (!request_mem_region(udc->io_p_start, udc->io_p_size, driver_name)) {
dev_err(udc->dev, "someone's using UDC memory\n");
return -EBUSY;
retval = -EBUSY;
goto request_mem_region_fail;
}

udc->udp_baseaddr = ioremap(udc->io_p_start, udc->io_p_size);
Expand Down Expand Up @@ -3346,7 +3344,11 @@ static int __init lpc32xx_udc_probe(struct platform_device *pdev)
io_map_fail:
release_mem_region(udc->io_p_start, udc->io_p_size);
dev_err(udc->dev, "%s probe failed, %d\n", driver_name, retval);

request_mem_region_fail:
irq_fail:
resource_fail:
phy_fail:
kfree(udc);
return retval;
}

Expand Down Expand Up @@ -3384,6 +3386,7 @@ static int __devexit lpc32xx_udc_remove(struct platform_device *pdev)
clk_put(udc->usb_pll_clk);
iounmap(udc->udp_baseaddr);
release_mem_region(udc->io_p_start, udc->io_p_size);
kfree(udc);

return 0;
}
Expand Down

0 comments on commit 6dca015

Please sign in to comment.