#include <linux/usb/otg.h>
#include <linux/dma-mapping.h>
#include <linux/clk.h>
+ #include <linux/err.h>
#include <linux/prefetch.h>
+#include <linux/io.h>
#include <asm/byteorder.h>
-#include <asm/io.h>
#include <asm/irq.h>
#include <asm/unaligned.h>
#include <asm/mach-types.h>
if (devstat & UDC_ATT) {
udc->gadget.speed = USB_SPEED_FULL;
VDBG("connect\n");
- if (!udc->transceiver)
+ if (IS_ERR_OR_NULL(udc->transceiver))
pullup_enable(udc);
- // if (driver->connect) call it
+ /* if (driver->connect) call it */
} else if (udc->gadget.speed != USB_SPEED_UNKNOWN) {
udc->gadget.speed = USB_SPEED_UNKNOWN;
- if (!udc->transceiver)
+ if (IS_ERR_OR_NULL(udc->transceiver))
pullup_disable(udc);
DBG("disconnect, gadget %s\n",
udc->driver->driver.name);
udc = NULL;
cleanup0:
- if (xceiv)
- usb_put_transceiver(xceiv);
+ if (!IS_ERR_OR_NULL(xceiv))
+ usb_put_phy(xceiv);
- if (cpu_is_omap16xx() || cpu_is_omap24xx() || cpu_is_omap7xx()) {
+ if (cpu_is_omap16xx() || cpu_is_omap7xx()) {
clk_disable(hhc_clk);
clk_disable(dc_clk);
clk_put(hhc_clk);
if (pdata->operating_mode == FSL_USB2_DR_OTG) {
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
- hcd->phy = usb_get_transceiver();
- ehci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
- dev_dbg(&pdev->dev, "hcd=0x%p ehci=0x%p, transceiver=0x%p\n",
- hcd, ehci, ehci->transceiver);
++ hcd->phy = usb_get_phy(USB_PHY_TYPE_USB2);
+ dev_dbg(&pdev->dev, "hcd=0x%p ehci=0x%p, phy=0x%p\n",
+ hcd, ehci, hcd->phy);
- if (hcd->phy) {
- if (!IS_ERR_OR_NULL(ehci->transceiver)) {
- retval = otg_set_host(ehci->transceiver->otg,
++ if (!IS_ERR_OR_NULL(hcd->phy)) {
+ retval = otg_set_host(hcd->phy->otg,
&ehci_to_hcd(ehci)->self);
if (retval) {
- usb_put_transceiver(hcd->phy);
- usb_put_phy(ehci->transceiver);
++ usb_put_phy(hcd->phy);
goto err4;
}
} else {
struct platform_device *pdev)
{
struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
- struct ehci_hcd *ehci = hcd_to_ehci(hcd);
- if (hcd->phy) {
- if (!IS_ERR_OR_NULL(ehci->transceiver)) {
- otg_set_host(ehci->transceiver->otg, NULL);
- usb_put_phy(ehci->transceiver);
++ if (!IS_ERR_OR_NULL(hcd->phy)) {
+ otg_set_host(hcd->phy->otg, NULL);
- usb_put_transceiver(hcd->phy);
++ usb_put_phy(hcd->phy);
}
usb_remove_hcd(hcd);
#ifdef CONFIG_USB_OTG
if (need_transceiver) {
- hcd->phy = usb_get_transceiver();
- if (hcd->phy) {
- ohci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
- if (!IS_ERR_OR_NULL(ohci->transceiver)) {
- int status = otg_set_host(ohci->transceiver->otg,
++ hcd->phy = usb_get_phy(USB_PHY_TYPE_USB2);
++ if (!IS_ERR_OR_NULL(hcd->phy)) {
+ int status = otg_set_host(hcd->phy->otg,
&ohci_to_hcd(ohci)->self);
- dev_dbg(hcd->self.controller, "init %s transceiver, status %d\n",
- ohci->transceiver->label, status);
+ dev_dbg(hcd->self.controller, "init %s phy, status %d\n",
+ hcd->phy->label, status);
if (status) {
- usb_put_transceiver(hcd->phy);
- usb_put_phy(ohci->transceiver);
++ usb_put_phy(hcd->phy);
return status;
}
} else {
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
usb_remove_hcd(hcd);
- if (hcd->phy) {
- if (!IS_ERR_OR_NULL(ohci->transceiver)) {
- (void) otg_set_host(ohci->transceiver->otg, 0);
- usb_put_phy(ohci->transceiver);
++ if (!IS_ERR_OR_NULL(hcd->phy)) {
+ (void) otg_set_host(hcd->phy->otg, 0);
- usb_put_transceiver(hcd->phy);
++ usb_put_phy(hcd->phy);
}
if (machine_is_omap_osk())
gpio_free(9);
regulator_enable(twl->usb3v3);
twl->asleep = 1;
- twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, 0x1);
- twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET,
- 0x10);
+ twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_CLR);
+ twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET);
- status = USB_EVENT_ID;
+ status = OMAP_MUSB_ID_GROUND;
+ otg->default_a = true;
+ twl->phy.state = OTG_STATE_A_IDLE;
twl->linkstat = status;
- twl->phy.last_event = status;
- atomic_notifier_call_chain(&twl->phy.notifier, status,
- otg->gadget);
+ omap_musb_mailbox(status);
} else {
- twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR,
- 0x10);
- twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET,
- 0x1);
+ twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_CLR);
+ twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET);
}
- twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_LATCH_CLR, status);
+ twl6030_writeb(twl, TWL_MODULE_USB, status, USB_ID_INT_LATCH_CLR);
return IRQ_HANDLED;
}