Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1cd572fc authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'musb-for-v3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

usb: musb: patches for v3.7 merge window

Here we have a bunch of miscellaneous cleanups and fixes
to the musb driver. It fixes a bunch of mistakes errors
which nobody has triggered before, so I'm not Ccing stable
tree.

We are finally improving OMAP's VBUS/ID Mailbox usage so
that we can introduce our PHY drivers properly. Also, we're
adding support for multiple instances of the MUSB IP in
the same SoC, as seen on some platforms from TI which
have 2 MUSB instances.

Other than that, we have some small fixes like not kicking
DMA for a zero byte transfer, or properly handling NAK timeout
on MUSB's host side, and the enabling of DMA Mode1 for any
transfers which are aligned to wMaxPacketSize.

All patches have been pending on mailing list for a long time
and I don't expect any big surprises with this pull request.
parents e6d49d09 d8c3ef25
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
AM33XX MUSB GLUE
 - compatible : Should be "ti,musb-am33xx"
 - ti,hwmods : must be "usb_otg_hs"
 - multipoint : Should be "1" indicating the musb controller supports
   multipoint. This is a MUSB configuration-specific setting.
 - num_eps : Specifies the number of endpoints. This is also a
   MUSB configuration-specific setting. Should be set to "16"
 - ram_bits : Specifies the ram address size. Should be set to "12"
 - port0_mode : Should be "3" to represent OTG. "1" signifies HOST and "2"
   represents PERIPHERAL.
 - port1_mode : Should be "1" to represent HOST. "3" signifies OTG and "2"
   represents PERIPHERAL.
 - power : Should be "250". This signifies the controller can supply upto
   500mA when operating in host mode.
+33 −0
Original line number Diff line number Diff line
OMAP GLUE

OMAP MUSB GLUE
 - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
 - ti,hwmods : must be "usb_otg_hs"
 - multipoint : Should be "1" indicating the musb controller supports
   multipoint. This is a MUSB configuration-specific setting.
 - num_eps : Specifies the number of endpoints. This is also a
   MUSB configuration-specific setting. Should be set to "16"
 - ram_bits : Specifies the ram address size. Should be set to "12"
 - interface_type : This is a board specific setting to describe the type of
   interface between the controller and the phy. It should be "0" or "1"
   specifying ULPI and UTMI respectively.
 - mode : Should be "3" to represent OTG. "1" signifies HOST and "2"
   represents PERIPHERAL.
 - power : Should be "50". This signifies the controller can supply upto
   100mA when operating in host mode.

SOC specific device node entry
usb_otg_hs: usb_otg_hs@4a0ab000 {
	compatible = "ti,omap4-musb";
	ti,hwmods = "usb_otg_hs";
	multipoint = <1>;
	num_eps = <16>;
	ram_bits = <12>;
};

Board specific device node entry
&usb_otg_hs {
	interface_type = <1>;
	mode = <3>;
	power = <50>;
};
+6 −0
Original line number Diff line number Diff line
@@ -5890,6 +5890,12 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {
		.pa_end		= 0x4a0ab003,
		.flags		= ADDR_TYPE_RT
	},
	{
		/* XXX: Remove this once control module driver is in place */
		.pa_start	= 0x4a00233c,
		.pa_end		= 0x4a00233f,
		.flags		= ADDR_TYPE_RT
	},
	{ }
};

+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ config USB_MUSB_HDRC
	  it's being used with, including the USB peripheral role,
	  or the USB host role, or both.

	  Texas Instruments familiies using this IP include DaVinci
	  Texas Instruments families using this IP include DaVinci
	  (35x, 644x ...), OMAP 243x, OMAP 3, and TUSB 6010.

	  Analog Devices parts using this IP include Blackfin BF54x,
+35 −31
Original line number Diff line number Diff line
@@ -108,7 +108,6 @@ static void am35x_musb_enable(struct musb *musb)
	musb_writel(reg_base, CORE_INTR_MASK_SET_REG, AM35X_INTR_USB_MASK);

	/* Force the DRVVBUS IRQ so we can start polling for ID change. */
	if (is_otg_enabled(musb))
	musb_writel(reg_base, CORE_INTR_SRC_SET_REG,
			AM35X_INTR_DRVVBUS << AM35X_INTR_USB_SHIFT);
}
@@ -174,9 +173,6 @@ static void otg_timer(unsigned long _musb)
			    MUSB_INTR_VBUSERROR << AM35X_INTR_USB_SHIFT);
		break;
	case OTG_STATE_B_IDLE:
		if (!is_peripheral_enabled(musb))
			break;

		devctl = musb_readb(mregs, MUSB_DEVCTL);
		if (devctl & MUSB_DEVCTL_BDEVICE)
			mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
@@ -193,9 +189,6 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout)
{
	static unsigned long last_timer;

	if (!is_otg_enabled(musb))
		return;

	if (timeout == 0)
		timeout = jiffies + msecs_to_jiffies(3);

@@ -272,8 +265,7 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
		u8 devctl = musb_readb(mregs, MUSB_DEVCTL);
		int err;

		err = is_host_enabled(musb) && (musb->int_usb &
						MUSB_INTR_VBUSERROR);
		err = musb->int_usb & MUSB_INTR_VBUSERROR;
		if (err) {
			/*
			 * The Mentor core doesn't debounce VBUS as needed
@@ -290,7 +282,7 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
			musb->xceiv->state = OTG_STATE_A_WAIT_VFALL;
			mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
			WARNING("VBUS error workaround (delay coming)\n");
		} else if (is_host_enabled(musb) && drvvbus) {
		} else if (drvvbus) {
			MUSB_HST_MODE(musb);
			otg->default_a = 1;
			musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
@@ -327,7 +319,7 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
	}

	/* Poll for ID change */
	if (is_otg_enabled(musb) && musb->xceiv->state == OTG_STATE_B_IDLE)
	if (musb->xceiv->state == OTG_STATE_B_IDLE)
		mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);

	spin_unlock_irqrestore(&musb->lock, flags);
@@ -370,7 +362,6 @@ static int am35x_musb_init(struct musb *musb)
	if (IS_ERR_OR_NULL(musb->xceiv))
		return -ENODEV;

	if (is_host_enabled(musb))
	setup_timer(&otg_workaround, otg_timer, (unsigned long) musb);

	/* Reset the musb */
@@ -401,7 +392,6 @@ static int am35x_musb_exit(struct musb *musb)
	struct musb_hdrc_platform_data *plat = dev->platform_data;
	struct omap_musb_board_data *data = plat->board_data;

	if (is_host_enabled(musb))
	del_timer_sync(&otg_workaround);

	/* Shutdown the on-chip PHY and its PLL. */
@@ -469,6 +459,7 @@ static int __devinit am35x_probe(struct platform_device *pdev)
	struct clk			*clk;

	int				ret = -ENOMEM;
	int				musbid;

	glue = kzalloc(sizeof(*glue), GFP_KERNEL);
	if (!glue) {
@@ -476,38 +467,47 @@ static int __devinit am35x_probe(struct platform_device *pdev)
		goto err0;
	}

	musb = platform_device_alloc("musb-hdrc", -1);
	/* get the musb id */
	musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
	if (musbid < 0) {
		dev_err(&pdev->dev, "failed to allocate musb id\n");
		ret = -ENOMEM;
		goto err1;
	}

	musb = platform_device_alloc("musb-hdrc", musbid);
	if (!musb) {
		dev_err(&pdev->dev, "failed to allocate musb device\n");
		goto err1;
		goto err2;
	}

	phy_clk = clk_get(&pdev->dev, "fck");
	if (IS_ERR(phy_clk)) {
		dev_err(&pdev->dev, "failed to get PHY clock\n");
		ret = PTR_ERR(phy_clk);
		goto err2;
		goto err3;
	}

	clk = clk_get(&pdev->dev, "ick");
	if (IS_ERR(clk)) {
		dev_err(&pdev->dev, "failed to get clock\n");
		ret = PTR_ERR(clk);
		goto err3;
		goto err4;
	}

	ret = clk_enable(phy_clk);
	if (ret) {
		dev_err(&pdev->dev, "failed to enable PHY clock\n");
		goto err4;
		goto err5;
	}

	ret = clk_enable(clk);
	if (ret) {
		dev_err(&pdev->dev, "failed to enable clock\n");
		goto err5;
		goto err6;
	}

	musb->id			= musbid;
	musb->dev.parent		= &pdev->dev;
	musb->dev.dma_mask		= &am35x_dmamask;
	musb->dev.coherent_dma_mask	= am35x_dmamask;
@@ -525,38 +525,41 @@ static int __devinit am35x_probe(struct platform_device *pdev)
			pdev->num_resources);
	if (ret) {
		dev_err(&pdev->dev, "failed to add resources\n");
		goto err6;
		goto err7;
	}

	ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
	if (ret) {
		dev_err(&pdev->dev, "failed to add platform_data\n");
		goto err6;
		goto err7;
	}

	ret = platform_device_add(musb);
	if (ret) {
		dev_err(&pdev->dev, "failed to register musb device\n");
		goto err6;
		goto err7;
	}

	return 0;

err6:
err7:
	clk_disable(clk);

err5:
err6:
	clk_disable(phy_clk);

err4:
err5:
	clk_put(clk);

err3:
err4:
	clk_put(phy_clk);

err2:
err3:
	platform_device_put(musb);

err2:
	musb_put_id(&pdev->dev, musbid);

err1:
	kfree(glue);

@@ -568,6 +571,7 @@ static int __devexit am35x_remove(struct platform_device *pdev)
{
	struct am35x_glue	*glue = platform_get_drvdata(pdev);

	musb_put_id(&pdev->dev, glue->musb->id);
	platform_device_del(glue->musb);
	platform_device_put(glue->musb);
	clk_disable(glue->clk);
Loading