18c2ecf20Sopenharmony_ci* Texas Instruments Keystone Navigator Queue Management SubSystem driver 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ciThe QMSS (Queue Manager Sub System) found on Keystone SOCs is one of 48c2ecf20Sopenharmony_cithe main hardware sub system which forms the backbone of the Keystone 58c2ecf20Sopenharmony_cimulti-core Navigator. QMSS consist of queue managers, packed-data structure 68c2ecf20Sopenharmony_ciprocessors(PDSP), linking RAM, descriptor pools and infrastructure 78c2ecf20Sopenharmony_ciPacket DMA. 88c2ecf20Sopenharmony_ciThe Queue Manager is a hardware module that is responsible for accelerating 98c2ecf20Sopenharmony_cimanagement of the packet queues. Packets are queued/de-queued by writing or 108c2ecf20Sopenharmony_cireading descriptor address to a particular memory mapped location. The PDSPs 118c2ecf20Sopenharmony_ciperform QMSS related functions like accumulation, QoS, or event management. 128c2ecf20Sopenharmony_ciLinking RAM registers are used to link the descriptors which are stored in 138c2ecf20Sopenharmony_cidescriptor RAM. Descriptor RAM is configurable as internal or external memory. 148c2ecf20Sopenharmony_ciThe QMSS driver manages the PDSP setups, linking RAM regions, 158c2ecf20Sopenharmony_ciqueue pool management (allocation, push, pop and notify) and descriptor 168c2ecf20Sopenharmony_cipool management. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciRequired properties: 208c2ecf20Sopenharmony_ci- compatible : Must be "ti,keystone-navigator-qmss". 218c2ecf20Sopenharmony_ci : Must be "ti,66ak2g-navss-qm" for QMSS on K2G SoC. 228c2ecf20Sopenharmony_ci- clocks : phandle to the reference clock for this device. 238c2ecf20Sopenharmony_ci- queue-range : <start number> total range of queue numbers for the device. 248c2ecf20Sopenharmony_ci- linkram0 : <address size> for internal link ram, where size is the total 258c2ecf20Sopenharmony_ci link ram entries. 268c2ecf20Sopenharmony_ci- linkram1 : <address size> for external link ram, where size is the total 278c2ecf20Sopenharmony_ci external link ram entries. If the address is specified as "0" 288c2ecf20Sopenharmony_ci driver will allocate memory. 298c2ecf20Sopenharmony_ci- qmgrs : child node describing the individual queue managers on the 308c2ecf20Sopenharmony_ci SoC. On keystone 1 devices there should be only one node. 318c2ecf20Sopenharmony_ci On keystone 2 devices there can be more than 1 node. 328c2ecf20Sopenharmony_ci -- managed-queues : the actual queues managed by each queue manager 338c2ecf20Sopenharmony_ci instance, specified as <"base queue #" "# of queues">. 348c2ecf20Sopenharmony_ci -- reg : Address and size of the register set for the device. 358c2ecf20Sopenharmony_ci Register regions should be specified in the following 368c2ecf20Sopenharmony_ci order 378c2ecf20Sopenharmony_ci - Queue Peek region. 388c2ecf20Sopenharmony_ci - Queue status RAM. 398c2ecf20Sopenharmony_ci - Queue configuration region. 408c2ecf20Sopenharmony_ci - Descriptor memory setup region. 418c2ecf20Sopenharmony_ci - Queue Management/Queue Proxy region for queue Push. 428c2ecf20Sopenharmony_ci - Queue Management/Queue Proxy region for queue Pop. 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciFor QMSS on K2G SoC, following QM reg indexes are used in that order 458c2ecf20Sopenharmony_ci - Queue Peek region. 468c2ecf20Sopenharmony_ci - Queue configuration region. 478c2ecf20Sopenharmony_ci - Queue Management/Queue Proxy region for queue Push/Pop. 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci- queue-pools : child node classifying the queue ranges into pools. 508c2ecf20Sopenharmony_ci Queue ranges are grouped into 3 type of pools: 518c2ecf20Sopenharmony_ci - qpend : pool of qpend(interruptible) queues 528c2ecf20Sopenharmony_ci - general-purpose : pool of general queues, primarily used 538c2ecf20Sopenharmony_ci as free descriptor queues or the 548c2ecf20Sopenharmony_ci transmit DMA queues. 558c2ecf20Sopenharmony_ci - accumulator : pool of queues on PDSP accumulator channel 568c2ecf20Sopenharmony_ci Each range can have the following properties: 578c2ecf20Sopenharmony_ci -- qrange : number of queues to use per queue range, specified as 588c2ecf20Sopenharmony_ci <"base queue #" "# of queues">. 598c2ecf20Sopenharmony_ci -- interrupts : Optional property to specify the interrupt mapping 608c2ecf20Sopenharmony_ci for interruptible queues. The driver additionally sets 618c2ecf20Sopenharmony_ci the interrupt affinity hint based on the cpu mask. 628c2ecf20Sopenharmony_ci -- qalloc-by-id : Optional property to specify that the queues in this 638c2ecf20Sopenharmony_ci range can only be allocated by queue id. 648c2ecf20Sopenharmony_ci -- accumulator : Accumulator channel specification. Any of the PDSPs in 658c2ecf20Sopenharmony_ci QMSS can be loaded with the accumulator firmware. The 668c2ecf20Sopenharmony_ci accumulator firmware’s job is to poll a select number of 678c2ecf20Sopenharmony_ci queues looking for descriptors that have been pushed 688c2ecf20Sopenharmony_ci into them. Descriptors are popped from the queue and 698c2ecf20Sopenharmony_ci placed in a buffer provided by the host. When the list 708c2ecf20Sopenharmony_ci becomes full or a programmed time period expires, the 718c2ecf20Sopenharmony_ci accumulator triggers an interrupt to the host to read 728c2ecf20Sopenharmony_ci the buffer for descriptor information. This firmware 738c2ecf20Sopenharmony_ci comes in 16, 32, and 48 channel builds. Each of these 748c2ecf20Sopenharmony_ci channels can be configured to monitor 32 contiguous 758c2ecf20Sopenharmony_ci queues. Accumulator channel property is specified as: 768c2ecf20Sopenharmony_ci <pdsp-id, channel, entries, pacing mode, latency> 778c2ecf20Sopenharmony_ci pdsp-id : QMSS PDSP running accumulator firmware 788c2ecf20Sopenharmony_ci on which the channel has to be 798c2ecf20Sopenharmony_ci configured 808c2ecf20Sopenharmony_ci channel : Accumulator channel number 818c2ecf20Sopenharmony_ci entries : Size of the accumulator descriptor list 828c2ecf20Sopenharmony_ci pacing mode : Interrupt pacing mode 838c2ecf20Sopenharmony_ci 0 : None, i.e interrupt on list full only 848c2ecf20Sopenharmony_ci 1 : Time delay since last interrupt 858c2ecf20Sopenharmony_ci 2 : Time delay since first new packet 868c2ecf20Sopenharmony_ci 3 : Time delay since last new packet 878c2ecf20Sopenharmony_ci latency : time to delay the interrupt, specified 888c2ecf20Sopenharmony_ci in microseconds. 898c2ecf20Sopenharmony_ci -- multi-queue : Optional property to specify that the channel has to 908c2ecf20Sopenharmony_ci monitor up to 32 queues starting at the base queue #. 918c2ecf20Sopenharmony_ci- descriptor-regions : child node describing the memory regions for keystone 928c2ecf20Sopenharmony_ci navigator packet DMA descriptors. The memory for 938c2ecf20Sopenharmony_ci descriptors will be allocated by the driver. 948c2ecf20Sopenharmony_ci -- id : region number in QMSS. 958c2ecf20Sopenharmony_ci -- region-spec : specifies the number of descriptors in the 968c2ecf20Sopenharmony_ci region, specified as 978c2ecf20Sopenharmony_ci <"# of descriptors" "descriptor size">. 988c2ecf20Sopenharmony_ci -- link-index : start index, i.e. index of the first 998c2ecf20Sopenharmony_ci descriptor in the region. 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ciOptional properties: 1028c2ecf20Sopenharmony_ci- dma-coherent : Present if DMA operations are coherent. 1038c2ecf20Sopenharmony_ci- pdsps : child node describing the PDSP configuration. 1048c2ecf20Sopenharmony_ci -- firmware : firmware to be loaded on the PDSP. 1058c2ecf20Sopenharmony_ci -- id : the qmss pdsp that will run the firmware. 1068c2ecf20Sopenharmony_ci -- reg : Address and size of the register set for the PDSP. 1078c2ecf20Sopenharmony_ci Register regions should be specified in the following 1088c2ecf20Sopenharmony_ci order 1098c2ecf20Sopenharmony_ci - PDSP internal RAM region. 1108c2ecf20Sopenharmony_ci - PDSP control/status region registers. 1118c2ecf20Sopenharmony_ci - QMSS interrupt distributor registers. 1128c2ecf20Sopenharmony_ci - PDSP command interface region. 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ciExample: 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ciqmss: qmss@2a40000 { 1178c2ecf20Sopenharmony_ci compatible = "ti,keystone-qmss"; 1188c2ecf20Sopenharmony_ci dma-coherent; 1198c2ecf20Sopenharmony_ci #address-cells = <1>; 1208c2ecf20Sopenharmony_ci #size-cells = <1>; 1218c2ecf20Sopenharmony_ci clocks = <&chipclk13>; 1228c2ecf20Sopenharmony_ci ranges; 1238c2ecf20Sopenharmony_ci queue-range = <0 0x4000>; 1248c2ecf20Sopenharmony_ci linkram0 = <0x100000 0x8000>; 1258c2ecf20Sopenharmony_ci linkram1 = <0x0 0x10000>; 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci qmgrs { 1288c2ecf20Sopenharmony_ci #address-cells = <1>; 1298c2ecf20Sopenharmony_ci #size-cells = <1>; 1308c2ecf20Sopenharmony_ci ranges; 1318c2ecf20Sopenharmony_ci qmgr0 { 1328c2ecf20Sopenharmony_ci managed-queues = <0 0x2000>; 1338c2ecf20Sopenharmony_ci reg = <0x2a40000 0x20000>, 1348c2ecf20Sopenharmony_ci <0x2a06000 0x400>, 1358c2ecf20Sopenharmony_ci <0x2a02000 0x1000>, 1368c2ecf20Sopenharmony_ci <0x2a03000 0x1000>, 1378c2ecf20Sopenharmony_ci <0x23a80000 0x20000>, 1388c2ecf20Sopenharmony_ci <0x2a80000 0x20000>; 1398c2ecf20Sopenharmony_ci }; 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci qmgr1 { 1428c2ecf20Sopenharmony_ci managed-queues = <0x2000 0x2000>; 1438c2ecf20Sopenharmony_ci reg = <0x2a60000 0x20000>, 1448c2ecf20Sopenharmony_ci <0x2a06400 0x400>, 1458c2ecf20Sopenharmony_ci <0x2a04000 0x1000>, 1468c2ecf20Sopenharmony_ci <0x2a05000 0x1000>, 1478c2ecf20Sopenharmony_ci <0x23aa0000 0x20000>, 1488c2ecf20Sopenharmony_ci <0x2aa0000 0x20000>; 1498c2ecf20Sopenharmony_ci }; 1508c2ecf20Sopenharmony_ci }; 1518c2ecf20Sopenharmony_ci queue-pools { 1528c2ecf20Sopenharmony_ci qpend { 1538c2ecf20Sopenharmony_ci qpend-0 { 1548c2ecf20Sopenharmony_ci qrange = <658 8>; 1558c2ecf20Sopenharmony_ci interrupts =<0 40 0xf04 0 41 0xf04 0 42 0xf04 1568c2ecf20Sopenharmony_ci 0 43 0xf04 0 44 0xf04 0 45 0xf04 1578c2ecf20Sopenharmony_ci 0 46 0xf04 0 47 0xf04>; 1588c2ecf20Sopenharmony_ci }; 1598c2ecf20Sopenharmony_ci qpend-1 { 1608c2ecf20Sopenharmony_ci qrange = <8704 16>; 1618c2ecf20Sopenharmony_ci interrupts = <0 48 0xf04 0 49 0xf04 0 50 0xf04 1628c2ecf20Sopenharmony_ci 0 51 0xf04 0 52 0xf04 0 53 0xf04 1638c2ecf20Sopenharmony_ci 0 54 0xf04 0 55 0xf04 0 56 0xf04 1648c2ecf20Sopenharmony_ci 0 57 0xf04 0 58 0xf04 0 59 0xf04 1658c2ecf20Sopenharmony_ci 0 60 0xf04 0 61 0xf04 0 62 0xf04 1668c2ecf20Sopenharmony_ci 0 63 0xf04>; 1678c2ecf20Sopenharmony_ci qalloc-by-id; 1688c2ecf20Sopenharmony_ci }; 1698c2ecf20Sopenharmony_ci qpend-2 { 1708c2ecf20Sopenharmony_ci qrange = <8720 16>; 1718c2ecf20Sopenharmony_ci interrupts = <0 64 0xf04 0 65 0xf04 0 66 0xf04 1728c2ecf20Sopenharmony_ci 0 59 0xf04 0 68 0xf04 0 69 0xf04 1738c2ecf20Sopenharmony_ci 0 70 0xf04 0 71 0xf04 0 72 0xf04 1748c2ecf20Sopenharmony_ci 0 73 0xf04 0 74 0xf04 0 75 0xf04 1758c2ecf20Sopenharmony_ci 0 76 0xf04 0 77 0xf04 0 78 0xf04 1768c2ecf20Sopenharmony_ci 0 79 0xf04>; 1778c2ecf20Sopenharmony_ci }; 1788c2ecf20Sopenharmony_ci }; 1798c2ecf20Sopenharmony_ci general-purpose { 1808c2ecf20Sopenharmony_ci gp-0 { 1818c2ecf20Sopenharmony_ci qrange = <4000 64>; 1828c2ecf20Sopenharmony_ci }; 1838c2ecf20Sopenharmony_ci netcp-tx { 1848c2ecf20Sopenharmony_ci qrange = <640 9>; 1858c2ecf20Sopenharmony_ci qalloc-by-id; 1868c2ecf20Sopenharmony_ci }; 1878c2ecf20Sopenharmony_ci }; 1888c2ecf20Sopenharmony_ci accumulator { 1898c2ecf20Sopenharmony_ci acc-0 { 1908c2ecf20Sopenharmony_ci qrange = <128 32>; 1918c2ecf20Sopenharmony_ci accumulator = <0 36 16 2 50>; 1928c2ecf20Sopenharmony_ci interrupts = <0 215 0xf01>; 1938c2ecf20Sopenharmony_ci multi-queue; 1948c2ecf20Sopenharmony_ci qalloc-by-id; 1958c2ecf20Sopenharmony_ci }; 1968c2ecf20Sopenharmony_ci acc-1 { 1978c2ecf20Sopenharmony_ci qrange = <160 32>; 1988c2ecf20Sopenharmony_ci accumulator = <0 37 16 2 50>; 1998c2ecf20Sopenharmony_ci interrupts = <0 216 0xf01>; 2008c2ecf20Sopenharmony_ci multi-queue; 2018c2ecf20Sopenharmony_ci }; 2028c2ecf20Sopenharmony_ci acc-2 { 2038c2ecf20Sopenharmony_ci qrange = <192 32>; 2048c2ecf20Sopenharmony_ci accumulator = <0 38 16 2 50>; 2058c2ecf20Sopenharmony_ci interrupts = <0 217 0xf01>; 2068c2ecf20Sopenharmony_ci multi-queue; 2078c2ecf20Sopenharmony_ci }; 2088c2ecf20Sopenharmony_ci acc-3 { 2098c2ecf20Sopenharmony_ci qrange = <224 32>; 2108c2ecf20Sopenharmony_ci accumulator = <0 39 16 2 50>; 2118c2ecf20Sopenharmony_ci interrupts = <0 218 0xf01>; 2128c2ecf20Sopenharmony_ci multi-queue; 2138c2ecf20Sopenharmony_ci }; 2148c2ecf20Sopenharmony_ci }; 2158c2ecf20Sopenharmony_ci }; 2168c2ecf20Sopenharmony_ci descriptor-regions { 2178c2ecf20Sopenharmony_ci #address-cells = <1>; 2188c2ecf20Sopenharmony_ci #size-cells = <1>; 2198c2ecf20Sopenharmony_ci ranges; 2208c2ecf20Sopenharmony_ci region-12 { 2218c2ecf20Sopenharmony_ci id = <12>; 2228c2ecf20Sopenharmony_ci region-spec = <8192 128>; /* num_desc desc_size */ 2238c2ecf20Sopenharmony_ci link-index = <0x4000>; 2248c2ecf20Sopenharmony_ci }; 2258c2ecf20Sopenharmony_ci }; 2268c2ecf20Sopenharmony_ci pdsps { 2278c2ecf20Sopenharmony_ci #address-cells = <1>; 2288c2ecf20Sopenharmony_ci #size-cells = <1>; 2298c2ecf20Sopenharmony_ci ranges; 2308c2ecf20Sopenharmony_ci pdsp0@2a10000 { 2318c2ecf20Sopenharmony_ci reg = <0x2a10000 0x1000>, 2328c2ecf20Sopenharmony_ci <0x2a0f000 0x100>, 2338c2ecf20Sopenharmony_ci <0x2a0c000 0x3c8>, 2348c2ecf20Sopenharmony_ci <0x2a20000 0x4000>; 2358c2ecf20Sopenharmony_ci id = <0>; 2368c2ecf20Sopenharmony_ci }; 2378c2ecf20Sopenharmony_ci }; 2388c2ecf20Sopenharmony_ci}; /* qmss */ 239