Lines Matching +full:dvddio +full:- +full:pex +full:- +full:supply

1 /*-
211 #define IPFS_WR4(_sc, _r, _v) bus_write_4((_sc)->mem_res_ipfs, (_r), (_v))
212 #define IPFS_RD4(_sc, _r) bus_read_4((_sc)->mem_res_ipfs, (_r))
213 #define FPCI_WR4(_sc, _r, _v) bus_write_4((_sc)->mem_res_fpci, (_r), (_v))
214 #define FPCI_RD4(_sc, _r) bus_read_4((_sc)->mem_res_fpci, (_r))
216 #define LOCK(_sc) mtx_lock(&(_sc)->mtx)
217 #define UNLOCK(_sc) mtx_unlock(&(_sc)->mtx)
219 mtx_sleep(sc, &sc->mtx, 0, "tegra_xhci", timeout);
221 mtx_init(&_sc->mtx, device_get_nameunit(_sc->dev), "tegra_xhci", MTX_DEF)
222 #define LOCK_DESTROY(_sc) mtx_destroy(&_sc->mtx)
223 #define ASSERT_LOCKED(_sc) mtx_assert(&_sc->mtx, MA_OWNED)
224 #define ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->mtx, MA_NOTOWNED)
302 "avddio-pex-supply",
303 "dvddio-pex-supply",
304 "avdd-usb-supply",
305 "avdd-pll-utmip-supply",
306 "avdd-pll-erefe-supply",
307 "avdd-usb-ss-pll-supply",
308 "hvdd-usb-ss-supply",
309 "hvdd-usb-ss-pll-e-supply",
314 "usb2-0",
315 "usb2-1",
316 "usb2-2",
317 "usb3-0",
330 "dvddio-pex-supply",
331 "hvddio-pex-supply",
332 "avdd-usb-supply",
333 "avdd-pll-utmip-supply",
334 "avdd-pll-uerefe-supply",
335 "dvdd-usb-ss-pll-supply",
336 "hvdd-usb-ss-pll-e-supply",
341 "usb2-0",
342 "usb2-1",
343 "usb2-2",
344 "usb2-3",
345 "usb3-0",
346 "usb3-1",
359 {"nvidia,tegra124-xusb", (uintptr_t)&tegra124_soc},
360 {"nvidia,tegra210-xusb", (uintptr_t)&tegra210_soc},
387 for (i = 0; sc->soc->regulator_names[i] != NULL; i++) { in get_fdt_resources()
388 if (i >= nitems(sc->regulators)) { in get_fdt_resources()
389 device_printf(sc->dev, in get_fdt_resources()
393 rv = regulator_get_by_ofw_property(sc->dev, 0, in get_fdt_resources()
394 sc->soc->regulator_names[i], sc->regulators + i); in get_fdt_resources()
396 device_printf(sc->dev, in get_fdt_resources()
398 sc->soc->regulator_names[i]); in get_fdt_resources()
403 rv = hwreset_get_by_ofw_name(sc->dev, 0, "xusb_host", in get_fdt_resources()
404 &sc->hwreset_xusb_host); in get_fdt_resources()
406 device_printf(sc->dev, "Cannot get 'xusb_host' reset\n"); in get_fdt_resources()
409 rv = hwreset_get_by_ofw_name(sc->dev, 0, "xusb_ss", in get_fdt_resources()
410 &sc->hwreset_xusb_ss); in get_fdt_resources()
412 device_printf(sc->dev, "Cannot get 'xusb_ss' reset\n"); in get_fdt_resources()
417 for (i = 0; sc->soc->phy_names[i] != NULL; i++) { in get_fdt_resources()
418 if (i >= nitems(sc->phys)) { in get_fdt_resources()
419 device_printf(sc->dev, in get_fdt_resources()
423 rv = phy_get_by_ofw_name(sc->dev, 0, sc->soc->phy_names[i], in get_fdt_resources()
424 sc->phys + i); in get_fdt_resources()
426 device_printf(sc->dev, "Cannot get '%s' phy.\n", in get_fdt_resources()
427 sc->soc->phy_names[i]); in get_fdt_resources()
432 rv = clk_get_by_ofw_name(sc->dev, 0, "xusb_host", in get_fdt_resources()
433 &sc->clk_xusb_host); in get_fdt_resources()
435 device_printf(sc->dev, "Cannot get 'xusb_host' clock\n"); in get_fdt_resources()
438 rv = clk_get_by_ofw_name(sc->dev, 0, "xusb_falcon_src", in get_fdt_resources()
439 &sc->clk_xusb_falcon_src); in get_fdt_resources()
441 device_printf(sc->dev, "Cannot get 'xusb_falcon_src' clock\n"); in get_fdt_resources()
444 rv = clk_get_by_ofw_name(sc->dev, 0, "xusb_ss", in get_fdt_resources()
445 &sc->clk_xusb_ss); in get_fdt_resources()
447 device_printf(sc->dev, "Cannot get 'xusb_ss' clock\n"); in get_fdt_resources()
450 rv = clk_get_by_ofw_name(sc->dev, 0, "xusb_hs_src", in get_fdt_resources()
451 &sc->clk_xusb_hs_src); in get_fdt_resources()
453 device_printf(sc->dev, "Cannot get 'xusb_hs_src' clock\n"); in get_fdt_resources()
456 rv = clk_get_by_ofw_name(sc->dev, 0, "xusb_fs_src", in get_fdt_resources()
457 &sc->clk_xusb_fs_src); in get_fdt_resources()
459 device_printf(sc->dev, "Cannot get 'xusb_fs_src' clock\n"); in get_fdt_resources()
463 rv = clk_get_by_name(sc->dev, "xusb_gate", &sc->clk_xusb_gate); in get_fdt_resources()
465 device_printf(sc->dev, "Cannot get 'xusb_gate' clock\n"); in get_fdt_resources()
476 rv = hwreset_assert(sc->hwreset_xusb_host); in enable_fdt_resources()
478 device_printf(sc->dev, "Cannot reset 'xusb_host' reset\n"); in enable_fdt_resources()
481 rv = hwreset_assert(sc->hwreset_xusb_ss); in enable_fdt_resources()
483 device_printf(sc->dev, "Cannot reset 'xusb_ss' reset\n"); in enable_fdt_resources()
488 for (i = 0; i < nitems(sc->regulators); i++) { in enable_fdt_resources()
489 if (sc->regulators[i] == NULL) in enable_fdt_resources()
491 rv = regulator_enable(sc->regulators[i]); in enable_fdt_resources()
493 device_printf(sc->dev, in enable_fdt_resources()
495 sc->soc->regulator_names[i]); in enable_fdt_resources()
503 device_printf(sc->dev, "Cannot powerdown 'xusba' domain\n"); in enable_fdt_resources()
508 device_printf(sc->dev, "Cannot powerdown 'xusbc' domain\n"); in enable_fdt_resources()
513 clk_set_freq(sc->clk_xusb_ss, TEGRA_XHCI_SS_HIGH_SPEED, 0); in enable_fdt_resources()
518 rv = clk_enable(sc->clk_xusb_gate); in enable_fdt_resources()
520 device_printf(sc->dev, in enable_fdt_resources()
527 sc->clk_xusb_host, sc->hwreset_xusb_host); in enable_fdt_resources()
529 device_printf(sc->dev, "Cannot powerup 'xusbc' domain\n"); in enable_fdt_resources()
533 sc->clk_xusb_ss, sc->hwreset_xusb_ss); in enable_fdt_resources()
535 device_printf(sc->dev, "Cannot powerup 'xusba' domain\n"); in enable_fdt_resources()
540 rv = clk_enable(sc->clk_xusb_falcon_src); in enable_fdt_resources()
542 device_printf(sc->dev, in enable_fdt_resources()
546 rv = clk_enable(sc->clk_xusb_fs_src); in enable_fdt_resources()
548 device_printf(sc->dev, in enable_fdt_resources()
552 rv = clk_enable(sc->clk_xusb_hs_src); in enable_fdt_resources()
554 device_printf(sc->dev, in enable_fdt_resources()
560 for (i = 0; i < nitems(sc->phys); i++) { in enable_fdt_resources()
561 if (sc->phys[i] == NULL) in enable_fdt_resources()
563 rv = phy_enable(sc->phys[i]); in enable_fdt_resources()
565 device_printf(sc->dev, "Cannot enable '%s' phy\n", in enable_fdt_resources()
566 sc->soc->phy_names[i]); in enable_fdt_resources()
597 device_printf(sc->dev, in mbox_send_cmd()
605 device_printf(sc->dev, in mbox_send_cmd()
616 for (i = 250; i > 0; i--) { in mbox_send_cmd()
623 device_printf(sc->dev, in mbox_send_cmd()
643 rv = clk_set_freq(sc->clk_xusb_falcon_src, req_data * 1000ULL, in process_msg()
646 rv = clk_get_freq(sc->clk_xusb_falcon_src, &freq); in process_msg()
654 rv = clk_set_freq(sc->clk_xusb_ss, req_data * 1000ULL, in process_msg()
657 rv = clk_get_freq(sc->clk_xusb_ss, &freq); in process_msg()
695 device_printf(sc->dev, in process_msg()
701 device_printf(sc->dev, in process_msg()
718 device_printf(sc->dev, in intr_mbox()
758 device_printf(sc->dev, in load_fw()
764 fw = firmware_get(sc->soc->fw_name); in load_fw()
766 device_printf(sc->dev, "Cannot read xusb firmware\n"); in load_fw()
771 fw_hdr = (const struct tegra_xusb_fw_hdr *)fw->data; in load_fw()
772 fw_size = fw_hdr->fwimg_len; in load_fw()
774 fw_vaddr = kmem_alloc_contig(fw_size, M_WAITOK, 0, -1UL, PAGE_SIZE, 0, in load_fw()
778 memcpy(fw_vaddr, fw->data, fw_size); in load_fw()
781 sc->fw_vaddr = fw_vaddr; in load_fw()
782 sc->fw_size = fw_size; in load_fw()
796 code_tags = howmany(fw_hdr->boot_codetag, XUSB_CSB_IMEM_BLOCK_SIZE); in load_fw()
797 code_size = howmany(fw_hdr->boot_codesize, XUSB_CSB_IMEM_BLOCK_SIZE); in load_fw()
806 /* Program FALCON auto-fill range and block count */ in load_fw()
814 for (i = 500; i > 0; i--) { in load_fw()
821 device_printf(sc->dev, "Timedout while wating for DMA, " in load_fw()
828 CSB_WR4(sc, XUSB_FALCON_BOOTVEC, fw_hdr->boot_codetag); in load_fw()
832 for (i = 50; i > 0; i--) { in load_fw()
838 device_printf(sc->dev, "Timedout while wating for FALCON cpu, " in load_fw()
843 fw_timespec.tv_sec = fw_hdr->fwimg_created_time; in load_fw()
846 device_printf(sc->dev, in load_fw()
849 (fw_hdr->version_id >> 24) & 0xFF,(fw_hdr->version_id >> 15) & 0xFF, in load_fw()
850 fw_hdr->version_id & 0xFFFF, in load_fw()
864 base_addr = rman_get_start(sc->xhci_softc.sc_io_res); in init_hw()
907 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { in tegra_xhci_probe()
922 xsc = &sc->xhci_softc; in tegra_xhci_detach()
929 if (sc->xhci_inited) { in tegra_xhci_detach()
930 usb_callout_drain(&xsc->sc_callout); in tegra_xhci_detach()
934 if (xsc->sc_irq_res && xsc->sc_intr_hdl) { in tegra_xhci_detach()
935 bus_teardown_intr(dev, xsc->sc_irq_res, xsc->sc_intr_hdl); in tegra_xhci_detach()
936 xsc->sc_intr_hdl = NULL; in tegra_xhci_detach()
938 if (xsc->sc_irq_res) { in tegra_xhci_detach()
940 rman_get_rid(xsc->sc_irq_res), xsc->sc_irq_res); in tegra_xhci_detach()
941 xsc->sc_irq_res = NULL; in tegra_xhci_detach()
943 if (xsc->sc_io_res != NULL) { in tegra_xhci_detach()
945 rman_get_rid(xsc->sc_io_res), xsc->sc_io_res); in tegra_xhci_detach()
946 xsc->sc_io_res = NULL; in tegra_xhci_detach()
948 if (sc->xhci_inited) in tegra_xhci_detach()
950 if (sc->irq_hdl_mbox != NULL) in tegra_xhci_detach()
951 bus_teardown_intr(dev, sc->irq_res_mbox, sc->irq_hdl_mbox); in tegra_xhci_detach()
952 if (sc->fw_vaddr != NULL) in tegra_xhci_detach()
953 kmem_free(sc->fw_vaddr, sc->fw_size); in tegra_xhci_detach()
967 sc->dev = dev; in tegra_xhci_attach()
968 sc->soc = (struct xhci_soc *)ofw_bus_search_compatible(dev, in tegra_xhci_attach()
969 compat_data)->ocd_data; in tegra_xhci_attach()
971 xsc = &sc->xhci_softc; in tegra_xhci_attach()
987 xsc->sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in tegra_xhci_attach()
989 if (xsc->sc_io_res == NULL) { in tegra_xhci_attach()
996 sc->mem_res_fpci = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in tegra_xhci_attach()
998 if (sc->mem_res_fpci == NULL) { in tegra_xhci_attach()
1005 sc->mem_res_ipfs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in tegra_xhci_attach()
1007 if (sc->mem_res_ipfs == NULL) { in tegra_xhci_attach()
1015 xsc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, in tegra_xhci_attach()
1017 if (xsc->sc_irq_res == NULL) { in tegra_xhci_attach()
1023 sc->irq_res_mbox = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, in tegra_xhci_attach()
1025 if (sc->irq_res_mbox == NULL) { in tegra_xhci_attach()
1040 device_printf(sc->dev, "Could not enable XUSB firmware\n"); in tegra_xhci_attach()
1045 xsc->sc_bus.parent = dev; in tegra_xhci_attach()
1046 xsc->sc_bus.devices = xsc->sc_devices; in tegra_xhci_attach()
1047 xsc->sc_bus.devices_max = XHCI_MAX_DEVICES; in tegra_xhci_attach()
1049 xsc->sc_io_tag = rman_get_bustag(xsc->sc_io_res); in tegra_xhci_attach()
1050 xsc->sc_io_hdl = rman_get_bushandle(xsc->sc_io_res); in tegra_xhci_attach()
1051 xsc->sc_io_size = rman_get_size(xsc->sc_io_res); in tegra_xhci_attach()
1052 strlcpy(xsc->sc_vendor, "Nvidia", sizeof(xsc->sc_vendor)); in tegra_xhci_attach()
1055 xsc->sc_bus.bdev = device_add_child(sc->dev, "usbus", DEVICE_UNIT_ANY); in tegra_xhci_attach()
1056 if (xsc->sc_bus.bdev == NULL) { in tegra_xhci_attach()
1057 device_printf(sc->dev, "Could not add USB device\n"); in tegra_xhci_attach()
1061 device_set_ivars(xsc->sc_bus.bdev, &xsc->sc_bus); in tegra_xhci_attach()
1062 device_set_desc(xsc->sc_bus.bdev, "Nvidia USB 3.0 controller"); in tegra_xhci_attach()
1064 rv = xhci_init(xsc, sc->dev, 1); in tegra_xhci_attach()
1066 device_printf(sc->dev, "USB init failed: %d\n", rv); in tegra_xhci_attach()
1069 sc->xhci_inited = true; in tegra_xhci_attach()
1072 device_printf(sc->dev, in tegra_xhci_attach()
1077 rv = bus_setup_intr(dev, sc->irq_res_mbox, INTR_TYPE_MISC | INTR_MPSAFE, in tegra_xhci_attach()
1078 NULL, intr_mbox, sc, &sc->irq_hdl_mbox); in tegra_xhci_attach()
1081 xsc->sc_intr_hdl = NULL; in tegra_xhci_attach()
1085 rv = bus_setup_intr(dev, xsc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, in tegra_xhci_attach()
1086 NULL, (driver_intr_t *)xhci_interrupt, xsc, &xsc->sc_intr_hdl); in tegra_xhci_attach()
1089 xsc->sc_intr_hdl = NULL; in tegra_xhci_attach()
1094 rv = device_probe_and_attach(xsc->sc_bus.bdev); in tegra_xhci_attach()
1096 device_printf(sc->dev, "Could not initialize USB: %d\n", rv); in tegra_xhci_attach()