phy: phy-mtk-tphy: add a property for disconnect threshold
This is used to tune the threshold of disconnect, the index range is [0, 15], the threshold voltage is about 400mV for 0, 700mV for 15, and the step is 20mV. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
This commit is contained in:
parent
7dffdebb61
commit
8be5a67f71
@ -60,6 +60,8 @@
|
||||
#define U3P_USBPHYACR6 0x018
|
||||
#define PA6_RG_U2_BC11_SW_EN BIT(23)
|
||||
#define PA6_RG_U2_OTG_VBUSCMP_EN BIT(20)
|
||||
#define PA6_RG_U2_DISCTH GENMASK(7, 4)
|
||||
#define PA6_RG_U2_DISCTH_VAL(x) ((0xf & (x)) << 4)
|
||||
#define PA6_RG_U2_SQTH GENMASK(3, 0)
|
||||
#define PA6_RG_U2_SQTH_VAL(x) (0xf & (x))
|
||||
|
||||
@ -300,6 +302,7 @@ struct mtk_phy_instance {
|
||||
int eye_src;
|
||||
int eye_vrt;
|
||||
int eye_term;
|
||||
int discth;
|
||||
bool bc12_en;
|
||||
};
|
||||
|
||||
@ -850,9 +853,12 @@ static void phy_parse_property(struct mtk_tphy *tphy,
|
||||
&instance->eye_vrt);
|
||||
device_property_read_u32(dev, "mediatek,eye-term",
|
||||
&instance->eye_term);
|
||||
dev_dbg(dev, "bc12:%d, src:%d, vrt:%d, term:%d\n",
|
||||
device_property_read_u32(dev, "mediatek,discth",
|
||||
&instance->discth);
|
||||
dev_dbg(dev, "bc12:%d, src:%d, vrt:%d, term:%d, disc:%d\n",
|
||||
instance->bc12_en, instance->eye_src,
|
||||
instance->eye_vrt, instance->eye_term);
|
||||
instance->eye_vrt, instance->eye_term,
|
||||
instance->discth);
|
||||
}
|
||||
|
||||
static void u2_phy_props_set(struct mtk_tphy *tphy,
|
||||
@ -888,6 +894,13 @@ static void u2_phy_props_set(struct mtk_tphy *tphy,
|
||||
tmp |= PA1_RG_TERM_SEL_VAL(instance->eye_term);
|
||||
writel(tmp, com + U3P_USBPHYACR1);
|
||||
}
|
||||
|
||||
if (instance->discth) {
|
||||
tmp = readl(com + U3P_USBPHYACR6);
|
||||
tmp &= ~PA6_RG_U2_DISCTH;
|
||||
tmp |= PA6_RG_U2_DISCTH_VAL(instance->discth);
|
||||
writel(tmp, com + U3P_USBPHYACR6);
|
||||
}
|
||||
}
|
||||
|
||||
static int mtk_phy_init(struct phy *phy)
|
||||
|
Loading…
Reference in New Issue
Block a user