2 * Thunderbolt Cactus Ridge driver - NHI registers
4 * Copyright (c) 2014 Andreas Noever <andreas.noever@gmail.com>
7 #ifndef DSL3510_REGS_H_
8 #define DSL3510_REGS_H_
10 #include <linux/types.h>
13 RING_FLAG_ISOCH_ENABLE
= 1 << 27, /* TX only? */
14 RING_FLAG_E2E_FLOW_CONTROL
= 1 << 28,
15 RING_FLAG_PCI_NO_SNOOP
= 1 << 29,
16 RING_FLAG_RAW
= 1 << 30, /* ignore EOF/SOF mask, include checksum */
17 RING_FLAG_ENABLE
= 1 << 31,
20 enum ring_desc_flags
{
21 RING_DESC_ISOCH
= 0x1, /* TX only? */
22 RING_DESC_COMPLETED
= 0x2, /* set by NHI */
23 RING_DESC_POSTED
= 0x4, /* always set this */
24 RING_DESC_INTERRUPT
= 0x8, /* request an interrupt on completion */
28 * struct ring_desc - TX/RX ring entry
30 * For TX set length/eof/sof.
31 * For RX length/eof/sof are set by the NHI.
38 enum ring_desc_flags flags
:12;
39 u32 time
; /* write zero */
42 /* NHI registers in bar 0 */
45 * 16 bytes per entry, one entry for every hop (REG_HOP_COUNT)
46 * 00: physical pointer to an array of struct ring_desc
47 * 08: ring tail (set by NHI)
48 * 10: ring head (index of first non posted descriptor)
49 * 12: descriptor count
51 #define REG_TX_RING_BASE 0x00000
54 * 16 bytes per entry, one entry for every hop (REG_HOP_COUNT)
55 * 00: physical pointer to an array of struct ring_desc
56 * 08: ring head (index of first not posted descriptor)
57 * 10: ring tail (set by NHI)
58 * 12: descriptor count
59 * 14: max frame sizes (anything larger than 0x100 has no effect)
61 #define REG_RX_RING_BASE 0x08000
64 * 32 bytes per entry, one entry for every hop (REG_HOP_COUNT)
66 * 04: isoch time stamp ?? (write 0)
69 #define REG_TX_OPTIONS_BASE 0x19800
72 * 32 bytes per entry, one entry for every hop (REG_HOP_COUNT)
74 * If RING_FLAG_E2E_FLOW_CONTROL is set then bits 13-23 must be set to
75 * the corresponding TX hop id.
76 * 04: EOF/SOF mask (ignored for RING_FLAG_RAW rings)
79 #define REG_RX_OPTIONS_BASE 0x29800
82 * three bitfields: tx, rx, rx overflow
83 * Every bitfield contains one bit for every hop (REG_HOP_COUNT). Registers are
84 * cleared on read. New interrupts are fired only after ALL registers have been
85 * read (even those containing only disabled rings).
87 #define REG_RING_NOTIFY_BASE 0x37800
88 #define RING_NOTIFY_REG_COUNT(nhi) ((31 + 3 * nhi->hop_count) / 32)
91 * two bitfields: rx, tx
92 * Both bitfields contains one bit for every hop (REG_HOP_COUNT). To
93 * enable/disable interrupts set/clear the corresponding bits.
95 #define REG_RING_INTERRUPT_BASE 0x38200
96 #define RING_INTERRUPT_REG_COUNT(nhi) ((31 + 2 * nhi->hop_count) / 32)
98 /* The last 11 bits contain the number of hops supported by the NHI port. */
99 #define REG_HOP_COUNT 0x39640