diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2015-02-03 16:18:17 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-03-11 11:19:38 -0400 |
commit | 168bdb88c3ab1f66c061a6220c18939ef20ba42e (patch) | |
tree | 5b3f4aaf25df39ccb7c7deb836d315de3613b402 /drivers/usb/phy | |
parent | f4e4f8dae3753685e577143e8116cbac52f13cc4 (diff) |
usb: phy: phy-generic: No need to call gpiod_direction_output() twice
Commit 9eb0797722895f4309b4 ("usb: phy: generic: fix the gpios to be optional")
calls gpiod_direction_output() in the probe function, so there is no need to
call it again, as we can simply call gpiod_set_value() directly.
Also, in usb_gen_phy_shutdown() we can simply put the GPIO directly in its
active level state and this allows us to simplify the nop_reset function to
treat only the reset case.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r-- | drivers/usb/phy/phy-generic.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index 70be50b734b2..deee68eafb72 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c | |||
@@ -62,14 +62,14 @@ static int nop_set_suspend(struct usb_phy *x, int suspend) | |||
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | static void nop_reset_set(struct usb_phy_generic *nop, int asserted) | 65 | static void nop_reset(struct usb_phy_generic *nop) |
66 | { | 66 | { |
67 | if (!nop->gpiod_reset) | 67 | if (!nop->gpiod_reset) |
68 | return; | 68 | return; |
69 | 69 | ||
70 | gpiod_direction_output(nop->gpiod_reset, !asserted); | 70 | gpiod_set_value(nop->gpiod_reset, 1); |
71 | usleep_range(10000, 20000); | 71 | usleep_range(10000, 20000); |
72 | gpiod_set_value(nop->gpiod_reset, asserted); | 72 | gpiod_set_value(nop->gpiod_reset, 0); |
73 | } | 73 | } |
74 | 74 | ||
75 | /* interface to regulator framework */ | 75 | /* interface to regulator framework */ |
@@ -151,8 +151,7 @@ int usb_gen_phy_init(struct usb_phy *phy) | |||
151 | if (!IS_ERR(nop->clk)) | 151 | if (!IS_ERR(nop->clk)) |
152 | clk_prepare_enable(nop->clk); | 152 | clk_prepare_enable(nop->clk); |
153 | 153 | ||
154 | /* De-assert RESET */ | 154 | nop_reset(nop); |
155 | nop_reset_set(nop, 0); | ||
156 | 155 | ||
157 | return 0; | 156 | return 0; |
158 | } | 157 | } |
@@ -162,8 +161,7 @@ void usb_gen_phy_shutdown(struct usb_phy *phy) | |||
162 | { | 161 | { |
163 | struct usb_phy_generic *nop = dev_get_drvdata(phy->dev); | 162 | struct usb_phy_generic *nop = dev_get_drvdata(phy->dev); |
164 | 163 | ||
165 | /* Assert RESET */ | 164 | gpiod_set_value(nop->gpiod_reset, 1); |
166 | nop_reset_set(nop, 1); | ||
167 | 165 | ||
168 | if (!IS_ERR(nop->clk)) | 166 | if (!IS_ERR(nop->clk)) |
169 | clk_disable_unprepare(nop->clk); | 167 | clk_disable_unprepare(nop->clk); |