/* Make the prev segment point to the next segment. Change the last TRB in the prev segment to be a Link TRB which points to the address of the next segment. The caller needs to set any Link TRB related flags, such as End TRB, Toggle Cycle, and no snoop. */
static void xhci_link_segments(struct xhci_segment *prev, struct xhci_segment *next, bool link_trbs)
/* Make the prev segment point to the next segment. Change the last TRB in the prev segment to be a Link TRB which points to the address of the next segment. The caller needs to set any Link TRB related flags, such as End TRB, Toggle Cycle, and no snoop. */
static void xhci_link_segments(struct xhci_segment *prev, struct xhci_segment *next, bool link_trbs)
{
	u32 val;
	u64 val_64 = 0;
	if (!prev || !next)
		return;
	prev->next = next;
	if (link_trbs) {
		val_64 = (uintptr_t)next->trbs;
		prev->trbs[TRBS_PER_SEGMENT-1].link.segment_ptr = val_64;
		val = le32_to_cpu(prev->trbs[TRBS_PER_SEGMENT-1].link.control);
		val &= ~TRB_TYPE_BITMASK;
		val |= (TRB_LINK << TRB_TYPE_SHIFT);
		prev->trbs[TRBS_PER_SEGMENT-1].link.control = cpu_to_le32(val);
	}
}