Skip to content

Commit 6eb6fbb

Browse files
Keshava MunegowdaSamuel Ortiz
authored andcommitted
mfd: Fix omap usbhs crash when rmmoding ehci or ohci
The disabling of clocks and freeing GPIO are changed to fix the occurrence of the crash of rmmod of ehci and ohci drivers. The GPIOs should be freed after the spin locks are unlocked. Signed-off-by: Keshava Munegowda <[email protected]> Acked-by: Felipe Balbi <[email protected]> Cc: [email protected] Signed-off-by: Samuel Ortiz <[email protected]>
1 parent 13ca4f6 commit 6eb6fbb

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

drivers/mfd/omap-usb-host.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -994,22 +994,33 @@ static void usbhs_disable(struct device *dev)
994994
dev_dbg(dev, "operation timed out\n");
995995
}
996996

997-
if (pdata->ehci_data->phy_reset) {
998-
if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
999-
gpio_free(pdata->ehci_data->reset_gpio_port[0]);
1000-
1001-
if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
1002-
gpio_free(pdata->ehci_data->reset_gpio_port[1]);
997+
if (is_omap_usbhs_rev2(omap)) {
998+
if (is_ehci_tll_mode(pdata->port_mode[0]))
999+
clk_enable(omap->usbtll_p1_fck);
1000+
if (is_ehci_tll_mode(pdata->port_mode[1]))
1001+
clk_enable(omap->usbtll_p2_fck);
1002+
clk_disable(omap->utmi_p2_fck);
1003+
clk_disable(omap->utmi_p1_fck);
10031004
}
10041005

1005-
clk_disable(omap->utmi_p2_fck);
1006-
clk_disable(omap->utmi_p1_fck);
10071006
clk_disable(omap->usbtll_ick);
10081007
clk_disable(omap->usbtll_fck);
10091008
clk_disable(omap->usbhost_fs_fck);
10101009
clk_disable(omap->usbhost_hs_fck);
10111010
clk_disable(omap->usbhost_ick);
10121011

1012+
/* The gpio_free migh sleep; so unlock the spinlock */
1013+
spin_unlock_irqrestore(&omap->lock, flags);
1014+
1015+
if (pdata->ehci_data->phy_reset) {
1016+
if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
1017+
gpio_free(pdata->ehci_data->reset_gpio_port[0]);
1018+
1019+
if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
1020+
gpio_free(pdata->ehci_data->reset_gpio_port[1]);
1021+
}
1022+
return;
1023+
10131024
end_disble:
10141025
spin_unlock_irqrestore(&omap->lock, flags);
10151026
}

0 commit comments

Comments
 (0)