]> git.sur5r.net Git - u-boot/blobdiff - drivers/usb/musb/musb_udc.c
spl: disk: usb: Add dependencies to sprintf/strto*
[u-boot] / drivers / usb / musb / musb_udc.c
index e0b4217dc3f5060c1fe8d2489f452722d804b003..d643334a2e8717bd4e7cd69a7dd74788e885d160 100644 (file)
  *
  * -------------------------------------------------------------------------
  *
- * 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 <common.h>
-#include <usb/musb_udc.h>
+#include <usbdevice.h>
+#include <usb/udc.h>
 #include "../gadget/ep0.h"
 #include "musb_core.h"
 #if defined(CONFIG_USB_OMAP3)
@@ -97,7 +85,7 @@ do {                                                                  \
 /* static implies these initialized to 0 or NULL */
 static int debug_setup;
 static int debug_level;
-static struct musb_epinfo epinfo[MAX_ENDPOINT * 2];
+static struct musb_epinfo epinfo[MAX_ENDPOINT * 2 + 2];
 static enum ep0_state_enum {
        IDLE = 0,
        TX,
@@ -894,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 "
@@ -957,7 +944,7 @@ int udc_init(void)
        musbr = musb_cfg.regs;
 
        /* Initialize the endpoints */
-       for (ep_loop = 0; ep_loop < MAX_ENDPOINT * 2; ep_loop++) {
+       for (ep_loop = 0; ep_loop <= MAX_ENDPOINT * 2; ep_loop++) {
                epinfo[ep_loop].epnum = (ep_loop / 2) + 1;
                epinfo[ep_loop].epdir = ep_loop % 2; /* OUT, IN */
                epinfo[ep_loop].epsize = 0;