Lines Matching +full:utmi +full:- +full:pads
1 /*-
276 /* UTMI params */
291 {"nvidia,tegra210-usb-phy", 1},
292 {"nvidia,tegra30-usb-phy", 1},
307 bus_read_4(sc->mem_res, offs)
310 bus_write_4(sc->mem_res, offs, val)
341 device_printf(sc->dev, "USB phy clock timeout.\n"); in usbphy_utmi_phy_clk()
365 val |= UTMIP_IDLE_WAIT(sc->idle_wait_delay); in usbphy_utmi_enable()
366 val |= UTMIP_ELASTIC_LIMIT(sc->elastic_limit); in usbphy_utmi_enable()
371 val |= UTMIP_HS_SYNC_START_DLY(sc->hssync_start_delay); in usbphy_utmi_enable()
383 if (sc->dr_mode == USB_DR_MODE_DEVICE) { in usbphy_utmi_enable()
400 rv = hwreset_deassert(sc->reset_pads); in usbphy_utmi_enable()
402 device_printf(sc->dev, in usbphy_utmi_enable()
403 "Cannot unreset 'utmi-pads' reset\n"); in usbphy_utmi_enable()
406 rv = clk_enable(sc->clk_pads); in usbphy_utmi_enable()
408 device_printf(sc->dev, in usbphy_utmi_enable()
409 "Cannot enable 'utmi-pads' clock\n"); in usbphy_utmi_enable()
413 val = bus_read_4(sc->pads_res, UTMIP_BIAS_CFG0); in usbphy_utmi_enable()
419 val |= UTMIP_HSSQUELCH_LEVEL(sc->hssquelch_level); in usbphy_utmi_enable()
420 val |= UTMIP_HSDISCON_LEVEL(sc->hsdiscon_level); in usbphy_utmi_enable()
421 val |= UTMIP_HSDISCON_LEVEL_MSB(sc->hsdiscon_level); in usbphy_utmi_enable()
422 bus_write_4(sc->pads_res, UTMIP_BIAS_CFG0, val); in usbphy_utmi_enable()
424 rv = clk_disable(sc->clk_pads); in usbphy_utmi_enable()
426 device_printf(sc->dev, in usbphy_utmi_enable()
427 "Cannot disable 'utmi-pads' clock\n"); in usbphy_utmi_enable()
441 val |= UTMIP_XCVR_LSFSLEW(sc->xcvr_lsfslew); in usbphy_utmi_enable()
442 val |= UTMIP_XCVR_LSRSLEW(sc->xcvr_lsrslew); in usbphy_utmi_enable()
443 val |= UTMIP_XCVR_HSSLEW(sc->xcvr_hsslew); in usbphy_utmi_enable()
444 val |= UTMIP_XCVR_HSSLEW_MSB(sc->xcvr_hsslew); in usbphy_utmi_enable()
445 if (!sc->xcvr_setup_use_fuses) { in usbphy_utmi_enable()
448 val |= UTMIP_XCVR_SETUP(sc->xcvr_setup); in usbphy_utmi_enable()
449 val |= UTMIP_XCVR_SETUP_MSB(sc->xcvr_setup); in usbphy_utmi_enable()
458 val |= UTMIP_XCVR_TERM_RANGE_ADJ(sc->term_range_adj); in usbphy_utmi_enable()
467 if (sc->xcvr_setup_use_fuses) in usbphy_utmi_enable()
485 if (sc->dr_mode == USB_DR_MODE_HOST) in usbphy_utmi_enable()
507 if (sc->dr_mode == USB_DR_MODE_DEVICE) { in usbphy_utmi_disable()
535 usbpby_enable_cnt--; in usbphy_utmi_disable()
537 rv = clk_enable(sc->clk_pads); in usbphy_utmi_disable()
539 device_printf(sc->dev, in usbphy_utmi_disable()
540 "Cannot enable 'utmi-pads' clock\n"); in usbphy_utmi_disable()
543 val =bus_read_4(sc->pads_res, UTMIP_BIAS_CFG0); in usbphy_utmi_disable()
546 bus_write_4(sc->pads_res, UTMIP_BIAS_CFG0, val); in usbphy_utmi_disable()
548 rv = clk_disable(sc->clk_pads); in usbphy_utmi_disable()
550 device_printf(sc->dev, in usbphy_utmi_disable()
551 "Cannot disable 'utmi-pads' clock\n"); in usbphy_utmi_disable()
568 if (sc->ifc_type != USB_IFC_TYPE_UTMI) { in usbphy_phy_enable()
569 device_printf(sc->dev, in usbphy_phy_enable()
570 "Only UTMI interface is supported.\n"); in usbphy_phy_enable()
593 if (strcmp(tmpstr, "utmi") == 0) in usb_get_ifc_mode()
632 rv = OF_getencprop(node, "nvidia,hssync-start-delay", in usbphy_utmi_read_params()
633 &sc->hssync_start_delay, sizeof (sc->hssync_start_delay)); in usbphy_utmi_read_params()
637 rv = OF_getencprop(node, "nvidia,elastic-limit", in usbphy_utmi_read_params()
638 &sc->elastic_limit, sizeof (sc->elastic_limit)); in usbphy_utmi_read_params()
642 rv = OF_getencprop(node, "nvidia,idle-wait-delay", in usbphy_utmi_read_params()
643 &sc->idle_wait_delay, sizeof (sc->idle_wait_delay)); in usbphy_utmi_read_params()
647 rv = OF_getencprop(node, "nvidia,term-range-adj", in usbphy_utmi_read_params()
648 &sc->term_range_adj, sizeof (sc->term_range_adj)); in usbphy_utmi_read_params()
652 rv = OF_getencprop(node, "nvidia,xcvr-lsfslew", in usbphy_utmi_read_params()
653 &sc->xcvr_lsfslew, sizeof (sc->xcvr_lsfslew)); in usbphy_utmi_read_params()
657 rv = OF_getencprop(node, "nvidia,xcvr-lsrslew", in usbphy_utmi_read_params()
658 &sc->xcvr_lsrslew, sizeof (sc->xcvr_lsrslew)); in usbphy_utmi_read_params()
662 rv = OF_getencprop(node, "nvidia,xcvr-hsslew", in usbphy_utmi_read_params()
663 &sc->xcvr_hsslew, sizeof (sc->xcvr_hsslew)); in usbphy_utmi_read_params()
667 rv = OF_getencprop(node, "nvidia,hssquelch-level", in usbphy_utmi_read_params()
668 &sc->hssquelch_level, sizeof (sc->hssquelch_level)); in usbphy_utmi_read_params()
672 rv = OF_getencprop(node, "nvidia,hsdiscon-level", in usbphy_utmi_read_params()
673 &sc->hsdiscon_level, sizeof (sc->hsdiscon_level)); in usbphy_utmi_read_params()
677 rv = OF_getproplen(node, "nvidia,xcvr-setup-use-fuses"); in usbphy_utmi_read_params()
679 sc->xcvr_setup_use_fuses = 1; in usbphy_utmi_read_params()
681 rv = OF_getencprop(node, "nvidia,xcvr-setup", in usbphy_utmi_read_params()
682 &sc->xcvr_setup, sizeof (sc->xcvr_setup)); in usbphy_utmi_read_params()
697 if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) in usbphy_probe()
714 sc->dev = dev; in usbphy_attach()
717 sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in usbphy_attach()
719 if (sc->mem_res == NULL) { in usbphy_attach()
725 sc->pads_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in usbphy_attach()
727 if (sc->mem_res == NULL) { in usbphy_attach()
734 rv = hwreset_get_by_ofw_name(sc->dev, 0, "usb", &sc->reset_usb); in usbphy_attach()
739 rv = hwreset_get_by_ofw_name(sc->dev, 0, "utmi-pads", &sc->reset_pads); in usbphy_attach()
741 device_printf(dev, "Cannot get 'utmi-pads' reset\n"); in usbphy_attach()
745 rv = clk_get_by_ofw_name(sc->dev, 0, "reg", &sc->clk_reg); in usbphy_attach()
747 device_printf(sc->dev, "Cannot get 'reg' clock\n"); in usbphy_attach()
750 rv = clk_get_by_ofw_name(sc->dev, 0, "pll_u", &sc->clk_pllu); in usbphy_attach()
752 device_printf(sc->dev, "Cannot get 'pll_u' clock\n"); in usbphy_attach()
755 rv = clk_get_by_ofw_name(sc->dev, 0, "utmi-pads", &sc->clk_pads); in usbphy_attach()
757 device_printf(sc->dev, "Cannot get 'utmi-pads' clock\n"); in usbphy_attach()
761 rv = hwreset_deassert(sc->reset_usb); in usbphy_attach()
767 rv = clk_enable(sc->clk_pllu); in usbphy_attach()
769 device_printf(sc->dev, "Cannot enable 'pllu' clock\n"); in usbphy_attach()
772 rv = clk_enable(sc->clk_reg); in usbphy_attach()
774 device_printf(sc->dev, "Cannot enable 'reg' clock\n"); in usbphy_attach()
777 if (OF_hasprop(node, "nvidia,has-utmi-pad-registers")) in usbphy_attach()
778 sc->have_utmi_regs = true; in usbphy_attach()
780 sc->dr_mode = usb_get_dr_mode(dev, node, "dr_mode"); in usbphy_attach()
781 if (sc->dr_mode == USB_DR_MODE_UNKNOWN) in usbphy_attach()
782 sc->dr_mode = USB_DR_MODE_HOST; in usbphy_attach()
784 sc->ifc_type = usb_get_ifc_mode(dev, node, "phy_type"); in usbphy_attach()
786 /* We supports only utmi phy mode for now .... */ in usbphy_attach()
787 if (sc->ifc_type != USB_IFC_TYPE_UTMI) { in usbphy_attach()
795 if (OF_hasprop(node, "vbus-supply")) { in usbphy_attach()
796 rv = regulator_get_by_ofw_property(sc->dev, 0, "vbus-supply", in usbphy_attach()
797 &sc->supply_vbus); in usbphy_attach()
799 device_printf(sc->dev, in usbphy_attach()
803 rv = regulator_enable(sc->supply_vbus); in usbphy_attach()
805 device_printf(sc->dev, in usbphy_attach()
817 device_printf(sc->dev, "Cannot create phy\n"); in usbphy_attach()
821 device_printf(sc->dev, "Cannot create phy\n"); in usbphy_attach()