0001
0002
0003
0004
0005
0006
0007 #ifndef __FSL_DPAA2_IO_H
0008 #define __FSL_DPAA2_IO_H
0009
0010 #include <linux/types.h>
0011 #include <linux/cpumask.h>
0012 #include <linux/irqreturn.h>
0013
0014 #include "dpaa2-fd.h"
0015 #include "dpaa2-global.h"
0016
0017 struct dpaa2_io;
0018 struct dpaa2_io_store;
0019 struct device;
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #define DPAA2_IO_ANY_CPU -1
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 struct dpaa2_io_desc {
0052 int receives_notifications;
0053 int has_8prio;
0054 int cpu;
0055 void *regs_cena;
0056 void __iomem *regs_cinh;
0057 int dpio_id;
0058 u32 qman_version;
0059 u32 qman_clk;
0060 };
0061
0062 struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc,
0063 struct device *dev);
0064
0065 void dpaa2_io_down(struct dpaa2_io *d);
0066
0067 irqreturn_t dpaa2_io_irq(struct dpaa2_io *obj);
0068
0069 struct dpaa2_io *dpaa2_io_service_select(int cpu);
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 struct dpaa2_io_notification_ctx {
0086 void (*cb)(struct dpaa2_io_notification_ctx *ctx);
0087 int is_cdan;
0088 u32 id;
0089 int desired_cpu;
0090 int dpio_id;
0091 u64 qman64;
0092 struct list_head node;
0093 void *dpio_private;
0094 };
0095
0096 int dpaa2_io_get_cpu(struct dpaa2_io *d);
0097
0098 int dpaa2_io_service_register(struct dpaa2_io *service,
0099 struct dpaa2_io_notification_ctx *ctx,
0100 struct device *dev);
0101 void dpaa2_io_service_deregister(struct dpaa2_io *service,
0102 struct dpaa2_io_notification_ctx *ctx,
0103 struct device *dev);
0104 int dpaa2_io_service_rearm(struct dpaa2_io *service,
0105 struct dpaa2_io_notification_ctx *ctx);
0106
0107 int dpaa2_io_service_pull_fq(struct dpaa2_io *d, u32 fqid,
0108 struct dpaa2_io_store *s);
0109 int dpaa2_io_service_pull_channel(struct dpaa2_io *d, u32 channelid,
0110 struct dpaa2_io_store *s);
0111
0112 int dpaa2_io_service_enqueue_fq(struct dpaa2_io *d, u32 fqid,
0113 const struct dpaa2_fd *fd);
0114 int dpaa2_io_service_enqueue_multiple_fq(struct dpaa2_io *d, u32 fqid,
0115 const struct dpaa2_fd *fd, int number_of_frame);
0116 int dpaa2_io_service_enqueue_multiple_desc_fq(struct dpaa2_io *d, u32 *fqid,
0117 const struct dpaa2_fd *fd, int number_of_frame);
0118 int dpaa2_io_service_enqueue_qd(struct dpaa2_io *d, u32 qdid, u8 prio,
0119 u16 qdbin, const struct dpaa2_fd *fd);
0120 int dpaa2_io_service_release(struct dpaa2_io *d, u16 bpid,
0121 const u64 *buffers, unsigned int num_buffers);
0122 int dpaa2_io_service_acquire(struct dpaa2_io *d, u16 bpid,
0123 u64 *buffers, unsigned int num_buffers);
0124
0125 struct dpaa2_io_store *dpaa2_io_store_create(unsigned int max_frames,
0126 struct device *dev);
0127 void dpaa2_io_store_destroy(struct dpaa2_io_store *s);
0128 struct dpaa2_dq *dpaa2_io_store_next(struct dpaa2_io_store *s, int *is_last);
0129
0130 int dpaa2_io_query_fq_count(struct dpaa2_io *d, u32 fqid,
0131 u32 *fcnt, u32 *bcnt);
0132 int dpaa2_io_query_bp_count(struct dpaa2_io *d, u16 bpid,
0133 u32 *num);
0134
0135 int dpaa2_io_set_irq_coalescing(struct dpaa2_io *d, u32 irq_holdoff);
0136 void dpaa2_io_get_irq_coalescing(struct dpaa2_io *d, u32 *irq_holdoff);
0137 void dpaa2_io_set_adaptive_coalescing(struct dpaa2_io *d,
0138 int use_adaptive_rx_coalesce);
0139 int dpaa2_io_get_adaptive_coalescing(struct dpaa2_io *d);
0140 void dpaa2_io_update_net_dim(struct dpaa2_io *d, __u64 frames, __u64 bytes);
0141 #endif