linux/include/soc/fsl/cpm.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __CPM_H
#define __CPM_H

#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/of.h>
#include <soc/fsl/qe/qe.h>

/*
 * SPI Parameter RAM common to QE and CPM.
 */
struct spi_pram {};

/*
 * USB Controller pram common to QE and CPM.
 */
struct usb_ctlr {} __attribute__ ((packed));

/*
 * Function code bits, usually generic to devices.
 */
#ifdef CONFIG_CPM1
#define CPMFCR_GBL
#define CPMFCR_TC2
#define CPMFCR_DTB
#define CPMFCR_BDB
#else
#define CPMFCR_GBL
#define CPMFCR_TC2
#define CPMFCR_DTB
#define CPMFCR_BDB
#endif
#define CPMFCR_EB

/* Opcodes common to CPM1 and CPM2
*/
#define CPM_CR_INIT_TRX
#define CPM_CR_INIT_RX
#define CPM_CR_INIT_TX
#define CPM_CR_HUNT_MODE
#define CPM_CR_STOP_TX
#define CPM_CR_GRA_STOP_TX
#define CPM_CR_RESTART_TX
#define CPM_CR_CLOSE_RX_BD
#define CPM_CR_SET_GADDR
#define CPM_CR_SET_TIMER
#define CPM_CR_STOP_IDMA

/* Buffer descriptors used by many of the CPM protocols. */
cbd_t;

/* Buffer descriptor control/status used by serial
 */

#define BD_SC_EMPTY
#define BD_SC_READY
#define BD_SC_WRAP
#define BD_SC_INTRPT
#define BD_SC_LAST
#define BD_SC_TC
#define BD_SC_CM
#define BD_SC_ID
#define BD_SC_P
#define BD_SC_BR
#define BD_SC_FR
#define BD_SC_PR
#define BD_SC_NAK
#define BD_SC_OV
#define BD_SC_UN
#define BD_SC_CD
#define BD_SC_CL

/* Buffer descriptor control/status used by Ethernet receive.
 * Common to SCC and FCC.
 */
#define BD_ENET_RX_EMPTY
#define BD_ENET_RX_WRAP
#define BD_ENET_RX_INTR
#define BD_ENET_RX_LAST
#define BD_ENET_RX_FIRST
#define BD_ENET_RX_MISS
#define BD_ENET_RX_BC
#define BD_ENET_RX_MC
#define BD_ENET_RX_LG
#define BD_ENET_RX_NO
#define BD_ENET_RX_SH
#define BD_ENET_RX_CR
#define BD_ENET_RX_OV
#define BD_ENET_RX_CL
#define BD_ENET_RX_STATS

/* Buffer descriptor control/status used by Ethernet transmit.
 * Common to SCC and FCC.
 */
#define BD_ENET_TX_READY
#define BD_ENET_TX_PAD
#define BD_ENET_TX_WRAP
#define BD_ENET_TX_INTR
#define BD_ENET_TX_LAST
#define BD_ENET_TX_TC
#define BD_ENET_TX_DEF
#define BD_ENET_TX_HB
#define BD_ENET_TX_LC
#define BD_ENET_TX_RL
#define BD_ENET_TX_RCMASK
#define BD_ENET_TX_UN
#define BD_ENET_TX_CSL
#define BD_ENET_TX_STATS

/* Buffer descriptor control/status used by Transparent mode SCC.
 */
#define BD_SCC_TX_LAST

/* Buffer descriptor control/status used by I2C.
 */
#define BD_I2C_START

#ifdef CONFIG_CPM
int cpm_command(u32 command, u8 opcode);
#else
static inline int cpm_command(u32 command, u8 opcode)
{}
#endif /* CONFIG_CPM */

int cpm2_gpiochip_add32(struct device *dev);

#endif