Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Icenowy Zheng and committed by
Kishon Vijay Abraham I
2659392e 1726ea90

+7
+7
drivers/phy/allwinner/phy-sun4i-usb.c
··· 126 126 bool dedicated_clocks; 127 127 bool enable_pmu_unk1; 128 128 bool phy0_dual_route; 129 + int missing_phys; 129 130 }; 130 131 131 132 struct sun4i_usb_phy_data { ··· 647 646 if (args->args[0] >= data->cfg->num_phys) 648 647 return ERR_PTR(-ENODEV); 649 648 649 + if (data->cfg->missing_phys & BIT(args->args[0])) 650 + return ERR_PTR(-ENODEV); 651 + 650 652 return data->phys[args->args[0]].phy; 651 653 } 652 654 ··· 744 740 for (i = 0; i < data->cfg->num_phys; i++) { 745 741 struct sun4i_usb_phy *phy = data->phys + i; 746 742 char name[16]; 743 + 744 + if (data->cfg->missing_phys & BIT(i)) 745 + continue; 747 746 748 747 snprintf(name, sizeof(name), "usb%d_vbus", i); 749 748 phy->vbus = devm_regulator_get_optional(dev, name);