| 690 | } |
| 691 | |
| 692 | int |
| 693 | fman_init(void) |
| 694 | { |
| 695 | const struct device_node *dpa_node, *parent_node; |
| 696 | int _errno; |
| 697 | |
| 698 | /* If multiple dependencies try to initialise the Fman driver, don't |
| 699 | * panic. |
| 700 | */ |
| 701 | if (fman_ccsr_map_fd != -1) |
| 702 | return 0; |
| 703 | |
| 704 | fman_ccsr_map_fd = open(FMAN_DEVICE_PATH, O_RDWR); |
| 705 | if (unlikely(fman_ccsr_map_fd < 0)) { |
| 706 | DPAA_BUS_LOG(ERR, "Unable to open (/dev/mem)"); |
| 707 | return fman_ccsr_map_fd; |
| 708 | } |
| 709 | |
| 710 | parent_node = of_find_compatible_node(NULL, NULL, "fsl,dpaa"); |
| 711 | if (!parent_node) { |
| 712 | DPAA_BUS_LOG(ERR, "Unable to find fsl,dpaa node"); |
| 713 | return -ENODEV; |
| 714 | } |
| 715 | |
| 716 | for_each_child_node(parent_node, dpa_node) { |
| 717 | _errno = fman_if_init(dpa_node); |
| 718 | if (_errno) { |
| 719 | FMAN_ERR(_errno, "if_init(%s)\n", dpa_node->full_name); |
| 720 | goto err; |
| 721 | } |
| 722 | } |
| 723 | |
| 724 | return 0; |
| 725 | err: |
| 726 | fman_finish(); |
| 727 | return _errno; |
| 728 | } |
| 729 | |
| 730 | void |
| 731 | fman_finish(void) |
no test coverage detected