Commit d0ed0645 authored by Mian Yousaf Kaukab's avatar Mian Yousaf Kaukab Committed by Felipe Balbi

usb: phy: ab8500-usb: add transceiver clock control

Add common clock support code for the ab8500-usb phy driver.
Acked-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarMaxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: default avatarMian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Signed-off-by: default avatarFabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 3147dad6
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/mfd/abx500.h> #include <linux/mfd/abx500.h>
#include <linux/mfd/abx500/ab8500.h> #include <linux/mfd/abx500/ab8500.h>
#include <linux/usb/musb-ux500.h> #include <linux/usb/musb-ux500.h>
...@@ -126,6 +128,7 @@ struct ab8500_usb { ...@@ -126,6 +128,7 @@ struct ab8500_usb {
unsigned vbus_draw; unsigned vbus_draw;
struct work_struct phy_dis_work; struct work_struct phy_dis_work;
enum ab8500_usb_mode mode; enum ab8500_usb_mode mode;
struct clk *sysclk;
struct regulator *v_ape; struct regulator *v_ape;
struct regulator *v_musb; struct regulator *v_musb;
struct regulator *v_ulpi; struct regulator *v_ulpi;
...@@ -252,6 +255,9 @@ static void ab8500_usb_phy_enable(struct ab8500_usb *ab, bool sel_host) ...@@ -252,6 +255,9 @@ static void ab8500_usb_phy_enable(struct ab8500_usb *ab, bool sel_host)
if (IS_ERR(ab->pinctrl)) if (IS_ERR(ab->pinctrl))
dev_err(ab->dev, "could not get/set default pinstate\n"); dev_err(ab->dev, "could not get/set default pinstate\n");
if (clk_prepare_enable(ab->sysclk))
dev_err(ab->dev, "can't prepare/enable clock\n");
ab8500_usb_regulator_enable(ab); ab8500_usb_regulator_enable(ab);
abx500_mask_and_set_register_interruptible(ab->dev, abx500_mask_and_set_register_interruptible(ab->dev,
...@@ -274,6 +280,8 @@ static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host) ...@@ -274,6 +280,8 @@ static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host)
/* Needed to disable the phy.*/ /* Needed to disable the phy.*/
ab8500_usb_wd_workaround(ab); ab8500_usb_wd_workaround(ab);
clk_disable_unprepare(ab->sysclk);
ab8500_usb_regulator_disable(ab); ab8500_usb_regulator_disable(ab);
if (!IS_ERR(ab->pinctrl)) { if (!IS_ERR(ab->pinctrl)) {
...@@ -784,6 +792,12 @@ static int ab8500_usb_probe(struct platform_device *pdev) ...@@ -784,6 +792,12 @@ static int ab8500_usb_probe(struct platform_device *pdev)
if (err) if (err)
return err; return err;
ab->sysclk = devm_clk_get(ab->dev, "sysclk");
if (IS_ERR(ab->sysclk)) {
dev_err(ab->dev, "Could not get sysclk.\n");
return PTR_ERR(ab->sysclk);
}
err = ab8500_usb_irq_setup(pdev, ab); err = ab8500_usb_irq_setup(pdev, ab);
if (err < 0) if (err < 0)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment