Lines Matching full:mgbe
11 "rx-pcs", "tx", "tx-pcs", "mac-divider", "mac", "mgbe", "ptp-ref", "mac"
57 struct tegra_mgbe *mgbe = get_stmmac_bsp_priv(dev); in tegra_mgbe_suspend() local
64 clk_bulk_disable_unprepare(ARRAY_SIZE(mgbe_clks), mgbe->clks); in tegra_mgbe_suspend()
66 return reset_control_assert(mgbe->rst_mac); in tegra_mgbe_suspend()
71 struct tegra_mgbe *mgbe = get_stmmac_bsp_priv(dev); in tegra_mgbe_resume() local
75 err = clk_bulk_prepare_enable(ARRAY_SIZE(mgbe_clks), mgbe->clks); in tegra_mgbe_resume()
79 err = reset_control_deassert(mgbe->rst_mac); in tegra_mgbe_resume()
84 writel(MAC_SBD_INTR, mgbe->regs + MGBE_WRAP_COMMON_INTR_ENABLE); in tegra_mgbe_resume()
87 writel(MGBE_SID, mgbe->hv + MGBE_WRAP_AXI_ASID0_CTRL); in tegra_mgbe_resume()
89 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_STATUS); in tegra_mgbe_resume()
91 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_HW_INIT_CTRL); in tegra_mgbe_resume()
93 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_HW_INIT_CTRL); in tegra_mgbe_resume()
96 err = readl_poll_timeout(mgbe->xpcs + XPCS_WRAP_UPHY_HW_INIT_CTRL, value, in tegra_mgbe_resume()
100 dev_err(mgbe->dev, "timeout waiting for TX lane to become enabled\n"); in tegra_mgbe_resume()
101 clk_bulk_disable_unprepare(ARRAY_SIZE(mgbe_clks), mgbe->clks); in tegra_mgbe_resume()
107 clk_bulk_disable_unprepare(ARRAY_SIZE(mgbe_clks), mgbe->clks); in tegra_mgbe_resume()
114 struct tegra_mgbe *mgbe = (struct tegra_mgbe *)mgbe_data; in mgbe_uphy_lane_bringup_serdes_up() local
118 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
120 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
122 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
124 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
126 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
128 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
131 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
133 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
136 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
138 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
140 err = readl_poll_timeout(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL, value, in mgbe_uphy_lane_bringup_serdes_up()
144 dev_err(mgbe->dev, "timeout waiting for RX calibration to become enabled\n"); in mgbe_uphy_lane_bringup_serdes_up()
149 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
151 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
153 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
155 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
158 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
160 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
163 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
165 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
168 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
170 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_up()
172 err = readl_poll_timeout(mgbe->xpcs + XPCS_WRAP_IRQ_STATUS, value, in mgbe_uphy_lane_bringup_serdes_up()
176 dev_err(mgbe->dev, "timeout waiting for link to become ready\n"); in mgbe_uphy_lane_bringup_serdes_up()
181 writel(value, mgbe->xpcs + XPCS_WRAP_IRQ_STATUS); in mgbe_uphy_lane_bringup_serdes_up()
188 struct tegra_mgbe *mgbe = (struct tegra_mgbe *)mgbe_data; in mgbe_uphy_lane_bringup_serdes_down() local
191 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_down()
193 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_down()
195 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_down()
197 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_down()
199 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_down()
201 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_down()
203 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_down()
205 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_down()
207 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_down()
209 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_RX_CONTROL); in mgbe_uphy_lane_bringup_serdes_down()
216 struct tegra_mgbe *mgbe; in tegra_mgbe_probe() local
220 mgbe = devm_kzalloc(&pdev->dev, sizeof(*mgbe), GFP_KERNEL); in tegra_mgbe_probe()
221 if (!mgbe) in tegra_mgbe_probe()
224 mgbe->dev = &pdev->dev; in tegra_mgbe_probe()
232 mgbe->hv = devm_platform_ioremap_resource_byname(pdev, "hypervisor"); in tegra_mgbe_probe()
233 if (IS_ERR(mgbe->hv)) in tegra_mgbe_probe()
234 return PTR_ERR(mgbe->hv); in tegra_mgbe_probe()
236 mgbe->regs = devm_platform_ioremap_resource_byname(pdev, "mac"); in tegra_mgbe_probe()
237 if (IS_ERR(mgbe->regs)) in tegra_mgbe_probe()
238 return PTR_ERR(mgbe->regs); in tegra_mgbe_probe()
240 mgbe->xpcs = devm_platform_ioremap_resource_byname(pdev, "xpcs"); in tegra_mgbe_probe()
241 if (IS_ERR(mgbe->xpcs)) in tegra_mgbe_probe()
242 return PTR_ERR(mgbe->xpcs); in tegra_mgbe_probe()
244 res.addr = mgbe->regs; in tegra_mgbe_probe()
247 mgbe->clks = devm_kcalloc(&pdev->dev, ARRAY_SIZE(mgbe_clks), in tegra_mgbe_probe()
248 sizeof(*mgbe->clks), GFP_KERNEL); in tegra_mgbe_probe()
249 if (!mgbe->clks) in tegra_mgbe_probe()
253 mgbe->clks[i].id = mgbe_clks[i]; in tegra_mgbe_probe()
255 err = devm_clk_bulk_get(mgbe->dev, ARRAY_SIZE(mgbe_clks), mgbe->clks); in tegra_mgbe_probe()
259 err = clk_bulk_prepare_enable(ARRAY_SIZE(mgbe_clks), mgbe->clks); in tegra_mgbe_probe()
264 mgbe->rst_mac = devm_reset_control_get(&pdev->dev, "mac"); in tegra_mgbe_probe()
265 if (IS_ERR(mgbe->rst_mac)) { in tegra_mgbe_probe()
266 err = PTR_ERR(mgbe->rst_mac); in tegra_mgbe_probe()
270 err = reset_control_assert(mgbe->rst_mac); in tegra_mgbe_probe()
276 err = reset_control_deassert(mgbe->rst_mac); in tegra_mgbe_probe()
281 mgbe->rst_pcs = devm_reset_control_get(&pdev->dev, "pcs"); in tegra_mgbe_probe()
282 if (IS_ERR(mgbe->rst_pcs)) { in tegra_mgbe_probe()
283 err = PTR_ERR(mgbe->rst_pcs); in tegra_mgbe_probe()
287 err = reset_control_assert(mgbe->rst_pcs); in tegra_mgbe_probe()
293 err = reset_control_deassert(mgbe->rst_pcs); in tegra_mgbe_probe()
306 plat->bsp_priv = mgbe; in tegra_mgbe_probe()
322 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_STATUS); in tegra_mgbe_probe()
324 value = readl(mgbe->xpcs + XPCS_WRAP_UPHY_HW_INIT_CTRL); in tegra_mgbe_probe()
326 writel(value, mgbe->xpcs + XPCS_WRAP_UPHY_HW_INIT_CTRL); in tegra_mgbe_probe()
329 err = readl_poll_timeout(mgbe->xpcs + XPCS_WRAP_UPHY_HW_INIT_CTRL, value, in tegra_mgbe_probe()
333 dev_err(mgbe->dev, "timeout waiting for TX lane to become enabled\n"); in tegra_mgbe_probe()
346 writel(MAC_SBD_INTR, mgbe->regs + MGBE_WRAP_COMMON_INTR_ENABLE); in tegra_mgbe_probe()
349 writel(MGBE_SID, mgbe->hv + MGBE_WRAP_AXI_ASID0_CTRL); in tegra_mgbe_probe()
360 clk_bulk_disable_unprepare(ARRAY_SIZE(mgbe_clks), mgbe->clks); in tegra_mgbe_probe()
367 struct tegra_mgbe *mgbe = get_stmmac_bsp_priv(&pdev->dev); in tegra_mgbe_remove() local
369 clk_bulk_disable_unprepare(ARRAY_SIZE(mgbe_clks), mgbe->clks); in tegra_mgbe_remove()
375 { .compatible = "nvidia,tegra234-mgbe", },
386 .name = "tegra-mgbe",
394 MODULE_DESCRIPTION("NVIDIA Tegra MGBE driver");