Lines Matching refs:gmac
570 struct sunxi_priv_data *gmac = priv; in sun8i_dwmac_init() local
573 if (gmac->regulator) { in sun8i_dwmac_init()
574 ret = regulator_enable(gmac->regulator); in sun8i_dwmac_init()
581 if (gmac->use_internal_phy) { in sun8i_dwmac_init()
590 if (gmac->regulator) in sun8i_dwmac_init()
591 regulator_disable(gmac->regulator); in sun8i_dwmac_init()
758 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in get_ephy_nodes() local
779 gmac->ephy_clk = of_clk_get(iphynode, 0); in get_ephy_nodes()
780 if (IS_ERR(gmac->ephy_clk)) in get_ephy_nodes()
782 gmac->rst_ephy = of_reset_control_get_exclusive(iphynode, NULL); in get_ephy_nodes()
783 if (IS_ERR(gmac->rst_ephy)) { in get_ephy_nodes()
784 ret = PTR_ERR(gmac->rst_ephy); in get_ephy_nodes()
804 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in sun8i_dwmac_power_internal_phy() local
807 if (gmac->internal_phy_powered) { in sun8i_dwmac_power_internal_phy()
813 ret = clk_prepare_enable(gmac->ephy_clk); in sun8i_dwmac_power_internal_phy()
824 ret = reset_control_reset(gmac->rst_ephy); in sun8i_dwmac_power_internal_phy()
827 clk_disable_unprepare(gmac->ephy_clk); in sun8i_dwmac_power_internal_phy()
831 gmac->internal_phy_powered = true; in sun8i_dwmac_power_internal_phy()
836 static void sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac) in sun8i_dwmac_unpower_internal_phy() argument
838 if (!gmac->internal_phy_powered) in sun8i_dwmac_unpower_internal_phy()
841 clk_disable_unprepare(gmac->ephy_clk); in sun8i_dwmac_unpower_internal_phy()
842 reset_control_assert(gmac->rst_ephy); in sun8i_dwmac_unpower_internal_phy()
843 gmac->internal_phy_powered = false; in sun8i_dwmac_unpower_internal_phy()
860 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in mdio_mux_syscon_switch_fn() local
865 regmap_field_read(gmac->regmap_field, ®); in mdio_mux_syscon_switch_fn()
870 gmac->use_internal_phy = true; in mdio_mux_syscon_switch_fn()
875 gmac->use_internal_phy = false; in mdio_mux_syscon_switch_fn()
882 regmap_field_write(gmac->regmap_field, val); in mdio_mux_syscon_switch_fn()
883 if (gmac->use_internal_phy) { in mdio_mux_syscon_switch_fn()
888 sun8i_dwmac_unpower_internal_phy(gmac); in mdio_mux_syscon_switch_fn()
902 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in sun8i_dwmac_register_mdio_mux() local
909 &gmac->mux_handle, priv, priv->mii); in sun8i_dwmac_register_mdio_mux()
917 struct sunxi_priv_data *gmac = plat->bsp_priv; in sun8i_dwmac_set_syscon() local
922 ret = regmap_field_read(gmac->regmap_field, &val); in sun8i_dwmac_set_syscon()
928 reg = gmac->variant->default_syscon_value; in sun8i_dwmac_set_syscon()
934 if (gmac->variant->soc_has_internal_phy) { in sun8i_dwmac_set_syscon()
966 if (val <= gmac->variant->tx_delay_max) { in sun8i_dwmac_set_syscon()
967 reg &= ~(gmac->variant->tx_delay_max << in sun8i_dwmac_set_syscon()
984 if (val <= gmac->variant->rx_delay_max) { in sun8i_dwmac_set_syscon()
985 reg &= ~(gmac->variant->rx_delay_max << in sun8i_dwmac_set_syscon()
997 if (gmac->variant->support_rmii) in sun8i_dwmac_set_syscon()
1019 regmap_field_write(gmac->regmap_field, reg); in sun8i_dwmac_set_syscon()
1024 static void sun8i_dwmac_unset_syscon(struct sunxi_priv_data *gmac) in sun8i_dwmac_unset_syscon() argument
1026 u32 reg = gmac->variant->default_syscon_value; in sun8i_dwmac_unset_syscon()
1028 regmap_field_write(gmac->regmap_field, reg); in sun8i_dwmac_unset_syscon()
1033 struct sunxi_priv_data *gmac = priv; in sun8i_dwmac_exit() local
1035 if (gmac->variant->soc_has_internal_phy) in sun8i_dwmac_exit()
1036 sun8i_dwmac_unpower_internal_phy(gmac); in sun8i_dwmac_exit()
1038 if (gmac->regulator) in sun8i_dwmac_exit()
1039 regulator_disable(gmac->regulator); in sun8i_dwmac_exit()
1138 struct sunxi_priv_data *gmac; in sun8i_dwmac_probe() local
1150 gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL); in sun8i_dwmac_probe()
1151 if (!gmac) in sun8i_dwmac_probe()
1154 gmac->variant = of_device_get_match_data(&pdev->dev); in sun8i_dwmac_probe()
1155 if (!gmac->variant) { in sun8i_dwmac_probe()
1161 gmac->regulator = devm_regulator_get_optional(dev, "phy"); in sun8i_dwmac_probe()
1162 if (IS_ERR(gmac->regulator)) { in sun8i_dwmac_probe()
1163 if (PTR_ERR(gmac->regulator) == -EPROBE_DEFER) in sun8i_dwmac_probe()
1166 gmac->regulator = NULL; in sun8i_dwmac_probe()
1196 gmac->regmap_field = devm_regmap_field_alloc(dev, regmap, in sun8i_dwmac_probe()
1197 *gmac->variant->syscon_field); in sun8i_dwmac_probe()
1198 if (IS_ERR(gmac->regmap_field)) { in sun8i_dwmac_probe()
1199 ret = PTR_ERR(gmac->regmap_field); in sun8i_dwmac_probe()
1219 plat_dat->bsp_priv = gmac; in sun8i_dwmac_probe()
1250 if (gmac->variant->soc_has_internal_phy) { in sun8i_dwmac_probe()
1270 reset_control_put(gmac->rst_ephy); in sun8i_dwmac_probe()
1271 clk_put(gmac->ephy_clk); in sun8i_dwmac_probe()
1276 sun8i_dwmac_exit(pdev, gmac); in sun8i_dwmac_probe()
1278 sun8i_dwmac_unset_syscon(gmac); in sun8i_dwmac_probe()
1289 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in sun8i_dwmac_remove() local
1291 if (gmac->variant->soc_has_internal_phy) { in sun8i_dwmac_remove()
1292 mdio_mux_uninit(gmac->mux_handle); in sun8i_dwmac_remove()
1293 sun8i_dwmac_unpower_internal_phy(gmac); in sun8i_dwmac_remove()
1294 reset_control_put(gmac->rst_ephy); in sun8i_dwmac_remove()
1295 clk_put(gmac->ephy_clk); in sun8i_dwmac_remove()
1299 sun8i_dwmac_unset_syscon(gmac); in sun8i_dwmac_remove()
1308 struct sunxi_priv_data *gmac = priv->plat->bsp_priv; in sun8i_dwmac_shutdown() local
1310 sun8i_dwmac_exit(pdev, gmac); in sun8i_dwmac_shutdown()