diff options
| -rw-r--r-- | drivers/usb/phy/phy-omap-control.c | 31 | ||||
| -rw-r--r-- | include/linux/usb/omap_control_usb.h | 5 |
2 files changed, 10 insertions, 26 deletions
diff --git a/drivers/usb/phy/phy-omap-control.c b/drivers/usb/phy/phy-omap-control.c index 1c8a7c5ccb9b..09c5ace1edd8 100644 --- a/drivers/usb/phy/phy-omap-control.c +++ b/drivers/usb/phy/phy-omap-control.c | |||
| @@ -26,26 +26,6 @@ | |||
| 26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
| 27 | #include <linux/usb/omap_control_usb.h> | 27 | #include <linux/usb/omap_control_usb.h> |
| 28 | 28 | ||
| 29 | static struct omap_control_usb *control_usb; | ||
| 30 | |||
| 31 | /** | ||
| 32 | * omap_get_control_dev - returns the device pointer for this control device | ||
| 33 | * | ||
| 34 | * This API should be called to get the device pointer for this control | ||
| 35 | * module device. This device pointer should be used for called other | ||
| 36 | * exported API's in this driver. | ||
| 37 | * | ||
| 38 | * To be used by PHY driver and glue driver. | ||
| 39 | */ | ||
| 40 | struct device *omap_get_control_dev(void) | ||
| 41 | { | ||
| 42 | if (!control_usb) | ||
| 43 | return ERR_PTR(-ENODEV); | ||
| 44 | |||
| 45 | return control_usb->dev; | ||
| 46 | } | ||
| 47 | EXPORT_SYMBOL_GPL(omap_get_control_dev); | ||
| 48 | |||
| 49 | /** | 29 | /** |
| 50 | * omap_control_usb_phy_power - power on/off the phy using control module reg | 30 | * omap_control_usb_phy_power - power on/off the phy using control module reg |
| 51 | * @dev: the control module device | 31 | * @dev: the control module device |
| @@ -182,11 +162,19 @@ void omap_control_usb_set_mode(struct device *dev, | |||
| 182 | { | 162 | { |
| 183 | struct omap_control_usb *ctrl_usb; | 163 | struct omap_control_usb *ctrl_usb; |
| 184 | 164 | ||
| 185 | if (IS_ERR(dev) || control_usb->type != OMAP_CTRL_TYPE_OTGHS) | 165 | if (IS_ERR(dev) || !dev) |
| 186 | return; | 166 | return; |
| 187 | 167 | ||
| 188 | ctrl_usb = dev_get_drvdata(dev); | 168 | ctrl_usb = dev_get_drvdata(dev); |
| 189 | 169 | ||
| 170 | if (!ctrl_usb) { | ||
| 171 | dev_err(dev, "Invalid control usb device\n"); | ||
| 172 | return; | ||
| 173 | } | ||
| 174 | |||
| 175 | if (ctrl_usb->type != OMAP_CTRL_TYPE_OTGHS) | ||
| 176 | return; | ||
| 177 | |||
| 190 | switch (mode) { | 178 | switch (mode) { |
| 191 | case USB_MODE_HOST: | 179 | case USB_MODE_HOST: |
| 192 | omap_control_usb_host_mode(ctrl_usb); | 180 | omap_control_usb_host_mode(ctrl_usb); |
| @@ -237,6 +225,7 @@ static int omap_control_usb_probe(struct platform_device *pdev) | |||
| 237 | { | 225 | { |
| 238 | struct resource *res; | 226 | struct resource *res; |
| 239 | const struct of_device_id *of_id; | 227 | const struct of_device_id *of_id; |
| 228 | struct omap_control_usb *control_usb; | ||
| 240 | 229 | ||
| 241 | of_id = of_match_device(of_match_ptr(omap_control_usb_id_table), | 230 | of_id = of_match_device(of_match_ptr(omap_control_usb_id_table), |
| 242 | &pdev->dev); | 231 | &pdev->dev); |
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h index 61b889a9c67b..596b01918813 100644 --- a/include/linux/usb/omap_control_usb.h +++ b/include/linux/usb/omap_control_usb.h | |||
| @@ -65,15 +65,10 @@ enum omap_control_usb_mode { | |||
| 65 | #define OMAP_CTRL_USB2_PHY_PD BIT(28) | 65 | #define OMAP_CTRL_USB2_PHY_PD BIT(28) |
| 66 | 66 | ||
| 67 | #if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) | 67 | #if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) |
| 68 | extern struct device *omap_get_control_dev(void); | ||
| 69 | extern void omap_control_usb_phy_power(struct device *dev, int on); | 68 | extern void omap_control_usb_phy_power(struct device *dev, int on); |
| 70 | extern void omap_control_usb_set_mode(struct device *dev, | 69 | extern void omap_control_usb_set_mode(struct device *dev, |
| 71 | enum omap_control_usb_mode mode); | 70 | enum omap_control_usb_mode mode); |
| 72 | #else | 71 | #else |
| 73 | static inline struct device *omap_get_control_dev(void) | ||
| 74 | { | ||
| 75 | return ERR_PTR(-ENODEV); | ||
| 76 | } | ||
| 77 | 72 | ||
| 78 | static inline void omap_control_usb_phy_power(struct device *dev, int on) | 73 | static inline void omap_control_usb_phy_power(struct device *dev, int on) |
| 79 | { | 74 | { |
