Skip to content

Commit

Permalink
Merge pull request #104 from BigfootACA/main
Browse files Browse the repository at this point in the history
[board] avaota-a1: set GICR_WAKER bit 2 for BL31
  • Loading branch information
YuzukiTsuru committed Jun 9, 2024
2 parents 58ebe11 + 48cabdd commit 55d3aba
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
8 changes: 8 additions & 0 deletions board/avaota-a1/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ void neon_enable(void) {
asm volatile("MCR p10, 7, r3, c8, c0, 0");
}

void gicr_set_waker(void) {
uint32_t gicr_waker = read32(GICR_WAKER(0));
if ((gicr_waker & 2) == 0) {
gicr_waker |= 2;
write32(GICR_WAKER(0), gicr_waker);
}
}

void clean_syterkit_data(void) {
/* Disable MMU, data cache, instruction cache, interrupts */
arm32_mmu_disable();
Expand Down
3 changes: 3 additions & 0 deletions board/avaota-a1/extlinux_boot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ extern void enable_sram_a3();
extern void rtc_set_vccio_det_spare();
extern void set_rpio_power_mode(void);
extern void sunxi_nsi_init();
extern void gicr_set_waker(void);

typedef struct atf_head {
uint32_t jump_instruction; /* jumping to real code */
Expand Down Expand Up @@ -821,6 +822,8 @@ int main(void) {

clean_syterkit_data();

gicr_set_waker();

jmp_to_arm64(CONFIG_BL31_LOAD_ADDR);

printk_info("Back to SyterKit\n");
Expand Down
3 changes: 3 additions & 0 deletions board/avaota-a1/syter_boot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ extern void enable_sram_a3();
extern void rtc_set_vccio_det_spare();
extern void set_rpio_power_mode(void);
extern void sunxi_nsi_init();
extern void gicr_set_waker(void);

typedef struct atf_head {
uint32_t jump_instruction; /* jumping to real code */
Expand Down Expand Up @@ -272,6 +273,8 @@ int cmd_boot(int argc, const char **argv) {

clean_syterkit_data();

gicr_set_waker();

jmp_to_arm64(CONFIG_BL31_LOAD_ADDR);

printk_info("Back to SyterKit\n");
Expand Down
3 changes: 3 additions & 0 deletions board/avaota-a1/syter_boot_bl33/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ extern void enable_sram_a3();
extern void rtc_set_vccio_det_spare();
extern void set_rpio_power_mode(void);
extern void sunxi_nsi_init();
extern void gicr_set_waker(void);

typedef struct atf_head {
uint32_t jump_instruction; /* jumping to real code */
Expand Down Expand Up @@ -272,6 +273,8 @@ int cmd_boot(int argc, const char **argv) {

clean_syterkit_data();

gicr_set_waker();

jmp_to_arm64(CONFIG_BL31_LOAD_ADDR);

printk_info("Back to SyterKit\n");
Expand Down
3 changes: 3 additions & 0 deletions board/avaota-a1/syter_boot_uboot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ extern void enable_sram_a3();
extern void rtc_set_vccio_det_spare();
extern void set_rpio_power_mode(void);
extern void sunxi_nsi_init();
extern void gicr_set_waker(void);

typedef struct atf_head {
uint32_t jump_instruction; /* jumping to real code */
Expand Down Expand Up @@ -261,6 +262,8 @@ int cmd_boot(int argc, const char **argv) {

clean_syterkit_data();

gicr_set_waker();

jmp_to_arm64(CONFIG_BL31_LOAD_ADDR);

printk_info("Back to SyterKit\n");
Expand Down
12 changes: 11 additions & 1 deletion include/drivers/sun55iw3/reg/reg-ncat.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@
#define GPIO_3_3V_MODE 0
#define GPIO_1_8V_MODE 1

/* GIC600 */
#define GIC_IROUTR(_n) (SUNXI_CPU_GIC600_BASE + 0x6000 + 8 * (_n))
#define GICR_LPI_BASE(n) (SUNXI_CPU_GIC600_BASE + 0x60000 + n*0x20000)
#define GICR_WAKER(m) (GICR_LPI_BASE(m) + 0x0014)
#define GICR_PWRR(m) (GICR_LPI_BASE(m) + 0x0024)
#define LEVEL_TRIGERRED (0)
#define EDGE_TRIGERRED (1)
#define GIC_IRQ_TYPE_CFG(_n) (SUNXI_CPU_GIC600_BASE + 0xc00 + 4 * (_n))
#define GIC_IRQ_MOD_CFG(_n) (SUNXI_CPU_GIC600_BASE + 0xd00 + 4 * (_n))

#define PIOC_REG_o_POW_MOD_SEL 0x380
#define PIOC_REG_o_POW_MS_CTL 0x384
#define PIOC_REG_o_POW_MS_VAL 0x388
Expand Down Expand Up @@ -231,4 +241,4 @@
#define SUNXI_S_SPI_CLK_REG 0x0150
#define SUNXI_S_SPI_BGR_REG 0x015C

#endif// __SUN55IW3_REG_NCAT_H__
#endif// __SUN55IW3_REG_NCAT_H__

0 comments on commit 55d3aba

Please sign in to comment.