diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2019-05-20 11:24:00 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-05-27 10:02:39 +0200 |
commit | cc8baa7dc6ee9e83d2dd0bca0c421789bcd5eb05 (patch) | |
tree | e50cc24a54e336bea79b29db5ad68266dabfff89 /drivers/usb | |
parent | 024d75696ffea45df9f5a549f623412ad1d9127f (diff) | |
download | barebox-cc8baa7dc6ee9e83d2dd0bca0c421789bcd5eb05.tar.gz barebox-cc8baa7dc6ee9e83d2dd0bca0c421789bcd5eb05.tar.xz |
usb: imx-usb-phy: Use stmp_reset_block() to reset PHY
Upstream kernel driver uses stmp_reset_block() to reset the PHY, so
convert the code to do so as well to save some code and sync both
drivers.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/imx/Kconfig | 1 | ||||
-rw-r--r-- | drivers/usb/imx/imx-usb-phy.c | 15 |
2 files changed, 6 insertions, 10 deletions
diff --git a/drivers/usb/imx/Kconfig b/drivers/usb/imx/Kconfig index 8e6f3156a1..07ca41b63a 100644 --- a/drivers/usb/imx/Kconfig +++ b/drivers/usb/imx/Kconfig @@ -17,3 +17,4 @@ config USB_IMX_CHIPIDEA config USB_IMX_PHY bool default y if (ARCH_IMX6 || ARCH_VF610) && GENERIC_PHY + select STMP_DEVICE diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c index 01bf04b672..306f843746 100644 --- a/drivers/usb/imx/imx-usb-phy.c +++ b/drivers/usb/imx/imx-usb-phy.c @@ -23,6 +23,7 @@ #include <linux/phy/phy.h> #include <linux/clk.h> #include <linux/err.h> +#include <stmp-device.h> #define HW_USBPHY_PWD 0x00 #define HW_USBPHY_TX 0x10 @@ -30,8 +31,6 @@ #define HW_USBPHY_CTRL_SET 0x34 #define HW_USBPHY_CTRL_CLR 0x38 -#define USBPHY_CTRL_SFTRST (1 << 31) -#define USBPHY_CTRL_CLKGATE (1 << 30) #define BM_USBPHY_CTRL_ENUTMILEVEL3 BIT(15) #define BM_USBPHY_CTRL_ENUTMILEVEL2 BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) @@ -47,17 +46,13 @@ struct imx_usbphy { static int imx_usbphy_phy_init(struct phy *phy) { struct imx_usbphy *imxphy = phy_get_drvdata(phy); + int ret; clk_enable(imxphy->clk); - /* reset usbphy */ - writel(USBPHY_CTRL_SFTRST, imxphy->base + HW_USBPHY_CTRL_SET); - - udelay(10); - - /* clr reset and clkgate */ - writel(USBPHY_CTRL_SFTRST | USBPHY_CTRL_CLKGATE, - imxphy->base + HW_USBPHY_CTRL_CLR); + ret = stmp_reset_block(imxphy->base + HW_USBPHY_CTRL, false); + if (ret) + return ret; /* Power up the PHY */ writel(0, imxphy->base + HW_USBPHY_PWD); |