162306a36Sopenharmony_ci* Texas Instruments Keystone Navigator Queue Management SubSystem driver
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciThe QMSS (Queue Manager Sub System) found on Keystone SOCs is one of
462306a36Sopenharmony_cithe main hardware sub system which forms the backbone of the Keystone
562306a36Sopenharmony_cimulti-core Navigator. QMSS consist of queue managers, packed-data structure
662306a36Sopenharmony_ciprocessors(PDSP), linking RAM, descriptor pools and infrastructure
762306a36Sopenharmony_ciPacket DMA.
862306a36Sopenharmony_ciThe Queue Manager is a hardware module that is responsible for accelerating
962306a36Sopenharmony_cimanagement of the packet queues. Packets are queued/de-queued by writing or
1062306a36Sopenharmony_cireading descriptor address to a particular memory mapped location. The PDSPs
1162306a36Sopenharmony_ciperform QMSS related functions like accumulation, QoS, or event management.
1262306a36Sopenharmony_ciLinking RAM registers are used to link the descriptors which are stored in
1362306a36Sopenharmony_cidescriptor RAM. Descriptor RAM is configurable as internal or external memory.
1462306a36Sopenharmony_ciThe QMSS driver manages the PDSP setups, linking RAM regions,
1562306a36Sopenharmony_ciqueue pool management (allocation, push, pop and notify) and descriptor
1662306a36Sopenharmony_cipool management.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciRequired properties:
2062306a36Sopenharmony_ci- compatible	: Must be "ti,keystone-navigator-qmss".
2162306a36Sopenharmony_ci		: Must be "ti,66ak2g-navss-qm" for QMSS on K2G SoC.
2262306a36Sopenharmony_ci- clocks	: phandle to the reference clock for this device.
2362306a36Sopenharmony_ci- queue-range	: <start number> total range of queue numbers for the device.
2462306a36Sopenharmony_ci- linkram0	: <address size> for internal link ram, where size is the total
2562306a36Sopenharmony_ci		  link ram entries.
2662306a36Sopenharmony_ci- linkram1	: <address size> for external link ram, where size is the total
2762306a36Sopenharmony_ci		  external link ram entries. If the address is specified as "0"
2862306a36Sopenharmony_ci		  driver will allocate memory.
2962306a36Sopenharmony_ci- qmgrs         : child node describing the individual queue managers on the
3062306a36Sopenharmony_ci		  SoC. On keystone 1 devices there should be only one node.
3162306a36Sopenharmony_ci		  On keystone 2 devices there can be more than 1 node.
3262306a36Sopenharmony_ci  -- managed-queues	: the actual queues managed by each queue manager
3362306a36Sopenharmony_ci			  instance, specified as <"base queue #" "# of queues">.
3462306a36Sopenharmony_ci  -- reg		: Address and size of the register set for the device.
3562306a36Sopenharmony_ci			  Register regions should be specified in the following
3662306a36Sopenharmony_ci			  order
3762306a36Sopenharmony_ci			  - Queue Peek region.
3862306a36Sopenharmony_ci			  - Queue status RAM.
3962306a36Sopenharmony_ci			  - Queue configuration region.
4062306a36Sopenharmony_ci			  - Descriptor memory setup region.
4162306a36Sopenharmony_ci			  - Queue Management/Queue Proxy region for queue Push.
4262306a36Sopenharmony_ci			  - Queue Management/Queue Proxy region for queue Pop.
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ciFor QMSS on K2G SoC, following QM reg indexes are used in that order
4562306a36Sopenharmony_ci			  - Queue Peek region.
4662306a36Sopenharmony_ci			  - Queue configuration region.
4762306a36Sopenharmony_ci			  - Queue Management/Queue Proxy region for queue Push/Pop.
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci- queue-pools	: child node classifying the queue ranges into pools.
5062306a36Sopenharmony_ci		  Queue ranges are grouped into 3 type of pools:
5162306a36Sopenharmony_ci		  - qpend	    : pool of qpend(interruptible) queues
5262306a36Sopenharmony_ci		  - general-purpose : pool of general queues, primarily used
5362306a36Sopenharmony_ci				      as free descriptor queues or the
5462306a36Sopenharmony_ci				      transmit DMA queues.
5562306a36Sopenharmony_ci		  - accumulator	    : pool of queues on PDSP accumulator channel
5662306a36Sopenharmony_ci		  Each range can have the following properties:
5762306a36Sopenharmony_ci  -- qrange		: number of queues to use per queue range, specified as
5862306a36Sopenharmony_ci			  <"base queue #" "# of queues">.
5962306a36Sopenharmony_ci  -- interrupts		: Optional property to specify the interrupt mapping
6062306a36Sopenharmony_ci			  for interruptible queues. The driver additionally sets
6162306a36Sopenharmony_ci			  the interrupt affinity hint based on the cpu mask.
6262306a36Sopenharmony_ci  -- qalloc-by-id	: Optional property to specify that the queues in this
6362306a36Sopenharmony_ci			  range can only be allocated by queue id.
6462306a36Sopenharmony_ci  -- accumulator	: Accumulator channel specification. Any of the PDSPs in
6562306a36Sopenharmony_ci			  QMSS can be loaded with the accumulator firmware. The
6662306a36Sopenharmony_ci			  accumulator firmware’s job is to poll a select number of
6762306a36Sopenharmony_ci			  queues looking for descriptors that have been pushed
6862306a36Sopenharmony_ci			  into them. Descriptors are popped from the queue and
6962306a36Sopenharmony_ci			  placed in a buffer provided by the host. When the list
7062306a36Sopenharmony_ci			  becomes full or a programmed time period expires, the
7162306a36Sopenharmony_ci			  accumulator triggers an interrupt to the host to read
7262306a36Sopenharmony_ci			  the buffer for descriptor information. This firmware
7362306a36Sopenharmony_ci			  comes in 16, 32, and 48 channel builds. Each of these
7462306a36Sopenharmony_ci			  channels can be configured to monitor 32 contiguous
7562306a36Sopenharmony_ci			  queues.  Accumulator channel property is specified as:
7662306a36Sopenharmony_ci			  <pdsp-id, channel, entries, pacing mode, latency>
7762306a36Sopenharmony_ci			  pdsp-id     : QMSS PDSP running accumulator firmware
7862306a36Sopenharmony_ci					on which the channel has to be
7962306a36Sopenharmony_ci					configured
8062306a36Sopenharmony_ci			  channel     : Accumulator channel number
8162306a36Sopenharmony_ci			  entries     : Size of the accumulator descriptor list
8262306a36Sopenharmony_ci			  pacing mode : Interrupt pacing mode
8362306a36Sopenharmony_ci					0 : None, i.e interrupt on list full only
8462306a36Sopenharmony_ci					1 : Time delay since last interrupt
8562306a36Sopenharmony_ci					2 : Time delay since first new packet
8662306a36Sopenharmony_ci					3 : Time delay since last new packet
8762306a36Sopenharmony_ci			  latency     : time to delay the interrupt, specified
8862306a36Sopenharmony_ci					in microseconds.
8962306a36Sopenharmony_ci  -- multi-queue	: Optional property to specify that the channel has to
9062306a36Sopenharmony_ci			  monitor up to 32 queues starting at the base queue #.
9162306a36Sopenharmony_ci- descriptor-regions	: child node describing the memory regions for keystone
9262306a36Sopenharmony_ci			  navigator packet DMA descriptors. The memory for
9362306a36Sopenharmony_ci			  descriptors will be allocated by the driver.
9462306a36Sopenharmony_ci  -- id				: region number in QMSS.
9562306a36Sopenharmony_ci  -- region-spec		: specifies the number of descriptors in the
9662306a36Sopenharmony_ci				  region, specified as
9762306a36Sopenharmony_ci				  <"# of descriptors" "descriptor size">.
9862306a36Sopenharmony_ci  -- link-index			: start index, i.e. index of the first
9962306a36Sopenharmony_ci				  descriptor in the region.
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ciOptional properties:
10262306a36Sopenharmony_ci- dma-coherent	: Present if DMA operations are coherent.
10362306a36Sopenharmony_ci- pdsps		: child node describing the PDSP configuration.
10462306a36Sopenharmony_ci  -- firmware		: firmware to be loaded on the PDSP.
10562306a36Sopenharmony_ci  -- id			: the qmss pdsp that will run the firmware.
10662306a36Sopenharmony_ci  -- reg		: Address and size of the register set for the PDSP.
10762306a36Sopenharmony_ci			  Register regions should be specified in the following
10862306a36Sopenharmony_ci			  order
10962306a36Sopenharmony_ci			  - PDSP internal RAM region.
11062306a36Sopenharmony_ci			  - PDSP control/status region registers.
11162306a36Sopenharmony_ci			  - QMSS interrupt distributor registers.
11262306a36Sopenharmony_ci			  - PDSP command interface region.
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ciExample:
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ciqmss: qmss@2a40000 {
11762306a36Sopenharmony_ci	compatible = "ti,keystone-qmss";
11862306a36Sopenharmony_ci	dma-coherent;
11962306a36Sopenharmony_ci	#address-cells = <1>;
12062306a36Sopenharmony_ci	#size-cells = <1>;
12162306a36Sopenharmony_ci	clocks = <&chipclk13>;
12262306a36Sopenharmony_ci	ranges;
12362306a36Sopenharmony_ci	queue-range	= <0 0x4000>;
12462306a36Sopenharmony_ci	linkram0	= <0x100000 0x8000>;
12562306a36Sopenharmony_ci	linkram1	= <0x0 0x10000>;
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci	qmgrs {
12862306a36Sopenharmony_ci		#address-cells = <1>;
12962306a36Sopenharmony_ci		#size-cells = <1>;
13062306a36Sopenharmony_ci		ranges;
13162306a36Sopenharmony_ci		qmgr0 {
13262306a36Sopenharmony_ci			managed-queues = <0 0x2000>;
13362306a36Sopenharmony_ci			reg = <0x2a40000 0x20000>,
13462306a36Sopenharmony_ci			      <0x2a06000 0x400>,
13562306a36Sopenharmony_ci			      <0x2a02000 0x1000>,
13662306a36Sopenharmony_ci			      <0x2a03000 0x1000>,
13762306a36Sopenharmony_ci			      <0x23a80000 0x20000>,
13862306a36Sopenharmony_ci			      <0x2a80000 0x20000>;
13962306a36Sopenharmony_ci		};
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci		qmgr1 {
14262306a36Sopenharmony_ci			managed-queues = <0x2000 0x2000>;
14362306a36Sopenharmony_ci			reg = <0x2a60000 0x20000>,
14462306a36Sopenharmony_ci			      <0x2a06400 0x400>,
14562306a36Sopenharmony_ci			      <0x2a04000 0x1000>,
14662306a36Sopenharmony_ci			      <0x2a05000 0x1000>,
14762306a36Sopenharmony_ci			      <0x23aa0000 0x20000>,
14862306a36Sopenharmony_ci			      <0x2aa0000 0x20000>;
14962306a36Sopenharmony_ci		};
15062306a36Sopenharmony_ci	};
15162306a36Sopenharmony_ci	queue-pools {
15262306a36Sopenharmony_ci		qpend {
15362306a36Sopenharmony_ci			qpend-0 {
15462306a36Sopenharmony_ci				qrange = <658 8>;
15562306a36Sopenharmony_ci				interrupts =<0 40 0xf04 0 41 0xf04 0 42 0xf04
15662306a36Sopenharmony_ci					     0 43 0xf04 0 44 0xf04 0 45 0xf04
15762306a36Sopenharmony_ci					     0 46 0xf04 0 47 0xf04>;
15862306a36Sopenharmony_ci			};
15962306a36Sopenharmony_ci			qpend-1 {
16062306a36Sopenharmony_ci				qrange = <8704 16>;
16162306a36Sopenharmony_ci				interrupts = <0 48 0xf04 0 49 0xf04 0 50 0xf04
16262306a36Sopenharmony_ci					      0 51 0xf04 0 52 0xf04 0 53 0xf04
16362306a36Sopenharmony_ci					      0 54 0xf04 0 55 0xf04 0 56 0xf04
16462306a36Sopenharmony_ci					      0 57 0xf04 0 58 0xf04 0 59 0xf04
16562306a36Sopenharmony_ci					      0 60 0xf04 0 61 0xf04 0 62 0xf04
16662306a36Sopenharmony_ci					      0 63 0xf04>;
16762306a36Sopenharmony_ci				qalloc-by-id;
16862306a36Sopenharmony_ci			};
16962306a36Sopenharmony_ci			qpend-2 {
17062306a36Sopenharmony_ci				qrange = <8720 16>;
17162306a36Sopenharmony_ci				interrupts = <0 64 0xf04 0 65 0xf04 0 66 0xf04
17262306a36Sopenharmony_ci					      0 59 0xf04 0 68 0xf04 0 69 0xf04
17362306a36Sopenharmony_ci					      0 70 0xf04 0 71 0xf04 0 72 0xf04
17462306a36Sopenharmony_ci					      0 73 0xf04 0 74 0xf04 0 75 0xf04
17562306a36Sopenharmony_ci					      0 76 0xf04 0 77 0xf04 0 78 0xf04
17662306a36Sopenharmony_ci					      0 79 0xf04>;
17762306a36Sopenharmony_ci			};
17862306a36Sopenharmony_ci		};
17962306a36Sopenharmony_ci		general-purpose {
18062306a36Sopenharmony_ci			gp-0 {
18162306a36Sopenharmony_ci				qrange = <4000 64>;
18262306a36Sopenharmony_ci			};
18362306a36Sopenharmony_ci			netcp-tx {
18462306a36Sopenharmony_ci				qrange = <640 9>;
18562306a36Sopenharmony_ci				qalloc-by-id;
18662306a36Sopenharmony_ci			};
18762306a36Sopenharmony_ci		};
18862306a36Sopenharmony_ci		accumulator {
18962306a36Sopenharmony_ci			acc-0 {
19062306a36Sopenharmony_ci				qrange = <128 32>;
19162306a36Sopenharmony_ci				accumulator = <0 36 16 2 50>;
19262306a36Sopenharmony_ci				interrupts = <0 215 0xf01>;
19362306a36Sopenharmony_ci				multi-queue;
19462306a36Sopenharmony_ci				qalloc-by-id;
19562306a36Sopenharmony_ci			};
19662306a36Sopenharmony_ci			acc-1 {
19762306a36Sopenharmony_ci				qrange = <160 32>;
19862306a36Sopenharmony_ci				accumulator = <0 37 16 2 50>;
19962306a36Sopenharmony_ci				interrupts = <0 216 0xf01>;
20062306a36Sopenharmony_ci				multi-queue;
20162306a36Sopenharmony_ci			};
20262306a36Sopenharmony_ci			acc-2 {
20362306a36Sopenharmony_ci				qrange = <192 32>;
20462306a36Sopenharmony_ci				accumulator = <0 38 16 2 50>;
20562306a36Sopenharmony_ci				interrupts = <0 217 0xf01>;
20662306a36Sopenharmony_ci				multi-queue;
20762306a36Sopenharmony_ci			};
20862306a36Sopenharmony_ci			acc-3 {
20962306a36Sopenharmony_ci				qrange = <224 32>;
21062306a36Sopenharmony_ci				accumulator = <0 39 16 2 50>;
21162306a36Sopenharmony_ci				interrupts = <0 218 0xf01>;
21262306a36Sopenharmony_ci				multi-queue;
21362306a36Sopenharmony_ci			};
21462306a36Sopenharmony_ci		};
21562306a36Sopenharmony_ci	};
21662306a36Sopenharmony_ci	descriptor-regions {
21762306a36Sopenharmony_ci		#address-cells = <1>;
21862306a36Sopenharmony_ci		#size-cells = <1>;
21962306a36Sopenharmony_ci		ranges;
22062306a36Sopenharmony_ci		region-12 {
22162306a36Sopenharmony_ci			id = <12>;
22262306a36Sopenharmony_ci			region-spec = <8192 128>; /* num_desc desc_size */
22362306a36Sopenharmony_ci			link-index = <0x4000>;
22462306a36Sopenharmony_ci		};
22562306a36Sopenharmony_ci	};
22662306a36Sopenharmony_ci	pdsps {
22762306a36Sopenharmony_ci		#address-cells = <1>;
22862306a36Sopenharmony_ci		#size-cells = <1>;
22962306a36Sopenharmony_ci		ranges;
23062306a36Sopenharmony_ci		pdsp0@2a10000 {
23162306a36Sopenharmony_ci			reg = <0x2a10000 0x1000>,
23262306a36Sopenharmony_ci			      <0x2a0f000 0x100>,
23362306a36Sopenharmony_ci			      <0x2a0c000 0x3c8>,
23462306a36Sopenharmony_ci			      <0x2a20000 0x4000>;
23562306a36Sopenharmony_ci			id = <0>;
23662306a36Sopenharmony_ci		};
23762306a36Sopenharmony_ci	};
23862306a36Sopenharmony_ci}; /* qmss */
239