0001
0002
0003
0004 #include <linux/io.h>
0005 #include <linux/device.h>
0006
0007 #include "lima_device.h"
0008 #include "lima_bcast.h"
0009 #include "lima_regs.h"
0010
0011 #define bcast_write(reg, data) writel(data, ip->iomem + reg)
0012 #define bcast_read(reg) readl(ip->iomem + reg)
0013
0014 void lima_bcast_enable(struct lima_device *dev, int num_pp)
0015 {
0016 struct lima_sched_pipe *pipe = dev->pipe + lima_pipe_pp;
0017 struct lima_ip *ip = dev->ip + lima_ip_bcast;
0018 int i, mask = bcast_read(LIMA_BCAST_BROADCAST_MASK) & 0xffff0000;
0019
0020 for (i = 0; i < num_pp; i++) {
0021 struct lima_ip *pp = pipe->processor[i];
0022
0023 mask |= 1 << (pp->id - lima_ip_pp0);
0024 }
0025
0026 bcast_write(LIMA_BCAST_BROADCAST_MASK, mask);
0027 }
0028
0029 static int lima_bcast_hw_init(struct lima_ip *ip)
0030 {
0031 bcast_write(LIMA_BCAST_BROADCAST_MASK, ip->data.mask << 16);
0032 bcast_write(LIMA_BCAST_INTERRUPT_MASK, ip->data.mask);
0033 return 0;
0034 }
0035
0036 int lima_bcast_resume(struct lima_ip *ip)
0037 {
0038 return lima_bcast_hw_init(ip);
0039 }
0040
0041 void lima_bcast_suspend(struct lima_ip *ip)
0042 {
0043
0044 }
0045
0046 int lima_bcast_init(struct lima_ip *ip)
0047 {
0048 int i;
0049
0050 for (i = lima_ip_pp0; i <= lima_ip_pp7; i++) {
0051 if (ip->dev->ip[i].present)
0052 ip->data.mask |= 1 << (i - lima_ip_pp0);
0053 }
0054
0055 return lima_bcast_hw_init(ip);
0056 }
0057
0058 void lima_bcast_fini(struct lima_ip *ip)
0059 {
0060
0061 }
0062