Exemplo n.º 1
0
int musb_platform_init(void)
{
	int ret = -1;

	if (platform_needs_initialization) {
		u32 stdby;

		/*
		 * OMAP3EVM uses ISP1504 phy and so
		 * twl4030 related init is not required.
		 */
#ifdef CONFIG_TWL4030_USB
		if (twl4030_usb_ulpi_init()) {
			serial_printf("ERROR: %s Could not initialize PHY\n",
				__PRETTY_FUNCTION__);
			goto end;
		}
#endif
		otg = (struct omap3_otg_regs *)OMAP3_OTG_BASE;

		/* Set OTG to always be on */
		writel(OMAP3_OTG_SYSCONFIG_NO_STANDBY_MODE |
		       OMAP3_OTG_SYSCONFIG_NO_IDLE_MODE, &otg->sysconfig);

		/* Set the interface */
		writel(OMAP3_OTG_INTERFSEL_OMAP, &otg->interfsel);

		/* Clear force standby */
		stdby = readl(&otg->forcestdby);
		stdby &= ~OMAP3_OTG_FORCESTDBY_STANDBY;
		writel(stdby, &otg->forcestdby);

#ifdef CONFIG_OMAP3_EVM
		if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
			musb_cfg.extvbus = 1;
#endif
		platform_needs_initialization = 0;
	}

	ret = platform_needs_initialization;

#ifdef CONFIG_TWL4030_USB
end:
#endif
	return ret;

}
Exemplo n.º 2
0
int musb_platform_init(void)
{
	int ret = -1;

	if (platform_needs_initialization) {
		u32 stdby;

		/*
		 * OMAP3EVM uses ISP1504 phy and so
		 * twl4030 related init is not required.
		 */
#ifdef CONFIG_TWL4030_USB
		if (twl4030_usb_ulpi_init()) {
			serial_printf("ERROR: %s Could not initialize PHY\n",
				__PRETTY_FUNCTION__);
			goto end;
		}
#endif

#ifdef CONFIG_TWL6030_POWER
		twl6030_usb_device_settings();
#endif

		otg = (struct omap3_otg_regs *)OMAP3_OTG_BASE;

		/* Reset Mentor USB block */
		/* soft reset */
		writel(OMAP3_OTG_SYSCONFIG_SOFTRESET | readl(&otg->sysconfig),
		       &otg->sysconfig);

		/* Wait for reset to finish */
		while ((readl(&otg->sysstatus) &
			OMAP3_OTG_SYSSTATUS_RESETDONE) == 0);

		/* Set OTG to always be on */
		writel(OMAP3_OTG_SYSCONFIG_NO_STANDBY_MODE |
		       OMAP3_OTG_SYSCONFIG_NO_IDLE_MODE, &otg->sysconfig);

		/* Set the interface */
		writel(OMAP3_OTG_INTERFSEL_OMAP, &otg->interfsel);

		/* Clear force standby */
		stdby = readl(&otg->forcestdby);
		stdby &= ~OMAP3_OTG_FORCESTDBY_STANDBY;
		writel(stdby, &otg->forcestdby);

#ifdef CONFIG_OMAP3_EVM
		musb_cfg.extvbus = omap3_evm_need_extvbus();
#endif

#ifdef CONFIG_OMAP4430
		u32 *usbotghs_control = (u32 *)(CTRL_BASE + 0x33C);
		*usbotghs_control = 0x15;
#endif

		platform_needs_initialization = 0;
	}

	ret = platform_needs_initialization;

#ifdef CONFIG_TWL4030_USB
end:
#endif
	return ret;

}