mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
phy: phy-rockchip-inno-usb2: fix otg-id irq error
For the 'otg-mux' irq in SoC should include 'otg-bvalid', 'linestate', and 'otg-id'. This change fix the previous error condition. Change-Id: I8fe46c8c9efd6ce04eead89c276227d4cc70902e Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
This commit is contained in:
@@ -1468,17 +1468,6 @@ static irqreturn_t rockchip_usb2phy_bvalid_irq(int irq, void *data)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static irqreturn_t rockchip_usb2phy_otg_mux_irq(int irq, void *data)
|
||||
{
|
||||
struct rockchip_usb2phy_port *rport = data;
|
||||
struct rockchip_usb2phy *rphy = dev_get_drvdata(rport->phy->dev.parent);
|
||||
|
||||
if (property_enabled(rphy->grf, &rport->port_cfg->bvalid_det_st))
|
||||
return rockchip_usb2phy_bvalid_irq(irq, data);
|
||||
else
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
static irqreturn_t rockchip_usb2phy_id_irq(int irq, void *data)
|
||||
{
|
||||
struct rockchip_usb2phy_port *rport = data;
|
||||
@@ -1515,6 +1504,17 @@ static irqreturn_t rockchip_usb2phy_id_irq(int irq, void *data)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static irqreturn_t rockchip_usb2phy_otg_mux_irq(int irq, void *data)
|
||||
{
|
||||
irqreturn_t ret = IRQ_NONE;
|
||||
|
||||
ret = rockchip_usb2phy_id_irq(irq, data);
|
||||
ret |= rockchip_usb2phy_bvalid_irq(irq, data);
|
||||
ret |= rockchip_usb2phy_linestate_irq(irq, data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rockchip_usb2phy_host_port_init(struct rockchip_usb2phy *rphy,
|
||||
struct rockchip_usb2phy_port *rport,
|
||||
struct device_node *child_np)
|
||||
@@ -1533,9 +1533,9 @@ static int rockchip_usb2phy_host_port_init(struct rockchip_usb2phy *rphy,
|
||||
INIT_DELAYED_WORK(&rport->sm_work, rockchip_usb2phy_sm_work);
|
||||
|
||||
rport->ls_irq = of_irq_get_byname(child_np, "linestate");
|
||||
if (rport->ls_irq < 0) {
|
||||
if (rport->ls_irq <= 0) {
|
||||
dev_err(rphy->dev, "no linestate irq provided\n");
|
||||
return rport->ls_irq;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = devm_request_threaded_irq(rphy->dev, rport->ls_irq, NULL,
|
||||
@@ -1656,9 +1656,9 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
|
||||
}
|
||||
} else {
|
||||
rport->bvalid_irq = of_irq_get_byname(child_np, "otg-bvalid");
|
||||
if (rport->bvalid_irq < 0) {
|
||||
if (rport->bvalid_irq <= 0) {
|
||||
dev_err(rphy->dev, "no vbus valid irq provided\n");
|
||||
return rport->bvalid_irq;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = devm_request_threaded_irq(rphy->dev, rport->bvalid_irq,
|
||||
@@ -1674,9 +1674,9 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
|
||||
}
|
||||
|
||||
rport->ls_irq = of_irq_get_byname(child_np, "linestate");
|
||||
if (rport->ls_irq < 0) {
|
||||
if (rport->ls_irq <= 0) {
|
||||
dev_err(rphy->dev, "no linestate irq provided\n");
|
||||
return rport->ls_irq;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = devm_request_threaded_irq(rphy->dev, rport->ls_irq, NULL,
|
||||
@@ -1687,24 +1687,28 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy,
|
||||
dev_err(rphy->dev, "failed to request linestate irq handle\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (rphy->edev_self) {
|
||||
rport->id_irq = of_irq_get_byname(child_np, "otg-id");
|
||||
if (rport->id_irq <= 0) {
|
||||
dev_err(rphy->dev, "no otg id irq provided\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = devm_request_threaded_irq(rphy->dev,
|
||||
rport->id_irq, NULL,
|
||||
rockchip_usb2phy_id_irq,
|
||||
IRQF_ONESHOT,
|
||||
"rockchip_usb2phy_id",
|
||||
rport);
|
||||
if (ret) {
|
||||
dev_err(rphy->dev, "failed to request otg-id irq handle\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rphy->edev_self) {
|
||||
rport->id_irq = of_irq_get_byname(child_np, "otg-id");
|
||||
if (rport->id_irq < 0) {
|
||||
dev_err(rphy->dev, "no otg id irq provided\n");
|
||||
return rport->id_irq;
|
||||
}
|
||||
|
||||
ret = devm_request_threaded_irq(rphy->dev, rport->id_irq, NULL,
|
||||
rockchip_usb2phy_id_irq,
|
||||
IRQF_ONESHOT,
|
||||
"rockchip_usb2phy_id", rport);
|
||||
if (ret) {
|
||||
dev_err(rphy->dev, "failed to request otg-id irq handle\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
iddig = property_enabled(rphy->grf, &rport->port_cfg->utmi_iddig);
|
||||
if (!iddig) {
|
||||
extcon_set_state(rphy->edev, EXTCON_USB, false);
|
||||
|
||||
Reference in New Issue
Block a user