Lines Matching +full:child +full:- +full:interrupt +full:- +full:base
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
78 #define ATU_OB_REGION_0_SIZE (( ATU_OB_REGIONS - 1) * ATU_OB_REGION_SIZE)
179 #define APB_WR4(_sc, _r, _v) bus_write_4((_sc)->apb_mem_res, (_r), (_v))
180 #define APB_RD4(_sc, _r) bus_read_4((_sc)->apb_mem_res, (_r))
240 {"rockchip,rk3399-pcie", 1},
249 bus_addr_t base; in rk_pcie_local_cfg_read() local
252 base = PCIE_RC_CONFIG_PRIV_BASE; in rk_pcie_local_cfg_read()
254 base = PCIE_RC_CONFIG_STD_BASE; in rk_pcie_local_cfg_read()
258 val = bus_read_4(sc->apb_mem_res, base + reg); in rk_pcie_local_cfg_read()
261 val = bus_read_2(sc->apb_mem_res, base + reg); in rk_pcie_local_cfg_read()
264 val = bus_read_1(sc->apb_mem_res, base + reg); in rk_pcie_local_cfg_read()
277 bus_addr_t base; in rk_pcie_local_cfg_write() local
280 base = PCIE_RC_CONFIG_PRIV_BASE; in rk_pcie_local_cfg_write()
282 base = PCIE_RC_CONFIG_STD_BASE; in rk_pcie_local_cfg_write()
286 bus_write_4(sc->apb_mem_res, base + reg, val); in rk_pcie_local_cfg_write()
289 val2 = bus_read_4(sc->apb_mem_res, base + (reg & ~3)); in rk_pcie_local_cfg_write()
292 bus_write_4(sc->apb_mem_res, base + (reg & ~3), val2); in rk_pcie_local_cfg_write()
295 val2 = bus_read_4(sc->apb_mem_res, base + (reg & ~3)); in rk_pcie_local_cfg_write()
298 bus_write_4(sc->apb_mem_res, base + (reg & ~3), val2); in rk_pcie_local_cfg_write()
309 if (bus < sc->bus_start || bus > sc->bus_end || slot > PCI_SLOTMAX || in rk_pcie_check_dev()
313 if (bus == sc->root_bus) { in rk_pcie_check_dev()
320 /* link is needed for accessing non-root busses */ in rk_pcie_check_dev()
326 if (bus == sc->sub_bus && slot != 0 ) in rk_pcie_check_dev()
351 APB_WR4(sc, PCIE_CORE_OB_DESC1(idx), sc->root_bus); in rk_pcie_map_out_atu()
369 APB_WR4(sc, PCIE_CORE_OB_ADDR0(idx), 25 - 1); in rk_pcie_map_cfg_atu()
372 APB_WR4(sc, PCIE_CORE_OB_DESC1(idx), sc->root_bus); in rk_pcie_map_cfg_atu()
407 if (sc->io_range.size != 0) { in rk_pcie_decode_ranges()
408 device_printf(sc->dev, in rk_pcie_decode_ranges()
412 sc->io_range = ranges[i]; in rk_pcie_decode_ranges()
417 if (sc->pref_mem_range.size != 0) { in rk_pcie_decode_ranges()
418 device_printf(sc->dev, in rk_pcie_decode_ranges()
423 sc->pref_mem_range = ranges[i]; in rk_pcie_decode_ranges()
425 if (sc->mem_range.size != 0) { in rk_pcie_decode_ranges()
426 device_printf(sc->dev, in rk_pcie_decode_ranges()
431 sc->mem_range = ranges[i]; in rk_pcie_decode_ranges()
435 if (sc->mem_range.size == 0) { in rk_pcie_decode_ranges()
436 device_printf(sc->dev, in rk_pcie_decode_ranges()
443 /*-----------------------------------------------------------------------------
462 if (bus == sc->root_bus) in rk_pcie_read_config()
467 type = bus == sc->sub_bus ? ATU_TYPE_CFG0: ATU_TYPE_CFG1; in rk_pcie_read_config()
470 ret = -1; in rk_pcie_read_config()
473 ret = bus_peek_1(sc->axi_mem_res, addr, &d8); in rk_pcie_read_config()
477 ret = bus_peek_2(sc->axi_mem_res, addr, &d16); in rk_pcie_read_config()
481 ret = bus_peek_4(sc->axi_mem_res, addr, &d32); in rk_pcie_read_config()
503 if (bus == sc->root_bus) in rk_pcie_write_config()
508 type = bus == sc->sub_bus ? ATU_TYPE_CFG0: ATU_TYPE_CFG1; in rk_pcie_write_config()
513 bus_poke_1(sc->axi_mem_res, addr, (uint8_t)val); in rk_pcie_write_config()
516 bus_poke_2(sc->axi_mem_res, addr, (uint16_t)val); in rk_pcie_write_config()
519 bus_poke_4(sc->axi_mem_res, addr, val); in rk_pcie_write_config()
528 rk_pcie_alloc_msi(device_t pci, device_t child, int count, in rk_pcie_alloc_msi() argument
534 rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), in rk_pcie_alloc_msi()
539 rv = intr_alloc_msi(pci, child, msi_parent, count, maxcount,irqs); in rk_pcie_alloc_msi()
544 rk_pcie_release_msi(device_t pci, device_t child, int count, int *irqs) in rk_pcie_release_msi() argument
549 rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), in rk_pcie_release_msi()
553 rv = intr_release_msi(pci, child, msi_parent, count, irqs); in rk_pcie_release_msi()
559 rk_pcie_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, in rk_pcie_map_msi() argument
565 rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), in rk_pcie_map_msi()
569 rv = intr_map_msi(pci, child, msi_parent, irq, addr, data); in rk_pcie_map_msi()
575 rk_pcie_alloc_msix(device_t pci, device_t child, int *irq) in rk_pcie_alloc_msix() argument
580 rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), in rk_pcie_alloc_msix()
584 rv = intr_alloc_msix(pci, child, msi_parent, irq); in rk_pcie_alloc_msix()
589 rk_pcie_release_msix(device_t pci, device_t child, int irq) in rk_pcie_release_msix() argument
594 rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), in rk_pcie_release_msix()
598 rv = intr_release_msix(pci, child, msi_parent, irq); in rk_pcie_release_msix()
604 rk_pcie_get_id(device_t pci, device_t child, enum pci_id_type type, in rk_pcie_get_id() argument
613 return (pcib_get_id(pci, child, type, id)); in rk_pcie_get_id()
616 pci_rid = pci_get_rid(child); in rk_pcie_get_id()
633 irq = intr_map_clone_irq(rman_get_start(sc->legacy_irq_res)); in rk_pcie_route_interrupt()
640 /*-----------------------------------------------------------------------------
651 rv = regulator_get_by_ofw_property(sc->dev, 0, in rk_pcie_parse_fdt_resources()
652 "vpcie12v-supply", &sc->supply_12v); in rk_pcie_parse_fdt_resources()
654 device_printf(sc->dev,"Cannot get 'vpcie12' regulator\n"); in rk_pcie_parse_fdt_resources()
657 rv = regulator_get_by_ofw_property(sc->dev, 0, in rk_pcie_parse_fdt_resources()
658 "vpcie3v3-supply", &sc->supply_3v3); in rk_pcie_parse_fdt_resources()
660 device_printf(sc->dev,"Cannot get 'vpcie3v3' regulator\n"); in rk_pcie_parse_fdt_resources()
663 rv = regulator_get_by_ofw_property(sc->dev, 0, in rk_pcie_parse_fdt_resources()
664 "vpcie1v8-supply", &sc->supply_1v8); in rk_pcie_parse_fdt_resources()
666 device_printf(sc->dev,"Cannot get 'vpcie1v8' regulator\n"); in rk_pcie_parse_fdt_resources()
669 rv = regulator_get_by_ofw_property(sc->dev, 0, in rk_pcie_parse_fdt_resources()
670 "vpcie0v9-supply", &sc->supply_0v9); in rk_pcie_parse_fdt_resources()
672 device_printf(sc->dev,"Cannot get 'vpcie0v9' regulator\n"); in rk_pcie_parse_fdt_resources()
677 rv = hwreset_get_by_ofw_name(sc->dev, 0, "core", &sc->hwreset_core); in rk_pcie_parse_fdt_resources()
679 device_printf(sc->dev, "Cannot get 'core' reset\n"); in rk_pcie_parse_fdt_resources()
682 rv = hwreset_get_by_ofw_name(sc->dev, 0, "mgmt", &sc->hwreset_mgmt); in rk_pcie_parse_fdt_resources()
684 device_printf(sc->dev, "Cannot get 'mgmt' reset\n"); in rk_pcie_parse_fdt_resources()
687 rv = hwreset_get_by_ofw_name(sc->dev, 0, "mgmt-sticky", in rk_pcie_parse_fdt_resources()
688 &sc->hwreset_mgmt_sticky); in rk_pcie_parse_fdt_resources()
690 device_printf(sc->dev, "Cannot get 'mgmt-sticky' reset\n"); in rk_pcie_parse_fdt_resources()
693 rv = hwreset_get_by_ofw_name(sc->dev, 0, "pipe", &sc->hwreset_pipe); in rk_pcie_parse_fdt_resources()
695 device_printf(sc->dev, "Cannot get 'pipe' reset\n"); in rk_pcie_parse_fdt_resources()
698 rv = hwreset_get_by_ofw_name(sc->dev, 0, "pm", &sc->hwreset_pm); in rk_pcie_parse_fdt_resources()
700 device_printf(sc->dev, "Cannot get 'pm' reset\n"); in rk_pcie_parse_fdt_resources()
703 rv = hwreset_get_by_ofw_name(sc->dev, 0, "aclk", &sc->hwreset_aclk); in rk_pcie_parse_fdt_resources()
705 device_printf(sc->dev, "Cannot get 'aclk' reset\n"); in rk_pcie_parse_fdt_resources()
708 rv = hwreset_get_by_ofw_name(sc->dev, 0, "pclk", &sc->hwreset_pclk); in rk_pcie_parse_fdt_resources()
710 device_printf(sc->dev, "Cannot get 'pclk' reset\n"); in rk_pcie_parse_fdt_resources()
715 rv = clk_get_by_ofw_name(sc->dev, 0, "aclk", &sc->clk_aclk); in rk_pcie_parse_fdt_resources()
717 device_printf(sc->dev, "Cannot get 'aclk' clock\n"); in rk_pcie_parse_fdt_resources()
720 rv = clk_get_by_ofw_name(sc->dev, 0, "aclk-perf", &sc->clk_aclk_perf); in rk_pcie_parse_fdt_resources()
722 device_printf(sc->dev, "Cannot get 'aclk-perf' clock\n"); in rk_pcie_parse_fdt_resources()
725 rv = clk_get_by_ofw_name(sc->dev, 0, "hclk", &sc->clk_hclk); in rk_pcie_parse_fdt_resources()
727 device_printf(sc->dev, "Cannot get 'hclk' clock\n"); in rk_pcie_parse_fdt_resources()
730 rv = clk_get_by_ofw_name(sc->dev, 0, "pm", &sc->clk_pm); in rk_pcie_parse_fdt_resources()
732 device_printf(sc->dev, "Cannot get 'pm' clock\n"); in rk_pcie_parse_fdt_resources()
738 sprintf (buf, "pcie-phy-%d", i); in rk_pcie_parse_fdt_resources()
739 rv = phy_get_by_ofw_name(sc->dev, 0, buf, sc->phys + i); in rk_pcie_parse_fdt_resources()
741 device_printf(sc->dev, "Cannot get '%s' phy\n", buf); in rk_pcie_parse_fdt_resources()
747 rv = gpio_pin_get_by_ofw_property(sc->dev, sc->node, "ep-gpios", in rk_pcie_parse_fdt_resources()
748 &sc->gpio_ep); in rk_pcie_parse_fdt_resources()
750 device_printf(sc->dev, "Cannot get 'ep-gpios' gpio\n"); in rk_pcie_parse_fdt_resources()
764 rv = hwreset_assert(sc->hwreset_pclk); in rk_pcie_enable_resources()
766 device_printf(sc->dev, "Cannot assert 'pclk' reset\n"); in rk_pcie_enable_resources()
769 rv = hwreset_assert(sc->hwreset_aclk); in rk_pcie_enable_resources()
771 device_printf(sc->dev, "Cannot assert 'aclk' reset\n"); in rk_pcie_enable_resources()
774 rv = hwreset_assert(sc->hwreset_pm); in rk_pcie_enable_resources()
776 device_printf(sc->dev, "Cannot assert 'pm' reset\n"); in rk_pcie_enable_resources()
779 rv = hwreset_assert(sc->hwreset_pipe); in rk_pcie_enable_resources()
781 device_printf(sc->dev, "Cannot assert 'pipe' reset\n"); in rk_pcie_enable_resources()
784 rv = hwreset_assert(sc->hwreset_mgmt_sticky); in rk_pcie_enable_resources()
786 device_printf(sc->dev, "Cannot assert 'mgmt_sticky' reset\n"); in rk_pcie_enable_resources()
789 rv = hwreset_assert(sc->hwreset_mgmt); in rk_pcie_enable_resources()
791 device_printf(sc->dev, "Cannot assert 'hmgmt' reset\n"); in rk_pcie_enable_resources()
794 rv = hwreset_assert(sc->hwreset_core); in rk_pcie_enable_resources()
796 device_printf(sc->dev, "Cannot assert 'hcore' reset\n"); in rk_pcie_enable_resources()
802 rv = clk_enable(sc->clk_aclk); in rk_pcie_enable_resources()
804 device_printf(sc->dev, "Cannot enable 'aclk' clock\n"); in rk_pcie_enable_resources()
807 rv = clk_enable(sc->clk_aclk_perf); in rk_pcie_enable_resources()
809 device_printf(sc->dev, "Cannot enable 'aclk_perf' clock\n"); in rk_pcie_enable_resources()
812 rv = clk_enable(sc->clk_hclk); in rk_pcie_enable_resources()
814 device_printf(sc->dev, "Cannot enable 'hclk' clock\n"); in rk_pcie_enable_resources()
817 rv = clk_enable(sc->clk_pm); in rk_pcie_enable_resources()
819 device_printf(sc->dev, "Cannot enable 'pm' clock\n"); in rk_pcie_enable_resources()
824 if (sc->supply_12v != NULL) { in rk_pcie_enable_resources()
825 rv = regulator_enable(sc->supply_12v); in rk_pcie_enable_resources()
827 device_printf(sc->dev, in rk_pcie_enable_resources()
832 if (sc->supply_3v3 != NULL) { in rk_pcie_enable_resources()
833 rv = regulator_enable(sc->supply_3v3); in rk_pcie_enable_resources()
835 device_printf(sc->dev, in rk_pcie_enable_resources()
840 if (sc->supply_1v8 != NULL) { in rk_pcie_enable_resources()
841 rv = regulator_enable(sc->supply_1v8); in rk_pcie_enable_resources()
843 device_printf(sc->dev, in rk_pcie_enable_resources()
848 if (sc->supply_0v9 != NULL) { in rk_pcie_enable_resources()
849 rv = regulator_enable(sc->supply_0v9); in rk_pcie_enable_resources()
851 device_printf(sc->dev, in rk_pcie_enable_resources()
859 rv = hwreset_deassert(sc->hwreset_pm); in rk_pcie_enable_resources()
861 device_printf(sc->dev, "Cannot deassert 'pm' reset\n"); in rk_pcie_enable_resources()
864 rv = hwreset_deassert(sc->hwreset_aclk); in rk_pcie_enable_resources()
866 device_printf(sc->dev, "Cannot deassert 'aclk' reset\n"); in rk_pcie_enable_resources()
869 rv = hwreset_deassert(sc->hwreset_pclk); in rk_pcie_enable_resources()
871 device_printf(sc->dev, "Cannot deassert 'pclk' reset\n"); in rk_pcie_enable_resources()
877 (sc->link_is_gen2 ? STRAP_CONF_GEN_2: 0); in rk_pcie_enable_resources()
879 val |= STRAP_CONF_LANES(~0) << 16 | STRAP_CONF_LANES(sc->num_lanes); in rk_pcie_enable_resources()
885 rv = phy_enable(sc->phys[i]); in rk_pcie_enable_resources()
887 device_printf(sc->dev, "Cannot enable phy %d\n", i); in rk_pcie_enable_resources()
892 /* Deassert rest of resets - order is important ! */ in rk_pcie_enable_resources()
893 rv = hwreset_deassert(sc->hwreset_mgmt_sticky); in rk_pcie_enable_resources()
895 device_printf(sc->dev, "Cannot deassert 'mgmt_sticky' reset\n"); in rk_pcie_enable_resources()
898 rv = hwreset_deassert(sc->hwreset_core); in rk_pcie_enable_resources()
900 device_printf(sc->dev, "Cannot deassert 'core' reset\n"); in rk_pcie_enable_resources()
903 rv = hwreset_deassert(sc->hwreset_mgmt); in rk_pcie_enable_resources()
905 device_printf(sc->dev, "Cannot deassert 'mgmt' reset\n"); in rk_pcie_enable_resources()
908 rv = hwreset_deassert(sc->hwreset_pipe); in rk_pcie_enable_resources()
910 device_printf(sc->dev, "Cannot deassert 'pipe' reset\n"); in rk_pcie_enable_resources()
923 if (sc->gpio_ep != NULL) { in rk_pcie_setup_hw()
924 rv = gpio_pin_set_active(sc->gpio_ep, 0); in rk_pcie_setup_hw()
926 device_printf(sc->dev, in rk_pcie_setup_hw()
927 "Cannot clear 'gpio-ep' gpio\n"); in rk_pcie_setup_hw()
954 if (sc->gpio_ep != NULL) { in rk_pcie_setup_hw()
955 rv = gpio_pin_set_active(sc->gpio_ep, 1); in rk_pcie_setup_hw()
957 device_printf(sc->dev, "Cannot set 'gpio-ep' gpio\n"); in rk_pcie_setup_hw()
963 for (i = 500; i > 0; i--) { in rk_pcie_setup_hw()
970 device_printf(sc->dev, in rk_pcie_setup_hw()
975 if (sc->link_is_gen2) { in rk_pcie_setup_hw()
981 for (i = 500; i > 0; i--) { in rk_pcie_setup_hw()
989 device_printf(sc->dev, "Gen2 link training " in rk_pcie_setup_hw()
996 device_printf(sc->dev, "Link width: %d\n", 1 << val); in rk_pcie_setup_hw()
1007 pcib_bridge_init(sc->dev); in rk_pcie_setup_sw()
1013 PRIV_CFG_WR1(sc, PCIR_PRIBUS_1, sc->root_bus); in rk_pcie_setup_sw()
1014 PRIV_CFG_WR1(sc, PCIR_SECBUS_1, sc->sub_bus); in rk_pcie_setup_sw()
1015 PRIV_CFG_WR1(sc, PCIR_SUBBUS_1, sc->bus_end); in rk_pcie_setup_sw()
1025 if (sc->no_l0s) { in rk_pcie_setup_sw()
1041 rk_pcie_map_in_atu(sc, 2, 64 - 1, 0); in rk_pcie_setup_sw()
1044 /* - region 0 (32 MB) is used for config access */ in rk_pcie_setup_sw()
1046 rk_pcie_map_out_atu(sc, region++, ATU_TYPE_CFG0, 25 - 1, 0); in rk_pcie_setup_sw()
1048 /* - then map memory (by using 1MB regions */ in rk_pcie_setup_sw()
1049 for (i = 0; i < sc->mem_range.size / ATU_OB_REGION_SIZE; i++) { in rk_pcie_setup_sw()
1051 ATU_OB_REGION_SHIFT - 1, in rk_pcie_setup_sw()
1052 sc->mem_range.pci + ATU_OB_REGION_SIZE * i); in rk_pcie_setup_sw()
1055 /* - IO space is next, one region typically*/ in rk_pcie_setup_sw()
1056 for (i = 0; i < sc->io_range.size / ATU_OB_REGION_SIZE; i++) { in rk_pcie_setup_sw()
1058 ATU_OB_REGION_SHIFT - 1, in rk_pcie_setup_sw()
1059 sc->io_range.pci + ATU_OB_REGION_SIZE * i); in rk_pcie_setup_sw()
1078 device_printf(sc->dev, "'sys' interrupt received: 0x%04X\n", in rk_pcie_sys_irq()
1098 device_printf(sc->dev, "'client' interrupt received: 0x%04X\n", irq); in rk_pcie_client_irq()
1114 /* all legacy interrupt are shared, do nothing */ in rk_pcie_legacy_irq()
1119 rk_pcie_get_dma_tag(device_t dev, device_t child) in rk_pcie_get_dma_tag() argument
1124 return (sc->dmat); in rk_pcie_get_dma_tag()
1134 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) in rk_pcie_probe()
1151 sc->dev = dev; in rk_pcie_attach()
1152 sc->node = ofw_bus_get_node(dev); in rk_pcie_attach()
1154 mtx_init(&sc->mtx, "rk_pcie_mtx", NULL, MTX_DEF); in rk_pcie_attach()
1157 sc->bus_start = 0; in rk_pcie_attach()
1158 sc->bus_end = 0x1F; in rk_pcie_attach()
1159 sc->root_bus = sc->bus_start; in rk_pcie_attach()
1160 sc->sub_bus = 1; in rk_pcie_attach()
1167 sc->coherent = OF_hasprop(sc->node, "dma-coherent"); in rk_pcie_attach()
1168 sc->no_l0s = OF_hasprop(sc->node, "aspm-no-l0s"); in rk_pcie_attach()
1169 rv = OF_getencprop(sc->node, "num-lanes", &sc->num_lanes, in rk_pcie_attach()
1170 sizeof(sc->num_lanes)); in rk_pcie_attach()
1171 if (rv != sizeof(sc->num_lanes)) in rk_pcie_attach()
1172 sc->num_lanes = 1; in rk_pcie_attach()
1173 if (sc->num_lanes != 1 && sc->num_lanes != 2 && sc->num_lanes != 4) { in rk_pcie_attach()
1175 "invalid number of lanes: %d\n",sc->num_lanes); in rk_pcie_attach()
1176 sc->num_lanes = 0; in rk_pcie_attach()
1181 rv = OF_getencprop(sc->node, "max-link-speed", &max_speed, in rk_pcie_attach()
1184 sc->link_is_gen2 = true; in rk_pcie_attach()
1186 sc->link_is_gen2 = false; in rk_pcie_attach()
1188 rv = ofw_bus_find_string_index(sc->node, "reg-names", "axi-base", &rid); in rk_pcie_attach()
1190 device_printf(dev, "Cannot get 'axi-base' memory\n"); in rk_pcie_attach()
1194 sc->axi_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in rk_pcie_attach()
1196 if (sc->axi_mem_res == NULL) { in rk_pcie_attach()
1197 device_printf(dev, "Cannot allocate 'axi-base' (rid: %d)\n", in rk_pcie_attach()
1204 rv = bus_map_resource(dev, SYS_RES_MEMORY, sc->axi_mem_res, &req, in rk_pcie_attach()
1207 device_printf(dev, "Cannot map 'axi-base' (rid: %d)\n", in rk_pcie_attach()
1211 rman_set_mapping(sc->axi_mem_res, &map); in rk_pcie_attach()
1213 rv = ofw_bus_find_string_index(sc->node, "reg-names", "apb-base", &rid); in rk_pcie_attach()
1215 device_printf(dev, "Cannot get 'apb-base' memory\n"); in rk_pcie_attach()
1219 sc->apb_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in rk_pcie_attach()
1221 if (sc->apb_mem_res == NULL) { in rk_pcie_attach()
1222 device_printf(dev, "Cannot allocate 'apb-base' (rid: %d)\n", in rk_pcie_attach()
1228 rv = ofw_bus_find_string_index(sc->node, "interrupt-names", in rk_pcie_attach()
1235 sc->client_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, in rk_pcie_attach()
1237 if (sc->client_irq_res == NULL) { in rk_pcie_attach()
1243 rv = ofw_bus_find_string_index(sc->node, "interrupt-names", in rk_pcie_attach()
1250 sc->legacy_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, in rk_pcie_attach()
1252 if (sc->legacy_irq_res == NULL) { in rk_pcie_attach()
1258 rv = ofw_bus_find_string_index(sc->node, "interrupt-names", in rk_pcie_attach()
1265 sc->sys_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, in rk_pcie_attach()
1267 if (sc->sys_irq_res == NULL) { in rk_pcie_attach()
1274 device_printf(dev, "Bus is%s cache-coherent\n", in rk_pcie_attach()
1275 sc->coherent ? "" : " not"); in rk_pcie_attach()
1284 sc->coherent ? BUS_DMA_COHERENT : 0, /* flags */ in rk_pcie_attach()
1286 &sc->dmat); in rk_pcie_attach()
1294 rv = rk_pcie_decode_ranges(sc, sc->ofw_pci.sc_range, in rk_pcie_attach()
1295 sc->ofw_pci.sc_nrange); in rk_pcie_attach()
1306 rv = bus_setup_intr(dev, sc->client_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, in rk_pcie_attach()
1307 rk_pcie_client_irq, NULL, sc, &sc->client_irq_cookie); in rk_pcie_attach()
1309 device_printf(dev, "cannot setup client interrupt handler\n"); in rk_pcie_attach()
1314 rv = bus_setup_intr(dev, sc->legacy_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, in rk_pcie_attach()
1315 rk_pcie_legacy_irq, NULL, sc, &sc->legacy_irq_cookie); in rk_pcie_attach()
1317 device_printf(dev, "cannot setup client interrupt handler\n"); in rk_pcie_attach()
1322 rv = bus_setup_intr(dev, sc->sys_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, in rk_pcie_attach()
1323 rk_pcie_sys_irq, NULL, sc, &sc->sys_irq_cookie); in rk_pcie_attach()
1325 device_printf(dev, "cannot setup client interrupt handler\n"); in rk_pcie_attach()
1361 bus_teardown_intr(dev, sc->sys_irq_res, sc->sys_irq_cookie); in rk_pcie_attach()
1362 bus_teardown_intr(dev, sc->legacy_irq_res, sc->legacy_irq_cookie); in rk_pcie_attach()
1363 bus_teardown_intr(dev, sc->client_irq_res, sc->client_irq_cookie); in rk_pcie_attach()
1366 bus_dma_tag_destroy(sc->dmat); in rk_pcie_attach()
1367 bus_free_resource(dev, SYS_RES_IRQ, sc->sys_irq_res); in rk_pcie_attach()
1368 bus_free_resource(dev, SYS_RES_IRQ, sc->legacy_irq_res); in rk_pcie_attach()
1369 bus_free_resource(dev, SYS_RES_IRQ, sc->client_irq_res); in rk_pcie_attach()
1370 bus_free_resource(dev, SYS_RES_MEMORY, sc->apb_mem_res); in rk_pcie_attach()
1371 bus_free_resource(dev, SYS_RES_MEMORY, sc->axi_mem_res); in rk_pcie_attach()
1373 gpio_pin_release(sc->gpio_ep); in rk_pcie_attach()
1376 phy_release(sc->phys[i]); in rk_pcie_attach()
1379 clk_release(sc->clk_aclk); in rk_pcie_attach()
1380 clk_release(sc->clk_aclk_perf); in rk_pcie_attach()
1381 clk_release(sc->clk_hclk); in rk_pcie_attach()
1382 clk_release(sc->clk_pm); in rk_pcie_attach()
1384 hwreset_release(sc->hwreset_core); in rk_pcie_attach()
1385 hwreset_release(sc->hwreset_mgmt); in rk_pcie_attach()
1386 hwreset_release(sc->hwreset_pipe); in rk_pcie_attach()
1387 hwreset_release(sc->hwreset_pm); in rk_pcie_attach()
1388 hwreset_release(sc->hwreset_aclk); in rk_pcie_attach()
1389 hwreset_release(sc->hwreset_pclk); in rk_pcie_attach()
1391 regulator_release(sc->supply_12v); in rk_pcie_attach()
1392 regulator_release(sc->supply_3v3); in rk_pcie_attach()
1393 regulator_release(sc->supply_1v8); in rk_pcie_attach()
1394 regulator_release(sc->supply_0v9); in rk_pcie_attach()