Skip to content

Commit ae409cc

Browse files
Icenowykishon
authored andcommitted
phy: sun4i-usb: add support for H6 USB2 PHY
The USB 2.0 PHY on Allwinner H6 SoC is similar to older Allwinner SoCs, with some USB0 quirk like A83T and PHY index 1/2 missing. Add support for it. 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>
1 parent 2659392 commit ae409cc

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

‎drivers/phy/allwinner/phy-sun4i-usb.c‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ enum sun4i_usb_phy_type {
115115
sun8i_r40_phy,
116116
sun8i_v3s_phy,
117117
sun50i_a64_phy,
118+
sun50i_h6_phy,
118119
};
119120

120121
struct sun4i_usb_phy_cfg {
@@ -295,7 +296,8 @@ static int sun4i_usb_phy_init(struct phy *_phy)
295296
return ret;
296297
}
297298

298-
if (data->cfg->type == sun8i_a83t_phy) {
299+
if (data->cfg->type == sun8i_a83t_phy ||
300+
data->cfg->type == sun50i_h6_phy) {
299301
if (phy->index == 0) {
300302
val = readl(data->base + data->cfg->phyctl_offset);
301303
val |= PHY_CTL_VBUSVLDEXT;
@@ -344,7 +346,8 @@ static int sun4i_usb_phy_exit(struct phy *_phy)
344346
struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
345347

346348
if (phy->index == 0) {
347-
if (data->cfg->type == sun8i_a83t_phy) {
349+
if (data->cfg->type == sun8i_a83t_phy ||
350+
data->cfg->type == sun50i_h6_phy) {
348351
void __iomem *phyctl = data->base +
349352
data->cfg->phyctl_offset;
350353

@@ -959,6 +962,17 @@ static const struct sun4i_usb_phy_cfg sun50i_a64_cfg = {
959962
.phy0_dual_route = true,
960963
};
961964

965+
static const struct sun4i_usb_phy_cfg sun50i_h6_cfg = {
966+
.num_phys = 4,
967+
.type = sun50i_h6_phy,
968+
.disc_thresh = 3,
969+
.phyctl_offset = REG_PHYCTL_A33,
970+
.dedicated_clocks = true,
971+
.enable_pmu_unk1 = true,
972+
.phy0_dual_route = true,
973+
.missing_phys = BIT(1) | BIT(2),
974+
};
975+
962976
static const struct of_device_id sun4i_usb_phy_of_match[] = {
963977
{ .compatible = "allwinner,sun4i-a10-usb-phy", .data = &sun4i_a10_cfg },
964978
{ .compatible = "allwinner,sun5i-a13-usb-phy", .data = &sun5i_a13_cfg },
@@ -972,6 +986,7 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = {
972986
{ .compatible = "allwinner,sun8i-v3s-usb-phy", .data = &sun8i_v3s_cfg },
973987
{ .compatible = "allwinner,sun50i-a64-usb-phy",
974988
.data = &sun50i_a64_cfg},
989+
{ .compatible = "allwinner,sun50i-h6-usb-phy", .data = &sun50i_h6_cfg },
975990
{ },
976991
};
977992
MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match);

0 commit comments

Comments
 (0)