MCPcopy Create free account
hub / github.com/F-Stack/f-stack / fman_if_init

Function fman_if_init

dpdk/drivers/bus/dpaa/base/fman/fman.c:228–690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228static int
229fman_if_init(const struct device_node *dpa_node)
230{
231 const char *rprop, *mprop;
232 uint64_t phys_addr;
233 struct __fman_if *__if;
234 struct fman_if_bpool *bpool;
235
236 const phandle *mac_phandle, *ports_phandle, *pools_phandle;
237 const phandle *tx_channel_id = NULL, *mac_addr, *cell_idx;
238 const phandle *rx_phandle, *tx_phandle;
239 const phandle *port_cell_idx, *ext_args_cell_idx;
240 const struct device_node *parent_node_ext_args;
241 uint64_t tx_phandle_host[4] = {0};
242 uint64_t rx_phandle_host[6] = {0};
243 uint64_t regs_addr_host = 0;
244 uint64_t cell_idx_host = 0;
245 uint64_t port_cell_idx_val = 0;
246 uint64_t ext_args_cell_idx_val = 0;
247
248 const struct device_node *mac_node = NULL, *tx_node, *ext_args_node;
249 const struct device_node *pool_node, *fman_node, *rx_node;
250 const uint32_t *regs_addr = NULL;
251 const char *mname, *fname;
252 const char *dname = dpa_node->full_name;
253 size_t lenp;
254 int _errno, is_shared = 0;
255 const char *char_prop;
256 uint32_t na;
257
258 if (of_device_is_available(dpa_node) == false)
259 return 0;
260
261 if (!of_device_is_compatible(dpa_node, "fsl,dpa-ethernet-init") &&
262 !of_device_is_compatible(dpa_node, "fsl,dpa-ethernet")) {
263 return 0;
264 }
265
266 rprop = "fsl,qman-frame-queues-rx";
267 mprop = "fsl,fman-mac";
268
269 /* Obtain the MAC node used by this interface except macless */
270 mac_phandle = of_get_property(dpa_node, mprop, &lenp);
271 if (!mac_phandle) {
272 FMAN_ERR(-EINVAL, "%s: no %s\n", dname, mprop);
273 return -EINVAL;
274 }
275 assert(lenp == sizeof(phandle));
276 mac_node = of_find_node_by_phandle(*mac_phandle);
277 if (!mac_node) {
278 FMAN_ERR(-ENXIO, "%s: bad 'fsl,fman-mac\n", dname);
279 return -ENXIO;
280 }
281 mname = mac_node->full_name;
282
283 /* Extract the Rx and Tx ports */
284 ports_phandle = of_get_property(mac_node, "fsl,port-handles",
285 &lenp);

Callers 1

fman_initFunction · 0.85

Calls 15

of_device_is_availableFunction · 0.85
of_device_is_compatibleFunction · 0.85
of_get_propertyFunction · 0.85
of_find_node_by_phandleFunction · 0.85
of_read_numberFunction · 0.85
of_find_compatible_nodeFunction · 0.85
rte_mallocFunction · 0.85
memsetFunction · 0.85
INIT_LIST_HEADFunction · 0.85
of_get_addressFunction · 0.85
of_translate_addressFunction · 0.85
of_n_addr_cellsFunction · 0.85

Tested by

no test coverage detected