• Home
  • Raw
  • Download

Lines Matching refs:bgmac

36 static u32 platform_bgmac_read(struct bgmac *bgmac, u16 offset)  in platform_bgmac_read()  argument
38 return readl(bgmac->plat.base + offset); in platform_bgmac_read()
41 static void platform_bgmac_write(struct bgmac *bgmac, u16 offset, u32 value) in platform_bgmac_write() argument
43 writel(value, bgmac->plat.base + offset); in platform_bgmac_write()
46 static u32 platform_bgmac_idm_read(struct bgmac *bgmac, u16 offset) in platform_bgmac_idm_read() argument
48 return readl(bgmac->plat.idm_base + offset); in platform_bgmac_idm_read()
51 static void platform_bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value) in platform_bgmac_idm_write() argument
53 writel(value, bgmac->plat.idm_base + offset); in platform_bgmac_idm_write()
56 static bool platform_bgmac_clk_enabled(struct bgmac *bgmac) in platform_bgmac_clk_enabled() argument
58 if (!bgmac->plat.idm_base) in platform_bgmac_clk_enabled()
61 if ((bgmac_idm_read(bgmac, BCMA_IOCTL) & BGMAC_CLK_EN) != BGMAC_CLK_EN) in platform_bgmac_clk_enabled()
63 if (bgmac_idm_read(bgmac, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET) in platform_bgmac_clk_enabled()
68 static void platform_bgmac_clk_enable(struct bgmac *bgmac, u32 flags) in platform_bgmac_clk_enable() argument
72 if (!bgmac->plat.idm_base) in platform_bgmac_clk_enable()
79 val = bgmac_idm_read(bgmac, BCMA_RESET_CTL); in platform_bgmac_clk_enable()
81 bgmac_idm_write(bgmac, BCMA_RESET_CTL, 0); in platform_bgmac_clk_enable()
82 bgmac_idm_read(bgmac, BCMA_RESET_CTL); in platform_bgmac_clk_enable()
86 val = bgmac_idm_read(bgmac, BCMA_IOCTL); in platform_bgmac_clk_enable()
91 bgmac_idm_write(bgmac, BCMA_IOCTL, val); in platform_bgmac_clk_enable()
92 bgmac_idm_read(bgmac, BCMA_IOCTL); in platform_bgmac_clk_enable()
96 static void platform_bgmac_cco_ctl_maskset(struct bgmac *bgmac, u32 offset, in platform_bgmac_cco_ctl_maskset() argument
103 static u32 platform_bgmac_get_bus_clock(struct bgmac *bgmac) in platform_bgmac_get_bus_clock() argument
111 static void platform_bgmac_cmn_maskset32(struct bgmac *bgmac, u16 offset, in platform_bgmac_cmn_maskset32() argument
120 struct bgmac *bgmac = netdev_priv(net_dev); in bgmac_nicpm_speed_set() local
123 if (!bgmac->plat.nicpm_base) in bgmac_nicpm_speed_set()
128 bgmac->plat.nicpm_base + NICPM_PADRING_CFG); in bgmac_nicpm_speed_set()
131 switch (bgmac->net_dev->phydev->speed) { in bgmac_nicpm_speed_set()
146 writel(val, bgmac->plat.nicpm_base + NICPM_IOMUX_CTRL); in bgmac_nicpm_speed_set()
148 bgmac_adjust_link(bgmac->net_dev); in bgmac_nicpm_speed_set()
151 static int platform_phy_connect(struct bgmac *bgmac) in platform_phy_connect() argument
155 if (bgmac->plat.nicpm_base) in platform_phy_connect()
156 phy_dev = of_phy_get_and_connect(bgmac->net_dev, in platform_phy_connect()
157 bgmac->dev->of_node, in platform_phy_connect()
160 phy_dev = of_phy_get_and_connect(bgmac->net_dev, in platform_phy_connect()
161 bgmac->dev->of_node, in platform_phy_connect()
164 dev_err(bgmac->dev, "PHY connection failed\n"); in platform_phy_connect()
174 struct bgmac *bgmac; in bgmac_probe() local
178 bgmac = bgmac_alloc(&pdev->dev); in bgmac_probe()
179 if (!bgmac) in bgmac_probe()
182 platform_set_drvdata(pdev, bgmac); in bgmac_probe()
185 bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; in bgmac_probe()
186 bgmac->feature_flags |= BGMAC_FEAT_NO_RESET; in bgmac_probe()
187 bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4; in bgmac_probe()
188 bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP; in bgmac_probe()
189 bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP; in bgmac_probe()
190 bgmac->feature_flags |= BGMAC_FEAT_IDM_MASK; in bgmac_probe()
192 bgmac->dev = &pdev->dev; in bgmac_probe()
193 bgmac->dma_dev = &pdev->dev; in bgmac_probe()
195 ret = of_get_ethdev_address(np, bgmac->net_dev); in bgmac_probe()
203 bgmac->irq = platform_get_irq(pdev, 0); in bgmac_probe()
204 if (bgmac->irq < 0) in bgmac_probe()
205 return bgmac->irq; in bgmac_probe()
207 bgmac->plat.base = in bgmac_probe()
209 if (IS_ERR(bgmac->plat.base)) in bgmac_probe()
210 return PTR_ERR(bgmac->plat.base); in bgmac_probe()
215 bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs); in bgmac_probe()
216 if (IS_ERR(bgmac->plat.idm_base)) in bgmac_probe()
217 return PTR_ERR(bgmac->plat.idm_base); in bgmac_probe()
218 bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK; in bgmac_probe()
224 bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev, in bgmac_probe()
226 if (IS_ERR(bgmac->plat.nicpm_base)) in bgmac_probe()
227 return PTR_ERR(bgmac->plat.nicpm_base); in bgmac_probe()
230 bgmac->read = platform_bgmac_read; in bgmac_probe()
231 bgmac->write = platform_bgmac_write; in bgmac_probe()
232 bgmac->idm_read = platform_bgmac_idm_read; in bgmac_probe()
233 bgmac->idm_write = platform_bgmac_idm_write; in bgmac_probe()
234 bgmac->clk_enabled = platform_bgmac_clk_enabled; in bgmac_probe()
235 bgmac->clk_enable = platform_bgmac_clk_enable; in bgmac_probe()
236 bgmac->cco_ctl_maskset = platform_bgmac_cco_ctl_maskset; in bgmac_probe()
237 bgmac->get_bus_clock = platform_bgmac_get_bus_clock; in bgmac_probe()
238 bgmac->cmn_maskset32 = platform_bgmac_cmn_maskset32; in bgmac_probe()
240 bgmac->phy_connect = platform_phy_connect; in bgmac_probe()
242 bgmac->phy_connect = bgmac_phy_connect_direct; in bgmac_probe()
243 bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500; in bgmac_probe()
246 return bgmac_enet_probe(bgmac); in bgmac_probe()
251 struct bgmac *bgmac = platform_get_drvdata(pdev); in bgmac_remove() local
253 bgmac_enet_remove(bgmac); in bgmac_remove()
261 struct bgmac *bgmac = dev_get_drvdata(dev); in bgmac_suspend() local
263 return bgmac_enet_suspend(bgmac); in bgmac_suspend()
268 struct bgmac *bgmac = dev_get_drvdata(dev); in bgmac_resume() local
270 return bgmac_enet_resume(bgmac); in bgmac_resume()