mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-10 09:44:13 +00:00
tunables_static: abstraction to reuse entries
Signed-off-by: Eileen Yoon <eyn@gmx.com>
This commit is contained in:
parent
6ce14d8735
commit
cf09e4ff56
1 changed files with 34 additions and 10 deletions
|
@ -19,15 +19,25 @@ struct entry {
|
|||
u32 set;
|
||||
};
|
||||
|
||||
struct entry t8103_agx_tunables[] = {
|
||||
struct sequence {
|
||||
struct entry *entry;
|
||||
u64 base;
|
||||
};
|
||||
|
||||
struct entry t8103_agx_entry[] = {
|
||||
{0x30, 0xffffffff, 0x50014}, {0x34, 0xffffffff, 0xa003c},
|
||||
{0x400, 0x400103ff, 0x40010001}, {0x600, 0x1ffffff, 0x1ffffff},
|
||||
{0x738, 0x1ff01ff, 0x140034}, {0x798, 0x1ff01ff, 0x14003c},
|
||||
{0x800, 0x100, 0x100}, {-1, 0, 0},
|
||||
};
|
||||
|
||||
struct sequence t8103_agx_tunables[] = {
|
||||
{t8103_agx_entry, 0x205000000},
|
||||
{NULL, -1},
|
||||
};
|
||||
|
||||
// TODO: check masks
|
||||
struct entry t600x_agx_tunables[] = {
|
||||
struct entry t600x_agx_entry[] = {
|
||||
{0x0, 0x1, 0x1},
|
||||
{0x10, 0xfff0000, 0xd0000},
|
||||
{0x14, 0x3, 0x1},
|
||||
|
@ -43,8 +53,13 @@ struct entry t600x_agx_tunables[] = {
|
|||
{-1, 0, 0},
|
||||
};
|
||||
|
||||
struct sequence t600x_agx_tunables[] = {
|
||||
{t600x_agx_entry, 0x405000000},
|
||||
{NULL, -1},
|
||||
};
|
||||
|
||||
// TODO: check masks
|
||||
struct entry t8112_agx_tunables[] = {
|
||||
struct entry t8112_agx_entry[] = {
|
||||
{0x0, 0x200, 0x200},
|
||||
{0x34, 0xffffffff, 0x50014},
|
||||
{0x38, 0xffffffff, 0xa003c},
|
||||
|
@ -56,22 +71,31 @@ struct entry t8112_agx_tunables[] = {
|
|||
{-1, 0, 0},
|
||||
};
|
||||
|
||||
static void tunables_apply(u64 base, struct entry *entry)
|
||||
struct sequence t8112_agx_tunables[] = {
|
||||
{t8112_agx_entry, 0x205000000},
|
||||
{NULL, -1},
|
||||
};
|
||||
|
||||
static void tunables_apply(struct sequence *seq)
|
||||
{
|
||||
struct entry *entry = seq->entry;
|
||||
while (entry->offset != UINT32_MAX) {
|
||||
mask32(base + entry->offset, entry->clear, entry->set);
|
||||
mask32(seq->base + entry->offset, entry->clear, entry->set);
|
||||
entry++;
|
||||
}
|
||||
}
|
||||
|
||||
int power_and_apply(const char *path, u64 base, struct entry *entries)
|
||||
int power_and_apply(const char *path, struct sequence *seq)
|
||||
{
|
||||
if (pmgr_adt_power_enable(path) < 0) {
|
||||
printf("tunables: Failed to enable power: %s\n", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tunables_apply(base, entries);
|
||||
while (seq->base != UINT32_MAX) {
|
||||
tunables_apply(seq);
|
||||
seq++;
|
||||
}
|
||||
|
||||
if (pmgr_adt_power_disable(path) < 0) {
|
||||
printf("tunables: Failed to disable power: %s\n", path);
|
||||
|
@ -87,15 +111,15 @@ int tunables_apply_static(void)
|
|||
|
||||
switch (chip_id) {
|
||||
case T8103:
|
||||
ret |= power_and_apply("/arm-io/sgx", 0x205000000, t8103_agx_tunables);
|
||||
ret |= power_and_apply("/arm-io/sgx", t8103_agx_tunables);
|
||||
break;
|
||||
case T8112:
|
||||
ret |= power_and_apply("/arm-io/sgx", 0x205000000, t8112_agx_tunables);
|
||||
ret |= power_and_apply("/arm-io/sgx", t8112_agx_tunables);
|
||||
break;
|
||||
case T6000:
|
||||
case T6001:
|
||||
case T6002:
|
||||
ret |= power_and_apply("/arm-io/sgx", 0x405000000, t600x_agx_tunables);
|
||||
ret |= power_and_apply("/arm-io/sgx", t600x_agx_tunables);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue