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>
This commit is contained in:
parent
2fd524297e
commit
7627f7f22d
|
@ -53,31 +53,28 @@ ehci_rh_destroy (usbdev_t *dev)
|
||||||
static void
|
static void
|
||||||
ehci_rh_hand_over_port (usbdev_t *dev, int port)
|
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);
|
debug("giving up port %x, it's USB1\n", port+1);
|
||||||
|
|
||||||
/* Lowspeed device. Hand over to companion */
|
/* Lowspeed device. Hand over to companion */
|
||||||
*p |= P_PORT_OWNER;
|
RH_INST(dev)->ports[port] |= P_PORT_OWNER;
|
||||||
do {} while (!(*p & P_CONN_STATUS_CHANGE));
|
do {} while (!(RH_INST(dev)->ports[port] & P_CONN_STATUS_CHANGE));
|
||||||
/* RW/C register, so clear it by writing 1 */
|
/* RW/C register, so clear it by writing 1 */
|
||||||
*p |= P_CONN_STATUS_CHANGE;
|
RH_INST(dev)->ports[port] |= P_CONN_STATUS_CHANGE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ehci_rh_scanport (usbdev_t *dev, int port)
|
ehci_rh_scanport (usbdev_t *dev, int port)
|
||||||
{
|
{
|
||||||
volatile portsc_t *p = &(RH_INST(dev)->ports[port]);
|
|
||||||
if (RH_INST(dev)->devices[port]!=-1) {
|
if (RH_INST(dev)->devices[port]!=-1) {
|
||||||
debug("Unregister device at port %x\n", port+1);
|
debug("Unregister device at port %x\n", port+1);
|
||||||
usb_detach_device(dev->controller, RH_INST(dev)->devices[port]);
|
usb_detach_device(dev->controller, RH_INST(dev)->devices[port]);
|
||||||
RH_INST(dev)->devices[port]=-1;
|
RH_INST(dev)->devices[port]=-1;
|
||||||
}
|
}
|
||||||
/* device connected, handle */
|
/* device connected, handle */
|
||||||
if (*p & P_CURR_CONN_STATUS) {
|
if (RH_INST(dev)->ports[port] & P_CURR_CONN_STATUS) {
|
||||||
mdelay(100);
|
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);
|
ehci_rh_hand_over_port(dev, port);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -85,17 +82,17 @@ ehci_rh_scanport (usbdev_t *dev, int port)
|
||||||
/* Deassert enable, assert reset. These must change
|
/* Deassert enable, assert reset. These must change
|
||||||
* atomically.
|
* 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. */
|
/* Wait a bit while reset is active. */
|
||||||
mdelay(50);
|
mdelay(50);
|
||||||
|
|
||||||
/* Deassert reset. */
|
/* 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 */
|
/* Wait for flag change to finish. The controller might take a while */
|
||||||
while (*p & P_PORT_RESET) ;
|
while (RH_INST(dev)->ports[port] & P_PORT_RESET) ;
|
||||||
if (!(*p & P_PORT_ENABLE)) {
|
if (!(RH_INST(dev)->ports[port] & P_PORT_ENABLE)) {
|
||||||
ehci_rh_hand_over_port(dev, port);
|
ehci_rh_hand_over_port(dev, port);
|
||||||
return;
|
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);
|
RH_INST(dev)->devices[port] = usb_attach_device(dev->controller, dev->address, port, 2);
|
||||||
}
|
}
|
||||||
/* RW/C register, so clear it by writing 1 */
|
/* 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
|
static int
|
||||||
|
@ -130,8 +127,6 @@ void
|
||||||
ehci_rh_init (usbdev_t *dev)
|
ehci_rh_init (usbdev_t *dev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
volatile portsc_t *p;
|
|
||||||
|
|
||||||
dev->destroy = ehci_rh_destroy;
|
dev->destroy = ehci_rh_destroy;
|
||||||
dev->poll = ehci_rh_poll;
|
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));
|
RH_INST(dev)->devices = malloc(RH_INST(dev)->n_ports * sizeof(int));
|
||||||
for (i=0; i < RH_INST(dev)->n_ports; i++) {
|
for (i=0; i < RH_INST(dev)->n_ports; i++) {
|
||||||
p = &(RH_INST(dev)->ports[i]);
|
|
||||||
RH_INST(dev)->devices[i] = -1;
|
RH_INST(dev)->devices[i] = -1;
|
||||||
*p |= P_PP;
|
RH_INST(dev)->ports[i] |= P_PP;
|
||||||
ehci_rh_scanport(dev, i);
|
ehci_rh_scanport(dev, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue