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

Commit 7751b6fb authored by Matwey V. Kornilov's avatar Matwey V. Kornilov Committed by Felipe Balbi
Browse files

usb: musb: tusb6010: Use musb->tusb_revision instead of tusb_get_revision call.



The value of the revision is stored in musb->tusb_revision,
so don't re-read it every time.
Exporting tusb_get_revision is not needed anymore,
so the dependency loop between tusb6010 and tusb6010_omap is resolved.

Signed-off-by: default avatarMatwey V. Kornilov <matwey@sai.msu.ru>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 8c240dc1
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on);
 * Checks the revision. We need to use the DMA register as 3.0 does not
 * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV.
 */
u8 tusb_get_revision(struct musb *musb)
static u8 tusb_get_revision(struct musb *musb)
{
	void __iomem	*tbase = musb->ctrl_base;
	u32		die_id;
@@ -59,14 +59,13 @@ u8 tusb_get_revision(struct musb *musb)

	return rev;
}
EXPORT_SYMBOL_GPL(tusb_get_revision);

static int tusb_print_revision(struct musb *musb)
static void tusb_print_revision(struct musb *musb)
{
	void __iomem	*tbase = musb->ctrl_base;
	u8		rev;

	rev = tusb_get_revision(musb);
	rev = musb->tusb_revision;

	pr_info("tusb: %s%i.%i %s%i.%i %s%i.%i %s%i.%i %s%i %s%i.%i\n",
		"prcm",
@@ -85,8 +84,6 @@ static int tusb_print_revision(struct musb *musb)
		TUSB_DIDR1_HI_CHIP_REV(musb_readl(tbase, TUSB_DIDR1_HI)),
		"rev",
		TUSB_REV_MAJOR(rev), TUSB_REV_MINOR(rev));

	return tusb_get_revision(musb);
}

#define WBUS_QUIRK_MASK	(TUSB_PHY_OTG_CTRL_TESTM2 | TUSB_PHY_OTG_CTRL_TESTM1 \
@@ -350,7 +347,7 @@ static void tusb_allow_idle(struct musb *musb, u32 wakeup_enables)
	u32		reg;

	if ((wakeup_enables & TUSB_PRCM_WBUS)
			&& (tusb_get_revision(musb) == TUSB_REV_30))
			&& (musb->tusb_revision == TUSB_REV_30))
		tusb_wbus_quirk(musb, 1);

	tusb_set_clock_source(musb, 0);
@@ -798,7 +795,7 @@ static irqreturn_t tusb_musb_interrupt(int irq, void *__hci)
		u32	reg;
		u32	i;

		if (tusb_get_revision(musb) == TUSB_REV_30)
		if (musb->tusb_revision == TUSB_REV_30)
			tusb_wbus_quirk(musb, 0);

		/* there are issues re-locking the PLL on wakeup ... */
@@ -1013,10 +1010,10 @@ static int tusb_musb_start(struct musb *musb)
	}

	musb->tusb_revision = tusb_get_revision(musb);
	ret = tusb_print_revision(musb);
	if (ret < 2) {
	tusb_print_revision(musb);
	if (musb->tusb_revision < 2) {
		printk(KERN_ERR "tusb: Unsupported TUSB6010 revision %i\n",
				ret);
				musb->tusb_revision);
		goto err;
	}

+0 −2
Original line number Diff line number Diff line
@@ -12,8 +12,6 @@
#ifndef __TUSB6010_H__
#define __TUSB6010_H__

extern u8 tusb_get_revision(struct musb *musb);

#ifdef CONFIG_USB_TUSB_OMAP_DMA
#define tusb_dma_omap()			1
#else
+1 −1
Original line number Diff line number Diff line
@@ -677,7 +677,7 @@ struct dma_controller *dma_controller_create(struct musb *musb, void __iomem *ba
	tusb_dma->controller.channel_program = tusb_omap_dma_program;
	tusb_dma->controller.channel_abort = tusb_omap_dma_abort;

	if (tusb_get_revision(musb) >= TUSB_REV_30)
	if (musb->tusb_revision >= TUSB_REV_30)
		tusb_dma->multichannel = 1;

	for (i = 0; i < MAX_DMAREQ; i++) {