]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Rename portstatus to reset_port.
authorVladimir Serbinenko <phcoder@gmail.com>
Tue, 1 Mar 2016 19:05:50 +0000 (20:05 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Tue, 1 Mar 2016 19:09:47 +0000 (20:09 +0100)
The way we currently use portstatus always uses
enable=1 and we use it for its reset side effect.
Change confusing name and remove unused parameter.

grub-core/bus/usb/ehci.c
grub-core/bus/usb/ohci.c
grub-core/bus/usb/uhci.c
grub-core/bus/usb/usbhub.c
include/grub/usb.h

index c772e76546e2c43c4d3fcf37d60adedf195dce48..d28b1709da03f560d36ac408c2a3bdddd8865e79 100644 (file)
@@ -1579,8 +1579,8 @@ grub_ehci_hubports (grub_usb_controller_t dev)
 }
 
 static grub_usb_err_t
-grub_ehci_portstatus (grub_usb_controller_t dev,
-                     unsigned int port, unsigned int enable)
+grub_ehci_reset_port (grub_usb_controller_t dev,
+                     unsigned int port)
 {
   struct grub_ehci *e = (struct grub_ehci *) dev->data;
   grub_uint64_t endtime;
@@ -1602,14 +1602,6 @@ grub_ehci_portstatus (grub_usb_controller_t dev,
     if (grub_get_time_ms () > endtime)
       return GRUB_USB_ERR_TIMEOUT;
 
-  if (!enable)                 /* We don't need reset port */
-    {
-      grub_dprintf ("ehci", "portstatus: Disabled.\n");
-      grub_dprintf ("ehci", "portstatus: end, status=0x%02x\n",
-                   grub_ehci_port_read (e, port));
-      return GRUB_USB_ERR_NONE;
-    }
-
   grub_dprintf ("ehci", "portstatus: enable\n");
 
   grub_boot_time ("Resetting port %d", port);
@@ -1810,7 +1802,7 @@ static struct grub_usb_controller_dev usb_controller = {
   .check_transfer = grub_ehci_check_transfer,
   .cancel_transfer = grub_ehci_cancel_transfer,
   .hubports = grub_ehci_hubports,
-  .portstatus = grub_ehci_portstatus,
+  .reset_port = grub_ehci_reset_port,
   .detect_dev = grub_ehci_detect_dev,
   /* estimated max. count of TDs for one bulk transfer */
   .max_bulk_tds = GRUB_EHCI_N_TD * 3 / 4 
index f0be533d41eb7cdb1dc88e79a2195237ea829d20..d91c64f9cae6896c4e80004a4b93114a4f61ec98 100644 (file)
@@ -1224,8 +1224,8 @@ grub_ohci_cancel_transfer (grub_usb_controller_t dev,
 }
 
 static grub_usb_err_t
-grub_ohci_portstatus (grub_usb_controller_t dev,
-                     unsigned int port, unsigned int enable)
+grub_ohci_rest_port (grub_usb_controller_t dev,
+                    unsigned int port)
 {
    struct grub_ohci *o = (struct grub_ohci *) dev->data;
    grub_uint64_t endtime;
@@ -1233,22 +1233,6 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
 
    grub_dprintf ("ohci", "begin of portstatus=0x%02x\n",
                  grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
-
-   if (!enable) /* We don't need reset port */
-     {
-       /* Disable the port and wait for it. */
-       grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
-                             GRUB_OHCI_CLEAR_PORT_ENABLE);
-       endtime = grub_get_time_ms () + 1000;
-       while ((grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
-               & (1 << 1)))
-         if (grub_get_time_ms () > endtime)
-           return GRUB_USB_ERR_TIMEOUT;
-
-       grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
-         grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
-       return GRUB_USB_ERR_NONE;
-     }
      
    /* OHCI does one reset signal 10ms long but USB spec.
     * requests 50ms for root hub (no need to be continuous).
@@ -1438,7 +1422,7 @@ static struct grub_usb_controller_dev usb_controller =
   .check_transfer = grub_ohci_check_transfer,
   .cancel_transfer = grub_ohci_cancel_transfer,
   .hubports = grub_ohci_hubports,
-  .portstatus = grub_ohci_portstatus,
+  .reset_port = grub_ohci_reset_port,
   .detect_dev = grub_ohci_detect_dev,
   /* estimated max. count of TDs for one bulk transfer */
   .max_bulk_tds = GRUB_OHCI_TDS * 3 / 4
index 7c5811fd643383db24273cf3f724ff6d39360219..f4b8e5644ca92ca3085e375767d295fdb02ff719 100644 (file)
@@ -710,8 +710,8 @@ grub_uhci_iterate (grub_usb_controller_iterate_hook_t hook, void *hook_data)
 }
 
 static grub_usb_err_t
-grub_uhci_portstatus (grub_usb_controller_t dev,
-                     unsigned int port, unsigned int enable)
+grub_uhci_reset_port (grub_usb_controller_t dev,
+                     unsigned int port)
 {
   struct grub_uhci *u = (struct grub_uhci *) dev->data;
   int reg;
@@ -731,21 +731,6 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
 
   status = grub_uhci_readreg16 (u, reg);
   grub_dprintf ("uhci", "detect=0x%02x\n", status);
-
-  if (!enable) /* We don't need reset port */
-    {
-      /* Disable the port.  */
-      grub_uhci_writereg16 (u, reg, 0 << 2);
-      grub_dprintf ("uhci", "waiting for the port to be disabled\n");
-      endtime = grub_get_time_ms () + 1000;
-      while ((grub_uhci_readreg16 (u, reg) & (1 << 2)))
-        if (grub_get_time_ms () > endtime)
-          return GRUB_USB_ERR_TIMEOUT;
-
-      status = grub_uhci_readreg16 (u, reg);
-      grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
-      return GRUB_USB_ERR_NONE;
-    }
     
   /* Reset the port.  */
   status = grub_uhci_readreg16 (u, reg) & ~GRUB_UHCI_PORTSC_RWC;
@@ -843,7 +828,7 @@ static struct grub_usb_controller_dev usb_controller =
   .check_transfer = grub_uhci_check_transfer,
   .cancel_transfer = grub_uhci_cancel_transfer,
   .hubports = grub_uhci_hubports,
-  .portstatus = grub_uhci_portstatus,
+  .reset_port = grub_uhci_reset_port,
   .detect_dev = grub_uhci_detect_dev,
   /* estimated max. count of TDs for one bulk transfer */
   .max_bulk_tds = N_TD * 3 / 4
index 34a7ff1b5f848cb2a7d5d9efefa5e83d928422b4..c1a178067cd5eb7b45db73aa9d096c887496f2fb 100644 (file)
@@ -207,8 +207,8 @@ attach_root_port (struct grub_usb_hub *hub, int portno,
 
   grub_boot_time ("After detect_dev");
 
-  /* Enable the port.  */
-  err = hub->controller->dev->portstatus (hub->controller, portno, 1);
+  /* Reset port.  */
+  err = hub->controller->dev->reset_port (hub->controller, portno);
   if (err)
     return;
   hub->controller->dev->pending_reset = grub_get_time_ms () + 5000;
index 7c022e0e51c8dcda995b44ece687ff03092f4d5e..130d91a0ad1199b4dea20b34d5537feff07327dd 100644 (file)
@@ -116,8 +116,7 @@ struct grub_usb_controller_dev
 
   int (*hubports) (grub_usb_controller_t dev);
 
-  grub_usb_err_t (*portstatus) (grub_usb_controller_t dev, unsigned int port,
-                               unsigned int enable);
+  grub_usb_err_t (*reset_port) (grub_usb_controller_t dev, unsigned int port);
 
   grub_usb_speed_t (*detect_dev) (grub_usb_controller_t dev, int port, int *changed);