#endif
 }
 
+#ifdef MUSB_NO_DYNAMIC_FIFO
+# define config_fifo(dir, idx, addr)
+#else
+# define config_fifo(dir, idx, addr) \
+       do { \
+               writeb(idx, &musbr->dir##fifosz); \
+               writew(fifoaddr >> 3, &musbr->dir##fifoadd); \
+       } while (0)
+#endif
+
 /*
  * This function configures the endpoint configuration. The musb hcd or musb
  * device implementation can use this function to configure the endpoints
                writeb(epinfo->epnum, &musbr->index);
                if (epinfo->epdir) {
                        /* Configure fifo size and fifo base address */
-                       writeb(idx, &musbr->txfifosz);
-                       writew(fifoaddr >> 3, &musbr->txfifoadd);
+                       config_fifo(tx, idx, fifoaddr);
 
                        csr = readw(&musbr->txcsr);
 #if defined(CONFIG_MUSB_HCD)
                                        &musbr->txcsr);
                } else {
                        /* Configure fifo size and fifo base address */
-                       writeb(idx, &musbr->rxfifosz);
-                       writew(fifoaddr >> 3, &musbr->rxfifoadd);
+                       config_fifo(rx, idx, fifoaddr);
 
                        csr = readw(&musbr->rxcsr);
 #if defined(CONFIG_MUSB_HCD)
  * length      - number of bytes to write to FIFO
  * fifo_data   - Pointer to data buffer that contains the data to write
  */
+__attribute__((weak))
 void write_fifo(u8 ep, u32 length, void *fifo_data)
 {
        u8  *data = (u8 *)fifo_data;
  * length       - number of bytes to read from FIFO
  * fifo_data    - pointer to data buffer into which data is read
  */
+__attribute__((weak))
 void read_fifo(u8 ep, u32 length, void *fifo_data)
 {
        u8  *data = (u8 *)fifo_data;