/* * Some ULPI devices don't have a vendor id * or provide an id_table so rely on OF match.
*/ if (ulpi->id.vendor == 0 || !drv->id_table) return of_driver_match_device(dev, driver);
for (id = drv->id_table; id->vendor; id++) if (id->vendor == ulpi->id.vendor &&
id->product == ulpi->id.product) return 1;
/** * __ulpi_register_driver - register a driver with the ULPI bus * @drv: driver being registered * @module: ends up being THIS_MODULE * * Registers a driver with the ULPI bus.
*/ int __ulpi_register_driver(struct ulpi_driver *drv, struct module *module)
{ if (!drv->probe) return -EINVAL;
/** * ulpi_unregister_driver - unregister a driver with the ULPI bus * @drv: driver to unregister * * Unregisters a driver with the ULPI bus.
*/ void ulpi_unregister_driver(struct ulpi_driver *drv)
{
driver_unregister(&drv->driver);
}
EXPORT_SYMBOL_GPL(ulpi_unregister_driver);
/* Find a ulpi bus underneath the parent or the grandparent */
parent = ulpi->dev.parent; if (parent->of_node)
np = of_get_child_by_name(parent->of_node, "ulpi"); elseif (parent->parent && parent->parent->of_node)
np = of_get_child_by_name(parent->parent->of_node, "ulpi"); if (!np) return 0;
child = of_get_next_available_child(np, NULL);
of_node_put(np); if (!child) return -EINVAL;
ulpi->dev.of_node = child;
return 0;
}
staticint ulpi_read_id(struct ulpi *ulpi)
{ int ret;
/* Test the interface */
ret = ulpi_write(ulpi, ULPI_SCRATCH, 0xaa); if (ret < 0) goto err;
ret = ulpi_read(ulpi, ULPI_SCRATCH); if (ret < 0) return ret;
#define ulpi_print(name, reg) do { \ int ret = ulpi_read(ulpi, reg); \ if (ret < 0) \ return ret; \
seq_printf(seq, name " %.02x\n", ret); \
} while (0)
ulpi_print("Vendor ID Low ", ULPI_VENDOR_ID_LOW);
ulpi_print("Vendor ID High ", ULPI_VENDOR_ID_HIGH);
ulpi_print("Product ID Low ", ULPI_PRODUCT_ID_LOW);
ulpi_print("Product ID High ", ULPI_PRODUCT_ID_HIGH);
ulpi_print("Function Control ", ULPI_FUNC_CTRL);
ulpi_print("Interface Control ", ULPI_IFC_CTRL);
ulpi_print("OTG Control ", ULPI_OTG_CTRL);
ulpi_print("USB Interrupt Enable Rising ", ULPI_USB_INT_EN_RISE);
ulpi_print("USB Interrupt Enable Falling", ULPI_USB_INT_EN_FALL);
ulpi_print("USB Interrupt Status ", ULPI_USB_INT_STS);
ulpi_print("USB Interrupt Latch ", ULPI_USB_INT_LATCH);
ulpi_print("Debug ", ULPI_DEBUG);
ulpi_print("Scratch Register ", ULPI_SCRATCH);
ulpi_print("Carkit Control ", ULPI_CARKIT_CTRL);
ulpi_print("Carkit Interrupt Delay ", ULPI_CARKIT_INT_DELAY);
ulpi_print("Carkit Interrupt Enable ", ULPI_CARKIT_INT_EN);
ulpi_print("Carkit Interrupt Status ", ULPI_CARKIT_INT_STS);
ulpi_print("Carkit Interrupt Latch ", ULPI_CARKIT_INT_LATCH);
ulpi_print("Carkit Pulse Control ", ULPI_CARKIT_PLS_CTRL);
ulpi_print("Transmit Positive Width ", ULPI_TX_POS_WIDTH);
ulpi_print("Transmit Negative Width ", ULPI_TX_NEG_WIDTH);
ulpi_print("Receive Polarity Recovery ", ULPI_POLARITY_RECOVERY);
/** * ulpi_register_interface - instantiate new ULPI device * @dev: USB controller's device interface * @ops: ULPI register access * * Allocates and registers a ULPI device and an interface for it. Called from * the USB controller that provides the ULPI interface.
*/ struct ulpi *ulpi_register_interface(struct device *dev, conststruct ulpi_ops *ops)
{ struct ulpi *ulpi; int ret;
ulpi = kzalloc(sizeof(*ulpi), GFP_KERNEL); if (!ulpi) return ERR_PTR(-ENOMEM);
ulpi->ops = ops;
ret = ulpi_register(dev, ulpi); if (ret) {
kfree(ulpi); return ERR_PTR(ret);
}
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.