1a4dfb8c4SSandeep Nair* Texas Instruments Keystone Navigator Queue Management SubSystem driver 2a4dfb8c4SSandeep Nair 3a4dfb8c4SSandeep NairThe QMSS (Queue Manager Sub System) found on Keystone SOCs is one of 4a4dfb8c4SSandeep Nairthe main hardware sub system which forms the backbone of the Keystone 5a4dfb8c4SSandeep Nairmulti-core Navigator. QMSS consist of queue managers, packed-data structure 6a4dfb8c4SSandeep Nairprocessors(PDSP), linking RAM, descriptor pools and infrastructure 7a4dfb8c4SSandeep NairPacket DMA. 8a4dfb8c4SSandeep NairThe Queue Manager is a hardware module that is responsible for accelerating 9a4dfb8c4SSandeep Nairmanagement of the packet queues. Packets are queued/de-queued by writing or 10a4dfb8c4SSandeep Nairreading descriptor address to a particular memory mapped location. The PDSPs 11a4dfb8c4SSandeep Nairperform QMSS related functions like accumulation, QoS, or event management. 12a4dfb8c4SSandeep NairLinking RAM registers are used to link the descriptors which are stored in 13a4dfb8c4SSandeep Nairdescriptor RAM. Descriptor RAM is configurable as internal or external memory. 14a4dfb8c4SSandeep NairThe QMSS driver manages the PDSP setups, linking RAM regions, 15a4dfb8c4SSandeep Nairqueue pool management (allocation, push, pop and notify) and descriptor 16a4dfb8c4SSandeep Nairpool management. 17a4dfb8c4SSandeep Nair 18a4dfb8c4SSandeep Nair 19a4dfb8c4SSandeep NairRequired properties: 20*350601b4SMurali Karicheri- compatible : Must be "ti,keystone-navigator-qmss". 21*350601b4SMurali Karicheri : Must be "ti,66ak2g-navss-qm" for QMSS on K2G SoC. 22a4dfb8c4SSandeep Nair- clocks : phandle to the reference clock for this device. 23a4dfb8c4SSandeep Nair- queue-range : <start number> total range of queue numbers for the device. 24a4dfb8c4SSandeep Nair- linkram0 : <address size> for internal link ram, where size is the total 25a4dfb8c4SSandeep Nair link ram entries. 26a4dfb8c4SSandeep Nair- linkram1 : <address size> for external link ram, where size is the total 27a4dfb8c4SSandeep Nair external link ram entries. If the address is specified as "0" 28a4dfb8c4SSandeep Nair driver will allocate memory. 29a4dfb8c4SSandeep Nair- qmgrs : child node describing the individual queue managers on the 30a4dfb8c4SSandeep Nair SoC. On keystone 1 devices there should be only one node. 31a4dfb8c4SSandeep Nair On keystone 2 devices there can be more than 1 node. 32a4dfb8c4SSandeep Nair -- managed-queues : the actual queues managed by each queue manager 33a4dfb8c4SSandeep Nair instance, specified as <"base queue #" "# of queues">. 34a4dfb8c4SSandeep Nair -- reg : Address and size of the register set for the device. 35a4dfb8c4SSandeep Nair Register regions should be specified in the following 36a4dfb8c4SSandeep Nair order 37a4dfb8c4SSandeep Nair - Queue Peek region. 38a4dfb8c4SSandeep Nair - Queue status RAM. 39a4dfb8c4SSandeep Nair - Queue configuration region. 40a4dfb8c4SSandeep Nair - Descriptor memory setup region. 41a4dfb8c4SSandeep Nair - Queue Management/Queue Proxy region for queue Push. 42a4dfb8c4SSandeep Nair - Queue Management/Queue Proxy region for queue Pop. 43*350601b4SMurali Karicheri 44*350601b4SMurali KaricheriFor QMSS on K2G SoC, following QM reg indexes are used in that order 45*350601b4SMurali Karicheri - Queue Peek region. 46*350601b4SMurali Karicheri - Queue configuration region. 47*350601b4SMurali Karicheri - Queue Management/Queue Proxy region for queue Push/Pop. 48*350601b4SMurali Karicheri 49a4dfb8c4SSandeep Nair- queue-pools : child node classifying the queue ranges into pools. 50a4dfb8c4SSandeep Nair Queue ranges are grouped into 3 type of pools: 51a4dfb8c4SSandeep Nair - qpend : pool of qpend(interruptible) queues 52718756b5SEric Engestrom - general-purpose : pool of general queues, primarily used 53a4dfb8c4SSandeep Nair as free descriptor queues or the 54a4dfb8c4SSandeep Nair transmit DMA queues. 55a4dfb8c4SSandeep Nair - accumulator : pool of queues on PDSP accumulator channel 56a4dfb8c4SSandeep Nair Each range can have the following properties: 57a4dfb8c4SSandeep Nair -- qrange : number of queues to use per queue range, specified as 58a4dfb8c4SSandeep Nair <"base queue #" "# of queues">. 59a4dfb8c4SSandeep Nair -- interrupts : Optional property to specify the interrupt mapping 60718756b5SEric Engestrom for interruptible queues. The driver additionally sets 61a4dfb8c4SSandeep Nair the interrupt affinity hint based on the cpu mask. 62a4dfb8c4SSandeep Nair -- qalloc-by-id : Optional property to specify that the queues in this 63a4dfb8c4SSandeep Nair range can only be allocated by queue id. 64a4dfb8c4SSandeep Nair -- accumulator : Accumulator channel specification. Any of the PDSPs in 65a4dfb8c4SSandeep Nair QMSS can be loaded with the accumulator firmware. The 66a4dfb8c4SSandeep Nair accumulator firmware’s job is to poll a select number of 67a4dfb8c4SSandeep Nair queues looking for descriptors that have been pushed 68a4dfb8c4SSandeep Nair into them. Descriptors are popped from the queue and 69a4dfb8c4SSandeep Nair placed in a buffer provided by the host. When the list 70a4dfb8c4SSandeep Nair becomes full or a programmed time period expires, the 71a4dfb8c4SSandeep Nair accumulator triggers an interrupt to the host to read 72a4dfb8c4SSandeep Nair the buffer for descriptor information. This firmware 73a4dfb8c4SSandeep Nair comes in 16, 32, and 48 channel builds. Each of these 74a4dfb8c4SSandeep Nair channels can be configured to monitor 32 contiguous 75a4dfb8c4SSandeep Nair queues. Accumulator channel property is specified as: 76a4dfb8c4SSandeep Nair <pdsp-id, channel, entries, pacing mode, latency> 77a4dfb8c4SSandeep Nair pdsp-id : QMSS PDSP running accumulator firmware 78a4dfb8c4SSandeep Nair on which the channel has to be 79a4dfb8c4SSandeep Nair configured 80a4dfb8c4SSandeep Nair channel : Accumulator channel number 81a4dfb8c4SSandeep Nair entries : Size of the accumulator descriptor list 82a4dfb8c4SSandeep Nair pacing mode : Interrupt pacing mode 83a4dfb8c4SSandeep Nair 0 : None, i.e interrupt on list full only 84a4dfb8c4SSandeep Nair 1 : Time delay since last interrupt 85a4dfb8c4SSandeep Nair 2 : Time delay since first new packet 86a4dfb8c4SSandeep Nair 3 : Time delay since last new packet 87a4dfb8c4SSandeep Nair latency : time to delay the interrupt, specified 88a4dfb8c4SSandeep Nair in microseconds. 89a4dfb8c4SSandeep Nair -- multi-queue : Optional property to specify that the channel has to 90a4dfb8c4SSandeep Nair monitor up to 32 queues starting at the base queue #. 91a4dfb8c4SSandeep Nair- descriptor-regions : child node describing the memory regions for keystone 92a4dfb8c4SSandeep Nair navigator packet DMA descriptors. The memory for 93a4dfb8c4SSandeep Nair descriptors will be allocated by the driver. 94a4dfb8c4SSandeep Nair -- id : region number in QMSS. 95a4dfb8c4SSandeep Nair -- region-spec : specifies the number of descriptors in the 96a4dfb8c4SSandeep Nair region, specified as 97a4dfb8c4SSandeep Nair <"# of descriptors" "descriptor size">. 98a4dfb8c4SSandeep Nair -- link-index : start index, i.e. index of the first 99a4dfb8c4SSandeep Nair descriptor in the region. 100a4dfb8c4SSandeep Nair 101a4dfb8c4SSandeep NairOptional properties: 102a4dfb8c4SSandeep Nair- dma-coherent : Present if DMA operations are coherent. 103a4dfb8c4SSandeep Nair- pdsps : child node describing the PDSP configuration. 104a4dfb8c4SSandeep Nair -- firmware : firmware to be loaded on the PDSP. 105a4dfb8c4SSandeep Nair -- id : the qmss pdsp that will run the firmware. 106a4dfb8c4SSandeep Nair -- reg : Address and size of the register set for the PDSP. 107a4dfb8c4SSandeep Nair Register regions should be specified in the following 108a4dfb8c4SSandeep Nair order 109a4dfb8c4SSandeep Nair - PDSP internal RAM region. 110a4dfb8c4SSandeep Nair - PDSP control/status region registers. 111a4dfb8c4SSandeep Nair - QMSS interrupt distributor registers. 112a4dfb8c4SSandeep Nair - PDSP command interface region. 113a4dfb8c4SSandeep Nair 114a4dfb8c4SSandeep NairExample: 115a4dfb8c4SSandeep Nair 116a4dfb8c4SSandeep Nairqmss: qmss@2a40000 { 117a4dfb8c4SSandeep Nair compatible = "ti,keystone-qmss"; 118a4dfb8c4SSandeep Nair dma-coherent; 119a4dfb8c4SSandeep Nair #address-cells = <1>; 120a4dfb8c4SSandeep Nair #size-cells = <1>; 121a4dfb8c4SSandeep Nair clocks = <&chipclk13>; 122a4dfb8c4SSandeep Nair ranges; 123a4dfb8c4SSandeep Nair queue-range = <0 0x4000>; 124a4dfb8c4SSandeep Nair linkram0 = <0x100000 0x8000>; 125a4dfb8c4SSandeep Nair linkram1 = <0x0 0x10000>; 126a4dfb8c4SSandeep Nair 127a4dfb8c4SSandeep Nair qmgrs { 128a4dfb8c4SSandeep Nair #address-cells = <1>; 129a4dfb8c4SSandeep Nair #size-cells = <1>; 130a4dfb8c4SSandeep Nair ranges; 131a4dfb8c4SSandeep Nair qmgr0 { 132a4dfb8c4SSandeep Nair managed-queues = <0 0x2000>; 133a4dfb8c4SSandeep Nair reg = <0x2a40000 0x20000>, 134a4dfb8c4SSandeep Nair <0x2a06000 0x400>, 135a4dfb8c4SSandeep Nair <0x2a02000 0x1000>, 136a4dfb8c4SSandeep Nair <0x2a03000 0x1000>, 137a4dfb8c4SSandeep Nair <0x23a80000 0x20000>, 138a4dfb8c4SSandeep Nair <0x2a80000 0x20000>; 139a4dfb8c4SSandeep Nair }; 140a4dfb8c4SSandeep Nair 141a4dfb8c4SSandeep Nair qmgr1 { 142a4dfb8c4SSandeep Nair managed-queues = <0x2000 0x2000>; 143a4dfb8c4SSandeep Nair reg = <0x2a60000 0x20000>, 144a4dfb8c4SSandeep Nair <0x2a06400 0x400>, 145a4dfb8c4SSandeep Nair <0x2a04000 0x1000>, 146a4dfb8c4SSandeep Nair <0x2a05000 0x1000>, 147a4dfb8c4SSandeep Nair <0x23aa0000 0x20000>, 148a4dfb8c4SSandeep Nair <0x2aa0000 0x20000>; 149a4dfb8c4SSandeep Nair }; 150a4dfb8c4SSandeep Nair }; 151a4dfb8c4SSandeep Nair queue-pools { 152a4dfb8c4SSandeep Nair qpend { 153a4dfb8c4SSandeep Nair qpend-0 { 154a4dfb8c4SSandeep Nair qrange = <658 8>; 155a4dfb8c4SSandeep Nair interrupts =<0 40 0xf04 0 41 0xf04 0 42 0xf04 156a4dfb8c4SSandeep Nair 0 43 0xf04 0 44 0xf04 0 45 0xf04 157a4dfb8c4SSandeep Nair 0 46 0xf04 0 47 0xf04>; 158a4dfb8c4SSandeep Nair }; 159a4dfb8c4SSandeep Nair qpend-1 { 160a4dfb8c4SSandeep Nair qrange = <8704 16>; 161a4dfb8c4SSandeep Nair interrupts = <0 48 0xf04 0 49 0xf04 0 50 0xf04 162a4dfb8c4SSandeep Nair 0 51 0xf04 0 52 0xf04 0 53 0xf04 163a4dfb8c4SSandeep Nair 0 54 0xf04 0 55 0xf04 0 56 0xf04 164a4dfb8c4SSandeep Nair 0 57 0xf04 0 58 0xf04 0 59 0xf04 165a4dfb8c4SSandeep Nair 0 60 0xf04 0 61 0xf04 0 62 0xf04 166a4dfb8c4SSandeep Nair 0 63 0xf04>; 167a4dfb8c4SSandeep Nair qalloc-by-id; 168a4dfb8c4SSandeep Nair }; 169a4dfb8c4SSandeep Nair qpend-2 { 170a4dfb8c4SSandeep Nair qrange = <8720 16>; 171a4dfb8c4SSandeep Nair interrupts = <0 64 0xf04 0 65 0xf04 0 66 0xf04 172a4dfb8c4SSandeep Nair 0 59 0xf04 0 68 0xf04 0 69 0xf04 173a4dfb8c4SSandeep Nair 0 70 0xf04 0 71 0xf04 0 72 0xf04 174a4dfb8c4SSandeep Nair 0 73 0xf04 0 74 0xf04 0 75 0xf04 175a4dfb8c4SSandeep Nair 0 76 0xf04 0 77 0xf04 0 78 0xf04 176a4dfb8c4SSandeep Nair 0 79 0xf04>; 177a4dfb8c4SSandeep Nair }; 178a4dfb8c4SSandeep Nair }; 179a4dfb8c4SSandeep Nair general-purpose { 180a4dfb8c4SSandeep Nair gp-0 { 181a4dfb8c4SSandeep Nair qrange = <4000 64>; 182a4dfb8c4SSandeep Nair }; 183a4dfb8c4SSandeep Nair netcp-tx { 184a4dfb8c4SSandeep Nair qrange = <640 9>; 185a4dfb8c4SSandeep Nair qalloc-by-id; 186a4dfb8c4SSandeep Nair }; 187a4dfb8c4SSandeep Nair }; 188a4dfb8c4SSandeep Nair accumulator { 189a4dfb8c4SSandeep Nair acc-0 { 190a4dfb8c4SSandeep Nair qrange = <128 32>; 191a4dfb8c4SSandeep Nair accumulator = <0 36 16 2 50>; 192a4dfb8c4SSandeep Nair interrupts = <0 215 0xf01>; 193a4dfb8c4SSandeep Nair multi-queue; 194a4dfb8c4SSandeep Nair qalloc-by-id; 195a4dfb8c4SSandeep Nair }; 196a4dfb8c4SSandeep Nair acc-1 { 197a4dfb8c4SSandeep Nair qrange = <160 32>; 198a4dfb8c4SSandeep Nair accumulator = <0 37 16 2 50>; 199a4dfb8c4SSandeep Nair interrupts = <0 216 0xf01>; 200a4dfb8c4SSandeep Nair multi-queue; 201a4dfb8c4SSandeep Nair }; 202a4dfb8c4SSandeep Nair acc-2 { 203a4dfb8c4SSandeep Nair qrange = <192 32>; 204a4dfb8c4SSandeep Nair accumulator = <0 38 16 2 50>; 205a4dfb8c4SSandeep Nair interrupts = <0 217 0xf01>; 206a4dfb8c4SSandeep Nair multi-queue; 207a4dfb8c4SSandeep Nair }; 208a4dfb8c4SSandeep Nair acc-3 { 209a4dfb8c4SSandeep Nair qrange = <224 32>; 210a4dfb8c4SSandeep Nair accumulator = <0 39 16 2 50>; 211a4dfb8c4SSandeep Nair interrupts = <0 218 0xf01>; 212a4dfb8c4SSandeep Nair multi-queue; 213a4dfb8c4SSandeep Nair }; 214a4dfb8c4SSandeep Nair }; 215a4dfb8c4SSandeep Nair }; 216a4dfb8c4SSandeep Nair descriptor-regions { 217a4dfb8c4SSandeep Nair #address-cells = <1>; 218a4dfb8c4SSandeep Nair #size-cells = <1>; 219a4dfb8c4SSandeep Nair ranges; 220a4dfb8c4SSandeep Nair region-12 { 221a4dfb8c4SSandeep Nair id = <12>; 222a4dfb8c4SSandeep Nair region-spec = <8192 128>; /* num_desc desc_size */ 223a4dfb8c4SSandeep Nair link-index = <0x4000>; 224a4dfb8c4SSandeep Nair }; 225a4dfb8c4SSandeep Nair }; 226a4dfb8c4SSandeep Nair pdsps { 227a4dfb8c4SSandeep Nair #address-cells = <1>; 228a4dfb8c4SSandeep Nair #size-cells = <1>; 229a4dfb8c4SSandeep Nair ranges; 2304c9847b7SMathieu Malaterre pdsp0@2a10000 { 231a4dfb8c4SSandeep Nair reg = <0x2a10000 0x1000>, 232a4dfb8c4SSandeep Nair <0x2a0f000 0x100>, 233a4dfb8c4SSandeep Nair <0x2a0c000 0x3c8>, 234a4dfb8c4SSandeep Nair <0x2a20000 0x4000>; 235a4dfb8c4SSandeep Nair id = <0>; 236a4dfb8c4SSandeep Nair }; 237a4dfb8c4SSandeep Nair }; 238a4dfb8c4SSandeep Nair}; /* qmss */ 239