]> asedeno.scripts.mit.edu Git - linux.git/blob - drivers/gpu/drm/lima/lima_bcast.c
Merge tag 'linux-cpupower-5.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / drivers / gpu / drm / lima / lima_bcast.c
1 // SPDX-License-Identifier: GPL-2.0 OR MIT
2 /* Copyright 2018-2019 Qiang Yu <yuq825@gmail.com> */
3
4 #include <linux/io.h>
5 #include <linux/device.h>
6
7 #include "lima_device.h"
8 #include "lima_bcast.h"
9 #include "lima_regs.h"
10
11 #define bcast_write(reg, data) writel(data, ip->iomem + reg)
12 #define bcast_read(reg) readl(ip->iomem + reg)
13
14 void lima_bcast_enable(struct lima_device *dev, int num_pp)
15 {
16         struct lima_sched_pipe *pipe = dev->pipe + lima_pipe_pp;
17         struct lima_ip *ip = dev->ip + lima_ip_bcast;
18         int i, mask = bcast_read(LIMA_BCAST_BROADCAST_MASK) & 0xffff0000;
19
20         for (i = 0; i < num_pp; i++) {
21                 struct lima_ip *pp = pipe->processor[i];
22
23                 mask |= 1 << (pp->id - lima_ip_pp0);
24         }
25
26         bcast_write(LIMA_BCAST_BROADCAST_MASK, mask);
27 }
28
29 int lima_bcast_init(struct lima_ip *ip)
30 {
31         int i, mask = 0;
32
33         for (i = lima_ip_pp0; i <= lima_ip_pp7; i++) {
34                 if (ip->dev->ip[i].present)
35                         mask |= 1 << (i - lima_ip_pp0);
36         }
37
38         bcast_write(LIMA_BCAST_BROADCAST_MASK, mask << 16);
39         bcast_write(LIMA_BCAST_INTERRUPT_MASK, mask);
40         return 0;
41 }
42
43 void lima_bcast_fini(struct lima_ip *ip)
44 {
45
46 }
47