summaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs/common.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2011-12-13 09:37:40 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-13 09:37:40 -0800
commit121a8cdd79e2c68ae78c7633f2a46ee65a177ff6 (patch)
tree03793bef35f590718ebc6ae6110eb0c507ae60bf /drivers/usb/renesas_usbhs/common.c
parenta1016ce33ce23296ad030e5276fcfdf9cb27cb6a (diff)
parent15a3838b101b292c2e40824d843a4d8871ac4010 (diff)
downloadlinux-stable-121a8cdd79e2c68ae78c7633f2a46ee65a177ff6.tar.gz
linux-stable-121a8cdd79e2c68ae78c7633f2a46ee65a177ff6.tar.bz2
linux-stable-121a8cdd79e2c68ae78c7633f2a46ee65a177ff6.zip
Merge branch 'for-next/gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
* 'for-next/gadget' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (50 commits) usb: renesas_usbhs: show error reason on usbhsh_urb_enqueu() usb: renesas_usbhs: add force packet remove method usb: renesas_usbhs: care usb_hcd_giveback_urb() status usb: renesas_usbhs: add usbhsh_is_running() usb: renesas_usbhs: disable attch irq after device attached usb: renesas_usbhs: care pipe sequence usb: renesas_usbhs: add usbhs_pipe_attach() method usb: renesas_usbhs: add usbhsh_endpoint_detach_all() for error case usb: renesas_usbhs: modify device attach method usb: renesas_usbhs: pop packet when urb dequeued usb: renesas_usbhs: add lost error value when enqueue usb: gadget: mv_udc: replace some debug info usb: gadget: mv_udc: refine suspend/resume function usb: gadget: mv_udc: refine the clock relative code usb: gadget: mv_udc: disable ISR when stopped usb: gadget: mv_udc: add otg relative code usb: gadget: Use kcalloc instead of kzalloc to allocate array usb: renesas_usbhs: remove the_controller_link usb: renesas_usbhs: add test-mode support usb: renesas_usbhs: call usbhsg_queue_pop() when pipe disable. ...
Diffstat (limited to 'drivers/usb/renesas_usbhs/common.c')
-rw-r--r--drivers/usb/renesas_usbhs/common.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index aa94e33e6885..e9a5b1d2615e 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -95,25 +95,15 @@ struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev)
/*
* syscfg functions
*/
-void usbhs_sys_clock_ctrl(struct usbhs_priv *priv, int enable)
+static void usbhs_sys_clock_ctrl(struct usbhs_priv *priv, int enable)
{
usbhs_bset(priv, SYSCFG, SCKE, enable ? SCKE : 0);
}
-void usbhs_sys_hispeed_ctrl(struct usbhs_priv *priv, int enable)
-{
- usbhs_bset(priv, SYSCFG, HSE, enable ? HSE : 0);
-}
-
-void usbhs_sys_usb_ctrl(struct usbhs_priv *priv, int enable)
-{
- usbhs_bset(priv, SYSCFG, USBE, enable ? USBE : 0);
-}
-
void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable)
{
- u16 mask = DCFM | DRPD | DPRPU;
- u16 val = DCFM | DRPD;
+ u16 mask = DCFM | DRPD | DPRPU | HSE | USBE;
+ u16 val = DCFM | DRPD | HSE | USBE;
int has_otg = usbhs_get_dparam(priv, has_otg);
if (has_otg)
@@ -130,8 +120,8 @@ void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable)
void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable)
{
- u16 mask = DCFM | DRPD | DPRPU;
- u16 val = DPRPU;
+ u16 mask = DCFM | DRPD | DPRPU | HSE | USBE;
+ u16 val = DPRPU | HSE | USBE;
/*
* if enable
@@ -142,6 +132,11 @@ void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable)
usbhs_bset(priv, SYSCFG, mask, enable ? val : 0);
}
+void usbhs_sys_set_test_mode(struct usbhs_priv *priv, u16 mode)
+{
+ usbhs_write(priv, TESTMODE, mode);
+}
+
/*
* frame functions
*/
@@ -229,7 +224,7 @@ static void usbhsc_bus_init(struct usbhs_priv *priv)
/*
* device configuration
*/
-int usbhs_set_device_speed(struct usbhs_priv *priv, int devnum,
+int usbhs_set_device_config(struct usbhs_priv *priv, int devnum,
u16 upphub, u16 hubport, u16 speed)
{
struct device *dev = usbhs_priv_to_dev(priv);
@@ -301,18 +296,25 @@ static u32 usbhsc_default_pipe_type[] = {
*/
static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable)
{
+ struct platform_device *pdev = usbhs_priv_to_pdev(priv);
struct device *dev = usbhs_priv_to_dev(priv);
if (enable) {
/* enable PM */
pm_runtime_get_sync(dev);
+ /* enable platform power */
+ usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable);
+
/* USB on */
usbhs_sys_clock_ctrl(priv, enable);
} else {
/* USB off */
usbhs_sys_clock_ctrl(priv, enable);
+ /* disable platform power */
+ usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable);
+
/* disable PM */
pm_runtime_put_sync(dev);
}
@@ -388,7 +390,7 @@ static void usbhsc_notify_hotplug(struct work_struct *work)
usbhsc_hotplug(priv);
}
-int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
+static int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
{
struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
int delay = usbhs_get_dparam(priv, detection_delay);
@@ -398,7 +400,8 @@ int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
* To make sure safety context,
* use workqueue for usbhs_notify_hotplug
*/
- schedule_delayed_work(&priv->notify_hotplug_work, delay);
+ schedule_delayed_work(&priv->notify_hotplug_work,
+ msecs_to_jiffies(delay));
return 0;
}