Skip to content

os/board/bk7239n: Optimize the internal code of bk7239n#7280

Open
Poly-J wants to merge 2 commits intoSamsung:masterfrom
bekencorp:bk7239n_platform
Open

os/board/bk7239n: Optimize the internal code of bk7239n#7280
Poly-J wants to merge 2 commits intoSamsung:masterfrom
bekencorp:bk7239n_platform

Conversation

@Poly-J
Copy link
Copy Markdown
Contributor

@Poly-J Poly-J commented Apr 16, 2026

  • The form of the security interface has changed, and the corresponding test code also needs to be modified accordingly.
  • Logic optimization related to security dump
  • Optimize the logic related to the system entering sleep

@Poly-J Poly-J force-pushed the bk7239n_platform branch 2 times, most recently from e7bc91f to 9da17b6 Compare April 16, 2026 08:43
Copy link
Copy Markdown
Contributor

@ewoodev ewoodev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, this is only important agenda of this commit.

  • The form of the security interface has changed, and
    the corresponding test code also needs to be modified accordingly.

It's optimization

  • Logic optimization related to security dump

it's another agenda

  • Optimize the logic related to the system entering sleep

Could you please seperate commit?


void bk_security_to_nosecurity_dump_register_callback(void)
{
if (get_security_level() > LOW_SECURITY_LEVEL) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it not needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should not be added here, because after adding this logic, since security_level defaults to HIGH, it will cause this callback not to be injected.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah okay, this fuction is just register callback.

@Poly-J
Copy link
Copy Markdown
Contributor Author

Poly-J commented Apr 16, 2026

I think, this is only important agenda of this commit.

  • The form of the security interface has changed, and
    the corresponding test code also needs to be modified accordingly.

It's optimization

  • Logic optimization related to security dump

it's another agenda

  • Optimize the logic related to the system entering sleep

Could you please seperate commit?

Okay, I will split it into three commits

@Poly-J Poly-J force-pushed the bk7239n_platform branch from 9da17b6 to 25c4876 Compare April 16, 2026 09:49
void bk_security_donmain_notifies_non_security_domain_to_dump(uint32_t *reg)
{
// High security level will not dump the exception information.
if (get_security_level() > LOW_SECURITY_LEVEL) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (get_security_level() != LOW_SECURITY_LEVEL) 

The value can be changed, please use !=

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your feedback, I have already modified itit.


void bk_security_to_nosecurity_dump_register_callback(void)
{
if (get_security_level() > LOW_SECURITY_LEVEL) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah okay, this fuction is just register callback.

@Poly-J Poly-J force-pushed the bk7239n_platform branch from 25c4876 to 45037fd Compare April 16, 2026 10:00
{
if(bk_rtc_get_first_alarm_name() != NULL)
{
if(strcmp(bk_rtc_get_first_alarm_name(), PM_WIFI_RTC_ALARM_NAME) == 0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please use strncmp?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear customer
Okay, we will make the modification. Thank you

Comment on lines +947 to +972
#define PM_VANALDO_STEP_SIZE (2)
#define PM_VANALDO_STEP_UP_DELAY_US (10)
__attribute__((section(".iram"))) int32 sys_hal_vanaldo_set(uint32_t value)
{
uint32_t cur = 0;
cur = sys_ana_ll_get_ana_reg7_vanaldosel();
if (cur == value) {
return 0;
}

if (value < cur) {
/* Target is lower or equal: set directly */
sys_ana_ll_set_ana_reg7_vanaldosel(value);
} else {
/* Target is higher: step up by PM_VANALDO_STEP_SIZE, delay PM_VANALDO_STEP_UP_DELAY_US each step */
uint32_t v;
for (v = cur + PM_VANALDO_STEP_SIZE; v < value; v += PM_VANALDO_STEP_SIZE) {
sys_ana_ll_set_ana_reg7_vanaldosel(v);
pm_delay_us(PM_VANALDO_STEP_UP_DELAY_US);
}
sys_ana_ll_set_ana_reg7_vanaldosel(value);

pm_delay_us(PM_VANALDO_STEP_UP_DELAY_US);
}
return 0;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please explain this changes in commit description?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear customer
This adjustment is an optimization of the recovery sequence after low-power wake-up: first adjust the voltage, then configure other items. Compared to the previous approach of writing all at once, it is more robust. This modification does not affect functionality.

Comment on lines +1187 to +1194
/*step 1: restore ana voltage*/
sys_hal_vanaldo_set(vanaldosel);

sys_ana_ll_set_ana_reg7_spi_pwd_regpow(pwd_regpow);
sys_ana_ll_set_ana_reg7_vbspbuf_lp(vbspbuf_lp);
sys_ana_ll_set_ana_reg7_envrefh1v(envrefh1v);
sys_ana_ll_set_ana_reg7_aldohp(aldohp);
sys_ana_ll_set_ana_reg7_dldohp(dldohp);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's also, what changes?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear customer
The same as the above

@Poly-J Poly-J force-pushed the bk7239n_platform branch from 45037fd to b497f9c Compare April 16, 2026 11:03
…rface

The form of the security interface has changed, and the corresponding
test code also needs to be modified accordingly
@Poly-J Poly-J force-pushed the bk7239n_platform branch 3 times, most recently from 58302ac to 0ad7c04 Compare April 21, 2026 11:38
…leep

Optimized the logic of some wake-up source prompts after the system enters sleep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants