lib: utils/mpxy: Rename fdt_mpxy_rpmi_mbox to fdt_mpxy_rpmi

The common fdt_mpxy_rpmi_mbox driver is being upgraded to support emulated
MPXY channels hence drop term "mbox" from fdt_mpxy_rpmi_mbox everywhere.

Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com>
Reviewed-by: Pawandeep Oza <pawandeep.oza@oss.qualcomm.com>
Tested-by: Pawandeep Oza <pawandeep.oza@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260923032359.4041876-2-anup.patel@oss.qualcomm.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Anup Patel authored and Anup Patel committed 2026-10-25 14:30:46 +05:30
1 parent fde5dfe96f
commit 0298a2c343
12 files changed
+76 -84

No files matched your search

@@ -7,8 +7,8 @@
* Anup Patel <apatel@ventanamicro.com>
*/
#ifndef __FDT_MPXY_RPMI_MBOX_H__
#define __FDT_MPXY_RPMI_MBOX_H__
#ifndef __FDT_MPXY_RPMI_H__
#define __FDT_MPXY_RPMI_H__
#include <sbi/sbi_types.h>
#include <sbi/sbi_mpxy.h>
@@ -61,8 +61,8 @@ struct mpxy_rpmi_service_data {
u32 max_rx_len;
};
/** MPXY RPMI mbox data for each service group */
struct mpxy_rpmi_mbox_data {
/** MPXY RPMI data for each service group */
struct mpxy_rpmi_data {
u32 servicegrp_id;
u32 num_services;
struct mpxy_rpmi_service_data *service_data;
@@ -73,13 +73,13 @@ struct mpxy_rpmi_mbox_data {
/** Setup RPMI service group context for MPXY */
int (*setup_group)(void **context, struct mbox_chan *chan,
const struct mpxy_rpmi_mbox_data *data);
const struct mpxy_rpmi_data *data);
/** Cleanup RPMI service group context for MPXY */
void (*cleanup_group)(void *context);
};
/** Common probe function for MPXY RPMI drivers */
int mpxy_rpmi_mbox_init(const void *fdt, int nodeoff, const struct fdt_match *match);
int fdt_mpxy_rpmi_init(const void *fdt, int nodeoff, const struct fdt_match *match);
#endif
+3 -3
View File
@@ -7,12 +7,12 @@ config FDT_MPXY
depends on FDT
default n
config FDT_MPXY_RPMI_MBOX
bool "MPXY drivers as RPMI mailbox client"
config FDT_MPXY_RPMI
bool "FDT based MPXY RPMI drivers"
depends on FDT_MAILBOX && FDT_MPXY
default n
if FDT_MPXY_RPMI_MBOX
if FDT_MPXY_RPMI
config FDT_MPXY_RPMI_CLOCK
bool "MPXY driver for RPMI clock service group"
@@ -12,16 +12,16 @@
#include <sbi/sbi_error.h>
#include <sbi/sbi_heap.h>
#include <sbi_utils/fdt/fdt_helper.h>
#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h>
#include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
#include <sbi/sbi_console.h>
/**
* MPXY mbox instance per MPXY channel. This ties
* MPXY RPMI instance per MPXY channel. This ties
* an MPXY channel with an RPMI Service group.
*/
struct mpxy_rpmi_mbox {
struct mpxy_rpmi {
struct mbox_chan *chan;
const struct mpxy_rpmi_mbox_data *mbox_data;
const struct mpxy_rpmi_data *data;
struct mpxy_rpmi_channel_attrs msgprot_attrs;
struct sbi_mpxy_channel channel;
void *group_context;
@@ -32,12 +32,12 @@ struct mpxy_rpmi_mbox {
* MPXY message_id == RPMI service_id
*/
static const struct mpxy_rpmi_service_data *mpxy_find_rpmi_srvid(u32 message_id,
const struct mpxy_rpmi_mbox_data *mbox_data)
const struct mpxy_rpmi_data *data)
{
const struct mpxy_rpmi_service_data *srv = mbox_data->service_data;
const struct mpxy_rpmi_service_data *srv = data->service_data;
int mid = 0;
for (mid = 0; srv[mid].id < mbox_data->num_services; mid++) {
for (mid = 0; srv[mid].id < data->num_services; mid++) {
if (srv[mid].id == (u8)message_id)
return &srv[mid];
}
@@ -53,12 +53,10 @@ static void mpxy_copy_attrs(u32 *outmem, u32 *inmem, u32 count)
outmem[idx] = cpu_to_le32(inmem[idx]);
}
static int mpxy_mbox_read_attributes(struct sbi_mpxy_channel *channel,
u32 *outmem, u32 base_attr_id,
u32 attr_count)
static int mpxy_read_attributes(struct sbi_mpxy_channel *channel,
u32 *outmem, u32 base_attr_id, u32 attr_count)
{
struct mpxy_rpmi_mbox *rmb =
container_of(channel, struct mpxy_rpmi_mbox, channel);
struct mpxy_rpmi *rmb = container_of(channel, struct mpxy_rpmi, channel);
u32 *attr_array = (u32 *)&rmb->msgprot_attrs;
u32 end_id = base_attr_id + attr_count - 1;
@@ -96,18 +94,16 @@ static int mpxy_check_write_attr(u32 attr_id, u32 attr_val)
}
static void mpxy_write_attr(struct mpxy_rpmi_channel_attrs *attrs,
u32 attr_id,
u32 attr_val)
u32 attr_id, u32 attr_val)
{
/* No writable attributes in RPMI */
}
static int mpxy_mbox_write_attributes(struct sbi_mpxy_channel *channel,
u32 *outmem, u32 base_attr_id,
u32 attr_count)
static int mpxy_write_attributes(struct sbi_mpxy_channel *channel,
u32 *outmem, u32 base_attr_id,
u32 attr_count)
{
struct mpxy_rpmi_mbox *rmb =
container_of(channel, struct mpxy_rpmi_mbox, channel);
struct mpxy_rpmi *rmb = container_of(channel, struct mpxy_rpmi, channel);
u32 end_id = base_attr_id + attr_count - 1;
u32 attr_val, idx;
int ret, mem_idx;
@@ -132,14 +128,12 @@ static int mpxy_mbox_write_attributes(struct sbi_mpxy_channel *channel,
return SBI_OK;
}
static int __mpxy_mbox_send_message(struct sbi_mpxy_channel *channel,
u32 message_id, void *tx, u32 tx_len,
void *rx, u32 rx_max_len,
unsigned long *ack_len)
static int __mpxy_send_message(struct sbi_mpxy_channel *channel,
u32 message_id, void *tx, u32 tx_len,
void *rx, u32 rx_max_len, unsigned long *ack_len)
{
struct mpxy_rpmi_mbox *rmb =
container_of(channel, struct mpxy_rpmi_mbox, channel);
const struct mpxy_rpmi_mbox_data *data = rmb->mbox_data;
struct mpxy_rpmi *rmb = container_of(channel, struct mpxy_rpmi, channel);
const struct mpxy_rpmi_data *data = rmb->data;
const struct mpxy_rpmi_service_data *srv =
mpxy_find_rpmi_srvid(message_id, data);
struct rpmi_message_args args = {0};
@@ -194,33 +188,33 @@ static int __mpxy_mbox_send_message(struct sbi_mpxy_channel *channel,
return SBI_OK;
}
static int mpxy_mbox_send_message_withresp(struct sbi_mpxy_channel *channel,
u32 message_id, void *tx, u32 tx_len,
void *rx, u32 rx_max_len,
unsigned long *ack_len)
static int mpxy_send_message_withresp(struct sbi_mpxy_channel *channel,
u32 message_id, void *tx, u32 tx_len,
void *rx, u32 rx_max_len,
unsigned long *ack_len)
{
return __mpxy_mbox_send_message(channel, message_id, tx, tx_len,
rx, rx_max_len, ack_len);
return __mpxy_send_message(channel, message_id, tx, tx_len,
rx, rx_max_len, ack_len);
}
static int mpxy_mbox_send_message_withoutresp(struct sbi_mpxy_channel *channel,
u32 message_id, void *tx, u32 tx_len)
static int mpxy_send_message_withoutresp(struct sbi_mpxy_channel *channel,
u32 message_id, void *tx, u32 tx_len)
{
return __mpxy_mbox_send_message(channel, message_id, tx, tx_len,
NULL, 0, NULL);
return __mpxy_send_message(channel, message_id, tx, tx_len,
NULL, 0, NULL);
}
int mpxy_rpmi_mbox_init(const void *fdt, int nodeoff, const struct fdt_match *match)
int fdt_mpxy_rpmi_init(const void *fdt, int nodeoff, const struct fdt_match *match)
{
u32 channel_id, servicegrp_ver, pro_ver, max_data_len, tx_tout, rx_tout;
u32 impl_id, impl_ver;
const struct mpxy_rpmi_mbox_data *data = match->data;
struct mpxy_rpmi_mbox *rmb;
const struct mpxy_rpmi_data *data = match->data;
struct mpxy_rpmi *rmb;
struct mbox_chan *chan;
const fdt32_t *val;
int rc, len;
/* Allocate context for MPXY mbox client */
/* Allocate context for MPXY RPMI instance */
rmb = sbi_zalloc(sizeof(*rmb));
if (!rmb)
return SBI_ENOMEM;
@@ -285,8 +279,8 @@ int mpxy_rpmi_mbox_init(const void *fdt, int nodeoff, const struct fdt_match *ma
/*
* The "riscv,sbi-mpxy-channel-id" DT property is mandatory
* for MPXY RPMI mailbox client driver so if this is not
* present then try other drivers.
* for MPXY RPMI drivers so if this is not present then try
* other drivers.
*/
val = fdt_getprop(fdt, nodeoff, "riscv,sbi-mpxy-channel-id", &len);
if (len > 0 && val) {
@@ -296,20 +290,18 @@ int mpxy_rpmi_mbox_init(const void *fdt, int nodeoff, const struct fdt_match *ma
goto fail_free_chan;
}
/* Setup MPXY mbox client */
/* Setup MPXY RPMI channel */
/* Channel ID*/
rmb->channel.channel_id = channel_id;
/* Set the owner domain */
rmb->channel.owner_domain = &root;
/* Callback for read RPMI attributes */
rmb->channel.read_attributes = mpxy_mbox_read_attributes;
rmb->channel.read_attributes = mpxy_read_attributes;
/* Callback for write RPMI attributes */
rmb->channel.write_attributes = mpxy_mbox_write_attributes;
rmb->channel.write_attributes = mpxy_write_attributes;
/* Callback for sending RPMI message */
rmb->channel.send_message_with_response =
mpxy_mbox_send_message_withresp;
rmb->channel.send_message_without_response =
mpxy_mbox_send_message_withoutresp;
rmb->channel.send_message_with_response = mpxy_send_message_withresp;
rmb->channel.send_message_without_response = mpxy_send_message_withoutresp;
/* RPMI Message Protocol ID */
rmb->channel.attrs.msg_proto_id = SBI_MPXY_MSGPROTO_RPMI_ID;
@@ -334,7 +326,7 @@ int mpxy_rpmi_mbox_init(const void *fdt, int nodeoff, const struct fdt_match *ma
rmb->msgprot_attrs.impl_id = impl_id;
rmb->msgprot_attrs.impl_ver = impl_ver;
rmb->mbox_data = data;
rmb->data = data;
rmb->chan = chan;
/* Setup RPMI service group context */
+3 -3
View File
@@ -8,7 +8,7 @@
* Anup Patel <apatel@ventanamicro.com>
*/
#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h>
#include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
static struct mpxy_rpmi_service_data clock_services[] = {
{
@@ -69,7 +69,7 @@ static struct mpxy_rpmi_service_data clock_services[] = {
},
};
static const struct mpxy_rpmi_mbox_data clock_data = {
static const struct mpxy_rpmi_data clock_data = {
.servicegrp_id = RPMI_SRVGRP_CLOCK,
.num_services = RPMI_CLOCK_SRV_MAX_COUNT,
.service_data = clock_services,
@@ -82,5 +82,5 @@ static const struct fdt_match clock_match[] = {
const struct fdt_driver fdt_mpxy_rpmi_clock = {
.match_table = clock_match,
.init = mpxy_rpmi_mbox_init,
.init = fdt_mpxy_rpmi_init,
};
+3 -3
View File
@@ -1,4 +1,4 @@
#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h>
#include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
static struct mpxy_rpmi_service_data dpwr_services[] = {
{
@@ -38,7 +38,7 @@ static struct mpxy_rpmi_service_data dpwr_services[] = {
},
};
static const struct mpxy_rpmi_mbox_data dpwr_data = {
static const struct mpxy_rpmi_data dpwr_data = {
.servicegrp_id = RPMI_SRVGRP_DEVICE_POWER,
.num_services = RPMI_DPWR_SRV_MAX_COUNT,
.service_data = dpwr_services,
@@ -52,5 +52,5 @@ static const struct fdt_match dpwr_match[] = {
const struct fdt_driver fdt_mpxy_rpmi_device_power = {
.experimental = true,
.match_table = dpwr_match,
.init = mpxy_rpmi_mbox_init,
.init = fdt_mpxy_rpmi_init,
};
+3 -3
View File
@@ -7,7 +7,7 @@
* Subrahmanya Lingappa <subrahmanya.lingappa@oss.qualcomm.com>
*/
#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h>
#include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
static struct mpxy_rpmi_service_data logging_services[] = {
[0] = {
@@ -33,7 +33,7 @@ static struct mpxy_rpmi_service_data logging_services[] = {
},
};
static const struct mpxy_rpmi_mbox_data logging_data = {
static const struct mpxy_rpmi_data logging_data = {
.servicegrp_id = RPMI_SRVGRP_LOGGING,
.num_services = RPMI_LOGGING_SRV_MAX_COUNT,
.service_data = logging_services,
@@ -46,6 +46,6 @@ static const struct fdt_match logging_match[] = {
const struct fdt_driver fdt_mpxy_rpmi_logging = {
.match_table = logging_match,
.init = mpxy_rpmi_mbox_init,
.init = fdt_mpxy_rpmi_init,
.experimental = true,
};
+4 -4
View File
@@ -8,7 +8,7 @@
* Sunil V L <sunilvl@oss.qualcomm.com>
*/
#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h>
#include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
#include <sbi_utils/mailbox/rpmi_mailbox.h>
static struct rpmi_mm_get_attributes_rsp rsp;
@@ -38,7 +38,7 @@ static struct mpxy_rpmi_service_data mm_srvcdata[] = {
};
static int mpxy_rpmi_mm_setup(void **context, struct mbox_chan *chan,
const struct mpxy_rpmi_mbox_data *data)
const struct mpxy_rpmi_data *data)
{
unsigned long mm_region_addr = 0;
unsigned long mm_region_size = 0;
@@ -99,7 +99,7 @@ static int mpxy_rpmi_mm_xfer(void *context, struct mbox_chan *chan,
return rc;
}
static const struct mpxy_rpmi_mbox_data mm_data = {
static const struct mpxy_rpmi_data mm_data = {
.servicegrp_id = RPMI_SRVGRP_MANAGEMENT_MODE,
.num_services = RPMI_MM_SRV_MAX_COUNT,
.service_data = mm_srvcdata,
@@ -119,5 +119,5 @@ static const struct fdt_match mm_match[] = {
const struct fdt_driver fdt_mpxy_rpmi_mm = {
.experimental = true,
.match_table = mm_match,
.init = mpxy_rpmi_mbox_init,
.init = fdt_mpxy_rpmi_init,
};
+3 -3
View File
@@ -1,4 +1,4 @@
#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h>
#include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
static struct mpxy_rpmi_service_data performance_services[] = {
{
@@ -73,7 +73,7 @@ static struct mpxy_rpmi_service_data performance_services[] = {
},
};
static const struct mpxy_rpmi_mbox_data performance_data = {
static const struct mpxy_rpmi_data performance_data = {
.servicegrp_id = RPMI_SRVGRP_PERFORMANCE ,
.num_services = RPMI_PERF_SRV_MAX_COUNT,
.service_data = performance_services,
@@ -87,5 +87,5 @@ static const struct fdt_match performance_match[] = {
const struct fdt_driver fdt_mpxy_rpmi_performance = {
.experimental = true,
.match_table = performance_match,
.init = mpxy_rpmi_mbox_init,
.init = fdt_mpxy_rpmi_init,
};
+4 -4
View File
@@ -9,7 +9,7 @@
#include <sbi/sbi_byteorder.h>
#include <sbi/sbi_heap.h>
#include <sbi_utils/mailbox/rpmi_mailbox.h>
#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h>
#include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
struct mpxy_rpmi_sysmsi {
u32 sys_num_msi;
@@ -84,7 +84,7 @@ static void mpxy_rpmi_sysmsi_cleanup(void *context)
}
static int mpxy_rpmi_sysmsi_setup(void **context, struct mbox_chan *chan,
const struct mpxy_rpmi_mbox_data *data)
const struct mpxy_rpmi_data *data)
{
struct rpmi_sysmsi_get_msi_attributes_resp gmaresp;
struct rpmi_sysmsi_get_msi_attributes_req gmareq;
@@ -189,7 +189,7 @@ static struct mpxy_rpmi_service_data sysmsi_services[] = {
},
};
static const struct mpxy_rpmi_mbox_data sysmsi_data = {
static const struct mpxy_rpmi_data sysmsi_data = {
.servicegrp_id = RPMI_SRVGRP_SYSTEM_MSI,
.num_services = RPMI_SYSMSI_SRV_ID_MAX_COUNT,
.service_data = sysmsi_services,
@@ -205,5 +205,5 @@ static const struct fdt_match sysmsi_match[] = {
const struct fdt_driver fdt_mpxy_rpmi_sysmsi = {
.match_table = sysmsi_match,
.init = mpxy_rpmi_mbox_init,
.init = fdt_mpxy_rpmi_init,
};
+3 -3
View File
@@ -1,4 +1,4 @@
#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h>
#include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
static struct mpxy_rpmi_service_data voltage_services[] = {
{
@@ -59,7 +59,7 @@ static struct mpxy_rpmi_service_data voltage_services[] = {
},
};
static const struct mpxy_rpmi_mbox_data voltage_data = {
static const struct mpxy_rpmi_data voltage_data = {
.servicegrp_id = RPMI_SRVGRP_VOLTAGE,
.num_services = RPMI_VOLTAGE_SRV_MAX_COUNT,
.service_data = voltage_services,
@@ -73,5 +73,5 @@ static const struct fdt_match voltage_match[] = {
const struct fdt_driver fdt_mpxy_rpmi_voltage = {
.experimental = true,
.match_table = voltage_match,
.init = mpxy_rpmi_mbox_init,
.init = fdt_mpxy_rpmi_init,
};
+1 -1
View File
@@ -10,7 +10,7 @@
libsbiutils-objs-$(CONFIG_FDT_MPXY) += mpxy/fdt_mpxy.o
libsbiutils-objs-$(CONFIG_FDT_MPXY) += mpxy/fdt_mpxy_drivers.carray.o
libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_MBOX) += mpxy/fdt_mpxy_rpmi_mbox.o
libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI) += mpxy/fdt_mpxy_rpmi.o
carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_CLOCK) += fdt_mpxy_rpmi_clock
libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_CLOCK) += mpxy/fdt_mpxy_rpmi_clock.o
+1 -1
View File
@@ -78,7 +78,7 @@ CONFIG_FDT_TIMER=y
CONFIG_FDT_TIMER_MTIMER=y
CONFIG_FDT_TIMER_PLMT=y
CONFIG_FDT_MPXY=y
CONFIG_FDT_MPXY_RPMI_MBOX=y
CONFIG_FDT_MPXY_RPMI=y
CONFIG_FDT_MPXY_RPMI_CLOCK=y
CONFIG_FDT_MPXY_RPMI_VOLTAGE=y
CONFIG_FDT_MPXY_RPMI_DEVICE_POWER=y