miphy_phy 364 drivers/phy/st/phy-miphy28lp.c static inline void miphy28lp_set_reset(struct miphy28lp_phy *miphy_phy) miphy_phy 366 drivers/phy/st/phy-miphy28lp.c void __iomem *base = miphy_phy->base; miphy_phy 378 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->type == PHY_TYPE_PCIE) { miphy_phy 387 drivers/phy/st/phy-miphy28lp.c static inline void miphy28lp_pll_calibration(struct miphy28lp_phy *miphy_phy, miphy_phy 390 drivers/phy/st/phy-miphy28lp.c void __iomem *base = miphy_phy->base; miphy_phy 411 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->type != PHY_TYPE_SATA) miphy_phy 416 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->type == PHY_TYPE_USB3) { miphy_phy 429 drivers/phy/st/phy-miphy28lp.c static inline void miphy28lp_sata_config_gen(struct miphy28lp_phy *miphy_phy) miphy_phy 431 drivers/phy/st/phy-miphy28lp.c void __iomem *base = miphy_phy->base; miphy_phy 456 drivers/phy/st/phy-miphy28lp.c static inline void miphy28lp_pcie_config_gen(struct miphy28lp_phy *miphy_phy) miphy_phy 458 drivers/phy/st/phy-miphy28lp.c void __iomem *base = miphy_phy->base; miphy_phy 485 drivers/phy/st/phy-miphy28lp.c static inline int miphy28lp_wait_compensation(struct miphy28lp_phy *miphy_phy) miphy_phy 492 drivers/phy/st/phy-miphy28lp.c val = readb_relaxed(miphy_phy->base + MIPHY_COMP_FSM_6); miphy_phy 503 drivers/phy/st/phy-miphy28lp.c static inline int miphy28lp_compensation(struct miphy28lp_phy *miphy_phy, miphy_phy 506 drivers/phy/st/phy-miphy28lp.c void __iomem *base = miphy_phy->base; miphy_phy 516 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->type == PHY_TYPE_PCIE) miphy_phy 526 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->type == PHY_TYPE_PCIE) miphy_phy 527 drivers/phy/st/phy-miphy28lp.c return miphy28lp_wait_compensation(miphy_phy); miphy_phy 532 drivers/phy/st/phy-miphy28lp.c static inline void miphy28_usb3_miphy_reset(struct miphy28lp_phy *miphy_phy) miphy_phy 534 drivers/phy/st/phy-miphy28lp.c void __iomem *base = miphy_phy->base; miphy_phy 560 drivers/phy/st/phy-miphy28lp.c static void miphy_sata_tune_ssc(struct miphy28lp_phy *miphy_phy) miphy_phy 562 drivers/phy/st/phy-miphy28lp.c void __iomem *base = miphy_phy->base; miphy_phy 598 drivers/phy/st/phy-miphy28lp.c static void miphy_pcie_tune_ssc(struct miphy28lp_phy *miphy_phy) miphy_phy 600 drivers/phy/st/phy-miphy28lp.c void __iomem *base = miphy_phy->base; miphy_phy 638 drivers/phy/st/phy-miphy28lp.c static inline void miphy_tune_tx_impedance(struct miphy28lp_phy *miphy_phy) miphy_phy 641 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x02, miphy_phy->base + MIPHY_COMP_POSTP); miphy_phy 644 drivers/phy/st/phy-miphy28lp.c static inline int miphy28lp_configure_sata(struct miphy28lp_phy *miphy_phy) miphy_phy 646 drivers/phy/st/phy-miphy28lp.c void __iomem *base = miphy_phy->base; miphy_phy 651 drivers/phy/st/phy-miphy28lp.c miphy28lp_set_reset(miphy_phy); miphy_phy 654 drivers/phy/st/phy-miphy28lp.c miphy28lp_pll_calibration(miphy_phy, &sata_pll_ratio); miphy_phy 657 drivers/phy/st/phy-miphy28lp.c miphy28lp_sata_config_gen(miphy_phy); miphy_phy 668 drivers/phy/st/phy-miphy28lp.c err = miphy28lp_compensation(miphy_phy, &sata_pll_ratio); miphy_phy 672 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->px_rx_pol_inv) { miphy_phy 674 drivers/phy/st/phy-miphy28lp.c val = readb_relaxed(miphy_phy->base + MIPHY_CONTROL); miphy_phy 676 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(val, miphy_phy->base + MIPHY_CONTROL); miphy_phy 679 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->ssc) miphy_phy 680 drivers/phy/st/phy-miphy28lp.c miphy_sata_tune_ssc(miphy_phy); miphy_phy 682 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->tx_impedance) miphy_phy 683 drivers/phy/st/phy-miphy28lp.c miphy_tune_tx_impedance(miphy_phy); miphy_phy 688 drivers/phy/st/phy-miphy28lp.c static inline int miphy28lp_configure_pcie(struct miphy28lp_phy *miphy_phy) miphy_phy 690 drivers/phy/st/phy-miphy28lp.c void __iomem *base = miphy_phy->base; miphy_phy 694 drivers/phy/st/phy-miphy28lp.c miphy28lp_set_reset(miphy_phy); miphy_phy 697 drivers/phy/st/phy-miphy28lp.c miphy28lp_pll_calibration(miphy_phy, &pcie_pll_ratio); miphy_phy 700 drivers/phy/st/phy-miphy28lp.c miphy28lp_pcie_config_gen(miphy_phy); miphy_phy 711 drivers/phy/st/phy-miphy28lp.c err = miphy28lp_compensation(miphy_phy, &pcie_pll_ratio); miphy_phy 715 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->ssc) miphy_phy 716 drivers/phy/st/phy-miphy28lp.c miphy_pcie_tune_ssc(miphy_phy); miphy_phy 718 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->tx_impedance) miphy_phy 719 drivers/phy/st/phy-miphy28lp.c miphy_tune_tx_impedance(miphy_phy); miphy_phy 725 drivers/phy/st/phy-miphy28lp.c static inline void miphy28lp_configure_usb3(struct miphy28lp_phy *miphy_phy) miphy_phy 727 drivers/phy/st/phy-miphy28lp.c void __iomem *base = miphy_phy->base; miphy_phy 731 drivers/phy/st/phy-miphy28lp.c miphy28lp_set_reset(miphy_phy); miphy_phy 734 drivers/phy/st/phy-miphy28lp.c miphy28lp_pll_calibration(miphy_phy, &usb3_pll_ratio); miphy_phy 803 drivers/phy/st/phy-miphy28lp.c miphy28_usb3_miphy_reset(miphy_phy); miphy_phy 806 drivers/phy/st/phy-miphy28lp.c static inline int miphy_is_ready(struct miphy28lp_phy *miphy_phy) miphy_phy 816 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->type == PHY_TYPE_SATA) miphy_phy 820 drivers/phy/st/phy-miphy28lp.c val = readb_relaxed(miphy_phy->base + MIPHY_STATUS_1); miphy_phy 830 drivers/phy/st/phy-miphy28lp.c static int miphy_osc_is_ready(struct miphy28lp_phy *miphy_phy) miphy_phy 832 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; miphy_phy 836 drivers/phy/st/phy-miphy28lp.c if (!miphy_phy->osc_rdy) miphy_phy 839 drivers/phy/st/phy-miphy28lp.c if (!miphy_phy->syscfg_reg[SYSCFG_STATUS]) miphy_phy 844 drivers/phy/st/phy-miphy28lp.c miphy_phy->syscfg_reg[SYSCFG_STATUS], &val); miphy_phy 888 drivers/phy/st/phy-miphy28lp.c static int miphy28lp_setup(struct miphy28lp_phy *miphy_phy, u32 miphy_val) miphy_phy 891 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; miphy_phy 893 drivers/phy/st/phy-miphy28lp.c if (!miphy_phy->syscfg_reg[SYSCFG_CTRL]) miphy_phy 896 drivers/phy/st/phy-miphy28lp.c err = reset_control_assert(miphy_phy->miphy_rst); miphy_phy 902 drivers/phy/st/phy-miphy28lp.c if (miphy_phy->osc_force_ext) miphy_phy 906 drivers/phy/st/phy-miphy28lp.c miphy_phy->syscfg_reg[SYSCFG_CTRL], miphy_phy 909 drivers/phy/st/phy-miphy28lp.c err = reset_control_deassert(miphy_phy->miphy_rst); miphy_phy 915 drivers/phy/st/phy-miphy28lp.c return miphy_osc_is_ready(miphy_phy); miphy_phy 918 drivers/phy/st/phy-miphy28lp.c static int miphy28lp_init_sata(struct miphy28lp_phy *miphy_phy) miphy_phy 920 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; miphy_phy 923 drivers/phy/st/phy-miphy28lp.c if ((!miphy_phy->syscfg_reg[SYSCFG_SATA]) || miphy_phy 924 drivers/phy/st/phy-miphy28lp.c (!miphy_phy->syscfg_reg[SYSCFG_PCI]) || miphy_phy 925 drivers/phy/st/phy-miphy28lp.c (!miphy_phy->base)) miphy_phy 928 drivers/phy/st/phy-miphy28lp.c dev_info(miphy_dev->dev, "sata-up mode, addr 0x%p\n", miphy_phy->base); miphy_phy 931 drivers/phy/st/phy-miphy28lp.c sata_conf |= ((miphy_phy->sata_gen - SATA_GEN1) << SATA_SPDMODE); miphy_phy 934 drivers/phy/st/phy-miphy28lp.c miphy_phy->syscfg_reg[SYSCFG_SATA], miphy_phy 937 drivers/phy/st/phy-miphy28lp.c regmap_update_bits(miphy_dev->regmap, miphy_phy->syscfg_reg[SYSCFG_PCI], miphy_phy 941 drivers/phy/st/phy-miphy28lp.c err = miphy28lp_setup(miphy_phy, MIPHY_CTRL_DEFAULT); miphy_phy 949 drivers/phy/st/phy-miphy28lp.c miphy28lp_configure_sata(miphy_phy); miphy_phy 951 drivers/phy/st/phy-miphy28lp.c return miphy_is_ready(miphy_phy); miphy_phy 954 drivers/phy/st/phy-miphy28lp.c static int miphy28lp_init_pcie(struct miphy28lp_phy *miphy_phy) miphy_phy 956 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; miphy_phy 959 drivers/phy/st/phy-miphy28lp.c if ((!miphy_phy->syscfg_reg[SYSCFG_SATA]) || miphy_phy 960 drivers/phy/st/phy-miphy28lp.c (!miphy_phy->syscfg_reg[SYSCFG_PCI]) miphy_phy 961 drivers/phy/st/phy-miphy28lp.c || (!miphy_phy->base) || (!miphy_phy->pipebase)) miphy_phy 964 drivers/phy/st/phy-miphy28lp.c dev_info(miphy_dev->dev, "pcie-up mode, addr 0x%p\n", miphy_phy->base); miphy_phy 968 drivers/phy/st/phy-miphy28lp.c miphy_phy->syscfg_reg[SYSCFG_SATA], miphy_phy 971 drivers/phy/st/phy-miphy28lp.c regmap_update_bits(miphy_dev->regmap, miphy_phy->syscfg_reg[SYSCFG_PCI], miphy_phy 975 drivers/phy/st/phy-miphy28lp.c err = miphy28lp_setup(miphy_phy, MIPHY_CTRL_DEFAULT); miphy_phy 983 drivers/phy/st/phy-miphy28lp.c err = miphy28lp_configure_pcie(miphy_phy); miphy_phy 988 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x68, miphy_phy->pipebase + 0x104); /* Rise_0 */ miphy_phy 989 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x61, miphy_phy->pipebase + 0x105); /* Rise_1 */ miphy_phy 990 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x68, miphy_phy->pipebase + 0x108); /* Fall_0 */ miphy_phy 991 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x61, miphy_phy->pipebase + 0x109); /* Fall-1 */ miphy_phy 992 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x68, miphy_phy->pipebase + 0x10c); /* Threshold_0 */ miphy_phy 993 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x60, miphy_phy->pipebase + 0x10d); /* Threshold_1 */ miphy_phy 996 drivers/phy/st/phy-miphy28lp.c return miphy_is_ready(miphy_phy); miphy_phy 999 drivers/phy/st/phy-miphy28lp.c static int miphy28lp_init_usb3(struct miphy28lp_phy *miphy_phy) miphy_phy 1001 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; miphy_phy 1004 drivers/phy/st/phy-miphy28lp.c if ((!miphy_phy->base) || (!miphy_phy->pipebase)) miphy_phy 1007 drivers/phy/st/phy-miphy28lp.c dev_info(miphy_dev->dev, "usb3-up mode, addr 0x%p\n", miphy_phy->base); miphy_phy 1010 drivers/phy/st/phy-miphy28lp.c err = miphy28lp_setup(miphy_phy, MIPHY_CTRL_SYNC_D_EN); miphy_phy 1017 drivers/phy/st/phy-miphy28lp.c miphy28lp_configure_usb3(miphy_phy); miphy_phy 1020 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x68, miphy_phy->pipebase + 0x23); miphy_phy 1021 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x61, miphy_phy->pipebase + 0x24); miphy_phy 1022 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x68, miphy_phy->pipebase + 0x26); miphy_phy 1023 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x61, miphy_phy->pipebase + 0x27); miphy_phy 1024 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x18, miphy_phy->pipebase + 0x29); miphy_phy 1025 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x61, miphy_phy->pipebase + 0x2a); miphy_phy 1028 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0X67, miphy_phy->pipebase + 0x68); miphy_phy 1029 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0x0d, miphy_phy->pipebase + 0x69); miphy_phy 1030 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0X67, miphy_phy->pipebase + 0x6a); miphy_phy 1031 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0X0d, miphy_phy->pipebase + 0x6b); miphy_phy 1032 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0X67, miphy_phy->pipebase + 0x6c); miphy_phy 1033 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0X0d, miphy_phy->pipebase + 0x6d); miphy_phy 1034 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0X67, miphy_phy->pipebase + 0x6e); miphy_phy 1035 drivers/phy/st/phy-miphy28lp.c writeb_relaxed(0X0d, miphy_phy->pipebase + 0x6f); miphy_phy 1037 drivers/phy/st/phy-miphy28lp.c return miphy_is_ready(miphy_phy); miphy_phy 1042 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_phy *miphy_phy = phy_get_drvdata(phy); miphy_phy 1043 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; miphy_phy 1048 drivers/phy/st/phy-miphy28lp.c switch (miphy_phy->type) { miphy_phy 1051 drivers/phy/st/phy-miphy28lp.c ret = miphy28lp_init_sata(miphy_phy); miphy_phy 1054 drivers/phy/st/phy-miphy28lp.c ret = miphy28lp_init_pcie(miphy_phy); miphy_phy 1057 drivers/phy/st/phy-miphy28lp.c ret = miphy28lp_init_usb3(miphy_phy); miphy_phy 1069 drivers/phy/st/phy-miphy28lp.c static int miphy28lp_get_addr(struct miphy28lp_phy *miphy_phy) miphy_phy 1071 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; miphy_phy 1072 drivers/phy/st/phy-miphy28lp.c struct device_node *phynode = miphy_phy->phy->dev.of_node; miphy_phy 1075 drivers/phy/st/phy-miphy28lp.c if ((miphy_phy->type != PHY_TYPE_SATA) && miphy_phy 1076 drivers/phy/st/phy-miphy28lp.c (miphy_phy->type != PHY_TYPE_PCIE) && miphy_phy 1077 drivers/phy/st/phy-miphy28lp.c (miphy_phy->type != PHY_TYPE_USB3)) { miphy_phy 1082 drivers/phy/st/phy-miphy28lp.c PHY_TYPE_name[miphy_phy->type - PHY_TYPE_SATA], miphy_phy 1083 drivers/phy/st/phy-miphy28lp.c &miphy_phy->base); miphy_phy 1087 drivers/phy/st/phy-miphy28lp.c if ((miphy_phy->type == PHY_TYPE_PCIE) || miphy_phy 1088 drivers/phy/st/phy-miphy28lp.c (miphy_phy->type == PHY_TYPE_USB3)) { miphy_phy 1090 drivers/phy/st/phy-miphy28lp.c &miphy_phy->pipebase); miphy_phy 1102 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_phy *miphy_phy = NULL; miphy_phy 1113 drivers/phy/st/phy-miphy28lp.c miphy_phy = miphy_dev->phys[index]; miphy_phy 1117 drivers/phy/st/phy-miphy28lp.c if (!miphy_phy) { miphy_phy 1122 drivers/phy/st/phy-miphy28lp.c miphy_phy->type = args->args[0]; miphy_phy 1124 drivers/phy/st/phy-miphy28lp.c ret = miphy28lp_get_addr(miphy_phy); miphy_phy 1128 drivers/phy/st/phy-miphy28lp.c return miphy_phy->phy; miphy_phy 1137 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_phy *miphy_phy) miphy_phy 1139 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; miphy_phy 1142 drivers/phy/st/phy-miphy28lp.c miphy_phy->miphy_rst = miphy_phy 1145 drivers/phy/st/phy-miphy28lp.c if (IS_ERR(miphy_phy->miphy_rst)) { miphy_phy 1148 drivers/phy/st/phy-miphy28lp.c return PTR_ERR(miphy_phy->miphy_rst); miphy_phy 1151 drivers/phy/st/phy-miphy28lp.c err = reset_control_deassert(miphy_phy->miphy_rst); miphy_phy 1161 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_phy *miphy_phy) miphy_phy 1166 drivers/phy/st/phy-miphy28lp.c miphy_phy->osc_force_ext = miphy_phy 1169 drivers/phy/st/phy-miphy28lp.c miphy_phy->osc_rdy = of_property_read_bool(np, "st,osc-rdy"); miphy_phy 1171 drivers/phy/st/phy-miphy28lp.c miphy_phy->px_rx_pol_inv = miphy_phy 1174 drivers/phy/st/phy-miphy28lp.c miphy_phy->ssc = of_property_read_bool(np, "st,ssc-on"); miphy_phy 1176 drivers/phy/st/phy-miphy28lp.c miphy_phy->tx_impedance = miphy_phy 1179 drivers/phy/st/phy-miphy28lp.c of_property_read_u32(np, "st,sata-gen", &miphy_phy->sata_gen); miphy_phy 1180 drivers/phy/st/phy-miphy28lp.c if (!miphy_phy->sata_gen) miphy_phy 1181 drivers/phy/st/phy-miphy28lp.c miphy_phy->sata_gen = SATA_GEN1; miphy_phy 1185 drivers/phy/st/phy-miphy28lp.c miphy_phy->syscfg_reg[i] = ctrlreg; miphy_phy 1222 drivers/phy/st/phy-miphy28lp.c struct miphy28lp_phy *miphy_phy; miphy_phy 1224 drivers/phy/st/phy-miphy28lp.c miphy_phy = devm_kzalloc(&pdev->dev, sizeof(*miphy_phy), miphy_phy 1226 drivers/phy/st/phy-miphy28lp.c if (!miphy_phy) { miphy_phy 1231 drivers/phy/st/phy-miphy28lp.c miphy_dev->phys[port] = miphy_phy; miphy_phy 1243 drivers/phy/st/phy-miphy28lp.c ret = miphy28lp_of_probe(child, miphy_phy);