aboutsummaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/usb/ohci_private.h
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2012-06-20 10:08:06 +0200
committerNico Huber <nico.huber@secunet.com>2012-06-21 11:55:10 +0200
commit9951adeffd02c0226c5dd9dcbddbab9d86e28ee4 (patch)
treee68d40a10db03be7ce72ecd1452afa33e95b6644 /payloads/libpayload/drivers/usb/ohci_private.h
parentac8d5508541874b60aae6363f50e56f7df40b27f (diff)
libpayload: Implement correct done queue processing for OHCI
This adds correct processing of the done queue of the OHCI host controller (HC). We will always process the done queue after a control or bulk transfer. Unfortunately, it's hard to tell when the HC will write out the done queue, so we have do free the transfer descriptors later and have to allocate them one by one. To distinguish different types of TDs (e.g. async vs. interrupt transfers) on the done queue, they are flagged in the lsb of there .config field. We can utilize this bit for our own purpose, as it's reserved and the host controller won't interpret it and preserves its state. Change-Id: I3b2271ae6221cdd50fc0f94582afdfe52bf7e797 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/1125 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
Diffstat (limited to 'payloads/libpayload/drivers/usb/ohci_private.h')
-rw-r--r--payloads/libpayload/drivers/usb/ohci_private.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/payloads/libpayload/drivers/usb/ohci_private.h b/payloads/libpayload/drivers/usb/ohci_private.h
index a60b294607..0bcae03e97 100644
--- a/payloads/libpayload/drivers/usb/ohci_private.h
+++ b/payloads/libpayload/drivers/usb/ohci_private.h
@@ -191,9 +191,9 @@
typedef struct {
u32 HccaInterruptTable[32];
- u16 HccaFrameNumber;
- u16 HccaPad1;
- u32 HccaDoneHead;
+ volatile u16 HccaFrameNumber;
+ volatile u16 HccaPad1;
+ volatile u32 HccaDoneHead;
u8 reserved[116]; // pad to 256 byte
} __attribute__ ((packed)) hcca_t;
@@ -229,12 +229,25 @@
u32 next_td;
u32 buffer_end;
} __attribute__ ((packed)) td_t;
+/*
+ * Bits 0 through 17 of .config won't be interpreted by the host controller
+ * (HC) and, after processing the TD, the HC has to ensure those bits have
+ * the same state as before. So we are free to use those bits for our own
+ * purpose.
+ */
+#define TD_QUEUETYPE_SHIFT 0
+#define TD_QUEUETYPE_MASK MASK(TD_QUEUETYPE_SHIFT, 2)
+#define TD_QUEUETYPE_ASYNC (0 << TD_QUEUETYPE_SHIFT)
+
#define TD_DIRECTION_SHIFT 19
#define TD_DIRECTION_MASK MASK(TD_DIRECTION_SHIFT, 2)
#define TD_DIRECTION_SETUP OHCI_SETUP << TD_DIRECTION_SHIFT
#define TD_DIRECTION_IN OHCI_IN << TD_DIRECTION_SHIFT
#define TD_DIRECTION_OUT OHCI_OUT << TD_DIRECTION_SHIFT
-#define TD_DELAY_INTERRUPT_NODELAY (7 << 21)
+#define TD_DELAY_INTERRUPT_SHIFT 21
+#define TD_DELAY_INTERRUPT_MASK MASK(TD_DELAY_INTERRUPT_SHIFT, 3)
+#define TD_DELAY_INTERRUPT_ZERO 0
+#define TD_DELAY_INTERRUPT_NOINTR (7 << TD_DELAY_INTERRUPT_SHIFT)
#define TD_TOGGLE_DATA0 0
#define TD_TOGGLE_DATA1 (1 << 24)
#define TD_TOGGLE_FROM_ED 0