Skip to content

Commit d91f9c4

Browse files
committed
drivers: misc bflb updates
mostly makes things a little bit safer Signed-off-by: Camille BAUD <mail@massdriver.space>
1 parent 61fd608 commit d91f9c4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

drivers/clock_control/clock_control_bl60x.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const static uint32_t clock_control_bl60x_crystal_SDMIN_table[5] = {
9191

9292
static inline void clock_control_bl60x_clock_settle(void)
9393
{
94-
__asm__ volatile(".rept 15 ; nop ; .endr");
94+
__asm__ volatile(".rept 20 ; nop ; .endr");
9595
}
9696

9797
/* 32 Mhz Oscillator: 0
@@ -848,6 +848,8 @@ static int clock_control_bl60x_init(const struct device *dev)
848848

849849
clock_control_bl60x_peripheral_clock_init();
850850

851+
clock_control_bl60x_clock_settle();
852+
851853
irq_unlock(key);
852854

853855
return 0;

drivers/syscon/syscon_bflb_efuse.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct efuse_bflb_config {
2929

3030
static inline void efuse_bflb_clock_settle(void)
3131
{
32-
__asm__ volatile (".rept 15 ; nop ; .endr");
32+
__asm__ volatile (".rept 20 ; nop ; .endr");
3333
}
3434

3535
/* 32 Mhz Oscillator: 0
@@ -173,6 +173,9 @@ static void efuse_bflb_cache(const struct device *dev)
173173
const struct efuse_bflb_config *config = dev->config;
174174
uint32_t tmp;
175175
uint8_t old_clock_root;
176+
uint32_t key;
177+
178+
key = irq_lock();
176179

177180
tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET);
178181
old_clock_root = (tmp & HBN_ROOT_CLK_SEL_MSK) >> HBN_ROOT_CLK_SEL_POS;
@@ -193,6 +196,8 @@ static void efuse_bflb_cache(const struct device *dev)
193196
efuse_bflb_set_root_clock(old_clock_root);
194197
efuse_bflb_clock_settle();
195198
data->cached = true;
199+
200+
irq_unlock(key);
196201
}
197202

198203
static int efuse_bflb_read(const struct device *dev, uint16_t reg, uint32_t *val)

0 commit comments

Comments
 (0)