Lines Matching refs:gmac
523 struct sunxi_priv_data *gmac = priv; in sun8i_dwmac_init() local
526 if (gmac->regulator) { in sun8i_dwmac_init()
527 ret = regulator_enable(gmac->regulator); in sun8i_dwmac_init()
534 ret = clk_prepare_enable(gmac->tx_clk); in sun8i_dwmac_init()
536 if (gmac->regulator) in sun8i_dwmac_init()
537 regulator_disable(gmac->regulator); in sun8i_dwmac_init()
706 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in get_ephy_nodes() local
726 gmac->ephy_clk = of_clk_get(iphynode, 0); in get_ephy_nodes()
727 if (IS_ERR(gmac->ephy_clk)) in get_ephy_nodes()
729 gmac->rst_ephy = of_reset_control_get_exclusive(iphynode, NULL); in get_ephy_nodes()
730 if (IS_ERR(gmac->rst_ephy)) { in get_ephy_nodes()
731 ret = PTR_ERR(gmac->rst_ephy); in get_ephy_nodes()
744 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in sun8i_dwmac_power_internal_phy() local
747 if (gmac->internal_phy_powered) { in sun8i_dwmac_power_internal_phy()
753 ret = clk_prepare_enable(gmac->ephy_clk); in sun8i_dwmac_power_internal_phy()
762 reset_control_assert(gmac->rst_ephy); in sun8i_dwmac_power_internal_phy()
764 ret = reset_control_deassert(gmac->rst_ephy); in sun8i_dwmac_power_internal_phy()
767 clk_disable_unprepare(gmac->ephy_clk); in sun8i_dwmac_power_internal_phy()
771 gmac->internal_phy_powered = true; in sun8i_dwmac_power_internal_phy()
776 static int sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac) in sun8i_dwmac_unpower_internal_phy() argument
778 if (!gmac->internal_phy_powered) in sun8i_dwmac_unpower_internal_phy()
781 clk_disable_unprepare(gmac->ephy_clk); in sun8i_dwmac_unpower_internal_phy()
782 reset_control_assert(gmac->rst_ephy); in sun8i_dwmac_unpower_internal_phy()
783 gmac->internal_phy_powered = false; in sun8i_dwmac_unpower_internal_phy()
801 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in mdio_mux_syscon_switch_fn() local
807 regmap_field_read(gmac->regmap_field, ®); in mdio_mux_syscon_switch_fn()
825 regmap_field_write(gmac->regmap_field, val); in mdio_mux_syscon_switch_fn()
831 sun8i_dwmac_unpower_internal_phy(gmac); in mdio_mux_syscon_switch_fn()
845 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in sun8i_dwmac_register_mdio_mux() local
852 &gmac->mux_handle, priv, priv->mii); in sun8i_dwmac_register_mdio_mux()
858 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in sun8i_dwmac_set_syscon() local
863 regmap_field_read(gmac->regmap_field, &val); in sun8i_dwmac_set_syscon()
864 reg = gmac->variant->default_syscon_value; in sun8i_dwmac_set_syscon()
870 if (gmac->variant->soc_has_internal_phy) { in sun8i_dwmac_set_syscon()
897 if (val <= gmac->variant->tx_delay_max) { in sun8i_dwmac_set_syscon()
898 reg &= ~(gmac->variant->tx_delay_max << in sun8i_dwmac_set_syscon()
915 if (val <= gmac->variant->rx_delay_max) { in sun8i_dwmac_set_syscon()
916 reg &= ~(gmac->variant->rx_delay_max << in sun8i_dwmac_set_syscon()
928 if (gmac->variant->support_rmii) in sun8i_dwmac_set_syscon()
947 regmap_field_write(gmac->regmap_field, reg); in sun8i_dwmac_set_syscon()
952 static void sun8i_dwmac_unset_syscon(struct sunxi_priv_data *gmac) in sun8i_dwmac_unset_syscon() argument
954 u32 reg = gmac->variant->default_syscon_value; in sun8i_dwmac_unset_syscon()
956 regmap_field_write(gmac->regmap_field, reg); in sun8i_dwmac_unset_syscon()
961 struct sunxi_priv_data *gmac = priv; in sun8i_dwmac_exit() local
963 if (gmac->variant->soc_has_internal_phy) { in sun8i_dwmac_exit()
965 if (gmac->mux_handle) in sun8i_dwmac_exit()
966 mdio_mux_uninit(gmac->mux_handle); in sun8i_dwmac_exit()
967 if (gmac->internal_phy_powered) in sun8i_dwmac_exit()
968 sun8i_dwmac_unpower_internal_phy(gmac); in sun8i_dwmac_exit()
971 sun8i_dwmac_unset_syscon(gmac); in sun8i_dwmac_exit()
973 reset_control_put(gmac->rst_ephy); in sun8i_dwmac_exit()
975 clk_disable_unprepare(gmac->tx_clk); in sun8i_dwmac_exit()
977 if (gmac->regulator) in sun8i_dwmac_exit()
978 regulator_disable(gmac->regulator); in sun8i_dwmac_exit()
1067 struct sunxi_priv_data *gmac; in sun8i_dwmac_probe() local
1082 gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL); in sun8i_dwmac_probe()
1083 if (!gmac) in sun8i_dwmac_probe()
1086 gmac->variant = of_device_get_match_data(&pdev->dev); in sun8i_dwmac_probe()
1087 if (!gmac->variant) { in sun8i_dwmac_probe()
1092 gmac->tx_clk = devm_clk_get(dev, "stmmaceth"); in sun8i_dwmac_probe()
1093 if (IS_ERR(gmac->tx_clk)) { in sun8i_dwmac_probe()
1095 return PTR_ERR(gmac->tx_clk); in sun8i_dwmac_probe()
1099 gmac->regulator = devm_regulator_get_optional(dev, "phy"); in sun8i_dwmac_probe()
1100 if (IS_ERR(gmac->regulator)) { in sun8i_dwmac_probe()
1101 if (PTR_ERR(gmac->regulator) == -EPROBE_DEFER) in sun8i_dwmac_probe()
1104 gmac->regulator = NULL; in sun8i_dwmac_probe()
1134 gmac->regmap_field = devm_regmap_field_alloc(dev, regmap, in sun8i_dwmac_probe()
1135 *gmac->variant->syscon_field); in sun8i_dwmac_probe()
1136 if (IS_ERR(gmac->regmap_field)) { in sun8i_dwmac_probe()
1137 ret = PTR_ERR(gmac->regmap_field); in sun8i_dwmac_probe()
1150 plat_dat->bsp_priv = gmac; in sun8i_dwmac_probe()
1168 if (gmac->variant->soc_has_internal_phy) { in sun8i_dwmac_probe()
1185 sun8i_dwmac_unset_syscon(gmac); in sun8i_dwmac_probe()