1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#include "priv.h"
26
27#include <subdev/gpio.h>
28
29#include <subdev/gpio.h>
30
31static void
32nv04_bus_intr(struct nvkm_bus *bus)
33{
34 struct nvkm_subdev *subdev = &bus->subdev;
35 struct nvkm_device *device = subdev->device;
36 u32 stat = nvkm_rd32(device, 0x001100) & nvkm_rd32(device, 0x001140);
37
38 if (stat & 0x00000001) {
39 nvkm_error(subdev, "BUS ERROR\n");
40 stat &= ~0x00000001;
41 nvkm_wr32(device, 0x001100, 0x00000001);
42 }
43
44 if (stat & 0x00000110) {
45 struct nvkm_gpio *gpio = device->gpio;
46 if (gpio)
47 nvkm_subdev_intr(&gpio->subdev);
48 stat &= ~0x00000110;
49 nvkm_wr32(device, 0x001100, 0x00000110);
50 }
51
52 if (stat) {
53 nvkm_error(subdev, "intr %08x\n", stat);
54 nvkm_mask(device, 0x001140, stat, 0x00000000);
55 }
56}
57
58static void
59nv04_bus_init(struct nvkm_bus *bus)
60{
61 struct nvkm_device *device = bus->subdev.device;
62 nvkm_wr32(device, 0x001100, 0xffffffff);
63 nvkm_wr32(device, 0x001140, 0x00000111);
64}
65
66static const struct nvkm_bus_func
67nv04_bus = {
68 .init = nv04_bus_init,
69 .intr = nv04_bus_intr,
70};
71
72int
73nv04_bus_new(struct nvkm_device *device, int index, struct nvkm_bus **pbus)
74{
75 return nvkm_bus_new_(&nv04_bus, device, index, pbus);
76}
77