Lines Matching refs:dev

82 	struct rgmii_instance *dev = platform_get_drvdata(ofdev);  in rgmii_attach()  local
83 struct rgmii_regs __iomem *p = dev->base; in rgmii_attach()
85 RGMII_DBG(dev, "attach(%d)" NL, input); in rgmii_attach()
90 ofdev->dev.of_node); in rgmii_attach()
94 mutex_lock(&dev->lock); in rgmii_attach()
100 ofdev->dev.of_node, input, phy_modes(mode)); in rgmii_attach()
102 ++dev->users; in rgmii_attach()
104 mutex_unlock(&dev->lock); in rgmii_attach()
111 struct rgmii_instance *dev = platform_get_drvdata(ofdev); in rgmii_set_speed() local
112 struct rgmii_regs __iomem *p = dev->base; in rgmii_set_speed()
115 mutex_lock(&dev->lock); in rgmii_set_speed()
119 RGMII_DBG(dev, "speed(%d, %d)" NL, input, speed); in rgmii_set_speed()
130 mutex_unlock(&dev->lock); in rgmii_set_speed()
135 struct rgmii_instance *dev = platform_get_drvdata(ofdev); in rgmii_get_mdio() local
136 struct rgmii_regs __iomem *p = dev->base; in rgmii_get_mdio()
139 RGMII_DBG2(dev, "get_mdio(%d)" NL, input); in rgmii_get_mdio()
141 if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO)) in rgmii_get_mdio()
144 mutex_lock(&dev->lock); in rgmii_get_mdio()
151 DBG2(dev, " fer = 0x%08x\n", fer); in rgmii_get_mdio()
156 struct rgmii_instance *dev = platform_get_drvdata(ofdev); in rgmii_put_mdio() local
157 struct rgmii_regs __iomem *p = dev->base; in rgmii_put_mdio()
160 RGMII_DBG2(dev, "put_mdio(%d)" NL, input); in rgmii_put_mdio()
162 if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO)) in rgmii_put_mdio()
170 DBG2(dev, " fer = 0x%08x\n", fer); in rgmii_put_mdio()
172 mutex_unlock(&dev->lock); in rgmii_put_mdio()
177 struct rgmii_instance *dev = platform_get_drvdata(ofdev); in rgmii_detach() local
180 BUG_ON(!dev || dev->users == 0); in rgmii_detach()
181 p = dev->base; in rgmii_detach()
183 mutex_lock(&dev->lock); in rgmii_detach()
185 RGMII_DBG(dev, "detach(%d)" NL, input); in rgmii_detach()
190 --dev->users; in rgmii_detach()
192 mutex_unlock(&dev->lock); in rgmii_detach()
203 struct rgmii_instance *dev = platform_get_drvdata(ofdev); in rgmii_dump_regs() local
212 memcpy_fromio(regs, dev->base, sizeof(struct rgmii_regs)); in rgmii_dump_regs()
219 struct device_node *np = ofdev->dev.of_node; in rgmii_probe()
220 struct rgmii_instance *dev; in rgmii_probe() local
225 dev = kzalloc(sizeof(struct rgmii_instance), GFP_KERNEL); in rgmii_probe()
226 if (dev == NULL) in rgmii_probe()
229 mutex_init(&dev->lock); in rgmii_probe()
230 dev->ofdev = ofdev; in rgmii_probe()
239 dev->base = (struct rgmii_regs __iomem *)ioremap(regs.start, in rgmii_probe()
241 if (dev->base == NULL) { in rgmii_probe()
247 if (of_property_read_bool(ofdev->dev.of_node, "has-mdio")) in rgmii_probe()
248 dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; in rgmii_probe()
251 if (of_device_is_compatible(ofdev->dev.of_node, "ibm,rgmii-axon")) in rgmii_probe()
252 dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; in rgmii_probe()
254 DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n", in rgmii_probe()
255 in_be32(&dev->base->fer), in_be32(&dev->base->ssr)); in rgmii_probe()
258 out_be32(&dev->base->fer, 0); in rgmii_probe()
262 ofdev->dev.of_node, in rgmii_probe()
263 (dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out"); in rgmii_probe()
266 platform_set_drvdata(ofdev, dev); in rgmii_probe()
271 kfree(dev); in rgmii_probe()
278 struct rgmii_instance *dev = platform_get_drvdata(ofdev); in rgmii_remove() local
280 WARN_ON(dev->users != 0); in rgmii_remove()
282 iounmap(dev->base); in rgmii_remove()
283 kfree(dev); in rgmii_remove()