summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/usb
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@secunet.com>2012-01-31 14:48:05 +0100
committerPatrick Georgi <patrick@georgi-clan.de>2012-02-07 18:30:44 +0100
commit7627f7f22d06accc9a22b3859cd1813d6f3c99c5 (patch)
tree43b714403d4f5a0107de8a4bf763d4c2bff27851 /payloads/libpayload/drivers/usb
parent2fd524297e5f8cfa1c44c2e96067bc6680f03882 (diff)
libpayload: Remove workaround for bitfield management in EHCI driver
We don't use bitfields anymore. Change-Id: I25ceec2024f659612871bcfe5f98df3a10789055 Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com> Reviewed-on: http://review.coreboot.org/595 Tested-by: build bot (Jenkins) Reviewed-by: Marc Jones <marcj303@gmail.com>
Diffstat (limited to 'payloads/libpayload/drivers/usb')
-rw-r--r--payloads/libpayload/drivers/usb/ehci_rh.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/payloads/libpayload/drivers/usb/ehci_rh.c b/payloads/libpayload/drivers/usb/ehci_rh.c
index 1d41f3f574..dd073a3b99 100644
--- a/payloads/libpayload/drivers/usb/ehci_rh.c
+++ b/payloads/libpayload/drivers/usb/ehci_rh.c
@@ -53,31 +53,28 @@ ehci_rh_destroy (usbdev_t *dev)
static void
ehci_rh_hand_over_port (usbdev_t *dev, int port)
{
- volatile portsc_t *p = &(RH_INST(dev)->ports[port]);
-
debug("giving up port %x, it's USB1\n", port+1);
/* Lowspeed device. Hand over to companion */
- *p |= P_PORT_OWNER;
- do {} while (!(*p & P_CONN_STATUS_CHANGE));
+ RH_INST(dev)->ports[port] |= P_PORT_OWNER;
+ do {} while (!(RH_INST(dev)->ports[port] & P_CONN_STATUS_CHANGE));
/* RW/C register, so clear it by writing 1 */
- *p |= P_CONN_STATUS_CHANGE;
+ RH_INST(dev)->ports[port] |= P_CONN_STATUS_CHANGE;
return;
}
static void
ehci_rh_scanport (usbdev_t *dev, int port)
{
- volatile portsc_t *p = &(RH_INST(dev)->ports[port]);
if (RH_INST(dev)->devices[port]!=-1) {
debug("Unregister device at port %x\n", port+1);
usb_detach_device(dev->controller, RH_INST(dev)->devices[port]);
RH_INST(dev)->devices[port]=-1;
}
/* device connected, handle */
- if (*p & P_CURR_CONN_STATUS) {
+ if (RH_INST(dev)->ports[port] & P_CURR_CONN_STATUS) {
mdelay(100);
- if ((*p & P_LINE_STATUS) == P_LINE_STATUS_LOWSPEED) {
+ if ((RH_INST(dev)->ports[port] & P_LINE_STATUS) == P_LINE_STATUS_LOWSPEED) {
ehci_rh_hand_over_port(dev, port);
return;
}
@@ -85,17 +82,17 @@ ehci_rh_scanport (usbdev_t *dev, int port)
/* Deassert enable, assert reset. These must change
* atomically.
*/
- *p = (*p & ~P_PORT_ENABLE) | P_PORT_RESET;
+ RH_INST(dev)->ports[port] = (RH_INST(dev)->ports[port] & ~P_PORT_ENABLE) | P_PORT_RESET;
/* Wait a bit while reset is active. */
mdelay(50);
/* Deassert reset. */
- *p &= ~P_PORT_RESET;
+ RH_INST(dev)->ports[port] &= ~P_PORT_RESET;
/* Wait for flag change to finish. The controller might take a while */
- while (*p & P_PORT_RESET) ;
- if (!(*p & P_PORT_ENABLE)) {
+ while (RH_INST(dev)->ports[port] & P_PORT_RESET) ;
+ if (!(RH_INST(dev)->ports[port] & P_PORT_ENABLE)) {
ehci_rh_hand_over_port(dev, port);
return;
}
@@ -103,7 +100,7 @@ ehci_rh_scanport (usbdev_t *dev, int port)
RH_INST(dev)->devices[port] = usb_attach_device(dev->controller, dev->address, port, 2);
}
/* RW/C register, so clear it by writing 1 */
- *p |= P_CONN_STATUS_CHANGE;
+ RH_INST(dev)->ports[port] |= P_CONN_STATUS_CHANGE;
}
static int
@@ -130,8 +127,6 @@ void
ehci_rh_init (usbdev_t *dev)
{
int i;
- volatile portsc_t *p;
-
dev->destroy = ehci_rh_destroy;
dev->poll = ehci_rh_poll;
@@ -144,9 +139,8 @@ ehci_rh_init (usbdev_t *dev)
RH_INST(dev)->devices = malloc(RH_INST(dev)->n_ports * sizeof(int));
for (i=0; i < RH_INST(dev)->n_ports; i++) {
- p = &(RH_INST(dev)->ports[i]);
RH_INST(dev)->devices[i] = -1;
- *p |= P_PP;
+ RH_INST(dev)->ports[i] |= P_PP;
ehci_rh_scanport(dev, i);
}