}
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;
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);
.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
}
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;
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).
.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
}
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;
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;
.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
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;
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);