Index: uspace/drv/uhci-rhd/main.c
===================================================================
--- uspace/drv/uhci-rhd/main.c	(revision 67352d2ce57d0bbae9f4f2b0a767afb56ae158b6)
+++ uspace/drv/uhci-rhd/main.c	(revision f123909d82f100ce358a4d2d10ff2ecc24efcbda)
@@ -26,9 +26,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/** @addtogroup usb
+/** @addtogroup drvusbuhcirh
  * @{
  */
 /** @file
- * @brief UHCI driver
+ * @brief UHCI root hub initialization routines
  */
 #include <ddf/driver.h>
@@ -40,6 +40,4 @@
 #include <usb/debug.h>
 
-
-
 #include "root_hub.h"
 
@@ -47,4 +45,5 @@
 static int hc_get_my_registers(ddf_dev_t *dev,
     uintptr_t *io_reg_address, size_t *io_reg_size);
+#if 0
 /*----------------------------------------------------------------------------*/
 static int usb_iface_get_hc_handle(ddf_fun_t *fun, devman_handle_t *handle)
@@ -67,6 +66,7 @@
 	.interfaces[USB_DEV_IFACE] = &uhci_rh_usb_iface,
 };
+#endif
 /*----------------------------------------------------------------------------*/
-/** Initializes a new ddf driver instance of UHCI root hub.
+/** Initialize a new ddf driver instance of UHCI root hub.
  *
  * @param[in] device DDF instance of the device to initialize.
@@ -81,20 +81,20 @@
 
 	//device->ops = &uhci_rh_ops;
-	(void) uhci_rh_ops;
-
-	uhci_root_hub_t *rh = malloc(sizeof(uhci_root_hub_t));
-	if (!rh) {
-		usb_log_error("Failed to allocate memory for driver instance.\n");
-		return ENOMEM;
-	}
-
 	uintptr_t io_regs = 0;
 	size_t io_size = 0;
 
 	int ret = hc_get_my_registers(device, &io_regs, &io_size);
-	assert(ret == EOK);
+	if (ret != EOK) {
+		usb_log_error("Failed(%d) to get registers from parent hc.",
+		    ret);
+	}
+	usb_log_info("I/O regs at %#X (size %zu).\n", io_regs, io_size);
 
-	/* TODO: verify values from hc */
-	usb_log_info("I/O regs at 0x%X (size %zu).\n", io_regs, io_size);
+	uhci_root_hub_t *rh = malloc(sizeof(uhci_root_hub_t));
+	if (!rh) {
+		usb_log_error("Failed to allocate driver instance.\n");
+		return ENOMEM;
+	}
+
 	ret = uhci_root_hub_init(rh, (void*)io_regs, io_size, device);
 	if (ret != EOK) {
@@ -119,5 +119,5 @@
 };
 /*----------------------------------------------------------------------------*/
-/** Initializes global driver structures (NONE).
+/** Initialize global driver structures (NONE).
  *
  * @param[in] argc Nmber of arguments in argv vector (ignored).
Index: uspace/drv/uhci-rhd/port.c
===================================================================
--- uspace/drv/uhci-rhd/port.c	(revision 67352d2ce57d0bbae9f4f2b0a767afb56ae158b6)
+++ uspace/drv/uhci-rhd/port.c	(revision f123909d82f100ce358a4d2d10ff2ecc24efcbda)
@@ -26,10 +26,11 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/** @addtogroup usb
+/** @addtogroup drvusbuhcirh
  * @{
  */
 /** @file
- * @brief UHCI driver
- */
+ * @brief UHCI root hub port routines
+ */
+#include <libarch/ddi.h> /* pio_read and pio_write */
 #include <errno.h>
 #include <str_error.h>
@@ -37,9 +38,6 @@
 
 #include <usb/usb.h>    /* usb_address_t */
-#include <usb/usbdevice.h>
 #include <usb/hub.h>
-#include <usb/request.h>
 #include <usb/debug.h>
-#include <usb/recognise.h>
 
 #include "port.h"
@@ -50,6 +48,33 @@
 static int uhci_port_check(void *port);
 static int uhci_port_reset_enable(int portno, void *arg);
-/*----------------------------------------------------------------------------*/
-/** Initializes UHCI root hub port instance.
+static void uhci_port_print_status(
+    uhci_port_t *port, const port_status_t value);
+
+/** Register reading helper function.
+ *
+ * @param[in] port Structure to use.
+ * @return Error code. (Always EOK)
+ */
+static inline port_status_t uhci_port_read_status(uhci_port_t *port)
+{
+	assert(port);
+	return pio_read_16(port->address);
+}
+/*----------------------------------------------------------------------------*/
+/** Register writing helper function.
+ *
+ * @param[in] port Structure to use.
+ * @param[in] value New register value.
+ * @return Error code. (Always EOK)
+ */
+static inline void uhci_port_write_status(
+    uhci_port_t *port, port_status_t value)
+{
+	assert(port);
+	pio_write_16(port->address, value);
+}
+
+/*----------------------------------------------------------------------------*/
+/** Initialize UHCI root hub port instance.
  *
  * @param[in] port Memory structure to use.
@@ -60,5 +85,5 @@
  * @return Error code.
  *
- * Starts the polling fibril.
+ * Creates and starts the polling fibril.
  */
 int uhci_port_init(uhci_port_t *port,
@@ -86,16 +111,16 @@
 	port->checker = fibril_create(uhci_port_check, port);
 	if (port->checker == 0) {
-		usb_log_error("Port(%p - %d): failed to launch root hub fibril.",
-		    port->address, port->number);
+		usb_log_error("%s: failed to create polling fibril.",
+		    port->id_string);
 		return ENOMEM;
 	}
 
 	fibril_add_ready(port->checker);
-	usb_log_debug("Port(%p - %d): Added fibril. %x\n",
-	    port->address, port->number, port->checker);
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-/** Finishes UHCI root hub port instance.
+	usb_log_debug("%s: Started polling fibril(%x).\n",
+	    port->id_string, port->checker);
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+/** Cleanup UHCI root hub port instance.
  *
  * @param[in] port Memory structure to use.
@@ -105,4 +130,6 @@
 void uhci_port_fini(uhci_port_t *port)
 {
+	assert(port);
+	free(port->id_string);
 	/* TODO: Kill fibril here */
 	return;
@@ -111,5 +138,5 @@
 /** Periodically checks port status and reports new devices.
  *
- * @param[in] port Memory structure to use.
+ * @param[in] port Port structure to use.
  * @return Error code.
  */
@@ -122,8 +149,8 @@
 		async_usleep(instance->wait_period_usec);
 
-		/* read register value */
+		/* Read register value */
 		port_status_t port_status = uhci_port_read_status(instance);
 
-		/* print the value if it's interesting */
+		/* Print the value if it's interesting */
 		if (port_status & ~STATUS_ALWAYS_ONE)
 			uhci_port_print_status(instance, port_status);
@@ -177,4 +204,6 @@
  * @param arg Pointer to uhci_port_t of port with the new device.
  * @return Error code.
+ *
+ * Resets and enables the ub port.
  */
 int uhci_port_reset_enable(int portno, void *arg)
@@ -214,7 +243,7 @@
 }
 /*----------------------------------------------------------------------------*/
-/** Initializes and reports connected device.
- *
- * @param[in] port Memory structure to use.
+/** Initialize and report connected device.
+ *
+ * @param[in] port Port structure to use.
  * @param[in] speed Detected speed.
  * @return Error code.
@@ -247,10 +276,12 @@
 }
 /*----------------------------------------------------------------------------*/
-/** Removes device.
+/** Remove device.
  *
  * @param[in] port Memory structure to use.
  * @return Error code.
  *
- * Does not work DDF does not support device removal.
+ * Does not work, DDF does not support device removal.
+ * Does not even free used USB address (it would be dangerous if tis driver
+ * is still running).
  */
 int uhci_port_remove_device(uhci_port_t *port)
@@ -261,7 +292,8 @@
 }
 /*----------------------------------------------------------------------------*/
-/** Enables and disables port.
- *
- * @param[in] port Memory structure to use.
+/** Enable or disable root hub port.
+ *
+ * @param[in] port Port structure to use.
+ * @param[in] enabled Port status to set.
  * @return Error code. (Always EOK)
  */
@@ -288,4 +320,28 @@
 }
 /*----------------------------------------------------------------------------*/
+/** Print the port status value in a human friendly way
+ *
+ * @param[in] port Port structure to use.
+ * @param[in] value Port register value to print.
+ * @return Error code. (Always EOK)
+ */
+void uhci_port_print_status(uhci_port_t *port, const port_status_t value)
+{
+	assert(port);
+	usb_log_debug2("%s Port status(%#x):%s%s%s%s%s%s%s%s%s%s%s.\n",
+	    port->id_string, value,
+	    (value & STATUS_SUSPEND) ? " SUSPENDED," : "",
+	    (value & STATUS_RESUME) ? " IN RESUME," : "",
+	    (value & STATUS_IN_RESET) ? " IN RESET," : "",
+	    (value & STATUS_LINE_D_MINUS) ? " VD-," : "",
+	    (value & STATUS_LINE_D_PLUS) ? " VD+," : "",
+	    (value & STATUS_LOW_SPEED) ? " LOWSPEED," : "",
+	    (value & STATUS_ENABLED_CHANGED) ? " ENABLED-CHANGE," : "",
+	    (value & STATUS_ENABLED) ? " ENABLED," : "",
+	    (value & STATUS_CONNECTED_CHANGED) ? " CONNECTED-CHANGE," : "",
+	    (value & STATUS_CONNECTED) ? " CONNECTED," : "",
+	    (value & STATUS_ALWAYS_ONE) ? " ALWAYS ONE" : " ERROR: NO ALWAYS ONE"
+	);
+}
 /**
  * @}
Index: uspace/drv/uhci-rhd/port.h
===================================================================
--- uspace/drv/uhci-rhd/port.h	(revision 67352d2ce57d0bbae9f4f2b0a767afb56ae158b6)
+++ uspace/drv/uhci-rhd/port.h	(revision f123909d82f100ce358a4d2d10ff2ecc24efcbda)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2010 Jan Vesely
+ * Copyright (c) 2011 Jan Vesely
  * All rights reserved.
  *
@@ -26,21 +26,19 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/** @addtogroup usb
+/** @addtogroup drvusbuhcirh
  * @{
  */
 /** @file
- * @brief UHCI port driver
+ * @brief UHCI root hub port routines
  */
 #ifndef DRV_UHCI_PORT_H
 #define DRV_UHCI_PORT_H
 
-#include <assert.h>
 #include <stdint.h>
+#include <fibril.h>
 #include <ddf/driver.h>
-#include <libarch/ddi.h> /* pio_read and pio_write */
-#include <usb/usbdevice.h>
+#include <usb/usbdevice.h> /* usb_hc_connection_t */
 
 typedef uint16_t port_status_t;
-
 #define STATUS_CONNECTED         (1 << 0)
 #define STATUS_CONNECTED_CHANGED (1 << 1)
@@ -74,36 +72,4 @@
 void uhci_port_fini(uhci_port_t *port);
 
-static inline port_status_t uhci_port_read_status(uhci_port_t *port)
-{
-	assert(port);
-	return pio_read_16(port->address);
-}
-
-static inline void uhci_port_write_status(
-    uhci_port_t *port, port_status_t value)
-{
-	assert(port);
-	pio_write_16(port->address, value);
-}
-
-static inline void uhci_port_print_status(
-    uhci_port_t *port, const port_status_t value)
-{
-	assert(port);
-	usb_log_debug2("%s Port status(%#x):%s%s%s%s%s%s%s%s%s%s%s.\n",
-	    port->id_string, value,
-	    (value & STATUS_SUSPEND) ? " SUSPENDED," : "",
-	    (value & STATUS_RESUME) ? " IN RESUME," : "",
-	    (value & STATUS_IN_RESET) ? " IN RESET," : "",
-	    (value & STATUS_LINE_D_MINUS) ? " VD-," : "",
-	    (value & STATUS_LINE_D_PLUS) ? " VD+," : "",
-	    (value & STATUS_LOW_SPEED) ? " LOWSPEED," : "",
-	    (value & STATUS_ENABLED_CHANGED) ? " ENABLED-CHANGE," : "",
-	    (value & STATUS_ENABLED) ? " ENABLED," : "",
-	    (value & STATUS_CONNECTED_CHANGED) ? " CONNECTED-CHANGE," : "",
-	    (value & STATUS_CONNECTED) ? " CONNECTED," : "",
-	    (value & STATUS_ALWAYS_ONE) ? " ALWAYS ONE" : " ERROR: NO ALWAYS ONE"
-	);
-}
 #endif
 /**
Index: uspace/drv/uhci-rhd/root_hub.c
===================================================================
--- uspace/drv/uhci-rhd/root_hub.c	(revision 67352d2ce57d0bbae9f4f2b0a767afb56ae158b6)
+++ uspace/drv/uhci-rhd/root_hub.c	(revision f123909d82f100ce358a4d2d10ff2ecc24efcbda)
@@ -26,24 +26,22 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/** @addtogroup usb
+/** @addtogroup drvusbuhcirh
  * @{
  */
 /** @file
- * @brief UHCI driver
+ * @brief UHCI root hub driver
  */
 #include <errno.h>
-#include <stdint.h>
 #include <ddi.h>
-#include <devman.h>
 #include <usb/debug.h>
 
 #include "root_hub.h"
 
-/** Initializes UHCI root hub instance.
+/** Initialize UHCI root hub instance.
  *
  * @param[in] instance Driver memory structure to use.
  * @param[in] addr Address of I/O registers.
  * @param[in] size Size of available I/O space.
- * @param[in] rh Pointer to ddf instance fo the root hub driver.
+ * @param[in] rh Pointer to ddf instance of the root hub driver.
  * @return Error code.
  */
@@ -61,9 +59,10 @@
 	if (ret < 0) {
 		usb_log_error(
-		    "Failed to gain access to port registers at %p\n", regs);
+		    "Failed(%d) to gain access to port registers at %p\n",
+		    ret, regs);
 		return ret;
 	}
 
-	/* add fibrils for periodic port checks */
+	/* Initialize root hub ports */
 	unsigned i = 0;
 	for (; i < UHCI_ROOT_HUB_PORT_COUNT; ++i) {
@@ -82,7 +81,7 @@
 }
 /*----------------------------------------------------------------------------*/
-/** Finishes UHCI root hub instance.
+/** Cleanup UHCI root hub instance.
  *
- * @param[in] instance Driver memory structure to use.
+ * @param[in] instance Root hub structure to use.
  * @return Error code.
  */
Index: uspace/drv/uhci-rhd/root_hub.h
===================================================================
--- uspace/drv/uhci-rhd/root_hub.h	(revision 67352d2ce57d0bbae9f4f2b0a767afb56ae158b6)
+++ uspace/drv/uhci-rhd/root_hub.h	(revision f123909d82f100ce358a4d2d10ff2ecc24efcbda)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2010 Jan Vesely
+ * Copyright (c) 2011 Jan Vesely
  * All rights reserved.
  *
@@ -26,5 +26,5 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/** @addtogroup usb
+/** @addtogroup drvusbuhcirh
  * @{
  */
@@ -35,5 +35,4 @@
 #define DRV_UHCI_ROOT_HUB_H
 
-#include <fibril.h>
 #include <ddf/driver.h>
 
