X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fusb%2Fmusb-new%2Fomap2430.c;h=ba22dfe6cb092b832b5ce23f2f1061b69d738f55;hb=f2e0315e9d27a6495bde8d80983be4e0208bb63f;hp=b1c4dc7828518252c856e658ddf4c5c92863e1e6;hpb=dfe161032d007e4901064ab36b58f054126b1f35;p=u-boot diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c index b1c4dc7828..ba22dfe6cb 100644 --- a/drivers/usb/musb-new/omap2430.c +++ b/drivers/usb/musb-new/omap2430.c @@ -7,24 +7,8 @@ * * This file is part of the Inventra Controller Driver for Linux. * - * The Inventra Controller Driver for Linux is free software; you - * can redistribute it and/or modify it under the terms of the GNU - * General Public License version 2 as published by the Free Software - * Foundation. - * - * The Inventra Controller Driver for Linux is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Inventra Controller Driver for Linux ; if not, - * write to the Free Software Foundation, Inc., 59 Temple Place, - * Suite 330, Boston, MA 02111-1307 USA - * + * SPDX-License-Identifier: GPL-2.0 */ -#define __UBOOT__ #ifndef __UBOOT__ #include #include @@ -39,8 +23,10 @@ #include #else #include +#include #include #include +#include #include "linux-compat.h" #endif @@ -322,6 +308,7 @@ static int omap2430_musb_init(struct musb *musb) { u32 l; int status = 0; + unsigned long int start; #ifndef __UBOOT__ struct device *dev = musb->controller; struct omap2430_glue *glue = dev_get_drvdata(dev->parent); @@ -332,6 +319,21 @@ static int omap2430_musb_init(struct musb *musb) (struct omap_musb_board_data *)musb->controller; #endif + /* Reset the controller */ + musb_writel(musb->mregs, OTG_SYSCONFIG, SOFTRST); + + start = get_timer(0); + + while (1) { + l = musb_readl(musb->mregs, OTG_SYSCONFIG); + if ((l & SOFTRST) == 0) + break; + + if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) { + dev_err(musb->controller, "MUSB reset is taking too long\n"); + return -ENODEV; + } + } #ifndef __UBOOT__ /* We require some kind of external transceiver, hooked @@ -385,7 +387,11 @@ err1: return status; } +#ifndef __UBOOT__ static void omap2430_musb_enable(struct musb *musb) +#else +static int omap2430_musb_enable(struct musb *musb) +#endif { #ifndef __UBOOT__ u8 devctl; @@ -430,6 +436,18 @@ static void omap2430_musb_enable(struct musb *musb) __PRETTY_FUNCTION__); } #endif + +#ifdef CONFIG_TWL6030_POWER + twl6030_usb_device_settings(); +#endif + +#ifdef CONFIG_OMAP44XX + u32 *usbotghs_control = (u32 *)((*ctrl)->control_usbotghs_ctrl); + *usbotghs_control = USBOTGHS_CONTROL_AVALID | + USBOTGHS_CONTROL_VBUSVALID | USBOTGHS_CONTROL_IDDIG; +#endif + + return 0; #endif }