Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 303818
b: refs/heads/master
c: fc9a731
h: refs/heads/master
v: v3
  • Loading branch information
Lukasz Majewski authored and Felipe Balbi committed May 4, 2012
1 parent 24aad6d commit b3c5930
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 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: 4118878697c76e5444a1d5db9c399ca5d923b0a8
refs/heads/master: fc9a731ed0ef7138432f0f14981710aea8e83320
41 changes: 39 additions & 2 deletions trunk/drivers/usb/gadget/s3c-hsotg.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/regulator/consumer.h>

#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
Expand All @@ -38,6 +39,11 @@

#define DMA_ADDR_INVALID (~((dma_addr_t)0))

static const char * const s3c_hsotg_supply_names[] = {
"vusb_d", /* digital USB supply, 1.2V */
"vusb_a", /* analog USB supply, 1.1V */
};

/* EP0_MPS_LIMIT
*
* Unfortunately there seems to be a limit of the amount of data that can
Expand Down Expand Up @@ -132,6 +138,7 @@ struct s3c_hsotg_ep {
* @regs: The memory area mapped for accessing registers.
* @regs_res: The resource that was allocated when claiming register space.
* @irq: The IRQ number we are using
* @supplies: Definition of USB power supplies
* @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos.
* @debug_root: root directrory for debugfs.
* @debug_file: main status file for debugfs.
Expand All @@ -152,6 +159,8 @@ struct s3c_hsotg {
int irq;
struct clk *clk;

struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)];

unsigned int dedicated_fifos:1;

struct dentry *debug_root;
Expand Down Expand Up @@ -3256,6 +3265,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
struct resource *res;
int epnum;
int ret;
int i;

plat = pdev->dev.platform_data;
if (!plat) {
Expand Down Expand Up @@ -3350,6 +3360,26 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)

clk_enable(hsotg->clk);

/* regulators */

for (i = 0; i < ARRAY_SIZE(hsotg->supplies); i++)
hsotg->supplies[i].supply = s3c_hsotg_supply_names[i];

ret = regulator_bulk_get(dev, ARRAY_SIZE(hsotg->supplies),
hsotg->supplies);
if (ret) {
dev_err(dev, "failed to request supplies: %d\n", ret);
goto err_supplies;
}

ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies),
hsotg->supplies);

if (ret) {
dev_err(hsotg->dev, "failed to enable supplies: %d\n", ret);
goto err_supplies;
}

/* usb phy enable */
s3c_hsotg_phy_enable(hsotg);

Expand All @@ -3362,7 +3392,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)

ret = usb_add_gadget_udc(&pdev->dev, &hsotg->gadget);
if (ret)
goto err_add_udc;
goto err_supplies;

s3c_hsotg_create_debug(hsotg);

Expand All @@ -3371,9 +3401,12 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
our_hsotg = hsotg;
return 0;

err_add_udc:
err_supplies:
s3c_hsotg_phy_disable(hsotg);

regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
regulator_bulk_free(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);

clk_disable(hsotg->clk);
clk_put(hsotg->clk);

Expand Down Expand Up @@ -3408,6 +3441,10 @@ static int __devexit s3c_hsotg_remove(struct platform_device *pdev)

s3c_hsotg_phy_disable(hsotg);


regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
regulator_bulk_free(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);

clk_disable(hsotg->clk);
clk_put(hsotg->clk);

Expand Down

0 comments on commit b3c5930

Please sign in to comment.