linux/drivers/bus/mhi/common.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2022, Linaro Ltd.
 *
 */

#ifndef _MHI_COMMON_H
#define _MHI_COMMON_H

#include <linux/bitfield.h>
#include <linux/mhi.h>

/* MHI registers */
#define MHIREGLEN
#define MHIVER
#define MHICFG
#define CHDBOFF
#define ERDBOFF
#define BHIOFF
#define BHIEOFF
#define DEBUGOFF
#define MHICTRL
#define MHISTATUS
#define CCABAP_LOWER
#define CCABAP_HIGHER
#define ECABAP_LOWER
#define ECABAP_HIGHER
#define CRCBAP_LOWER
#define CRCBAP_HIGHER
#define CRDB_LOWER
#define CRDB_HIGHER
#define MHICTRLBASE_LOWER
#define MHICTRLBASE_HIGHER
#define MHICTRLLIMIT_LOWER
#define MHICTRLLIMIT_HIGHER
#define MHIDATABASE_LOWER
#define MHIDATABASE_HIGHER
#define MHIDATALIMIT_LOWER
#define MHIDATALIMIT_HIGHER

/* MHI BHI registers */
#define BHI_BHIVERSION_MINOR
#define BHI_BHIVERSION_MAJOR
#define BHI_IMGADDR_LOW
#define BHI_IMGADDR_HIGH
#define BHI_IMGSIZE
#define BHI_RSVD1
#define BHI_IMGTXDB
#define BHI_RSVD2
#define BHI_INTVEC
#define BHI_RSVD3
#define BHI_EXECENV
#define BHI_STATUS
#define BHI_ERRCODE
#define BHI_ERRDBG1
#define BHI_ERRDBG2
#define BHI_ERRDBG3
#define BHI_SERIALNU
#define BHI_SBLANTIROLLVER
#define BHI_NUMSEG
#define BHI_MSMHWID(n)
#define BHI_OEMPKHASH(n)
#define BHI_RSVD5

/* BHI register bits */
#define BHI_TXDB_SEQNUM_BMSK
#define BHI_TXDB_SEQNUM_SHFT
#define BHI_STATUS_MASK
#define BHI_STATUS_ERROR
#define BHI_STATUS_SUCCESS
#define BHI_STATUS_RESET

/* MHI BHIE registers */
#define BHIE_MSMSOCID_OFFS
#define BHIE_TXVECADDR_LOW_OFFS
#define BHIE_TXVECADDR_HIGH_OFFS
#define BHIE_TXVECSIZE_OFFS
#define BHIE_TXVECDB_OFFS
#define BHIE_TXVECSTATUS_OFFS
#define BHIE_RXVECADDR_LOW_OFFS
#define BHIE_RXVECADDR_HIGH_OFFS
#define BHIE_RXVECSIZE_OFFS
#define BHIE_RXVECDB_OFFS
#define BHIE_RXVECSTATUS_OFFS

/* BHIE register bits */
#define BHIE_TXVECDB_SEQNUM_BMSK
#define BHIE_TXVECDB_SEQNUM_SHFT
#define BHIE_TXVECSTATUS_SEQNUM_BMSK
#define BHIE_TXVECSTATUS_SEQNUM_SHFT
#define BHIE_TXVECSTATUS_STATUS_BMSK
#define BHIE_TXVECSTATUS_STATUS_SHFT
#define BHIE_TXVECSTATUS_STATUS_RESET
#define BHIE_TXVECSTATUS_STATUS_XFER_COMPL
#define BHIE_TXVECSTATUS_STATUS_ERROR
#define BHIE_RXVECDB_SEQNUM_BMSK
#define BHIE_RXVECDB_SEQNUM_SHFT
#define BHIE_RXVECSTATUS_SEQNUM_BMSK
#define BHIE_RXVECSTATUS_SEQNUM_SHFT
#define BHIE_RXVECSTATUS_STATUS_BMSK
#define BHIE_RXVECSTATUS_STATUS_SHFT
#define BHIE_RXVECSTATUS_STATUS_RESET
#define BHIE_RXVECSTATUS_STATUS_XFER_COMPL
#define BHIE_RXVECSTATUS_STATUS_ERROR

/* MHI register bits */
#define MHICFG_NHWER_MASK
#define MHICFG_NER_MASK
#define MHICFG_NHWCH_MASK
#define MHICFG_NCH_MASK
#define MHICTRL_MHISTATE_MASK
#define MHICTRL_RESET_MASK
#define MHISTATUS_MHISTATE_MASK
#define MHISTATUS_SYSERR_MASK
#define MHISTATUS_READY_MASK

/* Command Ring Element macros */
/* No operation command */
#define MHI_TRE_CMD_NOOP_PTR
#define MHI_TRE_CMD_NOOP_DWORD0
#define MHI_TRE_CMD_NOOP_DWORD1

/* Channel reset command */
#define MHI_TRE_CMD_RESET_PTR
#define MHI_TRE_CMD_RESET_DWORD0
#define MHI_TRE_CMD_RESET_DWORD1(chid)

/* Channel stop command */
#define MHI_TRE_CMD_STOP_PTR
#define MHI_TRE_CMD_STOP_DWORD0
#define MHI_TRE_CMD_STOP_DWORD1(chid)

/* Channel start command */
#define MHI_TRE_CMD_START_PTR
#define MHI_TRE_CMD_START_DWORD0
#define MHI_TRE_CMD_START_DWORD1(chid)

#define MHI_TRE_GET_DWORD(tre, word)
#define MHI_TRE_GET_CMD_CHID(tre)
#define MHI_TRE_GET_CMD_TYPE(tre)

/* Event descriptor macros */
#define MHI_TRE_EV_PTR(ptr)
#define MHI_TRE_EV_DWORD0(code, len)
#define MHI_TRE_EV_DWORD1(chid, type)
#define MHI_TRE_GET_EV_PTR(tre)
#define MHI_TRE_GET_EV_CODE(tre)
#define MHI_TRE_GET_EV_LEN(tre)
#define MHI_TRE_GET_EV_CHID(tre)
#define MHI_TRE_GET_EV_TYPE(tre)
#define MHI_TRE_GET_EV_STATE(tre)
#define MHI_TRE_GET_EV_EXECENV(tre)
#define MHI_TRE_GET_EV_SEQ(tre)
#define MHI_TRE_GET_EV_TIME(tre)
#define MHI_TRE_GET_EV_COOKIE(tre)
#define MHI_TRE_GET_EV_VEID(tre)
#define MHI_TRE_GET_EV_LINKSPEED(tre)
#define MHI_TRE_GET_EV_LINKWIDTH(tre)

/* State change event */
#define MHI_SC_EV_PTR
#define MHI_SC_EV_DWORD0(state)
#define MHI_SC_EV_DWORD1(type)

/* EE event */
#define MHI_EE_EV_PTR
#define MHI_EE_EV_DWORD0(ee)
#define MHI_EE_EV_DWORD1(type)


/* Command Completion event */
#define MHI_CC_EV_PTR(ptr)
#define MHI_CC_EV_DWORD0(code)
#define MHI_CC_EV_DWORD1(type)

/* Transfer descriptor macros */
#define MHI_TRE_DATA_PTR(ptr)
#define MHI_TRE_DATA_DWORD0(len)
#define MHI_TRE_TYPE_TRANSFER
#define MHI_TRE_DATA_DWORD1(bei, ieot, ieob, chain)
#define MHI_TRE_DATA_GET_PTR(tre)
#define MHI_TRE_DATA_GET_LEN(tre)
#define MHI_TRE_DATA_GET_CHAIN(tre)
#define MHI_TRE_DATA_GET_IEOB(tre)
#define MHI_TRE_DATA_GET_IEOT(tre)
#define MHI_TRE_DATA_GET_BEI(tre)

/* RSC transfer descriptor macros */
#define MHI_RSCTRE_DATA_PTR(ptr, len)
#define MHI_RSCTRE_DATA_DWORD0(cookie)
#define MHI_RSCTRE_DATA_DWORD1

enum mhi_pkt_type {};

/* MHI transfer completion events */
enum mhi_ev_ccs {};

/* Channel state */
enum mhi_ch_state {};

enum mhi_cmd_type {};

#define EV_CTX_RESERVED_MASK
#define EV_CTX_INTMODC_MASK
#define EV_CTX_INTMODT_MASK
struct mhi_event_ctxt {};

#define CHAN_CTX_CHSTATE_MASK
#define CHAN_CTX_BRSTMODE_MASK
#define CHAN_CTX_POLLCFG_MASK
#define CHAN_CTX_RESERVED_MASK
struct mhi_chan_ctxt {};

struct mhi_cmd_ctxt {};

struct mhi_ring_element {};

#define MHI_STATE_LIST

#undef mhi_state
#undef mhi_state_end

#define mhi_state(a, b)
#define mhi_state_end(a, b)

static inline const char *mhi_state_str(enum mhi_state state)
{}

#endif /* _MHI_COMMON_H */