Skip to content

Commit

Permalink
Merge commit '8083526e0585' into sunxi-next
Browse files Browse the repository at this point in the history
Merge linux-phy up to 8083526 ("phy-sun4i-usb: Only check vbus-det on
power-on on boards with vbus-det")
  • Loading branch information
wens committed Aug 4, 2015
2 parents 7000ee6 + 8083526 commit 9f72e44
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 36 deletions.
1 change: 0 additions & 1 deletion drivers/phy/phy-armada375-usb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ static struct platform_driver armada375_usb_phy_driver = {
.driver = {
.of_match_table = of_usb_cluster_table,
.name = "armada-375-usb-cluster",
.owner = THIS_MODULE,
}
};
module_platform_driver(armada375_usb_phy_driver);
Expand Down
11 changes: 5 additions & 6 deletions drivers/phy/phy-berlin-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static struct phy_ops phy_berlin_usb_ops = {
.owner = THIS_MODULE,
};

static const struct of_device_id phy_berlin_sata_of_match[] = {
static const struct of_device_id phy_berlin_usb_of_match[] = {
{
.compatible = "marvell,berlin2-usb-phy",
.data = &phy_berlin_pll_dividers[0],
Expand All @@ -163,12 +163,12 @@ static const struct of_device_id phy_berlin_sata_of_match[] = {
},
{ },
};
MODULE_DEVICE_TABLE(of, phy_berlin_sata_of_match);
MODULE_DEVICE_TABLE(of, phy_berlin_usb_of_match);

static int phy_berlin_usb_probe(struct platform_device *pdev)
{
const struct of_device_id *match =
of_match_device(phy_berlin_sata_of_match, &pdev->dev);
of_match_device(phy_berlin_usb_of_match, &pdev->dev);
struct phy_berlin_usb_priv *priv;
struct resource *res;
struct phy *phy;
Expand Down Expand Up @@ -207,9 +207,8 @@ static struct platform_driver phy_berlin_usb_driver = {
.probe = phy_berlin_usb_probe,
.driver = {
.name = "phy-berlin-usb",
.owner = THIS_MODULE,
.of_match_table = phy_berlin_sata_of_match,
},
.of_match_table = phy_berlin_usb_of_match,
},
};
module_platform_driver(phy_berlin_usb_driver);

Expand Down
1 change: 0 additions & 1 deletion drivers/phy/phy-miphy28lp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,6 @@ static struct platform_driver miphy28lp_driver = {
.probe = miphy28lp_probe,
.driver = {
.name = "miphy28lp-phy",
.owner = THIS_MODULE,
.of_match_table = miphy28lp_of_match,
}
};
Expand Down
1 change: 0 additions & 1 deletion drivers/phy/phy-qcom-ufs-qmp-14nm.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ static struct platform_driver ufs_qcom_phy_qmp_14nm_driver = {
.driver = {
.of_match_table = ufs_qcom_phy_qmp_14nm_of_match,
.name = "ufs_qcom_phy_qmp_14nm",
.owner = THIS_MODULE,
},
};

Expand Down
1 change: 0 additions & 1 deletion drivers/phy/phy-qcom-ufs-qmp-20nm.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ static struct platform_driver ufs_qcom_phy_qmp_20nm_driver = {
.driver = {
.of_match_table = ufs_qcom_phy_qmp_20nm_of_match,
.name = "ufs_qcom_phy_qmp_20nm",
.owner = THIS_MODULE,
},
};

Expand Down
1 change: 0 additions & 1 deletion drivers/phy/phy-rockchip-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ static struct platform_driver rockchip_usb_driver = {
.probe = rockchip_usb_phy_probe,
.driver = {
.name = "rockchip-usb-phy",
.owner = THIS_MODULE,
.of_match_table = rockchip_usb_phy_dt_ids,
},
};
Expand Down
51 changes: 26 additions & 25 deletions drivers/phy/phy-sun4i-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,30 @@ static int sun4i_usb_phy_exit(struct phy *_phy)
return 0;
}

static int sun4i_usb_phy0_get_vbus_det(struct sun4i_usb_phy_data *data)
{
if (data->vbus_det_gpio)
return gpiod_get_value_cansleep(data->vbus_det_gpio);

if (data->vbus_power_supply) {
union power_supply_propval val;
int r;

r = power_supply_get_property(data->vbus_power_supply,
POWER_SUPPLY_PROP_PRESENT, &val);
if (r == 0)
return val.intval;
}

/* Fallback: report vbus as high */
return 1;
}

static bool sun4i_usb_phy0_have_vbus_det(struct sun4i_usb_phy_data *data)
{
return data->vbus_det_gpio || data->vbus_power_supply;
}

static int sun4i_usb_phy_power_on(struct phy *_phy)
{
struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
Expand All @@ -304,7 +328,8 @@ static int sun4i_usb_phy_power_on(struct phy *_phy)
return 0;

/* For phy0 only turn on Vbus if we don't have an ext. Vbus */
if (phy->index == 0 && data->vbus_det)
if (phy->index == 0 && sun4i_usb_phy0_have_vbus_det(data) &&
data->vbus_det)
return 0;

ret = regulator_enable(phy->vbus);
Expand Down Expand Up @@ -357,30 +382,6 @@ static struct phy_ops sun4i_usb_phy_ops = {
.owner = THIS_MODULE,
};

static int sun4i_usb_phy0_get_vbus_det(struct sun4i_usb_phy_data *data)
{
if (data->vbus_det_gpio)
return gpiod_get_value_cansleep(data->vbus_det_gpio);

if (data->vbus_power_supply) {
union power_supply_propval val;
int r;

r = power_supply_get_property(data->vbus_power_supply,
POWER_SUPPLY_PROP_PRESENT, &val);
if (r == 0)
return val.intval;
}

/* Fallback: report vbus as high */
return 1;
}

static bool sun4i_usb_phy0_have_vbus_det(struct sun4i_usb_phy_data *data)
{
return data->vbus_det_gpio || data->vbus_power_supply;
}

static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
{
struct sun4i_usb_phy_data *data =
Expand Down

0 comments on commit 9f72e44

Please sign in to comment.