summaryrefslogtreecommitdiff
path: root/drivers/usb/otg/ab8500-usb.c
diff options
context:
space:
mode:
authorJonas Aberg <jonas.aberg@stericsson.com>2012-01-24 11:08:39 +0530
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:03:17 +0200
commit30600535dfe60c8092d799fdfa3fc16f47393861 (patch)
tree15439e297b78e83f0d1500483758f9868a4c5b99 /drivers/usb/otg/ab8500-usb.c
parent395aea0fb7e8317b35530551cbb03d9e2fc962b7 (diff)
u8500: musb: Add pm runtime support
Add pm runtime support for musb, including both pin and clock handling. ST-Ericsson Linux next: - ST-Ericsson ID: 370128, 375498 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Idf72a6f226d1309d5a13b358e653ee97469e5ae6 Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/44709 Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Diffstat (limited to 'drivers/usb/otg/ab8500-usb.c')
-rw-r--r--drivers/usb/otg/ab8500-usb.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c
index 5c5b6a9dcdb..659fca15976 100644
--- a/drivers/usb/otg/ab8500-usb.c
+++ b/drivers/usb/otg/ab8500-usb.c
@@ -29,19 +29,15 @@
#include <linux/notifier.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
+#include <linux/io.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/mfd/abx500.h>
#include <linux/mfd/abx500/ab8500.h>
-#include <linux/regulator/consumer.h>
#include <linux/mfd/dbx500-prcmu.h>
#include <linux/kernel_stat.h>
#include <linux/pm_qos.h>
-#include <asm/io.h>
-
-#include <mach/usb.h>
-
#define AB8500_MAIN_WD_CTRL_REG 0x01
#define AB8500_USB_LINE_STAT_REG 0x80
#define AB8500_USB_PHY_CTRL_REG 0x8A
@@ -126,7 +122,6 @@ struct ab8500_usb {
struct regulator *v_ape;
struct regulator *v_musb;
struct regulator *v_ulpi;
- struct abx500_usbgpio_platform_data *usb_gpio;
struct delayed_work work_usb_workaround;
bool sysfs_flag;
};
@@ -245,7 +240,6 @@ static void ab8500_usb_phy_enable(struct ab8500_usb *ab, bool sel_host)
bit = sel_host ? AB8500_BIT_PHY_CTRL_HOST_EN :
AB8500_BIT_PHY_CTRL_DEVICE_EN;
- ab->usb_gpio->enable();
clk_enable(ab->sysclk);
ab8500_usb_regulator_ctrl(ab, sel_host, true);
@@ -299,8 +293,6 @@ static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host)
ab8500_usb_regulator_ctrl(ab, sel_host, false);
- ab->usb_gpio->disable();
-
prcmu_qos_update_requirement(PRCMU_QOS_APE_OPP,
(char *)dev_name(ab->dev), 50);
@@ -360,12 +352,16 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
if (ab->mode == USB_HOST) {
ab->mode = USB_PERIPHERAL;
ab8500_usb_host_phy_dis(ab);
- ux500_restore_context();
+ atomic_notifier_call_chain(&ab->otg.notifier,
+ USB_EVENT_PREPARE,
+ &ab->vbus_draw);
ab8500_usb_peri_phy_en(ab);
}
if (ab->mode == USB_IDLE) {
ab->mode = USB_PERIPHERAL;
- ux500_restore_context();
+ atomic_notifier_call_chain(&ab->otg.notifier,
+ USB_EVENT_PREPARE,
+ &ab->vbus_draw);
ab8500_usb_peri_phy_en(ab);
}
if (event != USB_EVENT_RIDC)
@@ -378,12 +374,16 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
if (ab->mode == USB_PERIPHERAL) {
ab->mode = USB_HOST;
ab8500_usb_peri_phy_dis(ab);
- ux500_restore_context();
+ atomic_notifier_call_chain(&ab->otg.notifier,
+ USB_EVENT_PREPARE,
+ &ab->vbus_draw);
ab8500_usb_host_phy_en(ab);
}
if (ab->mode == USB_IDLE) {
ab->mode = USB_HOST;
- ux500_restore_context();
+ atomic_notifier_call_chain(&ab->otg.notifier,
+ USB_EVENT_PREPARE,
+ &ab->vbus_draw);
ab8500_usb_host_phy_en(ab);
}
ab->phy.otg->default_a = true;
@@ -794,8 +794,6 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
{
struct ab8500_usb *ab;
struct usb_otg *otg;
- struct ab8500_platform_data *ab8500_pdata =
- dev_get_platdata(pdev->dev.parent);
int err;
int rev;
int ret = -1;
@@ -831,7 +829,6 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
otg->phy = &ab->phy;
otg->set_host = ab8500_usb_set_host;
otg->set_peripheral = ab8500_usb_set_peripheral;
- ab->usb_gpio = ab8500_pdata->usb;
ab->sysfs_flag = true;
platform_set_drvdata(pdev, ab);
@@ -917,10 +914,6 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
/* Needed to enable ID detection. */
ab8500_usb_wd_workaround(ab);
- err = ab->usb_gpio->get(ab->dev);
- if (err < 0)
- goto fail3;
-
prcmu_qos_add_requirement(PRCMU_QOS_APE_OPP,
(char *)dev_name(ab->dev), 50);
dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", ab->rev);
@@ -969,8 +962,6 @@ static int __devexit ab8500_usb_remove(struct platform_device *pdev)
ab8500_usb_regulator_put(ab);
- ab->usb_gpio->put();
-
platform_set_drvdata(pdev, NULL);
kfree(ab->phy.otg);