mirror of
				git://git.openwrt.org/openwrt/openwrt.git
				synced 2025-11-03 22:44:27 -05:00 
			
		
		
		
	Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release which was tagged LSDK-20.04-V5.4. https://source.codeaurora.org/external/qoriq/qoriq-components/linux/ For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in LSDK, port the dts patches from 4.14. The patches are sorted into the following categories: 301-arch-xxxx 302-dts-xxxx 303-core-xxxx 701-net-xxxx 801-audio-xxxx 802-can-xxxx 803-clock-xxxx 804-crypto-xxxx 805-display-xxxx 806-dma-xxxx 807-gpio-xxxx 808-i2c-xxxx 809-jailhouse-xxxx 810-keys-xxxx 811-kvm-xxxx 812-pcie-xxxx 813-pm-xxxx 814-qe-xxxx 815-sata-xxxx 816-sdhc-xxxx 817-spi-xxxx 818-thermal-xxxx 819-uart-xxxx 820-usb-xxxx 821-vfio-xxxx Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
		
			
				
	
	
		
			305 lines
		
	
	
		
			9.2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			305 lines
		
	
	
		
			9.2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From 1da6ba0350da068295d5bc5556193b21da38a388 Mon Sep 17 00:00:00 2001
 | 
						|
From: Youri Querry <youri.querry_1@nxp.com>
 | 
						|
Date: Mon, 4 Nov 2019 10:32:37 -0500
 | 
						|
Subject: [PATCH] soc: fsl: dpio: Adding QMAN multiple enqueue interface.
 | 
						|
 | 
						|
Update of QMAN the interface to enqueue frame. We now support multiple
 | 
						|
enqueue (qbman_swp_enqueue_multiple) and multiple enqueue with
 | 
						|
a table of descriptor (qbman_swp_enqueue_multiple_desc).
 | 
						|
 | 
						|
Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
 | 
						|
---
 | 
						|
 drivers/soc/fsl/dpio/dpio-service.c | 69 ++++++++++++++++++++++++++++++++--
 | 
						|
 drivers/soc/fsl/dpio/qbman-portal.c | 75 +++++++++++++++++++++++++++++++------
 | 
						|
 drivers/soc/fsl/dpio/qbman-portal.h | 17 +++++++++
 | 
						|
 include/soc/fsl/dpaa2-io.h          |  6 ++-
 | 
						|
 4 files changed, 152 insertions(+), 15 deletions(-)
 | 
						|
 | 
						|
--- a/drivers/soc/fsl/dpio/dpio-service.c
 | 
						|
+++ b/drivers/soc/fsl/dpio/dpio-service.c
 | 
						|
@@ -1,7 +1,7 @@
 | 
						|
 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 | 
						|
 /*
 | 
						|
  * Copyright 2014-2016 Freescale Semiconductor Inc.
 | 
						|
- * Copyright 2016 NXP
 | 
						|
+ * Copyright 2016-2019 NXP
 | 
						|
  *
 | 
						|
  */
 | 
						|
 #include <linux/types.h>
 | 
						|
@@ -437,6 +437,69 @@ int dpaa2_io_service_enqueue_fq(struct d
 | 
						|
 EXPORT_SYMBOL(dpaa2_io_service_enqueue_fq);
 | 
						|
 
 | 
						|
 /**
 | 
						|
+ * dpaa2_io_service_enqueue_multiple_fq() - Enqueue multiple frames
 | 
						|
+ * to a frame queue using one fqid.
 | 
						|
+ * @d: the given DPIO service.
 | 
						|
+ * @fqid: the given frame queue id.
 | 
						|
+ * @fd: the frame descriptor which is enqueued.
 | 
						|
+ * @nb: number of frames to be enqueud
 | 
						|
+ *
 | 
						|
+ * Return 0 for successful enqueue, -EBUSY if the enqueue ring is not ready,
 | 
						|
+ * or -ENODEV if there is no dpio service.
 | 
						|
+ */
 | 
						|
+int dpaa2_io_service_enqueue_multiple_fq(struct dpaa2_io *d,
 | 
						|
+				u32 fqid,
 | 
						|
+				const struct dpaa2_fd *fd,
 | 
						|
+				int nb)
 | 
						|
+{
 | 
						|
+	struct qbman_eq_desc ed;
 | 
						|
+
 | 
						|
+	d = service_select(d);
 | 
						|
+	if (!d)
 | 
						|
+		return -ENODEV;
 | 
						|
+
 | 
						|
+	qbman_eq_desc_clear(&ed);
 | 
						|
+	qbman_eq_desc_set_no_orp(&ed, 0);
 | 
						|
+	qbman_eq_desc_set_fq(&ed, fqid);
 | 
						|
+
 | 
						|
+	return qbman_swp_enqueue_multiple(d->swp, &ed, fd, 0, nb);
 | 
						|
+}
 | 
						|
+EXPORT_SYMBOL(dpaa2_io_service_enqueue_multiple_fq);
 | 
						|
+
 | 
						|
+/**
 | 
						|
+ * dpaa2_io_service_enqueue_multiple_desc_fq() - Enqueue multiple frames
 | 
						|
+ * to different frame queue using a list of fqids.
 | 
						|
+ * @d: the given DPIO service.
 | 
						|
+ * @fqid: the given list of frame queue ids.
 | 
						|
+ * @fd: the frame descriptor which is enqueued.
 | 
						|
+ * @nb: number of frames to be enqueud
 | 
						|
+ *
 | 
						|
+ * Return 0 for successful enqueue, -EBUSY if the enqueue ring is not ready,
 | 
						|
+ * or -ENODEV if there is no dpio service.
 | 
						|
+ */
 | 
						|
+int dpaa2_io_service_enqueue_multiple_desc_fq(struct dpaa2_io *d,
 | 
						|
+				u32 *fqid,
 | 
						|
+				const struct dpaa2_fd *fd,
 | 
						|
+				int nb)
 | 
						|
+{
 | 
						|
+	int i;
 | 
						|
+	struct qbman_eq_desc ed[32];
 | 
						|
+
 | 
						|
+	d = service_select(d);
 | 
						|
+	if (!d)
 | 
						|
+		return -ENODEV;
 | 
						|
+
 | 
						|
+	for (i = 0; i < nb; i++) {
 | 
						|
+		qbman_eq_desc_clear(&ed[i]);
 | 
						|
+		qbman_eq_desc_set_no_orp(&ed[i], 0);
 | 
						|
+		qbman_eq_desc_set_fq(&ed[i], fqid[i]);
 | 
						|
+	}
 | 
						|
+
 | 
						|
+	return qbman_swp_enqueue_multiple_desc(d->swp, &ed[0], fd, nb);
 | 
						|
+}
 | 
						|
+EXPORT_SYMBOL(dpaa2_io_service_enqueue_multiple_desc_fq);
 | 
						|
+
 | 
						|
+/**
 | 
						|
  * dpaa2_io_service_enqueue_qd() - Enqueue a frame to a QD.
 | 
						|
  * @d: the given DPIO service.
 | 
						|
  * @qdid: the given queuing destination id.
 | 
						|
@@ -530,7 +593,7 @@ EXPORT_SYMBOL_GPL(dpaa2_io_service_acqui
 | 
						|
 
 | 
						|
 /**
 | 
						|
  * dpaa2_io_store_create() - Create the dma memory storage for dequeue result.
 | 
						|
- * @max_frames: the maximum number of dequeued result for frames, must be <= 16.
 | 
						|
+ * @max_frames: the maximum number of dequeued result for frames, must be <= 32.
 | 
						|
  * @dev:        the device to allow mapping/unmapping the DMAable region.
 | 
						|
  *
 | 
						|
  * The size of the storage is "max_frames*sizeof(struct dpaa2_dq)".
 | 
						|
@@ -545,7 +608,7 @@ struct dpaa2_io_store *dpaa2_io_store_cr
 | 
						|
 	struct dpaa2_io_store *ret;
 | 
						|
 	size_t size;
 | 
						|
 
 | 
						|
-	if (!max_frames || (max_frames > 16))
 | 
						|
+	if (!max_frames || (max_frames > 32))
 | 
						|
 		return NULL;
 | 
						|
 
 | 
						|
 	ret = kmalloc(sizeof(*ret), GFP_KERNEL);
 | 
						|
--- a/drivers/soc/fsl/dpio/qbman-portal.c
 | 
						|
+++ b/drivers/soc/fsl/dpio/qbman-portal.c
 | 
						|
@@ -1,7 +1,7 @@
 | 
						|
 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 | 
						|
 /*
 | 
						|
  * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
 | 
						|
- * Copyright 2016 NXP
 | 
						|
+ * Copyright 2016-2019 NXP
 | 
						|
  *
 | 
						|
  */
 | 
						|
 
 | 
						|
@@ -86,7 +86,7 @@ enum qbman_sdqcr_fc {
 | 
						|
 
 | 
						|
 #define dccvac(p) { asm volatile("dc cvac, %0;" : : "r" (p) : "memory"); }
 | 
						|
 #define dcivac(p) { asm volatile("dc ivac, %0" : : "r"(p) : "memory"); }
 | 
						|
-static inline void qbman_inval_prefetch(struct qbman_swp *p, uint32_t offset)
 | 
						|
+static inline void qbman_inval_prefetch(struct qbman_swp *p, u32 offset)
 | 
						|
 {
 | 
						|
 	dcivac(p->addr_cena + offset);
 | 
						|
 	prefetch(p->addr_cena + offset);
 | 
						|
@@ -158,7 +158,7 @@ static inline u32 qbman_set_swp_cfg(u8 m
 | 
						|
  */
 | 
						|
 struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d)
 | 
						|
 {
 | 
						|
-	struct qbman_swp *p = kmalloc(sizeof(*p), GFP_KERNEL);
 | 
						|
+	struct qbman_swp *p = kzalloc(sizeof(*p), GFP_KERNEL);
 | 
						|
 	u32 reg;
 | 
						|
 
 | 
						|
 	if (!p)
 | 
						|
@@ -380,7 +380,6 @@ enum qb_enqueue_commands {
 | 
						|
 };
 | 
						|
 
 | 
						|
 #define QB_ENQUEUE_CMD_ORP_ENABLE_SHIFT      2
 | 
						|
-#define QB_ENQUEUE_CMD_IRQ_ON_DISPATCH_SHIFT 3
 | 
						|
 #define QB_ENQUEUE_CMD_TARGET_TYPE_SHIFT     4
 | 
						|
 
 | 
						|
 /**
 | 
						|
@@ -508,7 +507,7 @@ static inline void qbman_write_eqcr_am_r
 | 
						|
 int qbman_swp_enqueue(struct qbman_swp *s, const struct qbman_eq_desc *d,
 | 
						|
 		      const struct dpaa2_fd *fd)
 | 
						|
 {
 | 
						|
-	struct qbman_eq_desc *p;
 | 
						|
+	struct qbman_eq_desc_with_fd *p;
 | 
						|
 	u32 eqar = qbman_read_register(s, QBMAN_CINH_SWP_EQAR);
 | 
						|
 
 | 
						|
 	if (!EQAR_SUCCESS(eqar))
 | 
						|
@@ -522,19 +521,19 @@ int qbman_swp_enqueue(struct qbman_swp *
 | 
						|
 	 * desc.orpid address alignment = 4
 | 
						|
 	 * desc.tgtid address alignment = 8
 | 
						|
 	 */
 | 
						|
-	p->dca = d->dca;
 | 
						|
-	p->seqnum = d->seqnum;
 | 
						|
-	p->orpid = d->orpid;
 | 
						|
-	memcpy(&p->tgtid, &d->tgtid, 24);
 | 
						|
+	p->desc.dca = d->dca;
 | 
						|
+	p->desc.seqnum = d->seqnum;
 | 
						|
+	p->desc.orpid = d->orpid;
 | 
						|
+	memcpy(&p->desc.tgtid, &d->tgtid, 24);
 | 
						|
 	memcpy(&p->fd, fd, sizeof(*fd));
 | 
						|
 
 | 
						|
 	if ((s->desc->qman_version & QMAN_REV_MASK) < QMAN_REV_5000) {
 | 
						|
 		/* Set the verb byte, have to substitute in the valid-bit */
 | 
						|
 		dma_wmb();
 | 
						|
-		p->verb = d->verb | EQAR_VB(eqar);
 | 
						|
+		p->desc.verb = d->verb | EQAR_VB(eqar);
 | 
						|
 		dccvac(p);
 | 
						|
 	} else {
 | 
						|
-		p->verb = d->verb | EQAR_VB(eqar);
 | 
						|
+		p->desc.verb = d->verb | EQAR_VB(eqar);
 | 
						|
 		dma_wmb();
 | 
						|
 		qbman_write_eqcr_am_rt_register(s, EQAR_IDX(eqar));
 | 
						|
 	}
 | 
						|
@@ -542,6 +541,60 @@ int qbman_swp_enqueue(struct qbman_swp *
 | 
						|
 	return 0;
 | 
						|
 }
 | 
						|
 
 | 
						|
+/**
 | 
						|
+ * qbman_swp_enqueue_multiple() - Issue a multi enqueue command
 | 
						|
+ * using one enqueue descriptor
 | 
						|
+ * @s:  the software portal used for enqueue
 | 
						|
+ * @d:  the enqueue descriptor
 | 
						|
+ * @fd: table pointer of frame descriptor table to be enqueued
 | 
						|
+ * @flags: table pointer of flags, not used for the moment
 | 
						|
+ * @num_frames: number of fd to be enqueued
 | 
						|
+ *
 | 
						|
+ * Return the number of fd enqueued, or a negative error number.
 | 
						|
+ */
 | 
						|
+int qbman_swp_enqueue_multiple(struct qbman_swp *s,
 | 
						|
+			       const struct qbman_eq_desc *d,
 | 
						|
+			       const struct dpaa2_fd *fd,
 | 
						|
+			       uint32_t *flags,
 | 
						|
+			       int num_frames)
 | 
						|
+{
 | 
						|
+	int count = 0;
 | 
						|
+
 | 
						|
+	while (count < num_frames) {
 | 
						|
+		if (qbman_swp_enqueue(s, d, fd) != 0)
 | 
						|
+			break;
 | 
						|
+		count++;
 | 
						|
+	}
 | 
						|
+
 | 
						|
+	return count;
 | 
						|
+}
 | 
						|
+
 | 
						|
+/**
 | 
						|
+ * qbman_swp_enqueue_multiple_desc() - Issue a multi enqueue command
 | 
						|
+ * using multiple enqueue descriptor
 | 
						|
+ * @s:  the software portal used for enqueue
 | 
						|
+ * @d:  table of minimal enqueue descriptor
 | 
						|
+ * @fd: table pointer of frame descriptor table to be enqueued
 | 
						|
+ * @num_frames: number of fd to be enqueued
 | 
						|
+ *
 | 
						|
+ * Return the number of fd enqueued, or a negative error number.
 | 
						|
+ */
 | 
						|
+int qbman_swp_enqueue_multiple_desc(struct qbman_swp *s,
 | 
						|
+				    const struct qbman_eq_desc *d,
 | 
						|
+				    const struct dpaa2_fd *fd,
 | 
						|
+				    int num_frames)
 | 
						|
+{
 | 
						|
+	int count = 0;
 | 
						|
+
 | 
						|
+	while (count < num_frames) {
 | 
						|
+		if (qbman_swp_enqueue(s, &(d[count]), fd) != 0)
 | 
						|
+			break;
 | 
						|
+		count++;
 | 
						|
+	}
 | 
						|
+
 | 
						|
+	return count;
 | 
						|
+}
 | 
						|
+
 | 
						|
 /* Static (push) dequeue */
 | 
						|
 
 | 
						|
 /**
 | 
						|
--- a/drivers/soc/fsl/dpio/qbman-portal.h
 | 
						|
+++ b/drivers/soc/fsl/dpio/qbman-portal.h
 | 
						|
@@ -88,6 +88,10 @@ struct qbman_eq_desc {
 | 
						|
 	u8 wae;
 | 
						|
 	u8 rspid;
 | 
						|
 	__le64 rsp_addr;
 | 
						|
+};
 | 
						|
+
 | 
						|
+struct qbman_eq_desc_with_fd {
 | 
						|
+	struct qbman_eq_desc desc;
 | 
						|
 	u8 fd[32];
 | 
						|
 };
 | 
						|
 
 | 
						|
@@ -205,6 +209,19 @@ void *qbman_swp_mc_start(struct qbman_sw
 | 
						|
 void qbman_swp_mc_submit(struct qbman_swp *p, void *cmd, u8 cmd_verb);
 | 
						|
 void *qbman_swp_mc_result(struct qbman_swp *p);
 | 
						|
 
 | 
						|
+int
 | 
						|
+qbman_swp_enqueue_multiple(struct qbman_swp *s,
 | 
						|
+			   const struct qbman_eq_desc *d,
 | 
						|
+			   const struct dpaa2_fd *fd,
 | 
						|
+			   uint32_t *flags,
 | 
						|
+			   int num_frames);
 | 
						|
+
 | 
						|
+int
 | 
						|
+qbman_swp_enqueue_multiple_desc(struct qbman_swp *s,
 | 
						|
+				const struct qbman_eq_desc *d,
 | 
						|
+				const struct dpaa2_fd *fd,
 | 
						|
+				int num_frames);
 | 
						|
+
 | 
						|
 /**
 | 
						|
  * qbman_result_is_DQ() - check if the dequeue result is a dequeue response
 | 
						|
  * @dq: the dequeue result to be checked
 | 
						|
--- a/include/soc/fsl/dpaa2-io.h
 | 
						|
+++ b/include/soc/fsl/dpaa2-io.h
 | 
						|
@@ -1,7 +1,7 @@
 | 
						|
 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
 | 
						|
 /*
 | 
						|
  * Copyright 2014-2016 Freescale Semiconductor Inc.
 | 
						|
- * Copyright 2017 NXP
 | 
						|
+ * Copyright 2017-2019 NXP
 | 
						|
  *
 | 
						|
  */
 | 
						|
 #ifndef __FSL_DPAA2_IO_H
 | 
						|
@@ -109,6 +109,10 @@ int dpaa2_io_service_pull_channel(struct
 | 
						|
 
 | 
						|
 int dpaa2_io_service_enqueue_fq(struct dpaa2_io *d, u32 fqid,
 | 
						|
 				const struct dpaa2_fd *fd);
 | 
						|
+int dpaa2_io_service_enqueue_multiple_fq(struct dpaa2_io *d, u32 fqid,
 | 
						|
+				const struct dpaa2_fd *fd, int number_of_frame);
 | 
						|
+int dpaa2_io_service_enqueue_multiple_desc_fq(struct dpaa2_io *d, u32 *fqid,
 | 
						|
+				const struct dpaa2_fd *fd, int number_of_frame);
 | 
						|
 int dpaa2_io_service_enqueue_qd(struct dpaa2_io *d, u32 qdid, u8 prio,
 | 
						|
 				u16 qdbin, const struct dpaa2_fd *fd);
 | 
						|
 int dpaa2_io_service_release(struct dpaa2_io *d, u16 bpid,
 |