[PATCH] soc: qcom: cmd-db: Add optional support for device programmer flows

Sumit Garg sumit.garg at kernel.org
Mon Apr 13 14:52:39 CEST 2026


On Mon, Apr 13, 2026 at 02:28:20PM +0200, Casey Connolly wrote:
> On 2026-04-09 21:15 +0530, Balaji Selvanathan wrote:
> > Add QCOM_COMMAND_DB_OPTIONAL Kconfig option to allow the Command DB
> > driver to bind successfully even when CMD DB data is missing or has
> > an invalid magic number.
> > 
> > This is required for device programmer flows where U-Boot runs
> > without AOP (Always On Processor) being invoked. Since AOP is
> > responsible for populating CMD DB data, device programmer scenarios
> > lack valid CMD DB and would otherwise fail to boot.
> > 
> > Normal boot flows should keep this disabled
> > as they require valid CMD DB data populated by AOP.
> 
> Presumably this is only used for development and isn't meant to be a supported setup right? In that
> case how about just using a normal macro rather than a whole kconfig option, then you can just
> build with make CCFLAGS=-DQCOM_CMD_DB_OPTIONAL=1 or something?

Looks like the commit message lacks to describe the motivation here.
This patch is a preparatory step to allow U-Boot to be used as a device
flashing/provisioning tool. In that environment, there isn't TZ or HYP
stage running and U-Boot is expected to be launched in EL3.

> 
> Kind regards,
> 
> > 
> > Signed-off-by: Balaji Selvanathan <balaji.selvanathan at oss.qualcomm.com>
> > ---
> >  drivers/soc/qcom/Kconfig  | 16 ++++++++++++++++
> >  drivers/soc/qcom/cmd-db.c | 10 ++++++++++
> >  2 files changed, 26 insertions(+)
> > 
> > diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
> > index 8243805e46a..239d87e044f 100644
> > --- a/drivers/soc/qcom/Kconfig
> > +++ b/drivers/soc/qcom/Kconfig
> > @@ -18,6 +18,22 @@ config QCOM_COMMAND_DB
> >  	  resource on a RPM-hardened platform must use this database to get
> >  	  SoC specific identifier and information for the shared resources.
> >  
> > +config QCOM_COMMAND_DB_OPTIONAL
> > +	bool "Allow operation without Command DB data"
> > +	depends on QCOM_COMMAND_DB
> > +	help
> > +	  Allow the Command DB driver to bind successfully even when CMD DB
> > +	  data is not populated or has an invalid magic number.
> > +
> > +	  This is useful for platforms where CMD DB is not populated by
> > +
> > +	  When enabled, missing CMD DB will generate warnings but allow boot
> > +	  to continue. Consumer drivers must handle cmd_db API failures
> > +	  gracefully by checking return values.
> > +
> > +	  If unsure, say N. Most production Qualcomm platforms require
> > +	  valid CMD DB data.
> > +
> >  config QCOM_RPMH
> >  	bool "Qualcomm RPMh support"
> >  	depends on QCOM_COMMAND_DB
> > diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c
> > index d0a6047b8a6..b4682d811f7 100644
> > --- a/drivers/soc/qcom/cmd-db.c
> > +++ b/drivers/soc/qcom/cmd-db.c
> > @@ -252,8 +252,18 @@ static int cmd_db_bind(struct udevice *dev)
> >  
> >  	cmd_db_header = base;
> >  	if (!cmd_db_magic_matches(cmd_db_header)) {
> > +#ifdef CONFIG_QCOM_COMMAND_DB_OPTIONAL

Switch to IS_ENABLED(QCOM_COMMAND_DB_OPTIONAL) check instead.

> > +		log_warning("%s: CMD DB magic not found (0x%02x%02x%02x%02x)\n",
> > +			    __func__, cmd_db_header->magic[0], cmd_db_header->magic[1],
> > +			    cmd_db_header->magic[2], cmd_db_header->magic[3]);
> > +		log_warning("%s: CMD DB data unavailable, resource queries will fail\n",
> > +			    __func__);

Convert these warning rather to log_debug() since this will be under
special config check anyways.

-Sumit

> > +		cmd_db_header = NULL;
> > +		return 0;
> > +#else
> >  		log_err("%s: Invalid Command DB Magic\n", __func__);
> >  		return -EINVAL;
> > +#endif
> >  	}
> >  
> >  	return 0;
> > 
> > ---
> > base-commit: f0000b4a57e9edf8ff8454b9056d767466dff57f
> > change-id: 20260409-cmddb-394afa003818
> > 
> > Best regards,
> > -- 
> > Balaji Selvanathan <balaji.selvanathan at oss.qualcomm.com>
> > 
> > 
> > 
> 
> 


More information about the U-Boot mailing list