Lines Matching refs:gmac

32 	struct sunxi_priv_data *gmac = priv;  in sun7i_gmac_init()  local
35 if (gmac->regulator) { in sun7i_gmac_init()
36 ret = regulator_enable(gmac->regulator); in sun7i_gmac_init()
47 if (phy_interface_mode_is_rgmii(gmac->interface)) { in sun7i_gmac_init()
48 clk_set_rate(gmac->tx_clk, SUN7I_GMAC_GMII_RGMII_RATE); in sun7i_gmac_init()
49 clk_prepare_enable(gmac->tx_clk); in sun7i_gmac_init()
50 gmac->clk_enabled = 1; in sun7i_gmac_init()
52 clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE); in sun7i_gmac_init()
53 ret = clk_prepare(gmac->tx_clk); in sun7i_gmac_init()
54 if (ret && gmac->regulator) in sun7i_gmac_init()
55 regulator_disable(gmac->regulator); in sun7i_gmac_init()
63 struct sunxi_priv_data *gmac = priv; in sun7i_gmac_exit() local
65 if (gmac->clk_enabled) { in sun7i_gmac_exit()
66 clk_disable(gmac->tx_clk); in sun7i_gmac_exit()
67 gmac->clk_enabled = 0; in sun7i_gmac_exit()
69 clk_unprepare(gmac->tx_clk); in sun7i_gmac_exit()
71 if (gmac->regulator) in sun7i_gmac_exit()
72 regulator_disable(gmac->regulator); in sun7i_gmac_exit()
77 struct sunxi_priv_data *gmac = priv; in sun7i_fix_speed() local
80 if (gmac->interface != PHY_INTERFACE_MODE_GMII) in sun7i_fix_speed()
83 if (gmac->clk_enabled) { in sun7i_fix_speed()
84 clk_disable(gmac->tx_clk); in sun7i_fix_speed()
85 gmac->clk_enabled = 0; in sun7i_fix_speed()
87 clk_unprepare(gmac->tx_clk); in sun7i_fix_speed()
90 clk_set_rate(gmac->tx_clk, SUN7I_GMAC_GMII_RGMII_RATE); in sun7i_fix_speed()
91 clk_prepare_enable(gmac->tx_clk); in sun7i_fix_speed()
92 gmac->clk_enabled = 1; in sun7i_fix_speed()
94 clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE); in sun7i_fix_speed()
95 clk_prepare(gmac->tx_clk); in sun7i_fix_speed()
103 struct sunxi_priv_data *gmac; in sun7i_gmac_probe() local
115 gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL); in sun7i_gmac_probe()
116 if (!gmac) in sun7i_gmac_probe()
119 ret = of_get_phy_mode(dev->of_node, &gmac->interface); in sun7i_gmac_probe()
125 gmac->tx_clk = devm_clk_get(dev, "allwinner_gmac_tx"); in sun7i_gmac_probe()
126 if (IS_ERR(gmac->tx_clk)) { in sun7i_gmac_probe()
128 return PTR_ERR(gmac->tx_clk); in sun7i_gmac_probe()
132 gmac->regulator = devm_regulator_get_optional(dev, "phy"); in sun7i_gmac_probe()
133 if (IS_ERR(gmac->regulator)) { in sun7i_gmac_probe()
134 if (PTR_ERR(gmac->regulator) == -EPROBE_DEFER) in sun7i_gmac_probe()
137 gmac->regulator = NULL; in sun7i_gmac_probe()
144 plat_dat->bsp_priv = gmac; in sun7i_gmac_probe()