usb: phy: phy-generic: No need to call gpiod_direction_output() twice

Commit 9eb0797722 ("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>
This commit is contained in:
Fabio Estevam 2015-02-03 19:18:17 -02:00 committed by Felipe Balbi
parent f4e4f8dae3
commit 168bdb88c3
1 changed files with 5 additions and 7 deletions

View File

@ -62,14 +62,14 @@ static int nop_set_suspend(struct usb_phy *x, int suspend)
return 0;
}
static void nop_reset_set(struct usb_phy_generic *nop, int asserted)
static void nop_reset(struct usb_phy_generic *nop)
{
if (!nop->gpiod_reset)
return;
gpiod_direction_output(nop->gpiod_reset, !asserted);
gpiod_set_value(nop->gpiod_reset, 1);
usleep_range(10000, 20000);
gpiod_set_value(nop->gpiod_reset, asserted);
gpiod_set_value(nop->gpiod_reset, 0);
}
/* interface to regulator framework */
@ -151,8 +151,7 @@ int usb_gen_phy_init(struct usb_phy *phy)
if (!IS_ERR(nop->clk))
clk_prepare_enable(nop->clk);
/* De-assert RESET */
nop_reset_set(nop, 0);
nop_reset(nop);
return 0;
}
@ -162,8 +161,7 @@ void usb_gen_phy_shutdown(struct usb_phy *phy)
{
struct usb_phy_generic *nop = dev_get_drvdata(phy->dev);
/* Assert RESET */
nop_reset_set(nop, 1);
gpiod_set_value(nop->gpiod_reset, 1);
if (!IS_ERR(nop->clk))
clk_disable_unprepare(nop->clk);