Skip to content

Commit e0ace55

Browse files
rluboscarlescufi
authored andcommitted
drivers: flash_rpc: Lower driver init priority
Some nRF53 initializations are now done after POST_KERNEL init level, so initialize the serialization at the APPLICATION level. As DT doesn't allow to initialize devices at the APPLICATION level, make use of the zephyr,deferred-init property and initialize the device manually from SYS_INIT(). For whatever reason the property was not recognized if nordic,rpc-flash-controller binding was no present, so add it. Signed-off-by: Robert Lubos <[email protected]>
1 parent de709df commit e0ace55

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

drivers/flash/flash_rpc/flash_rpc_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ static int serialization_init(void)
3131
return 0;
3232
}
3333

34-
SYS_INIT(serialization_init, POST_KERNEL, CONFIG_FLASH_RPC_SYS_INIT_PRIORITY);
34+
SYS_INIT(serialization_init, APPLICATION, CONFIG_FLASH_RPC_SYS_INIT_PRIORITY);

drivers/flash/flash_rpc/flash_rpc_controller.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,18 @@ static const struct flash_driver_api flash_driver_rpc_api = {
231231

232232
DEVICE_DT_INST_DEFINE(0, flash_rpc_init, NULL, NULL, NULL, POST_KERNEL,
233233
CONFIG_FLASH_RPC_DRIVER_INIT_PRIORITY, &flash_driver_rpc_api);
234+
235+
static int controller_init(void)
236+
{
237+
int err;
238+
239+
err = device_init(DEVICE_DT_GET(DT_NODELABEL(rpc_flash_controller)));
240+
if (err != 0) {
241+
LOG_ERR("Flash RPC controller initialization failed, err %d", err);
242+
return err;
243+
}
244+
245+
return 0;
246+
}
247+
248+
SYS_INIT(controller_init, APPLICATION, CONFIG_FLASH_RPC_DRIVER_INIT_PRIORITY);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2025 Nordic Semiconductor
2+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
3+
4+
description: Flash RPC controller
5+
6+
compatible: "nordic,rpc-flash-controller"
7+
8+
include: flash-controller.yaml

tests/drivers/flash/flash_rpc/app.overlay

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
reg = <0x00000000 DT_SIZE_K(256)>;
66
#address-cells = <1>;
77
#size-cells = <1>;
8-
erase-value = <0xff>;
98
status = "okay";
9+
zephyr,deferred-init;
1010
flash_rpc: flash_rpc@0 {
1111
status = "okay";
1212
compatible = "soc-nv-flash";

0 commit comments

Comments
 (0)