diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index 839856c09e30..4d067d97c5a6 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -105,6 +105,7 @@ struct sun4i_usb_phy_cfg {
bool phy0_dual_route;
bool needs_phy2_siddq;
bool siddq_in_base;
+ bool siddq_before_reset;
bool poll_vbusen;
int missing_phys;
};@@ -253,6 +254,19 @@ static void sun4i_usb_phy_passby(struct sun4i_usb_phy *phy, int enable)
writel(reg_value, phy->pmu);
}
+static void sun4i_usb_phy_clear_hci_phy_ctl(struct sun4i_usb_phy *phy)
+{
+ struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
+ u32 val;
+
+ if (!phy->pmu || !data->cfg->hci_phy_ctl_clear)
+ return;
+
+ val = readl(phy->pmu + REG_HCI_PHY_CTL);
+ val &= ~data->cfg->hci_phy_ctl_clear;
+ writel(val, phy->pmu + REG_HCI_PHY_CTL);
+}
+
static int sun4i_usb_phy_init(struct phy *_phy)
{
struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);@@ -270,6 +284,10 @@ static int sun4i_usb_phy_init(struct phy *_phy)
return ret;
}
+ /* Some SoCs want SIDDQ cleared while the PHY is still in reset. */
+ if (data->cfg->siddq_before_reset)
+ sun4i_usb_phy_clear_hci_phy_ctl(phy);
+
ret = reset_control_deassert(phy->reset);
if (ret) {
clk_disable_unprepare(phy->clk2);@@ -321,11 +339,8 @@ static int sun4i_usb_phy_init(struct phy *_phy)
clk_disable_unprepare(phy2->clk2);
}
- if (phy->pmu && data->cfg->hci_phy_ctl_clear) {
- val = readl(phy->pmu + REG_HCI_PHY_CTL);
- val &= ~data->cfg->hci_phy_ctl_clear;
- writel(val, phy->pmu + REG_HCI_PHY_CTL);
- }
+ if (!data->cfg->siddq_before_reset)
+ sun4i_usb_phy_clear_hci_phy_ctl(phy);
if (data->cfg->siddq_in_base) {
if (phy->index == 0) {@@ -1013,6 +1028,15 @@ static const struct sun4i_usb_phy_cfg sun50i_h616_cfg = {
.siddq_in_base = true,
};
+static const struct sun4i_usb_phy_cfg sun60i_a733_cfg = {
+ .phyctl_offset = REG_PHYCTL_A33,
+ .dedicated_clocks = true,
+ .hci_phy_ctl_clear = PHY_CTL_SIDDQ,
+ .phy0_dual_route = true,
+ .siddq_in_base = true,
+ .siddq_before_reset = true,
+};
+
static const struct of_device_id sun4i_usb_phy_of_match[] = {
{ .compatible = "allwinner,sun4i-a10-usb-phy", .data = &sun4i_a10_cfg },
{ .compatible = "allwinner,sun5i-a13-usb-phy", .data = &sun5i_a13_cfg },@@ -1029,6 +1053,7 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = {
.data = &sun50i_a64_cfg},
{ .compatible = "allwinner,sun50i-h6-usb-phy", .data = &sun50i_h6_cfg },
{ .compatible = "allwinner,sun50i-h616-usb-phy", .data = &sun50i_h616_cfg },
+ { .compatible = "allwinner,sun60i-a733-usb-phy", .data = &sun60i_a733_cfg },
{ .compatible = "allwinner,suniv-f1c100s-usb-phy",
.data = &suniv_f1c100s_cfg },
{ },--
2.43.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy