[DEBUG] xusb-tegra
Signed-off-by: Thomas Makin <halorocker89@gmail.com>
This commit is contained in:
@@ -525,6 +525,8 @@ static void tegra_xusb_port_release(struct device *dev)
|
|||||||
{
|
{
|
||||||
struct tegra_xusb_port *port = to_tegra_xusb_port(dev);
|
struct tegra_xusb_port *port = to_tegra_xusb_port(dev);
|
||||||
|
|
||||||
|
printk("release\n");
|
||||||
|
|
||||||
if (port->ops->release)
|
if (port->ops->release)
|
||||||
port->ops->release(port);
|
port->ops->release(port);
|
||||||
}
|
}
|
||||||
@@ -541,19 +543,23 @@ static int tegra_xusb_port_init(struct tegra_xusb_port *port,
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
printk("init list\n");
|
||||||
INIT_LIST_HEAD(&port->list);
|
INIT_LIST_HEAD(&port->list);
|
||||||
port->padctl = padctl;
|
port->padctl = padctl;
|
||||||
port->index = index;
|
port->index = index;
|
||||||
|
|
||||||
|
printk("init device\n");
|
||||||
device_initialize(&port->dev);
|
device_initialize(&port->dev);
|
||||||
port->dev.type = &tegra_xusb_port_type;
|
port->dev.type = &tegra_xusb_port_type;
|
||||||
port->dev.of_node = of_node_get(np);
|
port->dev.of_node = of_node_get(np);
|
||||||
port->dev.parent = padctl->dev;
|
port->dev.parent = padctl->dev;
|
||||||
|
|
||||||
|
printk("set name\n");
|
||||||
err = dev_set_name(&port->dev, "%s-%u", name, index);
|
err = dev_set_name(&port->dev, "%s-%u", name, index);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto put_device;
|
goto put_device;
|
||||||
|
|
||||||
|
printk("device add\n");
|
||||||
err = device_add(&port->dev);
|
err = device_add(&port->dev);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto put_device;
|
goto put_device;
|
||||||
@@ -561,6 +567,7 @@ static int tegra_xusb_port_init(struct tegra_xusb_port *port,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
put_device:
|
put_device:
|
||||||
|
printk("put device\n");
|
||||||
put_device(&port->dev);
|
put_device(&port->dev);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -969,6 +976,7 @@ static int tegra_xusb_usb3_port_parse_dt(struct tegra_xusb_usb3_port *usb3)
|
|||||||
u32 value;
|
u32 value;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
printk("check usb2-companion\n");
|
||||||
err = of_property_read_u32(np, "nvidia,usb2-companion", &value);
|
err = of_property_read_u32(np, "nvidia,usb2-companion", &value);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
dev_err(&port->dev, "failed to read port: %d\n", err);
|
dev_err(&port->dev, "failed to read port: %d\n", err);
|
||||||
@@ -1004,6 +1012,7 @@ static int tegra_xusb_add_usb3_port(struct tegra_xusb_padctl *padctl,
|
|||||||
* port is unusable. But it is valid to configure only a single port,
|
* port is unusable. But it is valid to configure only a single port,
|
||||||
* hence return 0 instead of an error to allow ports to be optional.
|
* hence return 0 instead of an error to allow ports to be optional.
|
||||||
*/
|
*/
|
||||||
|
printk("find port node usb3\n");
|
||||||
np = tegra_xusb_find_port_node(padctl, "usb3", index);
|
np = tegra_xusb_find_port_node(padctl, "usb3", index);
|
||||||
if (!np || !of_device_is_available(np))
|
if (!np || !of_device_is_available(np))
|
||||||
goto out;
|
goto out;
|
||||||
@@ -1014,6 +1023,7 @@ static int tegra_xusb_add_usb3_port(struct tegra_xusb_padctl *padctl,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printk("xusb port init\n");
|
||||||
err = tegra_xusb_port_init(&usb3->base, padctl, np, "usb3", index);
|
err = tegra_xusb_port_init(&usb3->base, padctl, np, "usb3", index);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto out;
|
goto out;
|
||||||
@@ -1026,6 +1036,7 @@ static int tegra_xusb_add_usb3_port(struct tegra_xusb_padctl *padctl,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printk("xusb usb3 port parse dt\n");
|
||||||
err = tegra_xusb_usb3_port_parse_dt(usb3);
|
err = tegra_xusb_usb3_port_parse_dt(usb3);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
tegra_xusb_port_unregister(&usb3->base);
|
tegra_xusb_port_unregister(&usb3->base);
|
||||||
@@ -1118,24 +1129,28 @@ static int tegra_xusb_setup_ports(struct tegra_xusb_padctl *padctl)
|
|||||||
mutex_lock(&padctl->lock);
|
mutex_lock(&padctl->lock);
|
||||||
|
|
||||||
for (i = 0; i < padctl->soc->ports.usb2.count; i++) {
|
for (i = 0; i < padctl->soc->ports.usb2.count; i++) {
|
||||||
|
printk("add usb2 port %d\n", i);
|
||||||
err = tegra_xusb_add_usb2_port(padctl, i);
|
err = tegra_xusb_add_usb2_port(padctl, i);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto remove_ports;
|
goto remove_ports;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < padctl->soc->ports.ulpi.count; i++) {
|
for (i = 0; i < padctl->soc->ports.ulpi.count; i++) {
|
||||||
|
printk("add ulpi port %d\n", i);
|
||||||
err = tegra_xusb_add_ulpi_port(padctl, i);
|
err = tegra_xusb_add_ulpi_port(padctl, i);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto remove_ports;
|
goto remove_ports;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < padctl->soc->ports.hsic.count; i++) {
|
for (i = 0; i < padctl->soc->ports.hsic.count; i++) {
|
||||||
|
printk("add hsic port %d\n", i);
|
||||||
err = tegra_xusb_add_hsic_port(padctl, i);
|
err = tegra_xusb_add_hsic_port(padctl, i);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto remove_ports;
|
goto remove_ports;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < padctl->soc->ports.usb3.count; i++) {
|
for (i = 0; i < padctl->soc->ports.usb3.count; i++) {
|
||||||
|
printk("add usb3 port %d\n", i);
|
||||||
err = tegra_xusb_add_usb3_port(padctl, i);
|
err = tegra_xusb_add_usb3_port(padctl, i);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto remove_ports;
|
goto remove_ports;
|
||||||
@@ -1143,10 +1158,12 @@ static int tegra_xusb_setup_ports(struct tegra_xusb_padctl *padctl)
|
|||||||
|
|
||||||
if (padctl->soc->need_fake_usb3_port) {
|
if (padctl->soc->need_fake_usb3_port) {
|
||||||
for (i = 0; i < padctl->soc->ports.usb2.count; i++) {
|
for (i = 0; i < padctl->soc->ports.usb2.count; i++) {
|
||||||
|
printk("checking usb2 port %d\n", i);
|
||||||
usb2 = tegra_xusb_find_usb2_port(padctl, i);
|
usb2 = tegra_xusb_find_usb2_port(padctl, i);
|
||||||
if (!usb2)
|
if (!usb2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
printk("update usb3 fake port %d\n", i);
|
||||||
err = tegra_xusb_update_usb3_fake_port(usb2);
|
err = tegra_xusb_update_usb3_fake_port(usb2);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto remove_ports;
|
goto remove_ports;
|
||||||
@@ -1154,12 +1171,14 @@ static int tegra_xusb_setup_ports(struct tegra_xusb_padctl *padctl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
list_for_each_entry(port, &padctl->ports, list) {
|
list_for_each_entry(port, &padctl->ports, list) {
|
||||||
|
printk("enable port\n");
|
||||||
err = port->ops->enable(port);
|
err = port->ops->enable(port);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
dev_err(padctl->dev, "failed to enable port %s: %d\n",
|
dev_err(padctl->dev, "failed to enable port %s: %d\n",
|
||||||
dev_name(&port->dev), err);
|
dev_name(&port->dev), err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printk("unlock\n");
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
remove_ports:
|
remove_ports:
|
||||||
|
|||||||
Reference in New Issue
Block a user