Index: uspace/drv/bus/usb/xhci/Makefile
===================================================================
--- uspace/drv/bus/usb/xhci/Makefile	(revision dfd313bd44244a2c64f7d5878bb1305fd70ed78b)
+++ uspace/drv/bus/usb/xhci/Makefile	(revision c9c0e4127425d563b96b6263d2bdee6502389e30)
@@ -46,4 +46,5 @@
 	trb_ring.c \
 	scratchpad.c \
+	commands.c \
 	main.c
 
Index: uspace/drv/bus/usb/xhci/commands.c
===================================================================
--- uspace/drv/bus/usb/xhci/commands.c	(revision c9c0e4127425d563b96b6263d2bdee6502389e30)
+++ uspace/drv/bus/usb/xhci/commands.c	(revision c9c0e4127425d563b96b6263d2bdee6502389e30)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2017 Jaroslav Jindrak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup drvusbxhci
+ * @{
+ */
+/** @file
+ * @brief Command sending functions.
+ */
+
+#include <errno.h>
+#include <str_error.h>
+#include <usb/debug.h>
+#include <usb/host/utils/malloc32.h>
+#include "commands.h"
+#include "debug.h"
+#include "hc.h"
+#include "hw_struct/trb.h"
+
+static int ring_doorbell(xhci_hc_t *hc, unsigned doorbell, unsigned target)
+{
+	uint32_t v = host2xhci(32, target & BIT_RRANGE(uint32_t, 7));
+	pio_write_32(&hc->db_arry[doorbell], v);
+	return EOK;
+}
+
+int xhci_send_no_op_command(xhci_hc_t *hc)
+{
+	xhci_trb_t trb;
+	memset(&trb, 0, sizeof(trb));
+
+	trb.control = host2xhci(32, XHCI_TRB_TYPE_NO_OP_CMD << 10);
+
+	xhci_trb_ring_enqueue(&hc->command_ring, &trb);
+	ring_doorbell(hc, 0, 0);
+
+	xhci_dump_trb(&trb);
+	usb_log_debug2("HC(%p): Sent TRB", hc);
+	return EOK;
+}
+
+int xhci_send_enable_slot_command(xhci_hc_t *hc)
+{
+	xhci_trb_t trb;
+	memset(&trb, 0, sizeof(trb));
+
+	trb.control = host2xhci(32, XHCI_TRB_TYPE_ENABLE_SLOT_CMD << 10);
+	trb.control |= host2xhci(32, XHCI_REG_RD(hc->xecp, XHCI_EC_SP_SLOT_TYPE) << 16);
+
+	// TODO: Setup input control context.
+
+	xhci_trb_ring_enqueue(&hc->command_ring, &trb);
+	ring_doorbell(hc, 0, 0);
+
+	xhci_dump_trb(&trb);
+	usb_log_debug2("HC(%p): Sent TRB", hc);
+	return EOK;
+}
+
+
+
+/**
+ * @}
+ */
Index: uspace/drv/bus/usb/xhci/commands.h
===================================================================
--- uspace/drv/bus/usb/xhci/commands.h	(revision c9c0e4127425d563b96b6263d2bdee6502389e30)
+++ uspace/drv/bus/usb/xhci/commands.h	(revision c9c0e4127425d563b96b6263d2bdee6502389e30)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2017 Jaroslav Jindrak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup drvusbxhci
+ * @{
+ */
+/** @file
+ * Utility functions used to place TRBs onto the command ring.
+ */
+
+#ifndef XHCI_COMMANDS_H
+#define XHCI_COMMANDS_H
+
+typedef struct xhci_hc xhci_hc_t;
+
+int xhci_send_no_op_command(xhci_hc_t *);
+int xhci_send_enable_slot_command(xhci_hc_t *);
+
+#endif
+
+
+
+/**
+ * @}
+ */
Index: uspace/drv/bus/usb/xhci/hc.c
===================================================================
--- uspace/drv/bus/usb/xhci/hc.c	(revision dfd313bd44244a2c64f7d5878bb1305fd70ed78b)
+++ uspace/drv/bus/usb/xhci/hc.c	(revision c9c0e4127425d563b96b6263d2bdee6502389e30)
@@ -42,4 +42,5 @@
 #include "hw_struct/trb.h"
 #include "scratchpad.h"
+#include "commands.h"
 
 static const irq_cmd_t irq_commands[] = {
@@ -347,30 +348,8 @@
 }
 
-static int ring_doorbell(xhci_hc_t *hc, unsigned doorbell, unsigned target)
-{
-	uint32_t v = host2xhci(32, target & BIT_RRANGE(uint32_t, 7));
-	pio_write_32(&hc->db_arry[doorbell], v);
-	return EOK;
-}
-
-static int send_no_op_command(xhci_hc_t *hc)
-{
-	xhci_trb_t trb;
-	memset(&trb, 0, sizeof(trb));
-
-	trb.control = host2xhci(32, XHCI_TRB_TYPE_NO_OP_CMD << 10);
-
-	xhci_trb_ring_enqueue(&hc->command_ring, &trb);
-	ring_doorbell(hc, 0, 0);
-
-	xhci_dump_trb(&trb);
-	usb_log_debug2("HC(%p): Sent TRB", hc);
-	return EOK;
-}
-
 int hc_schedule(xhci_hc_t *hc, usb_transfer_batch_t *batch)
 {
 	xhci_dump_state(hc);
-	send_no_op_command(hc);
+	xhci_send_no_op_command(hc);
 	async_usleep(1000);
 	xhci_dump_state(hc);
