soc: qcom: cmd-db: Add cmd_db_read_slave_id() & cmd_db_read_aux_data() functions
Partially reverted commit "soc: qcom: cmd-db: drop unused functions" by restoring only the cmd_db_read_slave_id() and cmd_db_read_aux_data() functions, which were removed in that commit. These functions are required for the RPMH Power Domain Driver. Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Casey Connolly <casey.connolly@linaro.org> Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com> Signed-off-by: Aswin Murugan <aswin.murugan@oss.qualcomm.com> Reviewed-by: Casey Connolly <casey.connolly@linaro.org>> --- Link: https://patch.msgid.link/20251113113427.2218045-2-aswin.murugan@oss.qualcomm.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
This commit is contained in:
committed by
Neil Armstrong
parent
96edadab54
commit
a264c0454b
@@ -183,6 +183,51 @@ u32 cmd_db_read_addr(const char *id)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cmd_db_read_addr);
|
||||
|
||||
/**
|
||||
* cmd_db_read_slave_id - Get the slave ID for a given resource address
|
||||
*
|
||||
* @id: Resource id to query the DB for version
|
||||
*
|
||||
* Return: cmd_db_hw_type enum on success, CMD_DB_HW_INVALID on error
|
||||
*/
|
||||
enum cmd_db_hw_type cmd_db_read_slave_id(const char *id)
|
||||
{
|
||||
int ret;
|
||||
const struct entry_header *ent;
|
||||
u32 addr;
|
||||
|
||||
ret = cmd_db_get_header(id, &ent, NULL);
|
||||
if (ret < 0)
|
||||
return CMD_DB_HW_INVALID;
|
||||
|
||||
addr = le32_to_cpu(ent->addr);
|
||||
return (addr >> SLAVE_ID_SHIFT) & SLAVE_ID_MASK;
|
||||
}
|
||||
|
||||
/**
|
||||
* cmd_db_read_aux_data() - Query command db for aux data.
|
||||
*
|
||||
* @id: Resource to retrieve AUX Data on
|
||||
* @len: size of data buffer returned
|
||||
*
|
||||
* Return: pointer to data on success, error pointer otherwise
|
||||
*/
|
||||
const void *cmd_db_read_aux_data(const char *id, size_t *len)
|
||||
{
|
||||
int ret;
|
||||
const struct entry_header *ent;
|
||||
const struct rsc_hdr *rsc_hdr;
|
||||
|
||||
ret = cmd_db_get_header(id, &ent, &rsc_hdr);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
if (len)
|
||||
*len = le16_to_cpu(ent->len);
|
||||
|
||||
return rsc_offset(rsc_hdr, ent);
|
||||
}
|
||||
|
||||
static int cmd_db_bind(struct udevice *dev)
|
||||
{
|
||||
void __iomem *base;
|
||||
|
||||
@@ -21,6 +21,8 @@ enum cmd_db_hw_type {
|
||||
|
||||
#if IS_ENABLED(CONFIG_QCOM_COMMAND_DB)
|
||||
u32 cmd_db_read_addr(const char *resource_id);
|
||||
enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id);
|
||||
const void *cmd_db_read_aux_data(const char *resource_id, size_t *len);
|
||||
|
||||
#else
|
||||
static inline u32 cmd_db_read_addr(const char *resource_id)
|
||||
|
||||
Reference in New Issue
Block a user