SoC s6: add bl30 bl204_s905x5 board [2/3]
PD#SWPL-183494
Problem:
s6 add bl30 bl204_s905x5 board.
Solution:
S6 add bl30 bl204_s905x5 board.
Verify:
s6 bl204_s905x5
Change-Id: Id636d26db73eb2cb4ab4ae60bb0e40c672031aa8
Signed-off-by: bangzheng.liu <bangzheng.liu@amlogic.com>
diff --git a/bl204_s905x5/CMakeLists.txt b/bl204_s905x5/CMakeLists.txt
new file mode 100644
index 0000000..8eda1c4
--- /dev/null
+++ b/bl204_s905x5/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+
+# SPDX-License-Identifier: MIT
+
+aml_library_include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+aml_library_sources(
+ keypad.c
+ power.c
+ hw_business.c
+)
+
+aml_library_sources_ifdef(
+ CONFIG_LEDS
+ leds_plat.c
+)
\ No newline at end of file
diff --git a/bl204_s905x5/FreeRTOSConfig.h b/bl204_s905x5/FreeRTOSConfig.h
new file mode 100644
index 0000000..8b57646
--- /dev/null
+++ b/bl204_s905x5/FreeRTOSConfig.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef FREERTOS_CONFIG_H
+#define FREERTOS_CONFIG_H
+
+#include <stdio.h>
+
+#define USER_MODE_TASKS 0
+
+#define configUSE_PREEMPTION 1
+#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
+#define configUSE_TICKLESS_IDLE 0
+#define configCPU_CLOCK_HZ 12000000 //Use AO Internal Timer as Tick
+#define configTICK_RATE_HZ 50
+#define configMAX_PRIORITIES 4
+#define configMINIMAL_STACK_SIZE 450
+#define configMAX_TASK_NAME_LEN 16
+#define configUSE_16_BIT_TICKS 0
+#define configIDLE_SHOULD_YIELD 1
+#define configUSE_TASK_NOTIFICATIONS 1
+#define configUSE_MUTEXES 1
+#define configUSE_RECURSIVE_MUTEXES 0
+#define configUSE_COUNTING_SEMAPHORES 1
+#define configQUEUE_REGISTRY_SIZE 10
+#define configUSE_QUEUE_SETS 0
+#define configUSE_TIME_SLICING 1
+#define configUSE_NEWLIB_REENTRANT 0
+#define configENABLE_BACKWARD_COMPATIBILITY 0
+#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5
+
+/* Memory allocation related definitions. */
+#define configSUPPORT_STATIC_ALLOCATION 0
+#define configSUPPORT_DYNAMIC_ALLOCATION 1
+#define configTOTAL_HEAP_SIZE (30 * 1024)
+#define configAPPLICATION_ALLOCATED_HEAP 0
+
+/* Hook function related definitions. */
+#define configUSE_IDLE_HOOK 1
+#define configUSE_TICK_HOOK 0
+#define configCHECK_FOR_STACK_OVERFLOW 2
+#define configUSE_MALLOC_FAILED_HOOK 1
+#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
+
+/* Run time and task stats gathering related definitions. */
+#define configGENERATE_RUN_TIME_STATS 0
+#define configUSE_TRACE_FACILITY 0
+#define configUSE_STATS_FORMATTING_FUNCTIONS 0
+
+/* Co-routine related definitions. */
+#define configUSE_CO_ROUTINES 0
+#define configMAX_CO_ROUTINE_PRIORITIES 1
+
+/* Software timer related definitions. */
+#define configUSE_TIMERS 1
+#define configTIMER_TASK_PRIORITY 1
+#define configTIMER_QUEUE_LENGTH 10
+#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
+
+/* Interrupt nesting behavior configuration. */
+#define configKERNEL_INTERRUPT_PRIORITY 1
+#define configMAX_SYSCALL_INTERRUPT_PRIORITY 6
+#define configMAX_API_CALL_INTERRUPT_PRIORITY 6
+
+#define configSTICK_MEM_SIZE 128
+#define configDEFAULT_HEAP_ADDR 0x10000000
+#define configDEFAULT_HEAP_SIZE (32 * 1024 - configSTICK_MEM_SIZE)
+#define configSTICK_MEM_ADDR (configDEFAULT_HEAP_ADDR + configDEFAULT_HEAP_SIZE)
+
+#define portCRITICAL_NESTING_IN_TCB 1
+
+/* Define to trap errors during development. */
+#define configASSERT(x) \
+ do { \
+ if ((x) == 0) { \
+ taskDISABLE_INTERRUPTS(); \
+ printf("ASSERT: %s %d\n", __FILE__, __LINE__); \
+ for (;;) \
+ ; \
+ } \
+ } while (0)
+
+/* FreeRTOS MPU specific definitions. */
+//#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
+
+/* Optional functions - most linkers will remove unused functions anyway. */
+#define INCLUDE_vTaskPrioritySet 1
+#define INCLUDE_uxTaskPriorityGet 1
+#define INCLUDE_vTaskDelete 1
+#define INCLUDE_vTaskSuspend 1
+#define INCLUDE_xResumeFromISR 1
+#define INCLUDE_vTaskDelayUntil 1
+#define INCLUDE_vTaskDelay 1
+#define INCLUDE_xTaskGetSchedulerState 1
+#define INCLUDE_xTaskGetCurrentTaskHandle 1
+#define INCLUDE_uxTaskGetStackHighWaterMark 1
+#define INCLUDE_xTaskGetIdleTaskHandle 1
+#define INCLUDE_eTaskGetState 0
+#define INCLUDE_xEventGroupSetBitFromISR 1
+#define INCLUDE_xTimerPendFunctionCall 1
+#define INCLUDE_xTaskAbortDelay 0
+#define INCLUDE_xTaskGetHandle 1
+#define INCLUDE_xTaskResumeFromISR 1
+
+/* A header file that defines trace macro can be included here. */
+
+#endif /* FREERTOS_CONFIG_H */
diff --git a/bl204_s905x5/Kconfig b/bl204_s905x5/Kconfig
new file mode 100644
index 0000000..5b3a484
--- /dev/null
+++ b/bl204_s905x5/Kconfig
@@ -0,0 +1,29 @@
+# Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+
+# SPDX-License-Identifier: MIT
+
+config BOARD_BL204_S905X5
+ bool "Amlogic BL204_S905X5 Board"
+ select SOC_S6
+ select LIBC_AML
+ select COMMON
+ select GET_VERSION
+ select UART
+ select CEC
+ select MAILBOX
+ select STR
+ select GPIO
+ select KEY
+ select PWM
+ select LEDS
+# select I2C_SLAVE
+ select TIMER_SOURCE
+ select SARADC
+ select IR
+ select ETHERNET
+ select VRTC
+ select VERSION_FULL_INFO
+ select WIFI_BT_WAKE
+
+ help
+ Enable Amlogic BL204_S905X5 Board.
diff --git a/bl204_s905x5/compiler_options.cmake b/bl204_s905x5/compiler_options.cmake
new file mode 100644
index 0000000..d545948
--- /dev/null
+++ b/bl204_s905x5/compiler_options.cmake
@@ -0,0 +1,6 @@
+# Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+
+# SPDX-License-Identifier: MIT
+
+#add compiler options at here which is associated with current board.
+
diff --git a/bl204_s905x5/defconfig b/bl204_s905x5/defconfig
new file mode 100644
index 0000000..9dab366
--- /dev/null
+++ b/bl204_s905x5/defconfig
@@ -0,0 +1,8 @@
+#
+# Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: MIT
+#
+
+CONFIG_BOARD_BL204_S905X5=y
+
diff --git a/bl204_s905x5/hw_business.c b/bl204_s905x5/hw_business.c
new file mode 100644
index 0000000..aab4efe
--- /dev/null
+++ b/bl204_s905x5/hw_business.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include <stdio.h>
+#include "common.h"
+#include "uart.h"
+#include "eth.h"
+#include "mailbox-api.h"
+#include "hdmi_cec.h"
+#include "suspend.h"
+#include "vrtc.h"
+#include "hw_business.h"
+
+void hw_business_process(void)
+{
+ vMbInit();
+ vCecCallbackInit(CEC_CHIP_S6);
+ vRtcInit();
+ //rtc_init();
+ vETHMailboxCallback();
+ create_str_task();
+}
diff --git a/bl204_s905x5/hw_business.h b/bl204_s905x5/hw_business.h
new file mode 100644
index 0000000..2dc1d61
--- /dev/null
+++ b/bl204_s905x5/hw_business.h
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef __hW_BUSINESS_H__
+#define __hW_BUSINESS_H__
+
+void hw_business_process(void);
+
+#endif
diff --git a/bl204_s905x5/keypad.c b/bl204_s905x5/keypad.c
new file mode 100644
index 0000000..94633fc
--- /dev/null
+++ b/bl204_s905x5/keypad.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2021-2024 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "FreeRTOS.h"
+#include "soc.h"
+#include "keypad.h"
+#include "saradc.h"
+#include "suspend.h"
+
+/* KEY ID */
+#define ADC_KEY_ID_POWER 520
+#define GPIO_ETH_WOL
+
+static void vAdcKeyCallBack(struct xReportEvent event)
+{
+ uint32_t buf[4] = { 0 };
+
+ switch (event.ulCode) {
+ case ADC_KEY_ID_POWER:
+ buf[0] = POWER_KEY_WAKEUP;
+ STR_Wakeup_src_Queue_Send_FromISR(buf);
+ break;
+ default:
+ break;
+ }
+
+ printf("ADC key event 0x%x, key code %d, responseTime %d\n", event.event, event.ulCode,
+ event.responseTime);
+}
+
+static void vGpioKeyCallBack(struct xReportEvent event)
+{
+ uint32_t buf[4] = { 0 };
+
+ switch (event.ulCode) {
+ case GPIOZ_14:
+ printf("gpio14 wakeup\n");
+ buf[0] = ETH_PHY_GPIO;
+ STR_Wakeup_src_Queue_Send_FromISR(buf);
+ break;
+ default:
+ break;
+ }
+
+ printf("GPIO key event 0x%x, key code %d, responseTicks %d\n", event.event, event.ulCode,
+ event.responseTime);
+}
+
+struct xGpioKeyInfo gpioKeyInfo[] = {
+#ifdef GPIO_ETH_WOL
+ GPIO_KEY_INFO(GPIOZ_14, HIGH, EVENT_SHORT, vGpioKeyCallBack, NULL),
+#endif
+};
+struct xAdcKeyInfo adcKeyInfo[] = {
+ ADC_KEY_INFO(ADC_KEY_ID_POWER, 90, SARADC_CH3, EVENT_SHORT, vAdcKeyCallBack, NULL),
+};
+
+void vKeyPadInit(void)
+{
+ vCreateAdcKey(adcKeyInfo, sizeof(adcKeyInfo) / sizeof(struct xAdcKeyInfo));
+ vAdcKeyEnable();
+ vCreateGpioKey(gpioKeyInfo, sizeof(gpioKeyInfo) / sizeof(struct xGpioKeyInfo));
+ vGpioKeyEnable();
+}
+
+void vKeyPadDeinit(void)
+{
+ vAdcKeyDisable();
+ vDestroyAdcKey();
+ vGpioKeyDisable();
+ vDestroyGpioKey();
+}
diff --git a/bl204_s905x5/leds_plat.c b/bl204_s905x5/leds_plat.c
new file mode 100644
index 0000000..0ec1628
--- /dev/null
+++ b/bl204_s905x5/leds_plat.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "FreeRTOS.h"
+#include <gpio.h>
+#include <leds_plat.h>
+#include <leds_state.h>
+
+/* TODO: Temporarily use static variables instead of stick mem */
+static int32_t LedStickMem0;
+//static int32_t LedStickMem1;
+
+static struct LedCoord BreathInflections0[] = { { 0, 0 }, { 2500, 255 }, { 5000, 0 } };
+
+static struct LedCoord BreathInflections1[] = { { 0, 0 }, { 5000, 255 }, { 10000, 0 } };
+
+static struct LedCoord BreathInflections2[] = { { 0, 0 }, { 10000, 255 }, { 20000, 0 } };
+
+static struct LedCoord BreathInflections3[] = { { 0, 0 }, { 20000, 255 }, { 40000, 0 } };
+
+struct LedCoord *BreathInflections[LED_BREATH_MAX_COUNT] = {
+ BreathInflections0,
+ BreathInflections1,
+ BreathInflections2,
+ BreathInflections3,
+};
+
+struct LedDevice MesonLeds[] = {
+ {
+ .id = LED_ID_0,
+ .type = LED_TYPE_PWM,
+ .name = "sys_led",
+ .hardware_id = MESON_PWM_INVALID,
+ .pwm_chip_id = PWM_C,//after s7 soc, only use chip id
+ .polarity = LED_POLARITY_POSITIVE,
+ .breathtime = 0,
+ },
+};
+
+int32_t get_led_breath_len(uint32_t breath_id)
+{
+ switch (breath_id) {
+ case 0:
+ return sizeof(BreathInflections0) / sizeof(struct LedCoord);
+ case 1:
+ return sizeof(BreathInflections1) / sizeof(struct LedCoord);
+ case 2:
+ return sizeof(BreathInflections2) / sizeof(struct LedCoord);
+ case 3:
+ return sizeof(BreathInflections3) / sizeof(struct LedCoord);
+ } /* end switch */
+
+ iprintf("%s: id: %ld leds state init!\n", DRIVER_NAME, breath_id);
+
+ return -pdFREERTOS_ERRNO_EINVAL;
+}
+
+int32_t vLedPlatInit(int32_t **stickmem)
+{
+ /* TODO: Here is initialization stickmem, but not doing so now */
+ *stickmem = &LedStickMem0;
+
+ /* off by default */
+ return xLedsStateSetBrightness(LED_ID_0, LED_OFF);
+}
+
+int32_t vLedPinmuxInit(void)
+{
+ /* set pinmux */
+ return xPinmuxSet(GPIOF_4, PIN_FUNC1);
+}
diff --git a/bl204_s905x5/leds_plat.h b/bl204_s905x5/leds_plat.h
new file mode 100644
index 0000000..b3b1ef0
--- /dev/null
+++ b/bl204_s905x5/leds_plat.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/*
+ * platform related header file
+ */
+
+#ifndef _MESON_LEDS_PLAT_H_
+#define _MESON_LEDS_PLAT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * pwm a5 leds config
+ */
+#include <leds_state.h>
+#include <pwm_plat.h>
+
+#define LED_BREATH_MAX_COUNT 4
+
+extern struct LedDevice MesonLeds[];
+
+enum led_id {
+ LED_ID_0 = 0,
+ LED_ID_MAX,
+};
+
+int32_t get_led_breath_len(uint32_t breath_id);
+int32_t vLedPinmuxInit(void);
+int32_t vLedPlatInit(int32_t **stickmem);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _MESON_LED_PLAT_H_ */
diff --git a/bl204_s905x5/lscript.h b/bl204_s905x5/lscript.h
new file mode 100644
index 0000000..ec30ede
--- /dev/null
+++ b/bl204_s905x5/lscript.h
@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef _LSCRIPT_H_
+#define _LSCRIPT_H_
+
+#define configMEM_START 0xf3c00000
+#define configMEM_LEN (88 * 1024)
+
+#endif
diff --git a/bl204_s905x5/lscript.ld b/bl204_s905x5/lscript.ld
new file mode 100644
index 0000000..e5e75ca
--- /dev/null
+++ b/bl204_s905x5/lscript.ld
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "lscript.h"
+
+OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv",
+ "elf32-littleriscv")
+OUTPUT_ARCH("riscv")
+ENTRY( _start )
+MEMORY
+{
+ ram (rw) : ORIGIN = configMEM_START, LENGTH = configMEM_LEN
+}
+SECTIONS
+{
+ __stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
+ .text :
+ {
+ . = ALIGN(4);
+ PROVIDE( _text = . );
+ *(.init)
+ *(.text* .rodata*)
+ . = ALIGN(0x400);
+ PROVIDE( _etext = . );
+ *(.vtable)
+ } > ram
+ .data :
+ {
+ _data = .;
+ *(vtable)
+ *(.sdata* .data*)
+ _edata = .;
+ } > ram
+ .bss :
+ {
+ _bss = .;
+ *(.sbss*)
+ *(.gnu.linkonce.sb.*)
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ . = ALIGN(4);
+ _ebss = .;
+ } > ram
+ .stack :
+ {
+ PROVIDE( _stack = . );
+ . = ALIGN(1024);
+ . += __stack_size;
+ PROVIDE( _sp = . );
+ } >ram
+}
diff --git a/bl204_s905x5/power.c b/bl204_s905x5/power.c
new file mode 100644
index 0000000..99f22e9
--- /dev/null
+++ b/bl204_s905x5/power.c
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include <stdio.h>
+#include "FreeRTOS.h"
+#include "common.h"
+#include "gpio.h"
+#include "ir.h"
+#include "eth.h"
+#include "soc.h"
+#include "suspend.h"
+#include "task.h"
+#include "gpio.h"
+#include "pwm.h"
+#include "pwm_plat.h"
+#include "keypad.h"
+#include "timer_source.h"
+#if CONFIG_WIFI_BT_WAKE
+#include "wifi_bt_wake.h"
+#endif
+#include "power.h"
+#include "mailbox-api.h"
+#include "board_common.h"
+
+
+#include "hdmi_cec.h"
+static TaskHandle_t cecTask;
+
+GE_GPIO_CTRL(VCC3V3_CSI_DVB, GPIOF_2, INVERT)
+GE_GPIO_CTRL(VCC_5V, GPIOH_7, NOINVERT)
+GE_GPIO_CTRL(VCC_5V_HDMI, GPIOH_6, NOINVERT)
+HIZ_GPIO_CTRL(VCC_5V_USB, GPIOH_8)
+GE_GPIO_CTRL(VDDCPU, GPIO_TEST_N, NOINVERT)
+GE_GPIO_CTRL(ETH_RESET, GPIOZ_15, NOINVERT)
+
+
+static int vdd_ee;
+static int vdddos_npu_vpu;
+static TaskHandle_t vadTask;
+
+static struct IRPowerKey prvPowerKeyList[] = {
+ { 0xef10fe01, IR_NORMAL }, /* ref tv pwr */
+ { 0xba45bd02, IR_NORMAL }, /* small ir pwr */
+ { 0xef10fb04, IR_NORMAL }, /* old ref tv pwr */
+ { 0xf20dfe01, IR_NORMAL },
+ { 0xe51afb04, IR_NORMAL },
+ { 0x3ac5bd02, IR_CUSTOM },
+ {}
+};
+
+static void vIRHandler(struct IRPowerKey *pkey)
+{
+ uint32_t buf[4] = { 0 };
+
+ if (pkey->type == IR_NORMAL)
+ buf[0] = REMOTE_WAKEUP;
+ else if (pkey->type == IR_CUSTOM)
+ buf[0] = REMOTE_CUS_WAKEUP;
+
+ /* do sth below to wakeup*/
+ STR_Wakeup_src_Queue_Send_FromISR(buf);
+};
+
+static void *xMboxVadWakeup(void *msg)
+{
+ uint32_t buf[4] = { 0 };
+
+ buf[0] = VAD_WAKEUP;
+ STR_Wakeup_src_Queue_Send(buf);
+
+ return NULL;
+}
+
+void str_hw_init(void)
+{
+ int ret;
+ /*enable device & wakeup source interrupt*/
+ vIRInit(MODE_HARD_NEC, GPIOF_3, PIN_FUNC1, prvPowerKeyList, ARRAY_SIZE(prvPowerKeyList),
+ vIRHandler);
+ vETHInit(0);
+
+ xTaskCreate(vCEC_task, "CECtask", configMINIMAL_STACK_SIZE,
+ NULL, CEC_TASK_PRI, &cecTask);
+
+ vBackupAndClearGpioIrqReg();
+ vGpioIRQInit();
+ vKeyPadInit();
+
+#if CONFIG_WIFI_BT_WAKE
+ wifi_bt_wakeup_init();
+#endif
+}
+
+void str_hw_disable(void)
+{
+ /*disable wakeup source interrupt*/
+ vIRDeint();
+ vETHDeint();
+
+ if (cecTask) {
+ vTaskDelete(cecTask);
+ cec_req_irq(0);
+ }
+
+#if CONFIG_WIFI_BT_WAKE
+ wifi_bt_wakeup_deinit();
+#endif
+
+ vKeyPadDeinit();
+ vRestoreGpioIrqReg();
+}
+
+void str_power_on(int shutdown_flag)
+{
+ int ret;
+
+ (void)shutdown_flag;
+
+ VDDCPU_on();
+
+ /***set vdd_ee val***/
+ ret = vPwmMesonsetvoltage(VDDEE_VOLT, vdd_ee);
+ if (ret < 0) {
+ printf("VDD_EE pwm set fail\n");
+ return;
+ }
+
+ VCC3V3_CSI_DVB_on();
+ VCC_5V_on();
+ VCC_5V_USB_on();
+ if (exeth_wol_n_flag) {
+ printf("exeth power on\n");
+ ETH_RESET_on();
+ }
+
+ /*Wait POWERON_VDDCPU_DELAY for VDDCPU stable*/
+ vTaskDelay(POWERON_VDDCPU_DELAY);
+
+ printf("vdd_cpu on\n");
+}
+
+void str_power_off(int shutdown_flag)
+{
+ int ret;
+
+ (void)shutdown_flag;
+
+ if (exeth_wol_n_flag) {
+ printf("exeth wol set\n");
+ ETH_RESET_off();
+ }
+ VCC_5V_USB_off();
+ VCC_5V_off();
+ VCC3V3_CSI_DVB_off();
+
+ if (shutdown_flag)
+ VCC_5V_HDMI_off();
+ /***set vdd_ee val***/
+ vdd_ee = vPwmMesongetvoltage(VDDEE_VOLT);
+ if (vdd_ee < 0) {
+ printf("vdd_EE pwm get fail\n");
+ return;
+ }
+
+ ret = vPwmMesonsetvoltage(VDDEE_VOLT, 710);
+ if (ret < 0) {
+ printf("vdd_EE pwm set fail\n");
+ return;
+ }
+
+ /***power off A510 vdd_cpu***/
+ VDDCPU_off();
+
+ printf("Power down done.\n");
+}
diff --git a/bl204_s905x5/power.h b/bl204_s905x5/power.h
new file mode 100644
index 0000000..9cb7518
--- /dev/null
+++ b/bl204_s905x5/power.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef __POWER_H__
+#define __POWER_H__
+
+void str_hw_init(void);
+
+void str_hw_disable(void);
+
+void str_power_on(int shutdown_flag);
+
+void str_power_off(int shutdown_flag);
+
+extern uint32_t exeth_wol_n_flag;
+
+#endif
diff --git a/bl204_s905x5/save_version.h b/bl204_s905x5/save_version.h
new file mode 100644
index 0000000..980aa8b
--- /dev/null
+++ b/bl204_s905x5/save_version.h
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef __SAVE_VERSION_H__
+#define __SAVE_VERSION_H__
+
+#endif /* __SAVE_VERSION_H__ */
+
diff --git a/bl204_s905x5/wifi_bt_cfg.h b/bl204_s905x5/wifi_bt_cfg.h
new file mode 100644
index 0000000..c74287e
--- /dev/null
+++ b/bl204_s905x5/wifi_bt_cfg.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef __WIFI_BT_CFG_H__
+#define __WIFI_BT_CFG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//#include "gpio.h"
+
+#if CONFIG_WIFI_BT_WAKE
+
+#define WIFI_WAKE_CFG 1
+#define WIFI_WAKE_HOST GPIOX_7
+#define WIFI_PWREN GPIOX_6
+
+#define BT_WAKE_CFG 1
+#define BT_WAKE_HOST GPIOX_18
+#define BT_EN GPIOX_17
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/build_combination.in b/build_combination.in
index 0bd89fc..4f92fe3 100644
--- a/build_combination.in
+++ b/build_combination.in
@@ -35,6 +35,7 @@
riscv s7d bm209_s905x5m aocpu
riscv s6 s6_skt aocpu
riscv s6 bl201_s905x5 aocpu
+riscv s6 bl204_s905x5 aocpu
riscv s6 bl208_s905x5 aocpu
riscv s6 bl209_s905x5 aocpu
riscv s6 bq201_s905d5 aocpu