Lines Matching full:macro
180 static int lan966x_sd6g40_reg_cfg(struct serdes_macro *macro, in lan966x_sd6g40_reg_cfg() argument
203 macro->ctrl->regs, HSIO_SD_CFG(idx)); in lan966x_sd6g40_reg_cfg()
209 macro->ctrl->regs, HSIO_MPLL_CFG(idx)); in lan966x_sd6g40_reg_cfg()
213 macro->ctrl->regs, HSIO_SD_CFG(idx)); in lan966x_sd6g40_reg_cfg()
217 macro->ctrl->regs, HSIO_MPLL_CFG(idx)); in lan966x_sd6g40_reg_cfg()
223 macro->ctrl->regs, HSIO_SD_CFG(idx)); in lan966x_sd6g40_reg_cfg()
229 macro->ctrl->regs, HSIO_MPLL_CFG(idx)); in lan966x_sd6g40_reg_cfg()
233 value = readl(macro->ctrl->regs + lan_offset(HSIO_SD_STAT(idx))); in lan966x_sd6g40_reg_cfg()
236 dev_err(macro->ctrl->dev, in lan966x_sd6g40_reg_cfg()
244 macro->ctrl->regs, HSIO_SD_CFG(idx)); in lan966x_sd6g40_reg_cfg()
248 value = readl(macro->ctrl->regs + lan_offset(HSIO_SD_STAT(idx))); in lan966x_sd6g40_reg_cfg()
251 dev_err(macro->ctrl->dev, in lan966x_sd6g40_reg_cfg()
261 macro->ctrl->regs, HSIO_SD_CFG(idx)); in lan966x_sd6g40_reg_cfg()
266 value = readl(macro->ctrl->regs + lan_offset(HSIO_SD_STAT(idx))); in lan966x_sd6g40_reg_cfg()
269 dev_err(macro->ctrl->dev, in lan966x_sd6g40_reg_cfg()
276 value = readl(macro->ctrl->regs + lan_offset(HSIO_SD_STAT(idx))); in lan966x_sd6g40_reg_cfg()
279 dev_err(macro->ctrl->dev, in lan966x_sd6g40_reg_cfg()
289 macro->ctrl->regs, HSIO_SD_CFG(idx)); in lan966x_sd6g40_reg_cfg()
294 static int lan966x_sd6g40_get_conf_from_mode(struct serdes_macro *macro, in lan966x_sd6g40_get_conf_from_mode() argument
318 ret_val->mpll_multiplier = macro->speed == SPEED_2500 ? 50 : 40; in lan966x_sd6g40_get_conf_from_mode()
320 ret_val->tx_rate = macro->speed == SPEED_2500 ? 0x1 : 0x2; in lan966x_sd6g40_get_conf_from_mode()
321 ret_val->rx_rate = macro->speed == SPEED_2500 ? 0x1 : 0x2; in lan966x_sd6g40_get_conf_from_mode()
323 ret_val->mpll_multiplier = macro->speed == SPEED_2500 ? 125 : 100; in lan966x_sd6g40_get_conf_from_mode()
325 ret_val->tx_rate = macro->speed == SPEED_2500 ? 0x1 : 0x2; in lan966x_sd6g40_get_conf_from_mode()
326 ret_val->rx_rate = macro->speed == SPEED_2500 ? 0x1 : 0x2; in lan966x_sd6g40_get_conf_from_mode()
337 static int lan966x_calc_sd6g40_setup_lane(struct serdes_macro *macro, in lan966x_calc_sd6g40_setup_lane() argument
345 ret = lan966x_sd6g40_get_conf_from_mode(macro, config.mode, in lan966x_calc_sd6g40_setup_lane()
368 static int lan966x_sd6g40_setup_lane(struct serdes_macro *macro, in lan966x_sd6g40_setup_lane() argument
375 ret = lan966x_calc_sd6g40_setup_lane(macro, config, &calc_results); in lan966x_sd6g40_setup_lane()
379 return lan966x_sd6g40_reg_cfg(macro, &calc_results, idx); in lan966x_sd6g40_setup_lane()
382 static int lan966x_sd6g40_setup(struct serdes_macro *macro, u32 idx, int mode) in lan966x_sd6g40_setup() argument
386 conf.refclk125M = macro->ctrl->ref125; in lan966x_sd6g40_setup()
393 return lan966x_sd6g40_setup_lane(macro, conf, idx); in lan966x_sd6g40_setup()
396 static int lan966x_rgmii_setup(struct serdes_macro *macro, u32 idx, int mode) in lan966x_rgmii_setup() argument
404 HSIO_RGMII_CFG_TX_CLK_CFG_SET(macro->speed == SPEED_1000 ? 1 : in lan966x_rgmii_setup()
405 macro->speed == SPEED_100 ? 2 : in lan966x_rgmii_setup()
406 macro->speed == SPEED_10 ? 3 : 0), in lan966x_rgmii_setup()
410 macro->ctrl->regs, HSIO_RGMII_CFG(idx)); in lan966x_rgmii_setup()
425 macro->ctrl->regs, HSIO_DLL_CFG(idx == 0 ? 0x0 : 0x2)); in lan966x_rgmii_setup()
429 macro->ctrl->regs, HSIO_DLL_CFG(idx == 0 ? 0x0 : 0x2)); in lan966x_rgmii_setup()
435 macro->ctrl->regs, HSIO_DLL_CFG(idx == 0 ? 0x1 : 0x3)); in lan966x_rgmii_setup()
439 macro->ctrl->regs, HSIO_DLL_CFG(idx == 0 ? 0x1 : 0x3)); in lan966x_rgmii_setup()
446 struct serdes_macro *macro = phy_get_drvdata(phy); in serdes_set_speed() local
448 if (!phy_interface_mode_is_rgmii(macro->mode)) in serdes_set_speed()
451 macro->speed = speed; in serdes_set_speed()
452 lan966x_rgmii_setup(macro, macro->idx - (SERDES6G_MAX + 1), macro->mode); in serdes_set_speed()
459 struct serdes_macro *macro = phy_get_drvdata(phy); in serdes_set_mode() local
468 macro->speed = SPEED_2500; in serdes_set_mode()
470 macro->speed = SPEED_1000; in serdes_set_mode()
480 if (macro->idx != lan966x_serdes_muxes[i].idx || in serdes_set_mode()
483 macro->port != lan966x_serdes_muxes[i].port) in serdes_set_mode()
486 val = readl(macro->ctrl->regs + lan_offset(HSIO_HW_CFG)); in serdes_set_mode()
489 macro->ctrl->regs, HSIO_HW_CFG); in serdes_set_mode()
491 macro->mode = lan966x_serdes_muxes[i].submode; in serdes_set_mode()
493 if (macro->idx < CU_MAX) in serdes_set_mode()
496 if (macro->idx < SERDES6G_MAX) in serdes_set_mode()
497 return lan966x_sd6g40_setup(macro, in serdes_set_mode()
498 macro->idx - (CU_MAX + 1), in serdes_set_mode()
499 macro->mode); in serdes_set_mode()
501 if (macro->idx < RGMII_MAX) in serdes_set_mode()
502 return lan966x_rgmii_setup(macro, in serdes_set_mode()
503 macro->idx - (SERDES6G_MAX + 1), in serdes_set_mode()
504 macro->mode); in serdes_set_mode()
531 struct serdes_macro *macro = phy_get_drvdata(ctrl->phys[i]); in serdes_simple_xlate() local
533 if (idx != macro->idx) in serdes_simple_xlate()
536 macro->port = port; in serdes_simple_xlate()
545 struct serdes_macro *macro; in serdes_phy_create() local
551 macro = devm_kzalloc(ctrl->dev, sizeof(*macro), GFP_KERNEL); in serdes_phy_create()
552 if (!macro) in serdes_phy_create()
555 macro->idx = idx; in serdes_phy_create()
556 macro->ctrl = ctrl; in serdes_phy_create()
557 macro->port = -1; in serdes_phy_create()
559 phy_set_drvdata(*phy, macro); in serdes_phy_create()