Then we can provide a vendor resource hook in the remoteproc driver to handle
these resources:
static int ti_pru_rproc_handle_rsc(struct rproc *rproc, u32 rsc_type, void *rsc,
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ int offset, int avail)
{
ÂÂÂÂstruct ti_pru_data *pru = rproc->priv;
ÂÂÂÂstruct irq_fwspec fwspec;
ÂÂÂÂunsigned int virq;
ÂÂÂÂswitch (rsc_type) {
ÂÂÂÂcase TI_PRU_VENDOR_RESOURCE_IRQ:
ÂÂÂÂ{
ÂÂÂÂÂÂÂ struct ti_pru_vendor_resource_irq *rsc_irq = rsc;
ÂÂÂÂÂÂÂ fwspec.fwnode = pru->intc_fwnode;
ÂÂÂÂÂÂÂ fwspec.param[0] = le32_to_cpu(rsc_irq->event);
ÂÂÂÂÂÂÂ fwspec.param[1] = le32_to_cpu(rsc_irq->channel);
ÂÂÂÂÂÂÂ fwspec.param[2] = le32_to_cpu(rsc_irq->host);
ÂÂÂÂÂÂÂ fwspec.param[3] = le32_to_cpu(rsc_irq->domain);
ÂÂÂÂÂÂÂ fwspec.param_count = 4;
ÂÂÂÂ}
ÂÂÂÂÂÂÂ break;
ÂÂÂÂcase TI_PRU_VENDOR_RESOURCE_IRQ2:
ÂÂÂÂ{
ÂÂÂÂÂÂÂ struct ti_pru_vendor_resource_irq2 *rsc_irq2 = rsc;
ÂÂÂÂÂÂÂ fwspec.fwnode = pru->intc_fwnode;
ÂÂÂÂÂÂÂ fwspec.param[0] = le32_to_cpu(rsc_irq2->event);
ÂÂÂÂÂÂÂ fwspec.param[1] = le32_to_cpu(rsc_irq2->evt_sel);
ÂÂÂÂÂÂÂ fwspec.param[2] = le32_to_cpu(rsc_irq2->channel);
ÂÂÂÂÂÂÂ fwspec.param[3] = le32_to_cpu(rsc_irq2->host);
ÂÂÂÂÂÂÂ fwspec.param[4] = le32_to_cpu(rsc_irq2->domain);
ÂÂÂÂÂÂÂ fwspec.param_count = 5;
ÂÂÂÂÂÂÂ break;
ÂÂÂÂ}
ÂÂÂÂdefault:
ÂÂÂÂÂÂÂ return RSC_IGNORED;
ÂÂÂÂ}
ÂÂÂÂvirq = irq_create_fwspec_mapping(&fwspec);
ÂÂÂÂif (!virq)
ÂÂÂÂÂÂÂ return -EINVAL;
ÂÂÂÂ/* TODO: save virq (and other metadata) for later use */
ÂÂÂÂreturn RSC_HANDLED;
}
static const struct rproc_ops ti_pru_rproc_ops = {
ÂÂÂÂ.start = ti_pru_rproc_start,
ÂÂÂÂ.stop = ti_pru_rproc_stop,
ÂÂÂÂ.kick = ti_pru_rproc_kick,
ÂÂÂÂ.da_to_va = ti_pru_rproc_da_to_va,
ÂÂÂÂ.handle_rsc = ti_pru_rproc_handle_rsc,
};