^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2012-2015, NVIDIA Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef HOST1X_DEV_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define HOST1X_DEV_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/iommu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/iova.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/reset.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "cdma.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "channel.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "intr.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include "job.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include "syncpt.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct host1x_syncpt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct host1x_syncpt_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct host1x_channel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct host1x_cdma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct host1x_job;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct push_buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct output;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct dentry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct host1x_channel_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) int (*init)(struct host1x_channel *channel, struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) unsigned int id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int (*submit)(struct host1x_job *job);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct host1x_cdma_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void (*start)(struct host1x_cdma *cdma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) void (*stop)(struct host1x_cdma *cdma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void (*flush)(struct host1x_cdma *cdma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) int (*timeout_init)(struct host1x_cdma *cdma, unsigned int syncpt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) void (*timeout_destroy)(struct host1x_cdma *cdma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) void (*freeze)(struct host1x_cdma *cdma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void (*resume)(struct host1x_cdma *cdma, u32 getptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) void (*timeout_cpu_incr)(struct host1x_cdma *cdma, u32 getptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) u32 syncpt_incrs, u32 syncval, u32 nr_slots);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct host1x_pushbuffer_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void (*init)(struct push_buffer *pb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct host1x_debug_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) void (*debug_init)(struct dentry *de);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) void (*show_channel_cdma)(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct host1x_channel *ch,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct output *o);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) void (*show_channel_fifo)(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct host1x_channel *ch,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct output *o);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) void (*show_mlocks)(struct host1x *host, struct output *output);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) struct host1x_syncpt_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) void (*restore)(struct host1x_syncpt *syncpt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) void (*restore_wait_base)(struct host1x_syncpt *syncpt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) void (*load_wait_base)(struct host1x_syncpt *syncpt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) u32 (*load)(struct host1x_syncpt *syncpt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) int (*cpu_incr)(struct host1x_syncpt *syncpt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) void (*assign_to_channel)(struct host1x_syncpt *syncpt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) struct host1x_channel *channel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) void (*enable_protection)(struct host1x *host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct host1x_intr_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) int (*init_host_sync)(struct host1x *host, u32 cpm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) void (*syncpt_thresh_work)(struct work_struct *work));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) void (*set_syncpt_threshold)(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) struct host1x *host, unsigned int id, u32 thresh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) void (*enable_syncpt_intr)(struct host1x *host, unsigned int id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) void (*disable_syncpt_intr)(struct host1x *host, unsigned int id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) void (*disable_all_syncpt_intrs)(struct host1x *host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) int (*free_syncpt_irq)(struct host1x *host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct host1x_sid_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) unsigned int base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) unsigned int offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) unsigned int limit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) struct host1x_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) unsigned int nb_channels; /* host1x: number of channels supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) unsigned int nb_pts; /* host1x: number of syncpoints supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) unsigned int nb_bases; /* host1x: number of syncpoint bases supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) unsigned int nb_mlocks; /* host1x: number of mlocks supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) int (*init)(struct host1x *host1x); /* initialize per SoC ops */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) unsigned int sync_offset; /* offset of syncpoint registers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) u64 dma_mask; /* mask of addressable memory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) bool has_wide_gather; /* supports GATHER_W opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) bool has_hypervisor; /* has hypervisor registers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) unsigned int num_sid_entries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) const struct host1x_sid_entry *sid_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) struct host1x {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) const struct host1x_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) void __iomem *regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) void __iomem *hv_regs; /* hypervisor region */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct host1x_syncpt *syncpt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) struct host1x_syncpt_base *bases;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) struct clk *clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) struct reset_control *rst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) struct iommu_group *group;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) struct iommu_domain *domain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct iova_domain iova;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) dma_addr_t iova_end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct mutex intr_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) int intr_syncpt_irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) const struct host1x_syncpt_ops *syncpt_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) const struct host1x_intr_ops *intr_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) const struct host1x_channel_ops *channel_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) const struct host1x_cdma_ops *cdma_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) const struct host1x_pushbuffer_ops *cdma_pb_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) const struct host1x_debug_ops *debug_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) struct host1x_syncpt *nop_sp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) struct mutex syncpt_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) struct host1x_channel_list channel_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) struct dentry *debugfs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) struct mutex devices_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) struct list_head devices;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) struct device_dma_parameters dma_parms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) void host1x_hypervisor_writel(struct host1x *host1x, u32 r, u32 v);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) u32 host1x_hypervisor_readl(struct host1x *host1x, u32 r);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) void host1x_sync_writel(struct host1x *host1x, u32 r, u32 v);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) u32 host1x_sync_readl(struct host1x *host1x, u32 r);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) void host1x_ch_writel(struct host1x_channel *ch, u32 r, u32 v);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) u32 host1x_ch_readl(struct host1x_channel *ch, u32 r);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) static inline void host1x_hw_syncpt_restore(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) struct host1x_syncpt *sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) host->syncpt_op->restore(sp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) static inline void host1x_hw_syncpt_restore_wait_base(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) struct host1x_syncpt *sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) host->syncpt_op->restore_wait_base(sp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) static inline void host1x_hw_syncpt_load_wait_base(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) struct host1x_syncpt *sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) host->syncpt_op->load_wait_base(sp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) static inline u32 host1x_hw_syncpt_load(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) struct host1x_syncpt *sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) return host->syncpt_op->load(sp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) static inline int host1x_hw_syncpt_cpu_incr(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) struct host1x_syncpt *sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) return host->syncpt_op->cpu_incr(sp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) static inline void host1x_hw_syncpt_assign_to_channel(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) struct host1x *host, struct host1x_syncpt *sp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) struct host1x_channel *ch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) return host->syncpt_op->assign_to_channel(sp, ch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) static inline void host1x_hw_syncpt_enable_protection(struct host1x *host)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) return host->syncpt_op->enable_protection(host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) void (*syncpt_thresh_work)(struct work_struct *))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) return host->intr_op->init_host_sync(host, cpm, syncpt_thresh_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) static inline void host1x_hw_intr_set_syncpt_threshold(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) unsigned int id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) u32 thresh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) host->intr_op->set_syncpt_threshold(host, id, thresh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) static inline void host1x_hw_intr_enable_syncpt_intr(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) unsigned int id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) host->intr_op->enable_syncpt_intr(host, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) static inline void host1x_hw_intr_disable_syncpt_intr(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) unsigned int id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) host->intr_op->disable_syncpt_intr(host, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static inline void host1x_hw_intr_disable_all_syncpt_intrs(struct host1x *host)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) host->intr_op->disable_all_syncpt_intrs(host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) static inline int host1x_hw_intr_free_syncpt_irq(struct host1x *host)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) return host->intr_op->free_syncpt_irq(host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) static inline int host1x_hw_channel_init(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) struct host1x_channel *channel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) unsigned int id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) return host->channel_op->init(channel, host, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) static inline int host1x_hw_channel_submit(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) struct host1x_job *job)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) return host->channel_op->submit(job);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) static inline void host1x_hw_cdma_start(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) struct host1x_cdma *cdma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) host->cdma_op->start(cdma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) static inline void host1x_hw_cdma_stop(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) struct host1x_cdma *cdma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) host->cdma_op->stop(cdma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) static inline void host1x_hw_cdma_flush(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) struct host1x_cdma *cdma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) host->cdma_op->flush(cdma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) static inline int host1x_hw_cdma_timeout_init(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) struct host1x_cdma *cdma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) unsigned int syncpt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) return host->cdma_op->timeout_init(cdma, syncpt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) static inline void host1x_hw_cdma_timeout_destroy(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) struct host1x_cdma *cdma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) host->cdma_op->timeout_destroy(cdma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) static inline void host1x_hw_cdma_freeze(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) struct host1x_cdma *cdma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) host->cdma_op->freeze(cdma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) static inline void host1x_hw_cdma_resume(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) struct host1x_cdma *cdma, u32 getptr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) host->cdma_op->resume(cdma, getptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) static inline void host1x_hw_cdma_timeout_cpu_incr(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) struct host1x_cdma *cdma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) u32 getptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) u32 syncpt_incrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) u32 syncval, u32 nr_slots)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) host->cdma_op->timeout_cpu_incr(cdma, getptr, syncpt_incrs, syncval,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) nr_slots);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) static inline void host1x_hw_pushbuffer_init(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) struct push_buffer *pb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) host->cdma_pb_op->init(pb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) static inline void host1x_hw_debug_init(struct host1x *host, struct dentry *de)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) if (host->debug_op && host->debug_op->debug_init)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) host->debug_op->debug_init(de);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) static inline void host1x_hw_show_channel_cdma(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) struct host1x_channel *channel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) struct output *o)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) host->debug_op->show_channel_cdma(host, channel, o);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) static inline void host1x_hw_show_channel_fifo(struct host1x *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) struct host1x_channel *channel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) struct output *o)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) host->debug_op->show_channel_fifo(host, channel, o);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) static inline void host1x_hw_show_mlocks(struct host1x *host, struct output *o)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) host->debug_op->show_mlocks(host, o);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) extern struct platform_driver tegra_mipi_driver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) #endif