Lines Matching full:usb

48 #include <linux/usb.h>
51 #include <linux/usb/hcd.h>
63 * enum cvmx_usb_speed - the possible USB device speeds
76 * enum cvmx_usb_transfer - the possible USB transfer types
78 * @CVMX_USB_TRANSFER_CONTROL: USB transfer type control for hub and status
80 * @CVMX_USB_TRANSFER_ISOCHRONOUS: USB transfer type isochronous for low
82 * @CVMX_USB_TRANSFER_BULK: USB transfer type bulk for large low priority
84 * @CVMX_USB_TRANSFER_INTERRUPT: USB transfer type interrupt for high priority
115 * @CVMX_USB_STATUS_STALL: The transaction received a USB STALL response
138 * struct cvmx_usb_port_status - the USB port status information
140 * @port_enabled: 1 = Usb port is enabled, 0 = disabled
179 * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI: The USB port uses a 12MHz crystal
182 * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND: The USB port uses 12/24/48MHz 2.5V
191 * data transfer use for the USB
220 /* Maximum number of hardware channels supported by the USB block */
255 * struct cvmx_usb_transaction - describes each pending USB transaction
293 * and some USB device. It contains a list of pending
308 * @device_addr: USB device address at other end of pipe
309 * @endpoint_num: USB endpoint number at other end of pipe
349 * struct octeon_hcd - the state of the USB block
353 * index: Which USB block this is for.
391 c.u32 = cvmx_usb_read_csr32(usb, address); \
393 cvmx_usb_write_csr32(usb, address, c.u32); \
401 * struct octeon_temp_buffer - a bounce buffer for USB transfers
402 * @orig_buffer: the original buffer passed by the USB stack
420 * octeon_alloc_temp_buffer - allocate a temporary buffer for USB transfer
453 * octeon_free_temp_buffer - free a temporary buffer used by USB transfers.
483 * @hcd: USB HCD structure.
505 * @hcd: USB HCD structure.
515 * Read a USB 32bit CSR. It performs the necessary address swizzle
519 * @usb: USB block this access is for
524 static inline u32 cvmx_usb_read_csr32(struct octeon_hcd *usb, u64 address) in cvmx_usb_read_csr32() argument
530 * Write a USB 32bit CSR. It performs the necessary address
534 * @usb: USB block this access is for
538 static inline void cvmx_usb_write_csr32(struct octeon_hcd *usb, in cvmx_usb_write_csr32() argument
542 cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index)); in cvmx_usb_write_csr32()
549 * @usb: USB block this access is for
554 static inline int cvmx_usb_pipe_needs_split(struct octeon_hcd *usb, in cvmx_usb_pipe_needs_split() argument
558 usb->usbcx_hprt.s.prtspd == CVMX_USB_SPEED_HIGH; in cvmx_usb_pipe_needs_split()
576 static int cvmx_wait_tx_rx(struct octeon_hcd *usb, int fflsh_type) in cvmx_wait_tx_rx() argument
579 u64 address = CVMX_USBCX_GRSTCTL(usb->index); in cvmx_wait_tx_rx()
585 c.u32 = cvmx_usb_read_csr32(usb, address); in cvmx_wait_tx_rx()
602 static void cvmx_fifo_setup(struct octeon_hcd *usb) in cvmx_fifo_setup() argument
608 usbcx_ghwcfg3.u32 = cvmx_usb_read_csr32(usb, in cvmx_fifo_setup()
609 CVMX_USBCX_GHWCFG3(usb->index)); in cvmx_fifo_setup()
615 USB_SET_FIELD32(CVMX_USBCX_GRXFSIZ(usb->index), cvmx_usbcx_grxfsiz, in cvmx_fifo_setup()
623 npsiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index)); in cvmx_fifo_setup()
626 cvmx_usb_write_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index), npsiz.u32); in cvmx_fifo_setup()
633 psiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index)); in cvmx_fifo_setup()
636 cvmx_usb_write_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index), psiz.u32); in cvmx_fifo_setup()
639 USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), in cvmx_fifo_setup()
641 USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), in cvmx_fifo_setup()
643 cvmx_wait_tx_rx(usb, 0); in cvmx_fifo_setup()
644 USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index), in cvmx_fifo_setup()
646 cvmx_wait_tx_rx(usb, 1); in cvmx_fifo_setup()
650 * Shutdown a USB port after a call to cvmx_usb_initialize().
654 * @usb: USB device state populated by cvmx_usb_initialize().
658 static int cvmx_usb_shutdown(struct octeon_hcd *usb) in cvmx_usb_shutdown() argument
663 if (!list_empty(&usb->idle_pipes) || in cvmx_usb_shutdown()
664 !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_ISOCHRONOUS]) || in cvmx_usb_shutdown()
665 !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_INTERRUPT]) || in cvmx_usb_shutdown()
666 !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_CONTROL]) || in cvmx_usb_shutdown()
667 !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_BULK])) in cvmx_usb_shutdown()
671 usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index)); in cvmx_usb_shutdown()
677 cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); in cvmx_usb_shutdown()
682 * Initialize a USB port for use. This must be called before any
683 * other access to the Octeon USB port is made. The port starts
687 * @usb: Pointer to struct octeon_hcd.
692 struct octeon_hcd *usb) in cvmx_usb_initialize() argument
714 usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index)); in cvmx_usb_initialize()
721 * 2b. Select the USB reference clock/crystal parameters by writing in cvmx_usb_initialize()
724 if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND) { in cvmx_usb_initialize()
726 * The USB port uses 12/24/48MHz 2.5V board clock in cvmx_usb_initialize()
739 switch (usb->init_flags & in cvmx_usb_initialize()
753 * The USB port uses a 12MHz crystal as clock source in cvmx_usb_initialize()
768 * such that USB is as close as possible to 125Mhz in cvmx_usb_initialize()
776 cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); in cvmx_usb_initialize()
780 cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); in cvmx_usb_initialize()
789 cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); in cvmx_usb_initialize()
798 cvmx_read64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index)); in cvmx_usb_initialize()
800 cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index), in cvmx_usb_initialize()
809 cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index), in cvmx_usb_initialize()
816 cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); in cvmx_usb_initialize()
823 cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index), in cvmx_usb_initialize()
832 cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); in cvmx_usb_initialize()
833 /* 12. Proceed to USB core initialization */ in cvmx_usb_initialize()
835 cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); in cvmx_usb_initialize()
839 * USB Core Initialization in cvmx_usb_initialize()
842 * determine USB core configuration parameters. in cvmx_usb_initialize()
857 usbcx_gahbcfg.s.dmaen = !(usb->init_flags & in cvmx_usb_initialize()
863 cvmx_usb_write_csr32(usb, CVMX_USBCX_GAHBCFG(usb->index), in cvmx_usb_initialize()
870 * USB turnaround time, USBC_GUSBCFG[USBTRDTIM] = 0x5 in cvmx_usb_initialize()
873 usbcx_gusbcfg.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_initialize()
874 CVMX_USBCX_GUSBCFG(usb->index)); in cvmx_usb_initialize()
879 cvmx_usb_write_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index), in cvmx_usb_initialize()
888 usbcx_gintmsk.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_initialize()
889 CVMX_USBCX_GINTMSK(usb->index)); in cvmx_usb_initialize()
895 if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) in cvmx_usb_initialize()
897 cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTMSK(usb->index), in cvmx_usb_initialize()
904 cvmx_usb_write_csr32(usb, in cvmx_usb_initialize()
905 CVMX_USBCX_HCINTMSKX(channel, usb->index), in cvmx_usb_initialize()
914 USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), in cvmx_usb_initialize()
916 USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), in cvmx_usb_initialize()
923 usbcx_hcfg.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCFG(usb->index)); in cvmx_usb_initialize()
926 cvmx_usb_write_csr32(usb, CVMX_USBCX_HCFG(usb->index), usbcx_hcfg.u32); in cvmx_usb_initialize()
928 cvmx_fifo_setup(usb); in cvmx_usb_initialize()
935 usbc_gintsts.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_initialize()
936 CVMX_USBCX_GINTSTS(usb->index)); in cvmx_usb_initialize()
937 cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index), in cvmx_usb_initialize()
947 cvmx_usb_shutdown(usb); in cvmx_usb_initialize()
953 * Reset a USB port. After this call succeeds, the USB port is
956 * @usb: USB device state populated by cvmx_usb_initialize().
958 static void cvmx_usb_reset_port(struct octeon_hcd *usb) in cvmx_usb_reset_port() argument
960 usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_reset_port()
961 CVMX_USBCX_HPRT(usb->index)); in cvmx_usb_reset_port()
964 USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt, in cvmx_usb_reset_port()
974 USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt, in cvmx_usb_reset_port()
981 usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_reset_port()
982 CVMX_USBCX_HPRT(usb->index)); in cvmx_usb_reset_port()
986 * Disable a USB port. After this call the USB port will not
991 * @usb: USB device state populated by cvmx_usb_initialize().
995 static int cvmx_usb_disable(struct octeon_hcd *usb) in cvmx_usb_disable() argument
998 USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt, in cvmx_usb_disable()
1004 * Get the current state of the USB port. Use this call to
1005 * determine if the usb port has anything connected, is enabled,
1010 * @usb: USB device state populated by cvmx_usb_initialize().
1014 static struct cvmx_usb_port_status cvmx_usb_get_status(struct octeon_hcd *usb) in cvmx_usb_get_status() argument
1021 usbc_hprt.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index)); in cvmx_usb_get_status()
1028 result.connected != usb->port_status.connected; in cvmx_usb_get_status()
1034 * Open a virtual pipe between the host and a USB device. A pipe
1038 * @usb: USB device state populated by cvmx_usb_initialize().
1040 * USB device address to open the pipe to
1043 * USB endpoint number to open the pipe to
1085 static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct octeon_hcd *usb, in cvmx_usb_open_pipe() argument
1122 if (cvmx_usb_pipe_needs_split(usb, pipe)) { in cvmx_usb_open_pipe()
1125 pipe->next_tx_frame = ((usb->frame_number + 7) & ~7) + in cvmx_usb_open_pipe()
1129 pipe->next_tx_frame = usb->frame_number + pipe->interval; in cvmx_usb_open_pipe()
1136 list_add_tail(&pipe->node, &usb->idle_pipes); in cvmx_usb_open_pipe()
1151 * @usb: USB device state populated by cvmx_usb_initialize().
1153 static void cvmx_usb_poll_rx_fifo(struct octeon_hcd *usb) in cvmx_usb_poll_rx_fifo() argument
1161 rx_status.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_poll_rx_fifo()
1162 CVMX_USBCX_GRXSTSPH(usb->index)); in cvmx_usb_poll_rx_fifo()
1176 address = cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) + in cvmx_usb_poll_rx_fifo()
1180 cvmx_write64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) + channel * 8, in cvmx_usb_poll_rx_fifo()
1185 *ptr++ = cvmx_usb_read_csr32(usb, in cvmx_usb_poll_rx_fifo()
1186 USB_FIFO_ADDRESS(channel, usb->index)); in cvmx_usb_poll_rx_fifo()
1196 * @usb: USB device state populated by cvmx_usb_initialize().
1203 static int cvmx_usb_fill_tx_hw(struct octeon_hcd *usb, in cvmx_usb_fill_tx_hw() argument
1214 usb->index) ^ 4; in cvmx_usb_fill_tx_hw()
1238 cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index)); in cvmx_usb_fill_tx_hw()
1247 cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index)); in cvmx_usb_fill_tx_hw()
1255 * @usb: USB device state populated by cvmx_usb_initialize().
1257 static void cvmx_usb_poll_tx_fifo(struct octeon_hcd *usb) in cvmx_usb_poll_tx_fifo() argument
1259 if (usb->periodic.head != usb->periodic.tail) { in cvmx_usb_poll_tx_fifo()
1262 tx_status.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_poll_tx_fifo()
1263 CVMX_USBCX_HPTXSTS(usb->index)); in cvmx_usb_poll_tx_fifo()
1264 if (cvmx_usb_fill_tx_hw(usb, &usb->periodic, in cvmx_usb_poll_tx_fifo()
1266 USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), in cvmx_usb_poll_tx_fifo()
1269 USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), in cvmx_usb_poll_tx_fifo()
1273 if (usb->nonperiodic.head != usb->nonperiodic.tail) { in cvmx_usb_poll_tx_fifo()
1276 tx_status.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_poll_tx_fifo()
1277 CVMX_USBCX_GNPTXSTS(usb->index)); in cvmx_usb_poll_tx_fifo()
1278 if (cvmx_usb_fill_tx_hw(usb, &usb->nonperiodic, in cvmx_usb_poll_tx_fifo()
1280 USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), in cvmx_usb_poll_tx_fifo()
1283 USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), in cvmx_usb_poll_tx_fifo()
1291 * @usb: USB device state populated by cvmx_usb_initialize().
1294 static void cvmx_usb_fill_tx_fifo(struct octeon_hcd *usb, int channel) in cvmx_usb_fill_tx_fifo() argument
1302 hcchar.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_fill_tx_fifo()
1303 CVMX_USBCX_HCCHARX(channel, usb->index)); in cvmx_usb_fill_tx_fifo()
1308 usbc_hcsplt.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_fill_tx_fifo()
1309 CVMX_USBCX_HCSPLTX(channel, usb->index)); in cvmx_usb_fill_tx_fifo()
1317 usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_fill_tx_fifo()
1318 CVMX_USBCX_HCTSIZX(channel, usb->index)); in cvmx_usb_fill_tx_fifo()
1324 fifo = &usb->periodic; in cvmx_usb_fill_tx_fifo()
1326 fifo = &usb->nonperiodic; in cvmx_usb_fill_tx_fifo()
1330 cvmx_read64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) + in cvmx_usb_fill_tx_fifo()
1337 cvmx_usb_poll_tx_fifo(usb); in cvmx_usb_fill_tx_fifo()
1344 * @usb: USB device state populated by cvmx_usb_initialize().
1348 static void cvmx_usb_start_channel_control(struct octeon_hcd *usb, in cvmx_usb_start_channel_control() argument
1352 struct usb_hcd *hcd = octeon_to_hcd(usb); in cvmx_usb_start_channel_control()
1364 usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_start_channel_control()
1365 CVMX_USBCX_HCTSIZX(channel, usb->index)); in cvmx_usb_start_channel_control()
1376 USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), in cvmx_usb_start_channel_control()
1383 cvmx_write64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) + in cvmx_usb_start_channel_control()
1391 USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), in cvmx_usb_start_channel_control()
1395 USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index), in cvmx_usb_start_channel_control()
1400 if (cvmx_usb_pipe_needs_split(usb, pipe)) { in cvmx_usb_start_channel_control()
1406 USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), in cvmx_usb_start_channel_control()
1416 USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), in cvmx_usb_start_channel_control()
1421 USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index), in cvmx_usb_start_channel_control()
1427 USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), in cvmx_usb_start_channel_control()
1436 USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), in cvmx_usb_start_channel_control()
1441 USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index), in cvmx_usb_start_channel_control()
1465 (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) { in cvmx_usb_start_channel_control()
1485 cvmx_usb_write_csr32(usb, CVMX_USBCX_HCTSIZX(channel, usb->index), in cvmx_usb_start_channel_control()
1492 * @usb: USB device state populated by cvmx_usb_initialize().
1496 static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel, in cvmx_usb_start_channel() argument
1507 usb->pipe_for_channel[channel] = pipe; in cvmx_usb_start_channel()
1512 usb->idle_hardware_channels &= ~(1 << channel); in cvmx_usb_start_channel()
1521 usbc_hcint.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_start_channel()
1522 CVMX_USBCX_HCINTX(channel, usb->index)); in cvmx_usb_start_channel()
1524 cvmx_usb_write_csr32(usb, in cvmx_usb_start_channel()
1525 CVMX_USBCX_HCINTX(channel, usb->index), in cvmx_usb_start_channel()
1530 if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) { in cvmx_usb_start_channel()
1539 if (cvmx_usb_pipe_needs_split(usb, pipe)) { in cvmx_usb_start_channel()
1551 cvmx_usb_write_csr32(usb, in cvmx_usb_start_channel()
1552 CVMX_USBCX_HCINTMSKX(channel, usb->index), in cvmx_usb_start_channel()
1556 usbc_haintmsk.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_start_channel()
1557 CVMX_USBCX_HAINTMSK(usb->index)); in cvmx_usb_start_channel()
1559 cvmx_usb_write_csr32(usb, CVMX_USBCX_HAINTMSK(usb->index), in cvmx_usb_start_channel()
1575 reg = CVMX_USBNX_DMA0_OUTB_CHN0(usb->index); in cvmx_usb_start_channel()
1577 reg = CVMX_USBNX_DMA0_INB_CHN0(usb->index); in cvmx_usb_start_channel()
1602 if (cvmx_usb_pipe_needs_split(usb, pipe)) { in cvmx_usb_start_channel()
1612 (usb->frame_number + 1) & 0x7f; in cvmx_usb_start_channel()
1615 (usb->frame_number + 2) & 0x7f; in cvmx_usb_start_channel()
1708 (usb->init_flags & in cvmx_usb_start_channel()
1740 cvmx_usb_write_csr32(usb, in cvmx_usb_start_channel()
1741 CVMX_USBCX_HCSPLTX(channel, usb->index), in cvmx_usb_start_channel()
1743 cvmx_usb_write_csr32(usb, in cvmx_usb_start_channel()
1744 CVMX_USBCX_HCTSIZX(channel, usb->index), in cvmx_usb_start_channel()
1756 usbc_hcchar.s.oddfrm = usb->frame_number & 1; in cvmx_usb_start_channel()
1764 if (cvmx_usb_pipe_needs_split(usb, pipe)) in cvmx_usb_start_channel()
1781 cvmx_usb_write_csr32(usb, in cvmx_usb_start_channel()
1782 CVMX_USBCX_HCCHARX(channel, usb->index), in cvmx_usb_start_channel()
1789 cvmx_usb_start_channel_control(usb, channel, pipe); in cvmx_usb_start_channel()
1795 if (!cvmx_usb_pipe_needs_split(usb, pipe)) { in cvmx_usb_start_channel()
1804 usb->index), in cvmx_usb_start_channel()
1809 usb->index), in cvmx_usb_start_channel()
1817 cvmx_usb_read_csr32(usb, in cvmx_usb_start_channel()
1819 usb->index)) in cvmx_usb_start_channel()
1825 if (cvmx_usb_pipe_needs_split(usb, pipe)) in cvmx_usb_start_channel()
1826 usb->active_split = transaction; in cvmx_usb_start_channel()
1827 USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index), in cvmx_usb_start_channel()
1829 if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) in cvmx_usb_start_channel()
1830 cvmx_usb_fill_tx_fifo(usb, channel); in cvmx_usb_start_channel()
1835 * @usb: USB device state populated by cvmx_usb_initialize().
1840 static struct cvmx_usb_pipe *cvmx_usb_find_ready_pipe(struct octeon_hcd *usb, in cvmx_usb_find_ready_pipe() argument
1843 struct list_head *list = usb->active_pipes + xfer_type; in cvmx_usb_find_ready_pipe()
1844 u64 current_frame = usb->frame_number; in cvmx_usb_find_ready_pipe()
1856 (!usb->active_split || (usb->active_split == t))) { in cvmx_usb_find_ready_pipe()
1864 static struct cvmx_usb_pipe *cvmx_usb_next_pipe(struct octeon_hcd *usb, in cvmx_usb_next_pipe() argument
1876 pipe = cvmx_usb_find_ready_pipe(usb, in cvmx_usb_next_pipe()
1880 pipe = cvmx_usb_find_ready_pipe(usb, in cvmx_usb_next_pipe()
1885 pipe = cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_CONTROL); in cvmx_usb_next_pipe()
1888 return cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_BULK); in cvmx_usb_next_pipe()
1895 * @usb: USB device state populated by cvmx_usb_initialize().
1898 static void cvmx_usb_schedule(struct octeon_hcd *usb, int is_sof) in cvmx_usb_schedule() argument
1905 if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) { in cvmx_usb_schedule()
1911 .u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_schedule()
1912 CVMX_USBCX_HFNUM(usb->index)) in cvmx_usb_schedule()
1916 .u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_schedule()
1917 CVMX_USBCX_HFIR(usb->index)) in cvmx_usb_schedule()
1924 while (usb->idle_hardware_channels) { in cvmx_usb_schedule()
1926 channel = __fls(usb->idle_hardware_channels); in cvmx_usb_schedule()
1930 pipe = cvmx_usb_next_pipe(usb, is_sof); in cvmx_usb_schedule()
1934 cvmx_usb_start_channel(usb, channel, pipe); in cvmx_usb_schedule()
1945 list_for_each_entry(pipe, &usb->active_pipes[ttype], node) { in cvmx_usb_schedule()
1946 if (pipe->next_tx_frame > usb->frame_number) { in cvmx_usb_schedule()
1952 USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), in cvmx_usb_schedule()
1956 static void octeon_usb_urb_complete_callback(struct octeon_hcd *usb, in octeon_usb_urb_complete_callback() argument
1964 struct usb_hcd *hcd = octeon_to_hcd(usb); in octeon_usb_urb_complete_callback()
2039 usb_hcd_unlink_urb_from_ep(octeon_to_hcd(usb), urb); in octeon_usb_urb_complete_callback()
2040 spin_unlock(&usb->lock); in octeon_usb_urb_complete_callback()
2041 usb_hcd_giveback_urb(octeon_to_hcd(usb), urb, urb->status); in octeon_usb_urb_complete_callback()
2042 spin_lock(&usb->lock); in octeon_usb_urb_complete_callback()
2049 * @usb: USB device state populated by cvmx_usb_initialize().
2056 static void cvmx_usb_complete(struct octeon_hcd *usb, in cvmx_usb_complete() argument
2062 if (usb->active_split == transaction) in cvmx_usb_complete()
2063 usb->active_split = NULL; in cvmx_usb_complete()
2094 list_move_tail(&pipe->node, &usb->idle_pipes); in cvmx_usb_complete()
2095 octeon_usb_urb_complete_callback(usb, complete_code, pipe, in cvmx_usb_complete()
2103 * Submit a usb transaction to a pipe. Called for all types
2106 * @usb:
2125 struct octeon_hcd *usb, in cvmx_usb_submit_transaction() argument
2164 &usb->active_pipes[pipe->transfer_type]); in cvmx_usb_submit_transaction()
2170 cvmx_usb_schedule(usb, 0); in cvmx_usb_submit_transaction()
2177 * Call to submit a USB Bulk transfer to a pipe.
2179 * @usb: USB device state populated by cvmx_usb_initialize().
2186 struct octeon_hcd *usb, in cvmx_usb_submit_bulk() argument
2190 return cvmx_usb_submit_transaction(usb, pipe, CVMX_USB_TRANSFER_BULK, in cvmx_usb_submit_bulk()
2201 * Call to submit a USB Interrupt transfer to a pipe.
2203 * @usb: USB device state populated by cvmx_usb_initialize().
2210 struct octeon_hcd *usb, in cvmx_usb_submit_interrupt() argument
2214 return cvmx_usb_submit_transaction(usb, pipe, in cvmx_usb_submit_interrupt()
2226 * Call to submit a USB Control transfer to a pipe.
2228 * @usb: USB device state populated by cvmx_usb_initialize().
2235 struct octeon_hcd *usb, in cvmx_usb_submit_control() argument
2246 return cvmx_usb_submit_transaction(usb, pipe, in cvmx_usb_submit_control()
2257 * Call to submit a USB Isochronous transfer to a pipe.
2259 * @usb: USB device state populated by cvmx_usb_initialize().
2266 struct octeon_hcd *usb, in cvmx_usb_submit_isochronous() argument
2273 return cvmx_usb_submit_transaction(usb, pipe, in cvmx_usb_submit_isochronous()
2290 * @usb: USB device state populated by cvmx_usb_initialize().
2296 static int cvmx_usb_cancel(struct octeon_hcd *usb, in cvmx_usb_cancel() argument
2308 usb->pipe_for_channel[pipe->channel] = NULL; in cvmx_usb_cancel()
2313 usbc_hcchar.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_cancel()
2315 usb->index)); in cvmx_usb_cancel()
2322 cvmx_usb_write_csr32(usb, in cvmx_usb_cancel()
2324 usb->index), in cvmx_usb_cancel()
2328 cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_CANCEL); in cvmx_usb_cancel()
2336 * @usb: USB device state populated by cvmx_usb_initialize().
2341 static int cvmx_usb_cancel_all(struct octeon_hcd *usb, in cvmx_usb_cancel_all() argument
2348 int result = cvmx_usb_cancel(usb, pipe, transaction); in cvmx_usb_cancel_all()
2359 * @usb: USB device state populated by cvmx_usb_initialize().
2365 static int cvmx_usb_close_pipe(struct octeon_hcd *usb, in cvmx_usb_close_pipe() argument
2379 * Get the current USB protocol level frame number. The frame
2382 * @usb: USB device state populated by cvmx_usb_initialize().
2384 * Returns: USB frame number
2386 static int cvmx_usb_get_frame_number(struct octeon_hcd *usb) in cvmx_usb_get_frame_number() argument
2390 usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index)); in cvmx_usb_get_frame_number()
2395 static void cvmx_usb_transfer_control(struct octeon_hcd *usb, in cvmx_usb_transfer_control() argument
2406 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_transfer_control()
2411 if (cvmx_usb_pipe_needs_split(usb, pipe)) { in cvmx_usb_transfer_control()
2434 if (cvmx_usb_pipe_needs_split(usb, pipe)) { in cvmx_usb_transfer_control()
2466 if (cvmx_usb_pipe_needs_split(usb, pipe)) in cvmx_usb_transfer_control()
2470 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_transfer_control()
2474 cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK); in cvmx_usb_transfer_control()
2479 static void cvmx_usb_transfer_bulk(struct octeon_hcd *usb, in cvmx_usb_transfer_bulk() argument
2491 if (cvmx_usb_pipe_needs_split(usb, pipe)) { in cvmx_usb_transfer_bulk()
2499 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_transfer_bulk()
2508 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_transfer_bulk()
2513 static void cvmx_usb_transfer_intr(struct octeon_hcd *usb, in cvmx_usb_transfer_intr() argument
2519 if (cvmx_usb_pipe_needs_split(usb, pipe)) { in cvmx_usb_transfer_intr()
2528 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_transfer_intr()
2534 cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK); in cvmx_usb_transfer_intr()
2538 static void cvmx_usb_transfer_isoc(struct octeon_hcd *usb, in cvmx_usb_transfer_isoc() argument
2545 if (cvmx_usb_pipe_needs_split(usb, pipe)) { in cvmx_usb_transfer_isoc()
2560 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_transfer_isoc()
2574 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_transfer_isoc()
2583 cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK); in cvmx_usb_transfer_isoc()
2590 * @usb: USB device
2595 static int cvmx_usb_poll_channel(struct octeon_hcd *usb, int channel) in cvmx_usb_poll_channel() argument
2597 struct usb_hcd *hcd = octeon_to_hcd(usb); in cvmx_usb_poll_channel()
2610 usbc_hcint.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_poll_channel()
2611 CVMX_USBCX_HCINTX(channel, usb->index)); in cvmx_usb_poll_channel()
2613 if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) { in cvmx_usb_poll_channel()
2614 usbc_hcchar.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_poll_channel()
2616 usb->index)); in cvmx_usb_poll_channel()
2624 cvmx_usb_write_csr32(usb, in cvmx_usb_poll_channel()
2626 usb->index), in cvmx_usb_poll_channel()
2641 cvmx_usb_write_csr32(usb, in cvmx_usb_poll_channel()
2642 CVMX_USBCX_HCINTMSKX(channel, usb->index), in cvmx_usb_poll_channel()
2645 cvmx_usb_write_csr32(usb, in cvmx_usb_poll_channel()
2646 CVMX_USBCX_HCCHARX(channel, usb->index), in cvmx_usb_poll_channel()
2655 dev_err(dev, "USB%d: Channel %d interrupt without halt\n", in cvmx_usb_poll_channel()
2656 usb->index, channel); in cvmx_usb_poll_channel()
2670 cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTMSKX(channel, usb->index), 0); in cvmx_usb_poll_channel()
2671 usb->idle_hardware_channels |= (1 << channel); in cvmx_usb_poll_channel()
2674 pipe = usb->pipe_for_channel[channel]; in cvmx_usb_poll_channel()
2687 usb->pipe_for_channel[channel] = NULL; in cvmx_usb_poll_channel()
2694 usbc_hcchar.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_poll_channel()
2695 CVMX_USBCX_HCCHARX(channel, usb->index)); in cvmx_usb_poll_channel()
2696 usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_poll_channel()
2697 CVMX_USBCX_HCTSIZX(channel, usb->index)); in cvmx_usb_poll_channel()
2779 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_poll_channel()
2792 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_poll_channel()
2800 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_poll_channel()
2804 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_poll_channel()
2808 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_poll_channel()
2817 if (!cvmx_usb_pipe_needs_split(usb, pipe)) { in cvmx_usb_poll_channel()
2825 cvmx_usb_complete(usb, pipe, in cvmx_usb_poll_channel()
2861 cvmx_usb_transfer_control(usb, pipe, transaction, in cvmx_usb_poll_channel()
2867 cvmx_usb_transfer_bulk(usb, pipe, transaction, in cvmx_usb_poll_channel()
2872 cvmx_usb_transfer_intr(usb, pipe, transaction, in cvmx_usb_poll_channel()
2877 cvmx_usb_transfer_isoc(usb, pipe, transaction, in cvmx_usb_poll_channel()
2887 if (usb->active_split == transaction) in cvmx_usb_poll_channel()
2888 usb->active_split = NULL; in cvmx_usb_poll_channel()
2898 if (pipe->next_tx_frame < usb->frame_number) in cvmx_usb_poll_channel()
2899 pipe->next_tx_frame = usb->frame_number + in cvmx_usb_poll_channel()
2901 (usb->frame_number - pipe->next_tx_frame) % in cvmx_usb_poll_channel()
2906 port = cvmx_usb_get_status(usb); in cvmx_usb_poll_channel()
2915 cvmx_usb_complete(usb, pipe, transaction, in cvmx_usb_poll_channel()
2922 static void octeon_usb_port_callback(struct octeon_hcd *usb) in octeon_usb_port_callback() argument
2924 spin_unlock(&usb->lock); in octeon_usb_port_callback()
2925 usb_hcd_poll_rh_status(octeon_to_hcd(usb)); in octeon_usb_port_callback()
2926 spin_lock(&usb->lock); in octeon_usb_port_callback()
2930 * Poll the USB block for status and call all needed callback
2932 * handler for the USB controller. It can also be called
2935 * @usb: USB device state populated by cvmx_usb_initialize().
2939 static int cvmx_usb_poll(struct octeon_hcd *usb) in cvmx_usb_poll() argument
2944 prefetch_range(usb, sizeof(*usb)); in cvmx_usb_poll()
2947 usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index)); in cvmx_usb_poll()
2948 if ((usb->frame_number & 0x3fff) > usbc_hfnum.s.frnum) in cvmx_usb_poll()
2949 usb->frame_number += 0x4000; in cvmx_usb_poll()
2950 usb->frame_number &= ~0x3fffull; in cvmx_usb_poll()
2951 usb->frame_number |= usbc_hfnum.s.frnum; in cvmx_usb_poll()
2954 usbc_gintsts.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_poll()
2955 CVMX_USBCX_GINTSTS(usb->index)); in cvmx_usb_poll()
2958 cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index), in cvmx_usb_poll()
2969 if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) in cvmx_usb_poll()
2970 cvmx_usb_poll_rx_fifo(usb); in cvmx_usb_poll()
2974 if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) in cvmx_usb_poll()
2975 cvmx_usb_poll_tx_fifo(usb); in cvmx_usb_poll()
2985 * one of the O2P USB core ports in Host mode. The application in cvmx_usb_poll()
2993 octeon_usb_port_callback(usb); in cvmx_usb_poll()
2996 cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index)); in cvmx_usb_poll()
2998 cvmx_usb_write_csr32(usb, CVMX_USBCX_HPRT(usb->index), in cvmx_usb_poll()
3016 usbc_haint.u32 = cvmx_usb_read_csr32(usb, in cvmx_usb_poll()
3017 CVMX_USBCX_HAINT(usb->index)); in cvmx_usb_poll()
3022 cvmx_usb_poll_channel(usb, channel); in cvmx_usb_poll()
3027 cvmx_usb_schedule(usb, usbc_gintsts.s.sof); in cvmx_usb_poll()
3040 struct octeon_hcd *usb = hcd_to_octeon(hcd); in octeon_usb_irq() local
3043 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_irq()
3044 cvmx_usb_poll(usb); in octeon_usb_irq()
3045 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_irq()
3062 struct octeon_hcd *usb = hcd_to_octeon(hcd); in octeon_usb_get_frame_number() local
3064 return cvmx_usb_get_frame_number(usb); in octeon_usb_get_frame_number()
3071 struct octeon_hcd *usb = hcd_to_octeon(hcd); in octeon_usb_urb_enqueue() local
3081 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_urb_enqueue()
3085 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_urb_enqueue()
3127 * Start at this device and work our way up the usb in octeon_usb_urb_enqueue()
3151 pipe = cvmx_usb_open_pipe(usb, usb_pipedevice(urb->pipe), in octeon_usb_urb_enqueue()
3165 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_urb_enqueue()
3202 transaction = cvmx_usb_submit_isochronous(usb, in octeon_usb_urb_enqueue()
3218 transaction = cvmx_usb_submit_interrupt(usb, pipe, urb); in octeon_usb_urb_enqueue()
3224 transaction = cvmx_usb_submit_control(usb, pipe, urb); in octeon_usb_urb_enqueue()
3230 transaction = cvmx_usb_submit_bulk(usb, pipe, urb); in octeon_usb_urb_enqueue()
3235 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_urb_enqueue()
3240 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_urb_enqueue()
3248 struct octeon_hcd *usb = hcd_to_octeon(hcd); in octeon_usb_urb_dequeue() local
3255 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_urb_dequeue()
3262 cvmx_usb_cancel(usb, urb->ep->hcpriv, urb->hcpriv); in octeon_usb_urb_dequeue()
3265 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_urb_dequeue()
3276 struct octeon_hcd *usb = hcd_to_octeon(hcd); in octeon_usb_endpoint_disable() local
3280 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_endpoint_disable()
3281 cvmx_usb_cancel_all(usb, pipe); in octeon_usb_endpoint_disable()
3282 if (cvmx_usb_close_pipe(usb, pipe)) in octeon_usb_endpoint_disable()
3284 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_endpoint_disable()
3291 struct octeon_hcd *usb = hcd_to_octeon(hcd); in octeon_usb_hub_status_data() local
3295 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_hub_status_data()
3296 port_status = cvmx_usb_get_status(usb); in octeon_usb_hub_status_data()
3297 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_hub_status_data()
3306 struct octeon_hcd *usb = hcd_to_octeon(hcd); in octeon_usb_hub_control() local
3335 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_hub_control()
3336 cvmx_usb_disable(usb); in octeon_usb_hub_control()
3337 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_hub_control()
3354 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_hub_control()
3355 usb->port_status = cvmx_usb_get_status(usb); in octeon_usb_hub_control()
3356 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_hub_control()
3363 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_hub_control()
3364 usb->port_status = cvmx_usb_get_status(usb); in octeon_usb_hub_control()
3365 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_hub_control()
3373 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_hub_control()
3374 usb->port_status = cvmx_usb_get_status(usb); in octeon_usb_hub_control()
3375 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_hub_control()
3388 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_hub_control()
3389 usb->port_status = cvmx_usb_get_status(usb); in octeon_usb_hub_control()
3390 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_hub_control()
3420 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_hub_control()
3421 usb_port_status = cvmx_usb_get_status(usb); in octeon_usb_hub_control()
3422 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_hub_control()
3483 * Program the port power bit to drive VBUS on the USB. in octeon_usb_hub_control()
3485 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_hub_control()
3486 USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), in octeon_usb_hub_control()
3488 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_hub_control()
3492 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_hub_control()
3493 cvmx_usb_reset_port(usb); in octeon_usb_hub_control()
3494 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_hub_control()
3513 .description = "Octeon USB",
3539 struct octeon_hcd *usb; in octeon_usb_probe() local
3614 * Only cn52XX and cn56XX have DWC_OTG USB hardware and the in octeon_usb_probe()
3615 * IOB priority registers. Under heavy network load USB in octeon_usb_probe()
3639 usb = (struct octeon_hcd *)hcd->hcd_priv; in octeon_usb_probe()
3641 spin_lock_init(&usb->lock); in octeon_usb_probe()
3643 usb->init_flags = initialize_flags; in octeon_usb_probe()
3645 /* Initialize the USB state structure */ in octeon_usb_probe()
3646 usb->index = usb_num; in octeon_usb_probe()
3647 INIT_LIST_HEAD(&usb->idle_pipes); in octeon_usb_probe()
3648 for (i = 0; i < ARRAY_SIZE(usb->active_pipes); i++) in octeon_usb_probe()
3649 INIT_LIST_HEAD(&usb->active_pipes[i]); in octeon_usb_probe()
3653 usb->init_flags |= CVMX_USB_INITIALIZE_FLAGS_NO_DMA; in octeon_usb_probe()
3655 usb->idle_hardware_channels = 0x1; in octeon_usb_probe()
3658 usb->idle_hardware_channels = 0xf7; in octeon_usb_probe()
3660 usb->idle_hardware_channels = 0xff; in octeon_usb_probe()
3663 status = cvmx_usb_initialize(dev, usb); in octeon_usb_probe()
3665 dev_dbg(dev, "USB initialization failed with %d\n", status); in octeon_usb_probe()
3672 dev_dbg(dev, "USB add HCD failed with %d\n", status); in octeon_usb_probe()
3688 struct octeon_hcd *usb = hcd_to_octeon(hcd); in octeon_usb_remove() local
3692 spin_lock_irqsave(&usb->lock, flags); in octeon_usb_remove()
3693 status = cvmx_usb_shutdown(usb); in octeon_usb_remove()
3694 spin_unlock_irqrestore(&usb->lock, flags); in octeon_usb_remove()
3696 dev_dbg(dev, "USB shutdown failed with %d\n", status); in octeon_usb_remove()
3738 MODULE_DESCRIPTION("Cavium Inc. OCTEON USB Host driver.");