X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fusb%2Fmusb%2Fmusb_udc.c;h=87640f4e326a8062bca4757345ae1e90864bfbb5;hb=3f52e1b98527a8943718871f85de10d37a24f011;hp=fc43cf4f09d76db4d6852ee253e7eef04665f357;hpb=f7767c7541a8cdae55655d10f039a5bc62894ee8;p=u-boot diff --git a/drivers/usb/musb/musb_udc.c b/drivers/usb/musb/musb_udc.c index fc43cf4f09..87640f4e32 100644 --- a/drivers/usb/musb/musb_udc.c +++ b/drivers/usb/musb/musb_udc.c @@ -35,28 +35,18 @@ * * ------------------------------------------------------------------------- * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program 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 this program; 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+ */ #include -#include +#include +#include #include "../gadget/ep0.h" #include "musb_core.h" #if defined(CONFIG_USB_OMAP3) #include "omap3.h" +#elif defined(CONFIG_USB_AM35X) +#include "am35x.h" #elif defined(CONFIG_USB_DAVINCI) #include "davinci.h" #endif @@ -160,8 +150,6 @@ static void musb_db_regs(void) static void musb_peri_softconnect(void) { u8 power, devctl; - u8 intrusb; - u16 intrrx, intrtx; /* Power off MUSB */ power = readb(&musbr->power); @@ -169,9 +157,9 @@ static void musb_peri_softconnect(void) writeb(power, &musbr->power); /* Read intr to clear */ - intrusb = readb(&musbr->intrusb); - intrrx = readw(&musbr->intrrx); - intrtx = readw(&musbr->intrtx); + readb(&musbr->intrusb); + readw(&musbr->intrrx); + readw(&musbr->intrtx); udelay(1000 * 1000); /* 1 sec */ @@ -640,8 +628,17 @@ static void musb_peri_ep0(void) static void musb_peri_rx_ep(unsigned int ep) { - u16 peri_rxcount = readw(&musbr->ep[ep].epN.rxcount); + u16 peri_rxcount; + u8 peri_rxcsr = readw(&musbr->ep[ep].epN.rxcsr); + + if (!(peri_rxcsr & MUSB_RXCSR_RXPKTRDY)) { + if (debug_level > 0) + serial_printf("ERROR : %s %d without MUSB_RXCSR_RXPKTRDY set\n", + __PRETTY_FUNCTION__, ep); + return; + } + peri_rxcount = readw(&musbr->ep[ep].epN.rxcount); if (peri_rxcount) { struct usb_endpoint_instance *endpoint; u32 length; @@ -885,8 +882,7 @@ void udc_setup_ep(struct usb_device_instance *device, unsigned int id, epinfo[id * 2].epsize = endpoint->rcv_packetSize; } - musb_configure_ep(&epinfo[0], - sizeof(epinfo) / sizeof(struct musb_epinfo)); + musb_configure_ep(&epinfo[0], ARRAY_SIZE(epinfo)); } else { if (debug_level > 0) serial_printf("ERROR : %s endpoint request %d "