mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-13 08:27:23 +00:00
usb: host: ohci-generic: add generic PHY support
Extend ohci-generic driver with generic PHY framework Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
8a51b4b3da
commit
28df1cfddd
1 changed files with 30 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <clk.h>
|
#include <clk.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <dm/ofnode.h>
|
#include <dm/ofnode.h>
|
||||||
|
#include <generic-phy.h>
|
||||||
#include <reset.h>
|
#include <reset.h>
|
||||||
#include "ohci.h"
|
#include "ohci.h"
|
||||||
|
|
||||||
|
@ -19,6 +20,7 @@ struct generic_ohci {
|
||||||
ohci_t ohci;
|
ohci_t ohci;
|
||||||
struct clk *clocks; /* clock list */
|
struct clk *clocks; /* clock list */
|
||||||
struct reset_ctl *resets; /* reset list */
|
struct reset_ctl *resets; /* reset list */
|
||||||
|
struct phy phy;
|
||||||
int clock_count; /* number of clock in clock list */
|
int clock_count; /* number of clock in clock list */
|
||||||
int reset_count; /* number of reset in reset list */
|
int reset_count; /* number of reset in reset list */
|
||||||
};
|
};
|
||||||
|
@ -83,12 +85,33 @@ static int ohci_usb_probe(struct udevice *dev)
|
||||||
goto clk_err;
|
goto clk_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = generic_phy_get_by_index(dev, 0, &priv->phy);
|
||||||
|
if (err) {
|
||||||
|
if (err != -ENOENT) {
|
||||||
|
error("failed to get usb phy\n");
|
||||||
|
goto reset_err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = generic_phy_init(&priv->phy);
|
||||||
|
if (err) {
|
||||||
|
error("failed to init usb phy\n");
|
||||||
|
goto reset_err;
|
||||||
|
}
|
||||||
|
|
||||||
err = ohci_register(dev, regs);
|
err = ohci_register(dev, regs);
|
||||||
if (err)
|
if (err)
|
||||||
goto reset_err;
|
goto phy_err;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
phy_err:
|
||||||
|
if (generic_phy_valid(&priv->phy)) {
|
||||||
|
ret = generic_phy_exit(&priv->phy);
|
||||||
|
if (ret)
|
||||||
|
error("failed to release phy\n");
|
||||||
|
}
|
||||||
|
|
||||||
reset_err:
|
reset_err:
|
||||||
ret = reset_release_all(priv->resets, priv->reset_count);
|
ret = reset_release_all(priv->resets, priv->reset_count);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -110,6 +133,12 @@ static int ohci_usb_remove(struct udevice *dev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (generic_phy_valid(&priv->phy)) {
|
||||||
|
ret = generic_phy_exit(&priv->phy);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
ret = reset_release_all(priv->resets, priv->reset_count);
|
ret = reset_release_all(priv->resets, priv->reset_count);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue