Skip to content

Commit 912691e

Browse files
committed
dapf: Support reg indexing + add ISP
Also enable power if domain exists. Signed-off-by: Eileen Yoon <eyn@gmx.com>
1 parent f782456 commit 912691e

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

src/dapf.c

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "assert.h"
66
#include "malloc.h"
77
#include "memory.h"
8+
#include "pmgr.h"
89
#include "string.h"
910
#include "utils.h"
1011

@@ -83,7 +84,7 @@ static int dapf_init_t8110(const char *path, u64 base, int node)
8384
return 0;
8485
}
8586

86-
int dapf_init(const char *path)
87+
int dapf_init(const char *path, int index)
8788
{
8889
int ret;
8990
int dart_path[8];
@@ -93,8 +94,14 @@ int dapf_init(const char *path)
9394
return -1;
9495
}
9596

97+
u32 pwr;
98+
if (!adt_getprop(adt, node, "clock-gates", &pwr))
99+
pwr = 0;
100+
if (pwr && (pmgr_adt_power_enable(path) < 0))
101+
return -1;
102+
96103
u64 base;
97-
if (adt_get_reg(adt, dart_path, "reg", 1, &base, NULL) < 0) {
104+
if (adt_get_reg(adt, dart_path, "reg", index, &base, NULL) < 0) {
98105
printf("dapf: Error getting DAPF %s base address.\n", path);
99106
return -1;
100107
}
@@ -110,28 +117,44 @@ int dapf_init(const char *path)
110117
return -1;
111118
}
112119

120+
if (pwr)
121+
pmgr_adt_power_disable(path);
122+
113123
if (!ret)
114124
printf("dapf: Initialized %s\n", path);
115125

116126
return ret;
117127
}
118128

119-
const char *dapf_paths[] = {"/arm-io/dart-aop", "/arm-io/dart-mtp", "/arm-io/dart-pmp", NULL};
129+
struct entry {
130+
const char *path;
131+
int index;
132+
};
133+
134+
struct entry dapf_entries[] = {
135+
{"/arm-io/dart-aop", 1},
136+
{"/arm-io/dart-mtp", 1},
137+
{"/arm-io/dart-pmp", 1},
138+
{"/arm-io/dart-isp", 5},
139+
{NULL, -1},
140+
};
120141

121142
int dapf_init_all(void)
122143
{
123144
int ret = 0;
124145
int count = 0;
125146

126-
for (const char **path = dapf_paths; *path; path++) {
127-
if (adt_path_offset(adt, *path) < 0)
147+
struct entry *entry = dapf_entries;
148+
while (entry->path != NULL) {
149+
if (adt_path_offset(adt, entry->path) < 0) {
150+
entry++;
128151
continue;
129-
130-
if (dapf_init(*path) < 0) {
152+
}
153+
if (dapf_init(entry->path, entry->index) < 0) {
131154
ret = -1;
132155
}
156+
entry++;
133157
count += 1;
134158
}
135-
136159
return ret ? ret : count;
137160
}

src/dapf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
#define DAPF_H
55

66
int dapf_init_all(void);
7-
int dapf_init(const char *path);
7+
int dapf_init(const char *path, int index);
88

99
#endif

src/proxy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ int proxy_process(ProxyRequest *request, ProxyReply *reply)
586586
reply->retval = dapf_init_all();
587587
break;
588588
case P_DAPF_INIT:
589-
reply->retval = dapf_init((const char *)request->args[0]);
589+
reply->retval = dapf_init((const char *)request->args[0], 1);
590590
break;
591591

592592
case P_CPUFREQ_INIT:

0 commit comments

Comments
 (0)