Commit 6d1709b7 authored by Icenowy Zheng's avatar Icenowy Zheng Committed by Greg Kroah-Hartman

phy: sun4i-usb: add support for missing USB PHY index

[ Upstream commit 2659392e ]

The new Allwinner H6 SoC's USB2 PHY has two holes -- USB1 (which is a
3.0 port with dedicated PHY) and USB2 (which doesn't exist at all).

Add support for this kind of missing USB PHY index.
Signed-off-by: default avatarIcenowy Zheng <icenowy@aosc.io>
Reviewed-by: default avatarChen-Yu Tsai <wens@csie.org>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 8e6df638
...@@ -125,6 +125,7 @@ struct sun4i_usb_phy_cfg { ...@@ -125,6 +125,7 @@ struct sun4i_usb_phy_cfg {
bool dedicated_clocks; bool dedicated_clocks;
bool enable_pmu_unk1; bool enable_pmu_unk1;
bool phy0_dual_route; bool phy0_dual_route;
int missing_phys;
}; };
struct sun4i_usb_phy_data { struct sun4i_usb_phy_data {
...@@ -645,6 +646,9 @@ static struct phy *sun4i_usb_phy_xlate(struct device *dev, ...@@ -645,6 +646,9 @@ static struct phy *sun4i_usb_phy_xlate(struct device *dev,
if (args->args[0] >= data->cfg->num_phys) if (args->args[0] >= data->cfg->num_phys)
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
if (data->cfg->missing_phys & BIT(args->args[0]))
return ERR_PTR(-ENODEV);
return data->phys[args->args[0]].phy; return data->phys[args->args[0]].phy;
} }
...@@ -740,6 +744,9 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) ...@@ -740,6 +744,9 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
struct sun4i_usb_phy *phy = data->phys + i; struct sun4i_usb_phy *phy = data->phys + i;
char name[16]; char name[16];
if (data->cfg->missing_phys & BIT(i))
continue;
snprintf(name, sizeof(name), "usb%d_vbus", i); snprintf(name, sizeof(name), "usb%d_vbus", i);
phy->vbus = devm_regulator_get_optional(dev, name); phy->vbus = devm_regulator_get_optional(dev, name);
if (IS_ERR(phy->vbus)) { if (IS_ERR(phy->vbus)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment