]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/blackfin/lib/string.c
Merge git://git.denx.de/u-boot-dm
[karo-tx-uboot.git] / arch / blackfin / lib / string.c
index 44d8c6d906f17186430828f91fba73e5c30892c1..211df7b430c246b28b3977d6ecfadced44dac0ef 100644 (file)
@@ -6,23 +6,7 @@
  * (C) Copyright 2000-2004
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston,
- * MA 02110-1301 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -128,14 +112,16 @@ static void dma_calc_size(unsigned long ldst, unsigned long lsrc, size_t count,
        unsigned long limit;
 
 #ifdef MSIZE
-       limit = 6;
+       /* The max memory DMA memory transfer size is 32 bytes. */
+       limit = 5;
        *dshift = MSIZE_P;
 #else
-       limit = 3;
+       /* The max memory DMA memory transfer size is 4 bytes. */
+       limit = 2;
        *dshift = WDSIZE_P;
 #endif
 
-       *bpos = min(limit, ffs(ldst | lsrc | count)) - 1;
+       *bpos = min(limit, (unsigned long)ffs(ldst | lsrc | count)) - 1;
 }
 
 /* This version misbehaves for count values of 0 and 2^16+.
@@ -170,7 +156,8 @@ void dma_memcpy_nocache(void *dst, const void *src, size_t count)
        mod = 1 << bpos;
 
 #ifdef PSIZE
-       dsize |= min(3, bpos) << PSIZE_P;
+       /* The max memory DMA peripheral transfer size is 4 bytes. */
+       dsize |= min(2UL, bpos) << PSIZE_P;
 #endif
 
        /* Copy sram functions from sdram to sram */