/* ----------------------------------------------------------------------------- * Public API
*/
/** * rcar_fcp_get - Find and acquire a reference to an FCP instance * @np: Device node of the FCP instance * * Search the list of registered FCP instances for the instance corresponding to * the given device node. * * Return a pointer to the FCP instance, or an ERR_PTR if the instance can't be * found.
*/ struct rcar_fcp_device *rcar_fcp_get(conststruct device_node *np)
{ struct rcar_fcp_device *fcp;
mutex_lock(&fcp_lock);
list_for_each_entry(fcp, &fcp_devices, list) { if (fcp->dev->of_node != np) continue;
/** * rcar_fcp_put - Release a reference to an FCP instance * @fcp: The FCP instance * * Release the FCP instance acquired by a call to rcar_fcp_get().
*/ void rcar_fcp_put(struct rcar_fcp_device *fcp)
{ if (fcp)
put_device(fcp->dev);
}
EXPORT_SYMBOL_GPL(rcar_fcp_put);
/** * rcar_fcp_enable - Enable an FCP * @fcp: The FCP instance * * Before any memory access through an FCP is performed by a module, the FCP * must be enabled by a call to this function. The enable calls are reference * counted, each successful call must be followed by one rcar_fcp_disable() * call when no more memory transfer can occur through the FCP. * * Return 0 on success or a negative error code if an error occurs. The enable * reference count isn't increased when this function returns an error.
*/ int rcar_fcp_enable(struct rcar_fcp_device *fcp)
{ if (!fcp) return 0;
/** * rcar_fcp_disable - Disable an FCP * @fcp: The FCP instance * * This function is the counterpart of rcar_fcp_enable(). As enable calls are * reference counted a disable call may not disable the FCP synchronously.
*/ void rcar_fcp_disable(struct rcar_fcp_device *fcp)
{ if (fcp)
pm_runtime_put(fcp->dev);
}
EXPORT_SYMBOL_GPL(rcar_fcp_disable);
int rcar_fcp_soft_reset(struct rcar_fcp_device *fcp)
{
u32 value; int ret;
if (!fcp) return 0;
rcar_fcp_write(fcp, RCAR_FCP_REG_RST, RCAR_FCP_REG_RST_SOFTRST);
ret = readl_poll_timeout(fcp->base + RCAR_FCP_REG_STA,
value, !(value & RCAR_FCP_REG_STA_ACT),
1, 100); if (ret)
dev_err(fcp->dev, "Failed to soft-reset\n");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.