Index: uspace/drv/ohci/batch.h
===================================================================
--- uspace/drv/ohci/batch.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/ohci/batch.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -26,12 +26,12 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/** @addtogroup drvusbuhcihc
+/** @addtogroup drvusbohci
  * @{
  */
 /** @file
- * @brief UHCI driver USB transaction structure
+ * @brief OHCI driver USB transaction structure
  */
-#ifndef DRV_UHCI_BATCH_H
-#define DRV_UHCI_BATCH_H
+#ifndef DRV_OHCI_BATCH_H
+#define DRV_OHCI_BATCH_H
 
 #include <usbhc_iface.h>
Index: uspace/drv/ohci/endpoint_list.h
===================================================================
--- uspace/drv/ohci/endpoint_list.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/ohci/endpoint_list.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -41,6 +41,5 @@
 #include "utils/malloc32.h"
 
-typedef struct endpoint_list
-{
+typedef struct endpoint_list {
 	fibril_mutex_t guard;
 	ed_t *list_head;
Index: uspace/drv/ohci/iface.h
===================================================================
--- uspace/drv/ohci/iface.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/ohci/iface.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -26,5 +26,4 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-
 /** @addtogroup drvusbohci
  * @{
Index: uspace/drv/ohci/ohci.h
===================================================================
--- uspace/drv/ohci/ohci.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/ohci/ohci.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -26,5 +26,4 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-
 /** @addtogroup drvusbohci
  * @{
Index: uspace/drv/ohci/ohci_regs.h
===================================================================
--- uspace/drv/ohci/ohci_regs.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/ohci/ohci_regs.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -26,5 +26,4 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-
 /** @addtogroup drvusbohcihc
  * @{
Index: uspace/drv/ohci/pci.h
===================================================================
--- uspace/drv/ohci/pci.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/ohci/pci.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -26,5 +26,4 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-
 /** @addtogroup drvusbohci
  * @{
Index: uspace/drv/ohci/root_hub.c
===================================================================
--- uspace/drv/ohci/root_hub.c	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/ohci/root_hub.c	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -41,4 +41,6 @@
 #include "usb/classes/classes.h"
 #include "usb/devdrv.h"
+#include "ohci_regs.h"
+
 #include <usb/request.h>
 #include <usb/classes/hub.h>
@@ -109,6 +111,6 @@
  */
 static const uint32_t hub_clear_feature_valid_mask =
-    (1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER) |
-(1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT);
+    RHS_OCIC_FLAG |
+    RHS_CLEAR_PORT_POWER;
 
 /**
@@ -116,5 +118,6 @@
  */
 static const uint32_t hub_clear_feature_by_writing_one_mask =
-    1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER;
+   RHS_CLEAR_PORT_POWER;
+   // 1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER;
 
 /**
@@ -122,6 +125,8 @@
  */
 static const uint32_t hub_set_feature_valid_mask =
-    (1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT) |
-(1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
+    RHS_LPSC_FLAG |
+    RHS_OCIC_FLAG;
+    //(1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT) |
+    //(1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
 
 /**
@@ -129,5 +134,6 @@
  */
 static const uint32_t hub_set_feature_direct_mask =
-    (1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT);
+    RHS_SET_PORT_POWER;
+    //(1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT);
 
 /**
@@ -135,8 +141,8 @@
  */
 static const uint32_t port_set_feature_valid_mask =
-    (1 << USB_HUB_FEATURE_PORT_ENABLE) |
-(1 << USB_HUB_FEATURE_PORT_SUSPEND) |
-(1 << USB_HUB_FEATURE_PORT_RESET) |
-(1 << USB_HUB_FEATURE_PORT_POWER);
+    RHPS_SET_PORT_ENABLE |
+    RHPS_SET_PORT_SUSPEND |
+    RHPS_SET_PORT_RESET |
+    RHPS_SET_PORT_POWER;
 
 /**
@@ -144,26 +150,39 @@
  */
 static const uint32_t port_clear_feature_valid_mask =
+    RHPS_CCS_FLAG |
+    RHPS_SET_PORT_SUSPEND |
+    RHPS_POCI_FLAG |
+    RHPS_SET_PORT_POWER |
+    RHPS_CSC_FLAG |
+    RHPS_PESC_FLAG |
+    RHPS_PSSC_FLAG |
+    RHPS_OCIC_FLAG |
+    RHPS_PRSC_FLAG;
+
+/*
+
     (1 << USB_HUB_FEATURE_PORT_CONNECTION) |
-(1 << USB_HUB_FEATURE_PORT_SUSPEND) |
-(1 << USB_HUB_FEATURE_PORT_OVER_CURRENT) |
-(1 << USB_HUB_FEATURE_PORT_POWER) |
-(1 << USB_HUB_FEATURE_C_PORT_CONNECTION) |
-(1 << USB_HUB_FEATURE_C_PORT_ENABLE) |
-(1 << USB_HUB_FEATURE_C_PORT_SUSPEND) |
-(1 << USB_HUB_FEATURE_C_PORT_OVER_CURRENT) |
-(1 << USB_HUB_FEATURE_C_PORT_RESET);
+    (1 << USB_HUB_FEATURE_PORT_SUSPEND) |
+    (1 << USB_HUB_FEATURE_PORT_OVER_CURRENT) |
+    (1 << USB_HUB_FEATURE_PORT_POWER) |
+    (1 << USB_HUB_FEATURE_C_PORT_CONNECTION) |
+    (1 << USB_HUB_FEATURE_C_PORT_ENABLE) |
+    (1 << USB_HUB_FEATURE_C_PORT_SUSPEND) |
+    (1 << USB_HUB_FEATURE_C_PORT_OVER_CURRENT) |
+    (1 << USB_HUB_FEATURE_C_PORT_RESET);
+ */
 //note that USB_HUB_FEATURE_PORT_POWER bit is translated into
-//USB_HUB_FEATURE_PORT_LOW_SPEED
+//USB_HUB_FEATURE_PORT_LOW_SPEED for port set feature request
 
 /**
  * bitmask with port status changes
  */
-static const uint32_t port_status_change_mask =
-    (1 << USB_HUB_FEATURE_C_PORT_CONNECTION) |
-(1 << USB_HUB_FEATURE_C_PORT_ENABLE) |
-(1 << USB_HUB_FEATURE_C_PORT_OVER_CURRENT) |
-(1 << USB_HUB_FEATURE_C_PORT_RESET) |
-(1 << USB_HUB_FEATURE_C_PORT_SUSPEND);
-
+static const uint32_t port_status_change_mask = RHPS_CHANGE_WC_MASK;
+/*    (1 << USB_HUB_FEATURE_C_PORT_CONNECTION) |
+    (1 << USB_HUB_FEATURE_C_PORT_ENABLE) |
+    (1 << USB_HUB_FEATURE_C_PORT_OVER_CURRENT) |
+    (1 << USB_HUB_FEATURE_C_PORT_RESET) |
+    (1 << USB_HUB_FEATURE_C_PORT_SUSPEND);
+*/
 
 static int create_serialized_hub_descriptor(rh_t *instance);
Index: uspace/drv/ohci/root_hub.h
===================================================================
--- uspace/drv/ohci/root_hub.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/ohci/root_hub.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -26,5 +26,4 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-
 /** @addtogroup drvusbohci
  * @{
Index: uspace/drv/ohci/utils/malloc32.h
===================================================================
--- uspace/drv/ohci/utils/malloc32.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/ohci/utils/malloc32.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -26,12 +26,12 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/** @addtogroup usb
+/** @addtogroup drvusbohci
  * @{
  */
 /** @file
- * @brief UHCI driver
+ * @brief OHCI driver
  */
-#ifndef DRV_UHCI_TRANSLATOR_H
-#define DRV_UHCI_TRANSLATOR_H
+#ifndef DRV_OHCI_UTILS_MALLOC32_H
+#define DRV_OHCI_UTILS_MALLOC32_H
 
 #include <assert.h>
@@ -40,6 +40,4 @@
 #include <mem.h>
 #include <as.h>
-
-#define UHCI_REQUIRED_PAGE_SIZE 4096
 
 /** Get physical address translation
@@ -61,5 +59,5 @@
  *
  * @param[in] size Size of the required memory space
- * @return Address of the alligned and big enough memory place, NULL on failure.
+ * @return Address of the aligned and big enough memory place, NULL on failure.
  */
 static inline void * malloc32(size_t size)
@@ -72,23 +70,4 @@
 static inline void free32(void *addr)
 	{ if (addr) free(addr); }
-/*----------------------------------------------------------------------------*/
-/** Create 4KB page mapping
- *
- * @return Address of the mapped page, NULL on failure.
- */
-static inline void * get_page(void)
-{
-	void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);
-	assert(free_address);
-	if (free_address == 0)
-		return NULL;
-	void* ret =
-	  as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE,
-		  AS_AREA_READ | AS_AREA_WRITE);
-	if (ret != free_address)
-		return NULL;
-	return ret;
-}
-
 #endif
 /**
Index: uspace/drv/uhci-hcd/batch.c
===================================================================
--- uspace/drv/uhci-hcd/batch.c	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-hcd/batch.c	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -70,5 +70,5 @@
  * @param[in] ep Communication target
  * @param[in] buffer Data source/destination.
- * @param[in] size Size of the buffer.
+ * @param[in] buffer_size Size of the buffer.
  * @param[in] setup_buffer Setup data source (if not NULL)
  * @param[in] setup_size Size of setup_buffer (should be always 8)
Index: uspace/drv/uhci-hcd/hc.c
===================================================================
--- uspace/drv/uhci-hcd/hc.c	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-hcd/hc.c	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -61,5 +61,6 @@
  * @param[in] instance Memory place to initialize.
  * @param[in] regs Address of I/O control registers.
- * @param[in] size Size of I/O control registers.
+ * @param[in] reg_size Size of I/O control registers.
+ * @param[in] interrupts True if hw interrupts should be used.
  * @return Error code.
  * @note Should be called only once on any structure.
Index: uspace/drv/uhci-hcd/hc.h
===================================================================
--- uspace/drv/uhci-hcd/hc.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-hcd/hc.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -33,6 +33,6 @@
  * @brief UHCI host controller driver structure
  */
-#ifndef DRV_UHCI_UHCI_HC_H
-#define DRV_UHCI_UHCI_HC_H
+#ifndef DRV_UHCI_HC_H
+#define DRV_UHCI_HC_H
 
 #include <fibril.h>
Index: uspace/drv/uhci-hcd/hw_struct/link_pointer.h
===================================================================
--- uspace/drv/uhci-hcd/hw_struct/link_pointer.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-hcd/hw_struct/link_pointer.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -32,6 +32,6 @@
  * @brief UHCI driver
  */
-#ifndef DRV_UHCI_LINK_POINTER_H
-#define DRV_UHCI_LINK_POINTER_H
+#ifndef DRV_UHCI_HW_STRUCT_LINK_POINTER_H
+#define DRV_UHCI_HW_STRUCT_LINK_POINTER_H
 
 /* UHCI link pointer, used by many data structures */
Index: uspace/drv/uhci-hcd/hw_struct/queue_head.h
===================================================================
--- uspace/drv/uhci-hcd/hw_struct/queue_head.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-hcd/hw_struct/queue_head.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -26,5 +26,5 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/** @addtogroup drv usbuhcihc
+/** @addtogroup drvusbuhcihc
  * @{
  */
@@ -32,6 +32,6 @@
  * @brief UHCI driver
  */
-#ifndef DRV_UHCI_QH_H
-#define DRV_UHCI_QH_H
+#ifndef DRV_UHCI_HW_STRUCT_QH_H
+#define DRV_UHCI_HW_STRUCT_QH_H
 #include <assert.h>
 
@@ -65,5 +65,5 @@
  *
  * @param[in] instance qh_t structure to use.
- * @param[in] pa Physical address of the next queue head.
+ * @param[in] next Address of the next queue.
  *
  * Adds proper flag. If the pointer is NULL, sets next to terminal NULL.
@@ -81,6 +81,6 @@
 /** Set queue head element pointer
  *
- * @param[in] instance qh_t structure to initialize.
- * @param[in] pa Physical address of the TD structure.
+ * @param[in] instance qh_t structure to use.
+ * @param[in] td Transfer descriptor to set as the first element.
  *
  * Adds proper flag. If the pointer is NULL, sets element to terminal NULL.
Index: uspace/drv/uhci-hcd/hw_struct/transfer_descriptor.h
===================================================================
--- uspace/drv/uhci-hcd/hw_struct/transfer_descriptor.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-hcd/hw_struct/transfer_descriptor.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -32,6 +32,6 @@
  * @brief UHCI driver
  */
-#ifndef DRV_UHCI_TRANSFER_DESCRIPTOR_H
-#define DRV_UHCI_TRANSFER_DESCRIPTOR_H
+#ifndef DRV_UHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
+#define DRV_UHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
 
 #include <mem.h>
Index: uspace/drv/uhci-hcd/root_hub.h
===================================================================
--- uspace/drv/uhci-hcd/root_hub.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-hcd/root_hub.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -33,6 +33,6 @@
  * @brief UHCI driver
  */
-#ifndef DRV_UHCI_UHCI_RH_H
-#define DRV_UHCI_UHCI_RH_H
+#ifndef DRV_UHCI_RH_H
+#define DRV_UHCI_RH_H
 
 #include <ddf/driver.h>
Index: uspace/drv/uhci-hcd/uhci.c
===================================================================
--- uspace/drv/uhci-hcd/uhci.c	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-hcd/uhci.c	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -161,5 +161,4 @@
 /** Initialize hc and rh DDF structures and their respective drivers.
  *
- * @param[in] instance UHCI structure to use.
  * @param[in] device DDF instance of the device to use.
  *
@@ -167,5 +166,5 @@
  *  - gets device's hw resources
  *  - disables UHCI legacy support (PCI config space)
- *  - asks for interrupt
+ *  - attempts to enable interrupts
  *  - registers interrupt handler
  */
Index: uspace/drv/uhci-hcd/utils/malloc32.h
===================================================================
--- uspace/drv/uhci-hcd/utils/malloc32.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-hcd/utils/malloc32.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -26,5 +26,5 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/** @addtogroup usb
+/** @addtogroup drvusbuhci
  * @{
  */
@@ -32,6 +32,6 @@
  * @brief UHCI driver
  */
-#ifndef DRV_UHCI_TRANSLATOR_H
-#define DRV_UHCI_TRANSLATOR_H
+#ifndef DRV_UHCI_UTILS_MALLOC32_H
+#define DRV_UHCI_UTILS_MALLOC32_H
 
 #include <assert.h>
Index: uspace/drv/uhci-hcd/utils/slab.c
===================================================================
--- uspace/drv/uhci-hcd/utils/slab.c	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-hcd/utils/slab.c	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -26,5 +26,5 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/** @addtogroup usb
+/** @addtogroup drvusbuhcihc
  * @{
  */
Index: uspace/drv/uhci-hcd/utils/slab.h
===================================================================
--- uspace/drv/uhci-hcd/utils/slab.h	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-hcd/utils/slab.h	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -26,5 +26,5 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/** @addtogroup usb
+/** @addtogroup drvusbuhcihc
  * @{
  */
@@ -32,6 +32,6 @@
  * @brief UHCI driver
  */
-#ifndef DRV_UHCI_SLAB_H
-#define DRV_UHCI_SLAB_H
+#ifndef DRV_UHCI_UTILS_SLAB_H
+#define DRV_UHCI_UTILS_SLAB_H
 
 #include <bool.h>
Index: uspace/drv/uhci-rhd/port.c
===================================================================
--- uspace/drv/uhci-rhd/port.c	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/uhci-rhd/port.c	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -36,4 +36,5 @@
 #include <errno.h>
 #include <str_error.h>
+#include <time.h>
 
 #include <usb/usb.h>    /* usb_address_t */
@@ -65,5 +66,5 @@
  *
  * @param[in] port Structure to use.
- * @param[in] value New register value.
+ * @param[in] val New register value.
  * @return Error code. (Always EOK)
  */
@@ -77,5 +78,5 @@
  *
  * @param[in] port Memory structure to use.
- * @param[in] addr Address of I/O register.
+ * @param[in] address Address of I/O register.
  * @param[in] number Port number.
  * @param[in] usec Polling interval.
@@ -224,9 +225,6 @@
 		uhci_port_write_status(port, port_status);
 		while (uhci_port_read_status(port) & STATUS_IN_RESET);
-		// TODO: find a better way to waste time (it should be less than
-		// 10ms, if we reschedule it takes too much time (random
-		// interrupts can be solved by multiple attempts).
-		usb_log_debug2("%s: Reset Signal stop.\n", port->id_string);
-	}
+	}
+	udelay(10);
 	/* Enable the port. */
 	uhci_port_set_enabled(port, true);
Index: uspace/drv/usbhub/usbhub.c
===================================================================
--- uspace/drv/usbhub/usbhub.c	(revision e913cc9c6e7552261395e73e6ab3a2d0931f4c82)
+++ uspace/drv/usbhub/usbhub.c	(revision 72cd53d4a534c31423276f4e863f774083b559ee)
@@ -71,4 +71,7 @@
 
 static void usb_hub_process_global_interrupt(usb_hub_info_t * hub_info);
+
+static void usb_hub_polling_terminted_callback(usb_device_t * device,
+    bool was_error, void * data);
 
 
@@ -351,5 +354,5 @@
 	rc = usb_device_auto_poll(hub_info->usb_device, 0,
 	    hub_port_changes_callback, ((hub_info->port_count + 1) / 8) + 1,
-	    NULL, hub_info);
+	    usb_hub_polling_terminted_callback, hub_info);
 	if (rc != EOK) {
 		usb_log_error("Failed to create polling fibril: %s.\n",
@@ -489,4 +492,23 @@
 
 /**
+ * callback called from hub polling fibril when the fibril terminates
+ *
+ * Should perform a cleanup - deletes hub_info.
+ * @param device usb device afected
+ * @param was_error indicates that the fibril is stoped due to an error
+ * @param data pointer to usb_hub_info_t structure
+ */
+static void usb_hub_polling_terminted_callback(usb_device_t * device,
+    bool was_error, void * data){
+	usb_hub_info_t * hub_info = data;
+	if(!hub_info) return;
+	free(hub_info->ports);
+	free(hub_info);
+}
+
+
+
+
+/**
  * @}
  */
