soc: fsl: cpm1: qmc: Extend the API to provide Rx status

In HDLC mode, some status flags related to the data read transfer can be
set by the hardware and need to be known by a QMC consumer for further
analysis.

Extend the API in order to provide these transfer status flags at the
read complete() call.

In TRANSPARENT mode, these flags have no meaning. Keep only one read
complete() API and update the consumers working in transparent mode.
In this case, the newly introduced flags parameter is simply unused.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/20231205152116.122512-5-herve.codina@bootlin.com
This commit is contained in:
Herve Codina
2023-12-05 16:21:01 +01:00
parent dfe66d012a
commit 0e034aec5b
3 changed files with 40 additions and 6 deletions
+14 -1
View File
@@ -9,6 +9,7 @@
#ifndef __SOC_FSL_QMC_H__
#define __SOC_FSL_QMC_H__
#include <linux/bits.h>
#include <linux/types.h>
struct device_node;
@@ -56,8 +57,20 @@ int qmc_chan_set_param(struct qmc_chan *chan, const struct qmc_chan_param *param
int qmc_chan_write_submit(struct qmc_chan *chan, dma_addr_t addr, size_t length,
void (*complete)(void *context), void *context);
/* Flags available (ORed) for read complete() flags parameter in HDLC mode.
* No flags are available in transparent mode and the read complete() flags
* parameter has no meaning in transparent mode.
*/
#define QMC_RX_FLAG_HDLC_LAST BIT(11) /* Last in frame */
#define QMC_RX_FLAG_HDLC_FIRST BIT(10) /* First in frame */
#define QMC_RX_FLAG_HDLC_OVF BIT(5) /* Data overflow */
#define QMC_RX_FLAG_HDLC_UNA BIT(4) /* Unaligned (ie. bits received not multiple of 8) */
#define QMC_RX_FLAG_HDLC_ABORT BIT(3) /* Received an abort sequence (seven consecutive ones) */
#define QMC_RX_FLAG_HDLC_CRC BIT(2) /* CRC error */
int qmc_chan_read_submit(struct qmc_chan *chan, dma_addr_t addr, size_t length,
void (*complete)(void *context, size_t length),
void (*complete)(void *context, size_t length,
unsigned int flags),
void *context);
#define QMC_CHAN_READ (1<<0)