linux/include/soc/fsl/qe/ucc_fast.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Internal header file for UCC FAST unit routines.
 *
 * Copyright (C) 2006 Freescale Semiconductor, Inc. All rights reserved.
 *
 * Authors: 	Shlomi Gridish <[email protected]>
 * 		Li Yang <[email protected]>
 */
#ifndef __UCC_FAST_H__
#define __UCC_FAST_H__

#include <linux/types.h>

#include <soc/fsl/qe/immap_qe.h>
#include <soc/fsl/qe/qe.h>

#include <soc/fsl/qe/ucc.h>

/* Receive BD's status and length*/
#define R_E
#define R_W
#define R_I
#define R_L
#define R_F

/* transmit BD's status and length*/
#define T_R
#define T_W
#define T_I
#define T_L

/* Receive BD's status */
#define R_E_S
#define R_W_S
#define R_I_S
#define R_L_S
#define R_F_S
#define R_CM_S
#define R_LG_S
#define R_NO_S
#define R_AB_S
#define R_CR_S
#define R_OV_S
#define R_CD_S

/* transmit BD's status */
#define T_R_S
#define T_W_S
#define T_I_S
#define T_L_S
#define T_TC_S
#define T_TM_S
#define T_UN_S
#define T_CT_S

/* Rx Data buffer must be 4 bytes aligned in most cases */
#define UCC_FAST_RX_ALIGN
#define UCC_FAST_MRBLR_ALIGNMENT
#define UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT

/* Sizes */
#define UCC_FAST_URFS_MIN_VAL
#define UCC_FAST_RECEIVE_VIRTUAL_FIFO_SIZE_FUDGE_FACTOR

/* ucc_fast_channel_protocol_mode - UCC FAST mode */
enum ucc_fast_channel_protocol_mode {};

/* ucc_fast_transparent_txrx - UCC Fast Transparent TX & RX */
enum ucc_fast_transparent_txrx {};

/* UCC fast diagnostic mode */
enum ucc_fast_diag_mode {};

/* UCC fast Sync length (transparent mode only) */
enum ucc_fast_sync_len {};

/* UCC fast RTS mode */
enum ucc_fast_ready_to_send {};

/* UCC fast receiver decoding mode */
enum ucc_fast_rx_decoding_method {};

/* UCC fast transmitter encoding mode */
enum ucc_fast_tx_encoding_method {};

/* UCC fast CRC length */
enum ucc_fast_transparent_tcrc {};

/* Fast UCC initialization structure */
struct ucc_fast_info {};

struct ucc_fast_private {};

/* ucc_fast_init
 * Initializes Fast UCC according to user provided parameters.
 *
 * uf_info  - (In) pointer to the fast UCC info structure.
 * uccf_ret - (Out) pointer to the fast UCC structure.
 */
int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** uccf_ret);

/* ucc_fast_free
 * Frees all resources for fast UCC.
 *
 * uccf - (In) pointer to the fast UCC structure.
 */
void ucc_fast_free(struct ucc_fast_private * uccf);

/* ucc_fast_enable
 * Enables a fast UCC port.
 * This routine enables Tx and/or Rx through the General UCC Mode Register.
 *
 * uccf - (In) pointer to the fast UCC structure.
 * mode - (In) TX, RX, or both.
 */
void ucc_fast_enable(struct ucc_fast_private * uccf, enum comm_dir mode);

/* ucc_fast_disable
 * Disables a fast UCC port.
 * This routine disables Tx and/or Rx through the General UCC Mode Register.
 *
 * uccf - (In) pointer to the fast UCC structure.
 * mode - (In) TX, RX, or both.
 */
void ucc_fast_disable(struct ucc_fast_private * uccf, enum comm_dir mode);

/* ucc_fast_irq
 * Handles interrupts on fast UCC.
 * Called from the general interrupt routine to handle interrupts on fast UCC.
 *
 * uccf - (In) pointer to the fast UCC structure.
 */
void ucc_fast_irq(struct ucc_fast_private * uccf);

/* ucc_fast_transmit_on_demand
 * Immediately forces a poll of the transmitter for data to be sent.
 * Typically, the hardware performs a periodic poll for data that the
 * transmit routine has set up to be transmitted. In cases where
 * this polling cycle is not soon enough, this optional routine can
 * be invoked to force a poll right away, instead. Proper use for
 * each transmission for which this functionality is desired is to
 * call the transmit routine and then this routine right after.
 *
 * uccf - (In) pointer to the fast UCC structure.
 */
void ucc_fast_transmit_on_demand(struct ucc_fast_private * uccf);

u32 ucc_fast_get_qe_cr_subblock(int uccf_num);

void ucc_fast_dump_regs(struct ucc_fast_private * uccf);

#endif				/* __UCC_FAST_H__ */