Lines Matching full:dwmac
3 * T-HEAD DWMAC platform driver
56 struct thead_dwmac *dwmac = plat->bsp_priv; in thead_dwmac_set_phy_if() local
70 dev_err(dwmac->dev, "unsupported phy interface %d\n", in thead_dwmac_set_phy_if()
75 writel(phyif, dwmac->apb_base + GMAC_INTF_CTRL); in thead_dwmac_set_phy_if()
81 struct thead_dwmac *dwmac = plat->bsp_priv; in thead_dwmac_set_txclk_dir() local
95 dev_err(dwmac->dev, "unsupported phy interface %d\n", in thead_dwmac_set_txclk_dir()
100 writel(txclk_dir, dwmac->apb_base + GMAC_TXCLK_OEN); in thead_dwmac_set_txclk_dir()
107 struct thead_dwmac *dwmac = bsp_priv; in thead_set_clk_tx_rate() local
113 plat = dwmac->plat; in thead_set_clk_tx_rate()
126 writel(0, dwmac->apb_base + GMAC_PLLCLK_DIV); in thead_set_clk_tx_rate()
130 dev_err(dwmac->dev, "invalid speed %d\n", speed); in thead_set_clk_tx_rate()
136 dev_err(dwmac->dev, "invalid gmac rate %lu\n", rate); in thead_set_clk_tx_rate()
142 writel(reg, dwmac->apb_base + GMAC_PLLCLK_DIV); in thead_set_clk_tx_rate()
146 dev_err(dwmac->dev, "unsupported phy interface %d\n", in thead_set_clk_tx_rate()
154 struct thead_dwmac *dwmac = plat->bsp_priv; in thead_dwmac_enable_clk() local
171 writel(0, dwmac->apb_base + GMAC_PLLCLK_DIV); in thead_dwmac_enable_clk()
172 writel(reg, dwmac->apb_base + GMAC_PLLCLK_DIV); in thead_dwmac_enable_clk()
174 writel(GMAC_GTXCLK_SEL_PLL, dwmac->apb_base + GMAC_GTXCLK_SEL); in thead_dwmac_enable_clk()
180 dev_err(dwmac->dev, "unsupported phy interface %d\n", in thead_dwmac_enable_clk()
185 writel(reg, dwmac->apb_base + GMAC_CLK_EN); in thead_dwmac_enable_clk()
191 struct thead_dwmac *dwmac = priv; in thead_dwmac_init() local
195 ret = thead_dwmac_set_phy_if(dwmac->plat); in thead_dwmac_init()
199 ret = thead_dwmac_set_txclk_dir(dwmac->plat); in thead_dwmac_init()
203 reg = readl(dwmac->apb_base + GMAC_RXCLK_DELAY_CTRL); in thead_dwmac_init()
206 writel(reg, dwmac->apb_base + GMAC_RXCLK_DELAY_CTRL); in thead_dwmac_init()
208 reg = readl(dwmac->apb_base + GMAC_TXCLK_DELAY_CTRL); in thead_dwmac_init()
211 writel(reg, dwmac->apb_base + GMAC_TXCLK_DELAY_CTRL); in thead_dwmac_init()
213 return thead_dwmac_enable_clk(dwmac->plat); in thead_dwmac_init()
220 struct thead_dwmac *dwmac; in thead_dwmac_probe() local
248 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); in thead_dwmac_probe()
249 if (!dwmac) in thead_dwmac_probe()
257 dwmac->dev = &pdev->dev; in thead_dwmac_probe()
258 dwmac->plat = plat; in thead_dwmac_probe()
259 dwmac->apb_base = apb; in thead_dwmac_probe()
260 plat->bsp_priv = dwmac; in thead_dwmac_probe()
276 .name = "thead-dwmac",
285 MODULE_DESCRIPTION("T-HEAD DWMAC platform driver");