dm: core: Create a new header file for 'compat' features
[oweals/u-boot.git] / drivers / usb / musb-new / musb_gadget_ep0.c
index 6599d386dc5538ae5551ee1a2e026c6302ea732c..79e8222e3b3f7766ea6117154601e545dacb85de 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * MUSB OTG peripheral driver ep0 handling
  *
@@ -5,36 +6,10 @@
  * Copyright (C) 2005-2006 by Texas Instruments
  * Copyright (C) 2006-2007 Nokia Corporation
  * Copyright (C) 2008-2009 MontaVista Software, Inc. <source@mvista.com>
- *
- * This program 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.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
  */
 
-#define __UBOOT__
 #ifndef __UBOOT__
+#include <dm/device_compat.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/timer.h>
@@ -44,6 +19,7 @@
 #else
 #include <common.h>
 #include "linux-compat.h"
+#include <asm/processor.h>
 #endif
 
 #include "musb_core.h"
@@ -576,6 +552,10 @@ static void ep0_txstate(struct musb *musb)
        } else
                request = NULL;
 
+       /* send it out, triggering a "txpktrdy cleared" irq */
+       musb_ep_select(musb->mregs, 0);
+       musb_writew(regs, MUSB_CSR0, csr);
+
        /* report completions as soon as the fifo's loaded; there's no
         * win in waiting till this last packet gets acked.  (other than
         * very precise fault reporting, needed by USB TMC; possible with
@@ -588,10 +568,6 @@ static void ep0_txstate(struct musb *musb)
                        return;
                musb->ackpend = 0;
        }
-
-       /* send it out, triggering a "txpktrdy cleared" irq */
-       musb_ep_select(musb->mregs, 0);
-       musb_writew(regs, MUSB_CSR0, csr);
 }
 
 /*
@@ -907,7 +883,7 @@ finish:
 
        default:
                /* "can't happen" */
-               WARN_ON(1);
+               assert_noisy(false);
                musb_writew(regs, MUSB_CSR0, MUSB_CSR0_P_SENDSTALL);
                musb->ep0_state = MUSB_EP0_STAGE_IDLE;
                break;