Source
x
// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2015-2016
* Texas Instruments Incorporated - http://www.ti.com/
*/
DECLARE_GLOBAL_DATA_PTR;
/**
* struct ti_powerproc_privdata - power processor private data
* @loadaddr: base address for loading the power processor
* @psc_module: psc module address.
*/
struct ti_powerproc_privdata {
phys_addr_t loadaddr;
u32 psc_module;
};
/**
* ti_of_to_priv() - generate private data from device tree
* @dev: corresponding ti remote processor device
* @priv: pointer to driver specific private data
*
* Return: 0 if all went ok, else corresponding -ve error
*/
static int ti_of_to_priv(struct udevice *dev,
struct ti_powerproc_privdata *priv)
{
int node = dev_of_offset(dev);
const void *blob = gd->fdt_blob;
int tmp;
if (!blob) {
debug("'%s' no dt?\n", dev->name);
return -EINVAL;
}
priv->loadaddr = fdtdec_get_addr(blob, node, "reg");
if (priv->loadaddr == FDT_ADDR_T_NONE) {
debug("'%s': no 'reg' property\n", dev->name);
return -EINVAL;
}
tmp = fdtdec_get_int(blob, node, "ti,lpsc_module", -EINVAL);
if (tmp < 0) {
debug("'%s': no 'ti,lpsc_module' property\n", dev->name);
return tmp;
}
priv->psc_module = tmp;
return 0;
}
/**
* ti_powerproc_probe() - Basic probe
* @dev: corresponding ti remote processor device
*
* Return: 0 if all went ok, else corresponding -ve error
*/
static int ti_powerproc_probe(struct udevice *dev)
{
struct dm_rproc_uclass_pdata *uc_pdata;
struct ti_powerproc_privdata *priv;
int ret;
uc_pdata = dev_get_uclass_platdata(dev);
priv = dev_get_priv(dev);
ret = ti_of_to_priv(dev, priv);
debug("%s probed with slave_addr=0x%08lX module=%d(%d)\n",
uc_pdata->name, priv->loadaddr, priv->psc_module, ret);
return ret;
}
/**
* ti_powerproc_load() - Loadup the TI remote processor
* @dev: corresponding ti remote processor device
* @addr: Address in memory where image binary is stored
* @size: Size in bytes of the image binary
*
* Return: 0 if all went ok, else corresponding -ve error
*/
static int ti_powerproc_load(struct udevice *dev, ulong addr, ulong size)