#ifndef _MVNETA_BM_H_
#define _MVNETA_BM_H_
#define MVNETA_BM_CONFIG_REG …
#define MVNETA_BM_STATUS_MASK …
#define MVNETA_BM_ACTIVE_MASK …
#define MVNETA_BM_MAX_IN_BURST_SIZE_MASK …
#define MVNETA_BM_MAX_IN_BURST_SIZE_16BP …
#define MVNETA_BM_EMPTY_LIMIT_MASK …
#define MVNETA_BM_COMMAND_REG …
#define MVNETA_BM_START_MASK …
#define MVNETA_BM_STOP_MASK …
#define MVNETA_BM_PAUSE_MASK …
#define MVNETA_BM_XBAR_01_REG …
#define MVNETA_BM_XBAR_23_REG …
#define MVNETA_BM_XBAR_POOL_REG(pool) …
#define MVNETA_BM_TARGET_ID_OFFS(pool) …
#define MVNETA_BM_TARGET_ID_MASK(pool) …
#define MVNETA_BM_TARGET_ID_VAL(pool, id) …
#define MVNETA_BM_XBAR_ATTR_OFFS(pool) …
#define MVNETA_BM_XBAR_ATTR_MASK(pool) …
#define MVNETA_BM_XBAR_ATTR_VAL(pool, attr) …
#define MVNETA_BM_POOL_BASE_REG(pool) …
#define MVNETA_BM_POOL_ENABLE_MASK …
#define MVNETA_BM_POOL_READ_PTR_REG(pool) …
#define MVNETA_BM_POOL_SET_READ_PTR_MASK …
#define MVNETA_BM_POOL_GET_READ_PTR_OFFS …
#define MVNETA_BM_POOL_GET_READ_PTR_MASK …
#define MVNETA_BM_POOL_WRITE_PTR_REG(pool) …
#define MVNETA_BM_POOL_SET_WRITE_PTR_OFFS …
#define MVNETA_BM_POOL_SET_WRITE_PTR_MASK …
#define MVNETA_BM_POOL_GET_WRITE_PTR_OFFS …
#define MVNETA_BM_POOL_GET_WRITE_PTR_MASK …
#define MVNETA_BM_POOL_SIZE_REG(pool) …
#define MVNETA_BM_POOL_SIZE_MASK …
#define MVNETA_BM_INTR_CAUSE_REG …
#define MVNETA_BM_INTR_MASK_REG …
#define MVNETA_BM_SHORT_PKT_SIZE …
#define MVNETA_BM_POOLS_NUM …
#define MVNETA_BM_POOL_CAP_MIN …
#define MVNETA_BM_POOL_CAP_DEF …
#define MVNETA_BM_POOL_CAP_MAX …
#define MVNETA_BM_POOL_CAP_ALIGN …
#define MVNETA_BM_POOL_PTR_ALIGN …
#define MVNETA_BM_POOL_ACCESS_OFFS …
#define MVNETA_BM_BPPI_SIZE …
#define MVNETA_RX_BUF_SIZE(pkt_size) …
enum mvneta_bm_type { … };
struct mvneta_bm { … };
struct mvneta_bm_pool { … };
#if IS_ENABLED(CONFIG_MVNETA_BM)
struct mvneta_bm *mvneta_bm_get(struct device_node *node);
void mvneta_bm_put(struct mvneta_bm *priv);
void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
struct mvneta_bm_pool *bm_pool, u8 port_map);
void mvneta_bm_bufs_free(struct mvneta_bm *priv, struct mvneta_bm_pool *bm_pool,
u8 port_map);
int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf);
int mvneta_bm_pool_refill(struct mvneta_bm *priv,
struct mvneta_bm_pool *bm_pool);
struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
enum mvneta_bm_type type, u8 port_id,
int pkt_size);
static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv,
struct mvneta_bm_pool *bm_pool,
dma_addr_t buf_phys_addr)
{
writel_relaxed(buf_phys_addr, priv->bppi_virt_addr +
(bm_pool->id << MVNETA_BM_POOL_ACCESS_OFFS));
}
static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv,
struct mvneta_bm_pool *bm_pool)
{
return readl_relaxed(priv->bppi_virt_addr +
(bm_pool->id << MVNETA_BM_POOL_ACCESS_OFFS));
}
#else
static inline void mvneta_bm_pool_destroy(struct mvneta_bm *priv,
struct mvneta_bm_pool *bm_pool,
u8 port_map) { … }
static inline void mvneta_bm_bufs_free(struct mvneta_bm *priv,
struct mvneta_bm_pool *bm_pool,
u8 port_map) { … }
static inline int mvneta_bm_construct(struct hwbm_pool *hwbm_pool, void *buf)
{ … }
static inline int mvneta_bm_pool_refill(struct mvneta_bm *priv,
struct mvneta_bm_pool *bm_pool)
{ … }
static inline struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv,
u8 pool_id,
enum mvneta_bm_type type,
u8 port_id,
int pkt_size)
{ … }
static inline void mvneta_bm_pool_put_bp(struct mvneta_bm *priv,
struct mvneta_bm_pool *bm_pool,
dma_addr_t buf_phys_addr) { … }
static inline u32 mvneta_bm_pool_get_bp(struct mvneta_bm *priv,
struct mvneta_bm_pool *bm_pool)
{ … }
static inline struct mvneta_bm *mvneta_bm_get(struct device_node *node)
{ … }
static inline void mvneta_bm_put(struct mvneta_bm *priv) { … }
#endif
#endif