Lines Matching full:macro

644 static int sparx5_sd10g25_get_mode_preset(struct sparx5_serdes_macro *macro,  in sparx5_sd10g25_get_mode_preset()  argument
647 switch (macro->serdesmode) { in sparx5_sd10g25_get_mode_preset()
649 if (macro->speed == SPEED_25000) in sparx5_sd10g25_get_mode_preset()
651 else if (macro->speed == SPEED_10000) in sparx5_sd10g25_get_mode_preset()
653 else if (macro->speed == SPEED_5000) in sparx5_sd10g25_get_mode_preset()
672 static int sparx5_sd10g28_get_mode_preset(struct sparx5_serdes_macro *macro, in sparx5_sd10g28_get_mode_preset() argument
676 switch (macro->serdesmode) { in sparx5_sd10g28_get_mode_preset()
678 if (macro->speed == SPEED_10000) { in sparx5_sd10g28_get_mode_preset()
680 } else if (macro->speed == SPEED_5000) { in sparx5_sd10g28_get_mode_preset()
686 dev_err(macro->priv->dev, "%s: Illegal speed: %02u, sidx: %02u, mode (%u)", in sparx5_sd10g28_get_mode_preset()
687 __func__, macro->speed, macro->sidx, in sparx5_sd10g28_get_mode_preset()
688 macro->serdesmode); in sparx5_sd10g28_get_mode_preset()
709 static void sparx5_sd25g28_get_params(struct sparx5_serdes_macro *macro, in sparx5_sd25g28_get_params() argument
715 u8 iw = sd25g28_get_iw_setting(macro->priv->dev, mode->bitwidth); in sparx5_sd25g28_get_params()
819 static void sparx5_sd10g28_get_params(struct sparx5_serdes_macro *macro, in sparx5_sd10g28_get_params() argument
825 u8 iw = sd10g28_get_iw_setting(macro->priv->dev, mode->bwidth); in sparx5_sd10g28_get_params()
835 .fx_100 = macro->serdesmode == SPX5_SD_MODE_100FX, in sparx5_sd10g28_get_params()
942 static int sparx5_sd25g28_apply_params(struct sparx5_serdes_macro *macro, in sparx5_sd25g28_apply_params() argument
945 struct sparx5_serdes_private *priv = macro->priv; in sparx5_sd25g28_apply_params()
948 u32 sd_index = macro->stpidx; in sparx5_sd25g28_apply_params()
1416 static int sparx5_sd10g28_apply_params(struct sparx5_serdes_macro *macro, in sparx5_sd10g28_apply_params() argument
1419 struct sparx5_serdes_private *priv = macro->priv; in sparx5_sd10g28_apply_params()
1422 u32 lane_index = macro->sidx; in sparx5_sd10g28_apply_params()
1423 u32 sd_index = macro->stpidx; in sparx5_sd10g28_apply_params()
1854 static int sparx5_sd25g28_config(struct sparx5_serdes_macro *macro, bool reset) in sparx5_sd25g28_config() argument
1856 struct sparx5_sd25g28_media_preset media = media_presets_25g[macro->media]; in sparx5_sd25g28_config()
1868 err = sparx5_sd10g25_get_mode_preset(macro, &mode); in sparx5_sd25g28_config()
1871 sparx5_sd25g28_get_params(macro, &media, &mode, &args, &params); in sparx5_sd25g28_config()
1872 sparx5_sd25g28_reset(macro->priv->regs, &params, macro->stpidx); in sparx5_sd25g28_config()
1873 return sparx5_sd25g28_apply_params(macro, &params); in sparx5_sd25g28_config()
1876 static int sparx5_sd10g28_config(struct sparx5_serdes_macro *macro, bool reset) in sparx5_sd10g28_config() argument
1878 struct sparx5_sd10g28_media_preset media = media_presets_10g[macro->media]; in sparx5_sd10g28_config()
1882 .is_6g = (macro->serdestype == SPX5_SDT_6G), in sparx5_sd10g28_config()
1890 err = sparx5_sd10g28_get_mode_preset(macro, &mode, &args); in sparx5_sd10g28_config()
1893 sparx5_sd10g28_get_params(macro, &media, &mode, &args, &params); in sparx5_sd10g28_config()
1894 sparx5_sd10g28_reset(macro->priv->regs, macro->sidx); in sparx5_sd10g28_config()
1895 return sparx5_sd10g28_apply_params(macro, &params); in sparx5_sd10g28_config()
1899 static int sparx5_serdes_power_save(struct sparx5_serdes_macro *macro, u32 pwdn) in sparx5_serdes_power_save() argument
1901 struct sparx5_serdes_private *priv = macro->priv; in sparx5_serdes_power_save()
1904 if (macro->serdestype == SPX5_SDT_6G) in sparx5_serdes_power_save()
1905 sd_inst = sdx5_inst_get(priv, TARGET_SD6G_LANE, macro->stpidx); in sparx5_serdes_power_save()
1906 else if (macro->serdestype == SPX5_SDT_10G) in sparx5_serdes_power_save()
1907 sd_inst = sdx5_inst_get(priv, TARGET_SD10G_LANE, macro->stpidx); in sparx5_serdes_power_save()
1909 sd_inst = sdx5_inst_get(priv, TARGET_SD25G_LANE, macro->stpidx); in sparx5_serdes_power_save()
1911 if (macro->serdestype == SPX5_SDT_25G) { in sparx5_serdes_power_save()
1926 static int sparx5_serdes_clock_config(struct sparx5_serdes_macro *macro) in sparx5_serdes_clock_config() argument
1928 struct sparx5_serdes_private *priv = macro->priv; in sparx5_serdes_clock_config()
1930 if (macro->serdesmode == SPX5_SD_MODE_100FX) { in sparx5_serdes_clock_config()
1937 SD_LANE_MISC(macro->sidx)); in sparx5_serdes_clock_config()
2117 static int sparx5_serdes_config(struct sparx5_serdes_macro *macro) in sparx5_serdes_config() argument
2119 struct device *dev = macro->priv->dev; in sparx5_serdes_config()
2123 err = sparx5_serdes_cmu_enable(macro->priv); in sparx5_serdes_config()
2127 serdesmode = sparx5_serdes_get_serdesmode(macro->portmode, macro->speed); in sparx5_serdes_config()
2130 macro->sidx, in sparx5_serdes_config()
2131 phy_modes(macro->portmode)); in sparx5_serdes_config()
2134 macro->serdesmode = serdesmode; in sparx5_serdes_config()
2136 sparx5_serdes_clock_config(macro); in sparx5_serdes_config()
2138 if (macro->serdestype == SPX5_SDT_25G) in sparx5_serdes_config()
2139 err = sparx5_sd25g28_config(macro, false); in sparx5_serdes_config()
2141 err = sparx5_sd10g28_config(macro, false); in sparx5_serdes_config()
2144 macro->sidx, err); in sparx5_serdes_config()
2151 struct sparx5_serdes_macro *macro = phy_get_drvdata(phy); in sparx5_serdes_power_on() local
2153 return sparx5_serdes_power_save(macro, false); in sparx5_serdes_power_on()
2158 struct sparx5_serdes_macro *macro = phy_get_drvdata(phy); in sparx5_serdes_power_off() local
2160 return sparx5_serdes_power_save(macro, true); in sparx5_serdes_power_off()
2165 struct sparx5_serdes_macro *macro; in sparx5_serdes_set_mode() local
2176 macro = phy_get_drvdata(phy); in sparx5_serdes_set_mode()
2177 macro->portmode = submode; in sparx5_serdes_set_mode()
2178 sparx5_serdes_config(macro); in sparx5_serdes_set_mode()
2187 struct sparx5_serdes_macro *macro = phy_get_drvdata(phy); in sparx5_serdes_set_media() local
2189 if (media != macro->media) { in sparx5_serdes_set_media()
2190 macro->media = media; in sparx5_serdes_set_media()
2191 if (macro->serdesmode != SPX5_SD_MODE_NONE) in sparx5_serdes_set_media()
2192 sparx5_serdes_config(macro); in sparx5_serdes_set_media()
2199 struct sparx5_serdes_macro *macro = phy_get_drvdata(phy); in sparx5_serdes_set_speed() local
2201 if (macro->sidx < SPX5_SERDES_10G_START && speed > SPEED_5000) in sparx5_serdes_set_speed()
2203 if (macro->sidx < SPX5_SERDES_25G_START && speed > SPEED_10000) in sparx5_serdes_set_speed()
2205 if (speed != macro->speed) { in sparx5_serdes_set_speed()
2206 macro->speed = speed; in sparx5_serdes_set_speed()
2207 if (macro->serdesmode != SPX5_SD_MODE_NONE) in sparx5_serdes_set_speed()
2208 sparx5_serdes_config(macro); in sparx5_serdes_set_speed()
2215 struct sparx5_serdes_macro *macro = phy_get_drvdata(phy); in sparx5_serdes_reset() local
2218 err = sparx5_serdes_cmu_enable(macro->priv); in sparx5_serdes_reset()
2221 if (macro->serdestype == SPX5_SDT_25G) in sparx5_serdes_reset()
2222 err = sparx5_sd25g28_config(macro, true); in sparx5_serdes_reset()
2224 err = sparx5_sd10g28_config(macro, true); in sparx5_serdes_reset()
2227 macro->sidx, err); in sparx5_serdes_reset()
2236 struct sparx5_serdes_macro *macro = phy_get_drvdata(phy); in sparx5_serdes_validate() local
2241 if (macro->speed == 0) in sparx5_serdes_validate()
2244 if (macro->sidx < SPX5_SERDES_10G_START && macro->speed > SPEED_5000) in sparx5_serdes_validate()
2246 if (macro->sidx < SPX5_SERDES_25G_START && macro->speed > SPEED_10000) in sparx5_serdes_validate()
2251 if (macro->speed != SPEED_100 && /* This is for 100BASE-FX */ in sparx5_serdes_validate()
2252 macro->speed != SPEED_1000) in sparx5_serdes_validate()
2258 if (macro->speed >= SPEED_5000) in sparx5_serdes_validate()
2262 if (macro->speed < SPEED_5000) in sparx5_serdes_validate()
2285 struct sparx5_serdes_macro *macro; in sparx5_phy_create() local
2291 macro = devm_kzalloc(priv->dev, sizeof(*macro), GFP_KERNEL); in sparx5_phy_create()
2292 if (!macro) in sparx5_phy_create()
2295 macro->sidx = idx; in sparx5_phy_create()
2296 macro->priv = priv; in sparx5_phy_create()
2297 macro->speed = SPEED_UNKNOWN; in sparx5_phy_create()
2299 macro->serdestype = SPX5_SDT_6G; in sparx5_phy_create()
2300 macro->stpidx = macro->sidx; in sparx5_phy_create()
2302 macro->serdestype = SPX5_SDT_10G; in sparx5_phy_create()
2303 macro->stpidx = macro->sidx - SPX5_SERDES_10G_START; in sparx5_phy_create()
2305 macro->serdestype = SPX5_SDT_25G; in sparx5_phy_create()
2306 macro->stpidx = macro->sidx - SPX5_SERDES_25G_START; in sparx5_phy_create()
2309 phy_set_drvdata(*phy, macro); in sparx5_phy_create()
2426 struct sparx5_serdes_macro *macro = in sparx5_serdes_xlate() local
2429 if (sidx != macro->sidx) in sparx5_serdes_xlate()