Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 221924
b: refs/heads/master
c: 1e393c6
h: refs/heads/master
v: v3
  • Loading branch information
Bob Liu authored and Felipe Balbi committed Nov 5, 2010
1 parent a9001f5 commit 5f3c2cc
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 25 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: 32d5dc9520f0c6f60f691dd478741c774e292406
refs/heads/master: 1e393c6eece048052d4131ec4dad3b98e35a98e2
72 changes: 49 additions & 23 deletions trunk/drivers/usb/musb/blackfin.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,30 +323,8 @@ int musb_platform_set_mode(struct musb *musb, u8 musb_mode)
return -EIO;
}

int __init musb_platform_init(struct musb *musb, void *board_data)
static void musb_platform_reg_init(struct musb *musb)
{

/*
* Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE
* and OTG HOST modes, while rev 1.1 and greater require PE7 to
* be low for DEVICE mode and high for HOST mode. We set it high
* here because we are in host mode
*/

if (gpio_request(musb->config->gpio_vrsel, "USB_VRSEL")) {
printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d \n",
musb->config->gpio_vrsel);
return -ENODEV;
}
gpio_direction_output(musb->config->gpio_vrsel, 0);

usb_nop_xceiv_register();
musb->xceiv = otg_get_transceiver();
if (!musb->xceiv) {
gpio_free(musb->config->gpio_vrsel);
return -ENODEV;
}

if (ANOMALY_05000346) {
bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
SSYNC();
Expand Down Expand Up @@ -380,6 +358,33 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
EP2_RX_ENA | EP3_RX_ENA | EP4_RX_ENA |
EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA);
SSYNC();
}

int __init musb_platform_init(struct musb *musb, void *board_data)
{

/*
* Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE
* and OTG HOST modes, while rev 1.1 and greater require PE7 to
* be low for DEVICE mode and high for HOST mode. We set it high
* here because we are in host mode
*/

if (gpio_request(musb->config->gpio_vrsel, "USB_VRSEL")) {
printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d\n",
musb->config->gpio_vrsel);
return -ENODEV;
}
gpio_direction_output(musb->config->gpio_vrsel, 0);

usb_nop_xceiv_register();
musb->xceiv = otg_get_transceiver();
if (!musb->xceiv) {
gpio_free(musb->config->gpio_vrsel);
return -ENODEV;
}

musb_platform_reg_init(musb);

if (is_host_enabled(musb)) {
musb->board_set_vbus = bfin_set_vbus;
Expand All @@ -394,6 +399,27 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
return 0;
}

#ifdef CONFIG_PM
void musb_platform_save_context(struct musb *musb,
struct musb_context_registers *musb_context)
{
if (is_host_active(musb))
/*
* During hibernate gpio_vrsel will change from high to low
* low which will generate wakeup event resume the system
* immediately. Set it to 0 before hibernate to avoid this
* wakeup event.
*/
gpio_set_value(musb->config->gpio_vrsel, 0);
}

void musb_platform_restore_context(struct musb *musb,
struct musb_context_registers *musb_context)
{
musb_platform_reg_init(musb);
}
#endif

int musb_platform_exit(struct musb *musb)
{
gpio_free(musb->config->gpio_vrsel);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/usb/musb/musb_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ struct musb_context_registers {
};

#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
defined(CONFIG_ARCH_OMAP4)
defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_BLACKFIN)
extern void musb_platform_save_context(struct musb *musb,
struct musb_context_registers *musb_context);
extern void musb_platform_restore_context(struct musb *musb,
Expand Down

0 comments on commit 5f3c2cc

Please sign in to comment.