ipc: rpmsg_service: Convert to devicetree APIs
* Convert device_get_binding to DEVICE_DT_GET * Convert Kconfig RPMSG_SERVICE_SHM_BASE_ADDRESS and RPMSG_SERVICE_SHM_SIZE to DT_REG_ADDR/DT_REG_SIZE Signed-off-by: Kumar Gala <galak@kernel.org>
This commit is contained in:
parent
d1f519f1c9
commit
8d0b1650a9
3 changed files with 11 additions and 55 deletions
|
@ -2,7 +2,6 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Workaround for not being able to have commas in macro arguments
|
# Workaround for not being able to have commas in macro arguments
|
||||||
DT_CHOSEN_Z_IPC_SHM := zephyr,ipc_shm
|
|
||||||
DT_CHOSEN_Z_IPC := zephyr,ipc
|
DT_CHOSEN_Z_IPC := zephyr,ipc
|
||||||
DT_CHOSEN_Z_IPC_TX := zephyr,ipc_tx
|
DT_CHOSEN_Z_IPC_TX := zephyr,ipc_tx
|
||||||
DT_CHOSEN_Z_IPC_RX := zephyr,ipc_rx
|
DT_CHOSEN_Z_IPC_RX := zephyr,ipc_rx
|
||||||
|
@ -32,48 +31,6 @@ menuconfig RPMSG_SERVICE
|
||||||
|
|
||||||
if RPMSG_SERVICE
|
if RPMSG_SERVICE
|
||||||
|
|
||||||
config RPMSG_SERVICE_SHM_BASE_ADDRESS
|
|
||||||
hex
|
|
||||||
default "$(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_IPC_SHM))"
|
|
||||||
help
|
|
||||||
This option specifies base address of the memory region to
|
|
||||||
be used for the OpenAMP IPC shared memory
|
|
||||||
|
|
||||||
config RPMSG_SERVICE_SHM_SIZE
|
|
||||||
hex
|
|
||||||
default "$(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_IPC_SHM))"
|
|
||||||
help
|
|
||||||
This option specifies size of the memory region to be used
|
|
||||||
for the OpenAMP IPC shared memory
|
|
||||||
|
|
||||||
if RPMSG_SERVICE_SINGLE_IPM_SUPPORT
|
|
||||||
|
|
||||||
config RPMSG_SERVICE_IPM_NAME
|
|
||||||
string
|
|
||||||
default "$(dt_chosen_label,$(DT_CHOSEN_Z_IPC))"
|
|
||||||
help
|
|
||||||
This option specifies the IPM device name to be used
|
|
||||||
|
|
||||||
endif # RPMSG_SERVICE_SINGLE_IPM_SUPPORT
|
|
||||||
|
|
||||||
if RPMSG_SERVICE_DUAL_IPM_SUPPORT
|
|
||||||
|
|
||||||
config RPMSG_SERVICE_IPM_TX_NAME
|
|
||||||
string
|
|
||||||
default "$(dt_chosen_label,$(DT_CHOSEN_Z_IPC_TX))"
|
|
||||||
help
|
|
||||||
This option specifies the IPM device name to be used for
|
|
||||||
TX communication
|
|
||||||
|
|
||||||
config RPMSG_SERVICE_IPM_RX_NAME
|
|
||||||
string
|
|
||||||
default "$(dt_chosen_label,$(DT_CHOSEN_Z_IPC_RX))"
|
|
||||||
help
|
|
||||||
This option specifies the IPM device name to be used for
|
|
||||||
RX communication
|
|
||||||
|
|
||||||
endif # RPMSG_SERVICE_DUAL_IPM_SUPPORT
|
|
||||||
|
|
||||||
choice RPMSG_SERVICE_MODE
|
choice RPMSG_SERVICE_MODE
|
||||||
prompt "RPMsg Service mode"
|
prompt "RPMsg Service mode"
|
||||||
|
|
||||||
|
|
|
@ -210,16 +210,16 @@ int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device *vdev)
|
||||||
|
|
||||||
/* IPM setup */
|
/* IPM setup */
|
||||||
#if defined(CONFIG_RPMSG_SERVICE_DUAL_IPM_SUPPORT)
|
#if defined(CONFIG_RPMSG_SERVICE_DUAL_IPM_SUPPORT)
|
||||||
ipm_tx_handle = device_get_binding(CONFIG_RPMSG_SERVICE_IPM_TX_NAME);
|
ipm_tx_handle = DEVICE_DT_GET(DT_CHOSEN(zephyr_ipc_tx));
|
||||||
ipm_rx_handle = device_get_binding(CONFIG_RPMSG_SERVICE_IPM_RX_NAME);
|
ipm_rx_handle = DEVICE_DT_GET(DT_CHOSEN(zephyr_ipc_rx));
|
||||||
|
|
||||||
if (!ipm_tx_handle) {
|
if (!device_is_ready(ipm_tx_handle)) {
|
||||||
LOG_ERR("Could not get TX IPM device handle");
|
LOG_ERR("IPM TX device is not ready");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ipm_rx_handle) {
|
if (!device_is_ready(ipm_rx_handle)) {
|
||||||
LOG_ERR("Could not get RX IPM device handle");
|
LOG_ERR("IPM RX device is not ready");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,10 +232,9 @@ int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device *vdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(CONFIG_RPMSG_SERVICE_SINGLE_IPM_SUPPORT)
|
#elif defined(CONFIG_RPMSG_SERVICE_SINGLE_IPM_SUPPORT)
|
||||||
ipm_handle = device_get_binding(CONFIG_RPMSG_SERVICE_IPM_NAME);
|
ipm_handle = DEVICE_DT_GET(DT_CHOSEN(zephyr_ipc));
|
||||||
|
if (!device_is_ready(ipm_handle)) {
|
||||||
if (ipm_handle == NULL) {
|
LOG_ERR("IPM device is not ready");
|
||||||
LOG_ERR("Could not get IPM device handle");
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VDEV_START_ADDR CONFIG_RPMSG_SERVICE_SHM_BASE_ADDRESS
|
#define VDEV_START_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_ipc_shm))
|
||||||
#define VDEV_SIZE CONFIG_RPMSG_SERVICE_SHM_SIZE
|
#define VDEV_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_ipc_shm))
|
||||||
|
|
||||||
#define VDEV_STATUS_ADDR VDEV_START_ADDR
|
#define VDEV_STATUS_ADDR VDEV_START_ADDR
|
||||||
#define VDEV_STATUS_SIZE 0x400
|
#define VDEV_STATUS_SIZE 0x400
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue