Skip to content

Commit

Permalink
phy: omap_usb2: Add support for am437x
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Jacques Hiblot <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
  • Loading branch information
Jean-Jacques Hiblot authored and Marek Vasut committed Dec 14, 2018
1 parent 0f46fb5 commit 512a84c
Showing 1 changed file with 34 additions and 11 deletions.
45 changes: 34 additions & 11 deletions drivers/phy/omap-usb2-phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#define OMAP_DEV_PHY_PD BIT(0)
#define OMAP_USB2_PHY_PD BIT(28)

#define AM437X_USB2_PHY_PD BIT(0)
#define AM437X_USB2_OTG_PD BIT(1)
#define AM437X_USB2_OTGVDET_EN BIT(19)
#define AM437X_USB2_OTGSESSEND_EN BIT(20)

#define USB2PHY_DISCON_BYP_LATCH BIT(31)
#define USB2PHY_ANA_CONFIG1 (0x4c)

Expand Down Expand Up @@ -60,6 +65,15 @@ static const struct usb_phy_data dra7x_usb2_phy2_data = {
.power_off = OMAP_USB2_PHY_PD,
};

static const struct usb_phy_data am437x_usb2_data = {
.label = "am437x_usb2",
.flags = 0,
.mask = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD |
AM437X_USB2_OTGVDET_EN | AM437X_USB2_OTGSESSEND_EN,
.power_on = AM437X_USB2_OTGVDET_EN | AM437X_USB2_OTGSESSEND_EN,
.power_off = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD,
};

static const struct udevice_id omap_usb2_id_table[] = {
{
.compatible = "ti,omap5-usb2",
Expand All @@ -73,6 +87,10 @@ static const struct udevice_id omap_usb2_id_table[] = {
.compatible = "ti,dra7x-usb2-phy2",
.data = (ulong)&dra7x_usb2_phy2_data,
},
{
.compatible = "ti,am437x-usb2",
.data = (ulong)&am437x_usb2_data,
},
{},
};

Expand Down Expand Up @@ -170,20 +188,25 @@ int omap_usb2_phy_probe(struct udevice *dev)
}

regmap = syscon_regmap_lookup_by_phandle(dev, "syscon-phy-power");
if (IS_ERR(regmap)) {
printf("can't get regmap (err %ld)\n", PTR_ERR(regmap));
return PTR_ERR(regmap);
if (!IS_ERR(regmap)) {
priv->pwr_regmap = regmap;
rc = dev_read_u32_array(dev, "syscon-phy-power", tmp, 2);
if (rc) {
printf("couldn't get power reg. offset (err %d)\n", rc);
return rc;
}
priv->pwr_reg_offset = tmp[1];
return 0;
}
priv->pwr_regmap = regmap;

rc = dev_read_u32_array(dev, "syscon-phy-power", tmp, 2);
if (rc) {
printf("couldn't get power reg. offset (err %d)\n", rc);
return rc;
regmap = syscon_regmap_lookup_by_phandle(dev, "ctrl-module");
if (!IS_ERR(regmap)) {
priv->pwr_regmap = regmap;
priv->pwr_reg_offset = 0;
return 0;
}
priv->pwr_reg_offset = tmp[1];

return 0;
printf("can't get regmap (err %ld)\n", PTR_ERR(regmap));
return PTR_ERR(regmap);
}

U_BOOT_DRIVER(omap_usb2_phy) = {
Expand Down

0 comments on commit 512a84c

Please sign in to comment.