mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
Merge branch 'master' of git://source.denx.de/u-boot-usb into next
- Change the address parsing for MUSB and another patch to add compatibles for ti,musb-am33xx and bind functions that check the dr_mode.
This commit is contained in:
@@ -83,17 +83,17 @@ static int ti_musb_of_to_plat(struct udevice *dev)
|
||||
struct ti_musb_plat *plat = dev_get_plat(dev);
|
||||
const void *fdt = gd->fdt_blob;
|
||||
int node = dev_of_offset(dev);
|
||||
int phys;
|
||||
int ctrl_mod;
|
||||
ofnode phys_node;
|
||||
ofnode ctrl_mod_node;
|
||||
int usb_index;
|
||||
int ret;
|
||||
struct musb_hdrc_config *musb_config;
|
||||
|
||||
plat->base = devfdt_get_addr_index_ptr(dev, 1);
|
||||
|
||||
phys = fdtdec_lookup_phandle(fdt, node, "phys");
|
||||
ctrl_mod = fdtdec_lookup_phandle(fdt, phys, "ti,ctrl_mod");
|
||||
plat->ctrl_mod_base = (void *)fdtdec_get_addr(fdt, ctrl_mod, "reg");
|
||||
phys_node = ofnode_get_by_phandle(dev_read_u32_default(dev, "phys", 0));
|
||||
ctrl_mod_node = ofnode_get_by_phandle(ofnode_read_u32_default(phys_node, "ti,ctrl_mod", 0));
|
||||
plat->ctrl_mod_base = (void *)ofnode_get_addr(ctrl_mod_node);
|
||||
usb_index = ti_musb_get_usb_index(node);
|
||||
switch (usb_index) {
|
||||
case 1:
|
||||
@@ -183,6 +183,21 @@ static int ti_musb_host_remove(struct udevice *dev)
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||
static const struct udevice_id ti_musb_host_periph_ids[] = {
|
||||
{ .compatible = "ti,musb-am33xx" },
|
||||
{ }
|
||||
};
|
||||
|
||||
static int ti_musb_host_bind(struct udevice *dev)
|
||||
{
|
||||
enum usb_dr_mode dr_mode = usb_get_dr_mode(dev_ofnode(dev));
|
||||
|
||||
if (dr_mode != USB_DR_MODE_HOST && dr_mode != USB_DR_MODE_OTG)
|
||||
return -ENODEV;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ti_musb_host_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
struct ti_musb_plat *plat = dev_get_plat(dev);
|
||||
@@ -206,6 +221,8 @@ U_BOOT_DRIVER(ti_musb_host) = {
|
||||
.name = "ti-musb-host",
|
||||
.id = UCLASS_USB,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||
.of_match = ti_musb_host_periph_ids,
|
||||
.bind = ti_musb_host_bind,
|
||||
.of_to_plat = ti_musb_host_of_to_plat,
|
||||
#endif
|
||||
.probe = ti_musb_host_probe,
|
||||
@@ -221,6 +238,16 @@ struct ti_musb_peripheral {
|
||||
};
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||
static int ti_musb_peripheral_bind(struct udevice *dev)
|
||||
{
|
||||
enum usb_dr_mode dr_mode = usb_get_dr_mode(dev_ofnode(dev));
|
||||
|
||||
if (dr_mode != USB_DR_MODE_PERIPHERAL)
|
||||
return -ENODEV;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ti_musb_peripheral_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
struct ti_musb_plat *plat = dev_get_plat(dev);
|
||||
@@ -283,6 +310,8 @@ U_BOOT_DRIVER(ti_musb_peripheral) = {
|
||||
.name = "ti-musb-peripheral",
|
||||
.id = UCLASS_USB_GADGET_GENERIC,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||
.of_match = ti_musb_host_periph_ids,
|
||||
.bind = ti_musb_peripheral_bind,
|
||||
.of_to_plat = ti_musb_peripheral_of_to_plat,
|
||||
#endif
|
||||
.ops = &ti_musb_gadget_ops,
|
||||
|
||||
Reference in New Issue
Block a user