Lines Matching refs:gmac
588 struct sunxi_priv_data *gmac = priv; in sun8i_dwmac_init() local
591 if (gmac->regulator) { in sun8i_dwmac_init()
592 ret = regulator_enable(gmac->regulator); in sun8i_dwmac_init()
599 if (gmac->use_internal_phy) { in sun8i_dwmac_init()
608 if (gmac->regulator) in sun8i_dwmac_init()
609 regulator_disable(gmac->regulator); in sun8i_dwmac_init()
776 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in get_ephy_nodes() local
797 gmac->ephy_clk = of_clk_get(iphynode, 0); in get_ephy_nodes()
798 if (IS_ERR(gmac->ephy_clk)) in get_ephy_nodes()
800 gmac->rst_ephy = of_reset_control_get_exclusive(iphynode, NULL); in get_ephy_nodes()
801 if (IS_ERR(gmac->rst_ephy)) { in get_ephy_nodes()
802 ret = PTR_ERR(gmac->rst_ephy); in get_ephy_nodes()
820 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in sun8i_dwmac_power_internal_phy() local
823 if (gmac->internal_phy_powered) { in sun8i_dwmac_power_internal_phy()
829 ret = clk_prepare_enable(gmac->ephy_clk); in sun8i_dwmac_power_internal_phy()
840 ret = reset_control_reset(gmac->rst_ephy); in sun8i_dwmac_power_internal_phy()
843 clk_disable_unprepare(gmac->ephy_clk); in sun8i_dwmac_power_internal_phy()
847 gmac->internal_phy_powered = true; in sun8i_dwmac_power_internal_phy()
852 static void sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac) in sun8i_dwmac_unpower_internal_phy() argument
854 if (!gmac->internal_phy_powered) in sun8i_dwmac_unpower_internal_phy()
857 clk_disable_unprepare(gmac->ephy_clk); in sun8i_dwmac_unpower_internal_phy()
858 reset_control_assert(gmac->rst_ephy); in sun8i_dwmac_unpower_internal_phy()
859 gmac->internal_phy_powered = false; in sun8i_dwmac_unpower_internal_phy()
876 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in mdio_mux_syscon_switch_fn() local
881 regmap_field_read(gmac->regmap_field, ®); in mdio_mux_syscon_switch_fn()
886 gmac->use_internal_phy = true; in mdio_mux_syscon_switch_fn()
891 gmac->use_internal_phy = false; in mdio_mux_syscon_switch_fn()
898 regmap_field_write(gmac->regmap_field, val); in mdio_mux_syscon_switch_fn()
899 if (gmac->use_internal_phy) { in mdio_mux_syscon_switch_fn()
904 sun8i_dwmac_unpower_internal_phy(gmac); in mdio_mux_syscon_switch_fn()
918 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in sun8i_dwmac_register_mdio_mux() local
925 &gmac->mux_handle, priv, priv->mii); in sun8i_dwmac_register_mdio_mux()
933 struct sunxi_priv_data *gmac = plat->bsp_priv; in sun8i_dwmac_set_syscon() local
938 ret = regmap_field_read(gmac->regmap_field, &val); in sun8i_dwmac_set_syscon()
944 reg = gmac->variant->default_syscon_value; in sun8i_dwmac_set_syscon()
950 if (gmac->variant->soc_has_internal_phy) { in sun8i_dwmac_set_syscon()
982 if (val <= gmac->variant->tx_delay_max) { in sun8i_dwmac_set_syscon()
983 reg &= ~(gmac->variant->tx_delay_max << in sun8i_dwmac_set_syscon()
1000 if (val <= gmac->variant->rx_delay_max) { in sun8i_dwmac_set_syscon()
1001 reg &= ~(gmac->variant->rx_delay_max << in sun8i_dwmac_set_syscon()
1013 if (gmac->variant->support_rmii) in sun8i_dwmac_set_syscon()
1035 regmap_field_write(gmac->regmap_field, reg); in sun8i_dwmac_set_syscon()
1040 static void sun8i_dwmac_unset_syscon(struct sunxi_priv_data *gmac) in sun8i_dwmac_unset_syscon() argument
1042 u32 reg = gmac->variant->default_syscon_value; in sun8i_dwmac_unset_syscon()
1044 regmap_field_write(gmac->regmap_field, reg); in sun8i_dwmac_unset_syscon()
1049 struct sunxi_priv_data *gmac = priv; in sun8i_dwmac_exit() local
1051 if (gmac->variant->soc_has_internal_phy) in sun8i_dwmac_exit()
1052 sun8i_dwmac_unpower_internal_phy(gmac); in sun8i_dwmac_exit()
1054 if (gmac->regulator) in sun8i_dwmac_exit()
1055 regulator_disable(gmac->regulator); in sun8i_dwmac_exit()
1156 struct sunxi_priv_data *gmac; in sun8i_dwmac_probe() local
1168 gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL); in sun8i_dwmac_probe()
1169 if (!gmac) in sun8i_dwmac_probe()
1172 gmac->variant = of_device_get_match_data(&pdev->dev); in sun8i_dwmac_probe()
1173 if (!gmac->variant) { in sun8i_dwmac_probe()
1179 gmac->regulator = devm_regulator_get_optional(dev, "phy"); in sun8i_dwmac_probe()
1180 if (IS_ERR(gmac->regulator)) { in sun8i_dwmac_probe()
1181 if (PTR_ERR(gmac->regulator) == -EPROBE_DEFER) in sun8i_dwmac_probe()
1184 gmac->regulator = NULL; in sun8i_dwmac_probe()
1214 gmac->regmap_field = devm_regmap_field_alloc(dev, regmap, in sun8i_dwmac_probe()
1215 *gmac->variant->syscon_field); in sun8i_dwmac_probe()
1216 if (IS_ERR(gmac->regmap_field)) { in sun8i_dwmac_probe()
1217 ret = PTR_ERR(gmac->regmap_field); in sun8i_dwmac_probe()
1237 plat_dat->bsp_priv = gmac; in sun8i_dwmac_probe()
1268 if (gmac->variant->soc_has_internal_phy) { in sun8i_dwmac_probe()
1288 reset_control_put(gmac->rst_ephy); in sun8i_dwmac_probe()
1289 clk_put(gmac->ephy_clk); in sun8i_dwmac_probe()
1294 sun8i_dwmac_exit(pdev, gmac); in sun8i_dwmac_probe()
1296 sun8i_dwmac_unset_syscon(gmac); in sun8i_dwmac_probe()
1305 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in sun8i_dwmac_remove() local
1307 if (gmac->variant->soc_has_internal_phy) { in sun8i_dwmac_remove()
1308 mdio_mux_uninit(gmac->mux_handle); in sun8i_dwmac_remove()
1309 sun8i_dwmac_unpower_internal_phy(gmac); in sun8i_dwmac_remove()
1310 reset_control_put(gmac->rst_ephy); in sun8i_dwmac_remove()
1311 clk_put(gmac->ephy_clk); in sun8i_dwmac_remove()
1315 sun8i_dwmac_unset_syscon(gmac); in sun8i_dwmac_remove()
1322 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in sun8i_dwmac_shutdown() local
1324 sun8i_dwmac_exit(pdev, gmac); in sun8i_dwmac_shutdown()