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
51 mac_dev->set_exception(mac_dev->fman_mac, in mac_exception()
53 dev_err(mac_dev->dev, "10G MAC got RX FIFO Error = %x\n", ex); in mac_exception()
56 dev_dbg(mac_dev->dev, "%s:%s() -> %d\n", KBUILD_BASENAME ".c", in mac_exception()
68 priv = mac_dev->priv; in fman_set_multi()
71 list_for_each_entry_safe(old_addr, tmp, &priv->mc_addr_list, list) { in fman_set_multi()
72 addr = (enet_addr_t *)old_addr->addr; in fman_set_multi()
73 err = mac_dev->remove_hash_mac_addr(mac_dev->fman_mac, addr); in fman_set_multi()
77 list_del(&old_addr->list); in fman_set_multi()
83 addr = (enet_addr_t *)ha->addr; in fman_set_multi()
84 err = mac_dev->add_hash_mac_addr(mac_dev->fman_mac, addr); in fman_set_multi()
90 return -ENOMEM; in fman_set_multi()
92 ether_addr_copy(tmp->addr, ha->addr); in fman_set_multi()
93 list_add(&tmp->list, &priv->mc_addr_list); in fman_set_multi()
109 priv = mac_dev->priv; in dpaa_eth_add_device()
112 data.mac_hw_id = priv->cell_index; in dpaa_eth_add_device()
116 pdev = platform_device_alloc("dpaa-ethernet", dpaa_eth_dev_cnt); in dpaa_eth_add_device()
118 ret = -ENOMEM; in dpaa_eth_add_device()
122 pdev->dev.parent = mac_dev->dev; in dpaa_eth_add_device()
146 { .compatible = "fsl,fman-dtsec", .data = dtsec_initialization },
147 { .compatible = "fsl,fman-xgec", .data = tgec_initialization },
148 { .compatible = "fsl,fman-memac", .data = memac_initialization },
168 dev = &_of_dev->dev; in mac_probe()
169 mac_node = dev->of_node; in mac_probe()
174 return -ENOMEM; in mac_probe()
177 return -ENOMEM; in mac_probe()
181 mac_dev->priv = priv; in mac_probe()
182 mac_dev->dev = dev; in mac_probe()
184 INIT_LIST_HEAD(&priv->mc_addr_list); in mac_probe()
191 return -EINVAL; in mac_probe()
197 err = -EINVAL; in mac_probe()
200 mac_dev->fman_dev = &of_dev->dev; in mac_probe()
202 /* Get the FMan cell-index */ in mac_probe()
203 err = of_property_read_u32(dev_node, "cell-index", &val); in mac_probe()
205 dev_err(dev, "failed to read cell-index for %pOF\n", dev_node); in mac_probe()
206 err = -EINVAL; in mac_probe()
209 /* cell-index 0 => FMan id 1 */ in mac_probe()
212 priv->fman = fman_bind(mac_dev->fman_dev); in mac_probe()
213 if (!priv->fman) { in mac_probe()
215 err = -ENODEV; in mac_probe()
223 put_device(mac_dev->fman_dev); in mac_probe()
228 mac_dev->res = platform_get_mem_or_io(_of_dev, 0); in mac_probe()
229 if (!mac_dev->res) { in mac_probe()
231 err = -EINVAL; in mac_probe()
235 err = devm_request_resource(dev, fman_get_mem_region(priv->fman), in mac_probe()
236 mac_dev->res); in mac_probe()
242 mac_dev->vaddr = devm_ioremap(dev, mac_dev->res->start, in mac_probe()
243 resource_size(mac_dev->res)); in mac_probe()
244 if (!mac_dev->vaddr) { in mac_probe()
246 err = -EIO; in mac_probe()
251 err = -ENODEV; in mac_probe()
255 /* Get the cell-index */ in mac_probe()
256 err = of_property_read_u32(mac_node, "cell-index", &val); in mac_probe()
258 dev_err(dev, "failed to read cell-index for %pOF\n", mac_node); in mac_probe()
259 err = -EINVAL; in mac_probe()
262 priv->cell_index = (u8)val; in mac_probe()
265 err = of_get_mac_address(mac_node, mac_dev->addr); in mac_probe()
270 nph = of_count_phandle_with_args(mac_node, "fsl,fman-ports", NULL); in mac_probe()
272 dev_err(dev, "of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n", in mac_probe()
278 if (nph != ARRAY_SIZE(mac_dev->port)) { in mac_probe()
279 dev_err(dev, "Not supported number of fman-ports handles of mac node %pOF from device tree\n", in mac_probe()
281 err = -EINVAL; in mac_probe()
288 dev_node = of_parse_phandle(mac_node, "fsl,fman-ports", i); in mac_probe()
290 dev_err(dev, "of_parse_phandle(%pOF, fsl,fman-ports) failed\n", in mac_probe()
292 err = -EINVAL; in mac_probe()
300 err = -EINVAL; in mac_probe()
303 mac_dev->fman_port_devs[i] = &of_dev->dev; in mac_probe()
305 mac_dev->port[i] = fman_port_bind(mac_dev->fman_port_devs[i]); in mac_probe()
306 if (!mac_dev->port[i]) { in mac_probe()
309 err = -EINVAL; in mac_probe()
316 put_device(mac_dev->fman_port_devs[i]); in mac_probe()
329 mac_dev->phy_if = phy_if; in mac_probe()
331 params.mac_id = priv->cell_index; in mac_probe()
332 params.fm = (void *)priv->fman; in mac_probe()
340 if (!is_zero_ether_addr(mac_dev->addr)) in mac_probe()
341 dev_info(dev, "FMan MAC address: %pM\n", mac_dev->addr); in mac_probe()
343 priv->eth_dev = dpaa_eth_add_device(fman_id, mac_dev); in mac_probe()
344 if (IS_ERR(priv->eth_dev)) { in mac_probe()
345 err = PTR_ERR(priv->eth_dev); in mac_probe()
347 priv->cell_index); in mac_probe()
348 priv->eth_dev = NULL; in mac_probe()
356 put_device(mac_dev->fman_port_devs[i]); in mac_probe()
358 put_device(mac_dev->fman_dev); in mac_probe()
370 put_device(mac_dev->fman_port_devs[i]); in mac_remove()
371 put_device(mac_dev->fman_dev); in mac_remove()
373 platform_device_unregister(mac_dev->priv->eth_dev); in mac_remove()