Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/kboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "pmgr.h"
#include "sep.h"
#include "sio.h"
#include "smc.h"
#include "smp.h"
#include "tunables.h"
#include "types.h"
Expand Down Expand Up @@ -2746,6 +2747,13 @@ int kboot_boot(void *kernel)
pcie_init();
dapf_init_all();

if (chip_id == T8015 || chip_id == T8012) {
smc_power_on();
asc_dev_t *smc = asc_init("/arm-io/smc");
asc_cpu_start(smc);
asc_free(smc);
}

printf("Setting SMP mode to WFE...\n");
smp_set_wfe_mode(true);
printf("Preparing to boot kernel at %p with fdt at %p\n", kernel, dt);
Expand Down
15 changes: 15 additions & 0 deletions src/smc.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* SPDX-License-Identifier: MIT */

#include "adt.h"
#include "assert.h"
#include "malloc.h"
#include "pmgr.h"
#include "smc.h"
#include "string.h"
#include "types.h"
Expand Down Expand Up @@ -120,12 +122,25 @@ void smc_shutdown(smc_dev_t *smc)
free(smc);
}

void smc_power_on(void)
{
if (chip_id != T8015 && chip_id != T8012)
return;

pmgr_power_on(0, "SMC_I2CM1");
pmgr_power_on(0, "SMC_FABRIC");
pmgr_adt_power_enable("/arm-io/smc");
}

smc_dev_t *smc_init(void)
{
smc_dev_t *smc = calloc(1, sizeof(smc_dev_t));
if (!smc)
return NULL;

if (chip_id == T8015 || chip_id == T8012)
smc_power_on();

smc->asc = asc_init("/arm-io/smc");
if (!smc->asc) {
printf("SMC: failed to initialize ASC\n");
Expand Down
1 change: 1 addition & 0 deletions src/smc.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ typedef struct smc_dev smc_dev_t;
int smc_write_u32(smc_dev_t *smc, u32 key, u32 value);

smc_dev_t *smc_init(void);
void smc_power_on(void);
void smc_shutdown(smc_dev_t *smc);

#endif