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

phy: phy-mtk-tphy: add property for BC12

Some platforms support BC12 which is disabled by default,
here add a property to enable it if need

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Chunfeng Yun and committed by
Kishon Vijay Abraham I
d4f97f10 8158e917

+13
+13
drivers/phy/mediatek/phy-mtk-tphy.c
··· 101 101 #define P2C_RG_AVALID BIT(2) 102 102 #define P2C_RG_IDDIG BIT(1) 103 103 104 + #define U3P_U2PHYBC12C 0x080 105 + #define P2C_RG_CHGDT_EN BIT(0) 106 + 104 107 #define U3P_U3_CHIP_GPIO_CTLD 0x0c 105 108 #define P3C_REG_IP_SW_RST BIT(31) 106 109 #define P3C_MCU_BUS_CK_GATE_EN BIT(30) ··· 300 297 int eye_src; 301 298 int eye_vrt; 302 299 int eye_term; 300 + bool bc12_en; 303 301 }; 304 302 305 303 struct mtk_tphy { ··· 843 839 if (instance->type != PHY_TYPE_USB2) 844 840 return; 845 841 842 + instance->bc12_en = device_property_read_bool(dev, "mediatek,bc12"); 846 843 device_property_read_u32(dev, "mediatek,eye-src", 847 844 &instance->eye_src); 848 845 device_property_read_u32(dev, "mediatek,eye-vrt", 849 846 &instance->eye_vrt); 850 847 device_property_read_u32(dev, "mediatek,eye-term", 851 848 &instance->eye_term); 849 + dev_dbg(dev, "bc12:%d, src:%d, vrt:%d, term:%d\n", 850 + instance->bc12_en, instance->eye_src, 851 + instance->eye_vrt, instance->eye_term); 852 852 } 853 853 854 854 static void u2_phy_props_set(struct mtk_tphy *tphy, ··· 862 854 void __iomem *com = u2_banks->com; 863 855 u32 tmp; 864 856 857 + if (instance->bc12_en) { 858 + tmp = readl(com + U3P_U2PHYBC12C); 859 + tmp |= P2C_RG_CHGDT_EN; /* BC1.2 path Enable */ 860 + writel(tmp, com + U3P_U2PHYBC12C); 861 + } 865 862 866 863 if (instance->eye_src) { 867 864 tmp = readl(com + U3P_USBPHYACR5);