/* try getting the logical address after probe */
ret = slim_get_logical_addr(sbdev); if (!ret) {
slim_device_update_status(sbdev, SLIM_DEVICE_STATUS_UP);
} else {
dev_err(&sbdev->dev, "Failed to get logical address\n");
ret = -EPROBE_DEFER;
}
/* * __slim_driver_register() - Client driver registration with SLIMbus * * @drv:Client driver to be associated with client-device. * @owner: owning module/driver * * This API will register the client driver with the SLIMbus * It is called from the driver's module-init function.
*/ int __slim_driver_register(struct slim_driver *drv, struct module *owner)
{ /* ID table and probe are mandatory */ if (!(drv->driver.of_match_table || drv->id_table) || !drv->probe) return -EINVAL;
sbdev = slim_alloc_device(ctrl, &e_addr, node); if (!sbdev) continue;
}
}
/* * slim_register_controller() - Controller bring-up and registration. * * @ctrl: Controller to be registered. * * A controller is registered with the framework using this API. * If devices on a controller were registered before controller, * this will make sure that they get probed when controller is up
*/ int slim_register_controller(struct slim_controller *ctrl)
{ int id;
id = ida_alloc(&ctrl_ida, GFP_KERNEL); if (id < 0) return id;
ctrl->id = id;
if (!ctrl->min_cg)
ctrl->min_cg = SLIM_MIN_CLK_GEAR; if (!ctrl->max_cg)
ctrl->max_cg = SLIM_MAX_CLK_GEAR;
/** * slim_report_absent() - Controller calls this function when a device * reports absent, OR when the device cannot be communicated with * * @sbdev: Device that cannot be reached, or sent report absent
*/ void slim_report_absent(struct slim_device *sbdev)
{ struct slim_controller *ctrl = sbdev->ctrl;
dev = device_find_child(ctrl->dev, eaddr, slim_match_dev); if (dev) {
sbdev = to_slim_device(dev); return sbdev;
}
return NULL;
}
/** * slim_get_device() - get handle to a device. * * @ctrl: Controller on which this device will be added/queried * @e_addr: Enumeration address of the device to be queried * * Return: pointer to a device if it has already reported. Creates a new * device and returns pointer to it if the device has not yet enumerated.
*/ struct slim_device *slim_get_device(struct slim_controller *ctrl, struct slim_eaddr *e_addr)
{ struct slim_device *sbdev;
sbdev = find_slim_device(ctrl, e_addr); if (!sbdev) {
sbdev = slim_alloc_device(ctrl, e_addr, NULL); if (!sbdev) return ERR_PTR(-ENOMEM);
}
dev = device_find_child(ctrl->dev, np, device_match_of_node); if (dev) {
sbdev = to_slim_device(dev); return sbdev;
}
return NULL;
}
/** * of_slim_get_device() - get handle to a device using dt node. * * @ctrl: Controller on which this device will be added/queried * @np: node pointer to device * * Return: pointer to a device if it has already reported. Creates a new * device and returns pointer to it if the device has not yet enumerated.
*/ struct slim_device *of_slim_get_device(struct slim_controller *ctrl, struct device_node *np)
{ return of_find_slim_device(ctrl, np);
}
EXPORT_SYMBOL_GPL(of_slim_get_device);
/** * slim_device_report_present() - Report enumerated device. * * @ctrl: Controller with which device is enumerated. * @e_addr: Enumeration address of the device. * @laddr: Return logical address (if valid flag is false) * * Called by controller in response to REPORT_PRESENT. Framework will assign * a logical address to this enumeration address. * Function returns -EXFULL to indicate that all logical addresses are already * taken.
*/ int slim_device_report_present(struct slim_controller *ctrl, struct slim_eaddr *e_addr, u8 *laddr)
{ struct slim_device *sbdev; int ret;
ret = pm_runtime_get_sync(ctrl->dev);
if (ctrl->sched.clk_state != SLIM_CLK_ACTIVE) {
dev_err(ctrl->dev, "slim ctrl not active,state:%d, ret:%d\n",
ctrl->sched.clk_state, ret); goto slimbus_not_active;
}
sbdev = slim_get_device(ctrl, e_addr); if (IS_ERR(sbdev)) return -ENODEV;
if (sbdev->is_laddr_valid) {
*laddr = sbdev->laddr; return 0;
}
/** * slim_get_logical_addr() - get/allocate logical address of a SLIMbus device. * * @sbdev: client handle requesting the address. * * Return: zero if a logical address is valid or a new logical address * has been assigned. error code in case of error.
*/ int slim_get_logical_addr(struct slim_device *sbdev)
{ if (!sbdev->is_laddr_valid) return slim_device_alloc_laddr(sbdev, false);
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.