Lines Matching +full:fman +full:- +full:dtsec

1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
3 * Copyright 2008 - 2015 Freescale Semiconductor Inc.
30 MODULE_DESCRIPTION("FSL FMan MAC API based driver");
34 struct fman *fman; member
49 mac_dev->set_exception(mac_dev->fman_mac, in mac_exception()
51 dev_err(mac_dev->dev, "10G MAC got RX FIFO Error = %x\n", ex); in mac_exception()
54 dev_dbg(mac_dev->dev, "%s:%s() -> %d\n", KBUILD_BASENAME ".c", in mac_exception()
69 priv = mac_dev->priv; in dpaa_eth_add_device()
72 data.mac_hw_id = priv->cell_index; in dpaa_eth_add_device()
76 pdev = platform_device_alloc("dpaa-ethernet", dpaa_eth_dev_cnt); in dpaa_eth_add_device()
78 ret = -ENOMEM; in dpaa_eth_add_device()
82 pdev->dev.parent = mac_dev->dev; in dpaa_eth_add_device()
106 { .compatible = "fsl,fman-dtsec", .data = dtsec_initialization },
107 { .compatible = "fsl,fman-xgec", .data = tgec_initialization },
108 { .compatible = "fsl,fman-memac", .data = memac_initialization },
128 dev = &_of_dev->dev; in mac_probe()
129 mac_node = dev->of_node; in mac_probe()
134 return -ENOMEM; in mac_probe()
137 return -ENOMEM; in mac_probe()
141 mac_dev->priv = priv; in mac_probe()
142 mac_dev->dev = dev; in mac_probe()
149 return -EINVAL; in mac_probe()
155 err = -EINVAL; in mac_probe()
158 mac_dev->fman_dev = &of_dev->dev; in mac_probe()
160 /* Get the FMan cell-index */ in mac_probe()
161 err = of_property_read_u32(dev_node, "cell-index", &val); in mac_probe()
163 dev_err(dev, "failed to read cell-index for %pOF\n", dev_node); in mac_probe()
164 err = -EINVAL; in mac_probe()
167 /* cell-index 0 => FMan id 1 */ in mac_probe()
170 priv->fman = fman_bind(mac_dev->fman_dev); in mac_probe()
171 if (!priv->fman) { in mac_probe()
173 err = -ENODEV; in mac_probe()
181 put_device(mac_dev->fman_dev); in mac_probe()
186 mac_dev->res = platform_get_mem_or_io(_of_dev, 0); in mac_probe()
187 if (!mac_dev->res) { in mac_probe()
189 err = -EINVAL; in mac_probe()
193 err = devm_request_resource(dev, fman_get_mem_region(priv->fman), in mac_probe()
194 mac_dev->res); in mac_probe()
200 mac_dev->vaddr = devm_ioremap(dev, mac_dev->res->start, in mac_probe()
201 resource_size(mac_dev->res)); in mac_probe()
202 if (!mac_dev->vaddr) { in mac_probe()
204 err = -EIO; in mac_probe()
209 err = -ENODEV; in mac_probe()
213 /* Get the cell-index */ in mac_probe()
214 err = of_property_read_u32(mac_node, "cell-index", &val); in mac_probe()
216 dev_err(dev, "failed to read cell-index for %pOF\n", mac_node); in mac_probe()
217 err = -EINVAL; in mac_probe()
221 dev_err(dev, "cell-index value is too big for %pOF\n", mac_node); in mac_probe()
222 err = -EINVAL; in mac_probe()
225 priv->cell_index = (u8)val; in mac_probe()
228 err = of_get_mac_address(mac_node, mac_dev->addr); in mac_probe()
233 nph = of_count_phandle_with_args(mac_node, "fsl,fman-ports", NULL); in mac_probe()
235 dev_err(dev, "of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n", in mac_probe()
241 if (nph != ARRAY_SIZE(mac_dev->port)) { in mac_probe()
242 dev_err(dev, "Not supported number of fman-ports handles of mac node %pOF from device tree\n", in mac_probe()
244 err = -EINVAL; in mac_probe()
251 dev_node = of_parse_phandle(mac_node, "fsl,fman-ports", i); in mac_probe()
253 dev_err(dev, "of_parse_phandle(%pOF, fsl,fman-ports) failed\n", in mac_probe()
255 err = -EINVAL; in mac_probe()
263 err = -EINVAL; in mac_probe()
266 mac_dev->fman_port_devs[i] = &of_dev->dev; in mac_probe()
268 mac_dev->port[i] = fman_port_bind(mac_dev->fman_port_devs[i]); in mac_probe()
269 if (!mac_dev->port[i]) { in mac_probe()
272 err = -EINVAL; in mac_probe()
279 put_device(mac_dev->fman_port_devs[i]); in mac_probe()
292 mac_dev->phy_if = phy_if; in mac_probe()
294 params.mac_id = priv->cell_index; in mac_probe()
295 params.fm = (void *)priv->fman; in mac_probe()
303 if (!is_zero_ether_addr(mac_dev->addr)) in mac_probe()
304 dev_info(dev, "FMan MAC address: %pM\n", mac_dev->addr); in mac_probe()
306 priv->eth_dev = dpaa_eth_add_device(fman_id, mac_dev); in mac_probe()
307 if (IS_ERR(priv->eth_dev)) { in mac_probe()
308 err = PTR_ERR(priv->eth_dev); in mac_probe()
310 priv->cell_index); in mac_probe()
311 priv->eth_dev = NULL; in mac_probe()
319 put_device(mac_dev->fman_port_devs[i]); in mac_probe()
321 put_device(mac_dev->fman_dev); in mac_probe()
333 put_device(mac_dev->fman_port_devs[i]); in mac_remove()
334 put_device(mac_dev->fman_dev); in mac_remove()
336 platform_device_unregister(mac_dev->priv->eth_dev); in mac_remove()