0001
0002
0003
0004 #include <linux/io.h>
0005 #include <linux/device.h>
0006
0007 #include "lima_device.h"
0008 #include "lima_dlbu.h"
0009 #include "lima_vm.h"
0010 #include "lima_regs.h"
0011
0012 #define dlbu_write(reg, data) writel(data, ip->iomem + reg)
0013 #define dlbu_read(reg) readl(ip->iomem + reg)
0014
0015 void lima_dlbu_enable(struct lima_device *dev, int num_pp)
0016 {
0017 struct lima_sched_pipe *pipe = dev->pipe + lima_pipe_pp;
0018 struct lima_ip *ip = dev->ip + lima_ip_dlbu;
0019 int i, mask = 0;
0020
0021 for (i = 0; i < num_pp; i++) {
0022 struct lima_ip *pp = pipe->processor[i];
0023
0024 mask |= 1 << (pp->id - lima_ip_pp0);
0025 }
0026
0027 dlbu_write(LIMA_DLBU_PP_ENABLE_MASK, mask);
0028 }
0029
0030 void lima_dlbu_disable(struct lima_device *dev)
0031 {
0032 struct lima_ip *ip = dev->ip + lima_ip_dlbu;
0033
0034 dlbu_write(LIMA_DLBU_PP_ENABLE_MASK, 0);
0035 }
0036
0037 void lima_dlbu_set_reg(struct lima_ip *ip, u32 *reg)
0038 {
0039 dlbu_write(LIMA_DLBU_TLLIST_VBASEADDR, reg[0]);
0040 dlbu_write(LIMA_DLBU_FB_DIM, reg[1]);
0041 dlbu_write(LIMA_DLBU_TLLIST_CONF, reg[2]);
0042 dlbu_write(LIMA_DLBU_START_TILE_POS, reg[3]);
0043 }
0044
0045 static int lima_dlbu_hw_init(struct lima_ip *ip)
0046 {
0047 struct lima_device *dev = ip->dev;
0048
0049 dlbu_write(LIMA_DLBU_MASTER_TLLIST_PHYS_ADDR, dev->dlbu_dma | 1);
0050 dlbu_write(LIMA_DLBU_MASTER_TLLIST_VADDR, LIMA_VA_RESERVE_DLBU);
0051
0052 return 0;
0053 }
0054
0055 int lima_dlbu_resume(struct lima_ip *ip)
0056 {
0057 return lima_dlbu_hw_init(ip);
0058 }
0059
0060 void lima_dlbu_suspend(struct lima_ip *ip)
0061 {
0062
0063 }
0064
0065 int lima_dlbu_init(struct lima_ip *ip)
0066 {
0067 return lima_dlbu_hw_init(ip);
0068 }
0069
0070 void lima_dlbu_fini(struct lima_ip *ip)
0071 {
0072
0073 }