1
0
Fork 0

Merge branch 'agust@denx.de' of git://git.denx.de/u-boot-staging

* 'agust@denx.de' of git://git.denx.de/u-boot-staging:
  lin_gadget: use common linux/compat.h
  linux/compat.h: rename from linux/mtd/compat.h
  lin_gadget: use common mdelay
  gunzip: rename z{alloc, free} to gz{alloc, free}
  fs/fat: align disk buffers on cache line to enable DMA and cache
  part_dos: align disk buffers on cache line to enable DMA and cache
utp
Wolfgang Denk 2012-04-30 18:19:28 +02:00
commit 0a6deb3251
28 changed files with 52 additions and 61 deletions

View File

@ -22,7 +22,7 @@
*/ */
#include <common.h> #include <common.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/onenand.h> #include <linux/mtd/onenand.h>
#include <linux/mtd/samsung_onenand.h> #include <linux/mtd/samsung_onenand.h>

View File

@ -13,7 +13,7 @@
#include <command.h> #include <command.h>
#include <malloc.h> #include <malloc.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/onenand.h> #include <linux/mtd/onenand.h>

View File

@ -33,7 +33,7 @@
#include <errno.h> #include <errno.h>
#include <onenand_uboot.h> #include <onenand_uboot.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/onenand.h> #include <linux/mtd/onenand.h>

View File

@ -87,7 +87,7 @@ static int test_block_type(unsigned char *buffer)
int test_part_dos (block_dev_desc_t *dev_desc) int test_part_dos (block_dev_desc_t *dev_desc)
{ {
unsigned char buffer[dev_desc->blksz]; ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
if ((dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *) buffer) != 1) || if ((dev_desc->block_read(dev_desc->dev, 0, 1, (ulong *) buffer) != 1) ||
(buffer[DOS_PART_MAGIC_OFFSET + 0] != 0x55) || (buffer[DOS_PART_MAGIC_OFFSET + 0] != 0x55) ||
@ -102,7 +102,7 @@ int test_part_dos (block_dev_desc_t *dev_desc)
static void print_partition_extended (block_dev_desc_t *dev_desc, int ext_part_sector, int relative, static void print_partition_extended (block_dev_desc_t *dev_desc, int ext_part_sector, int relative,
int part_num) int part_num)
{ {
unsigned char buffer[dev_desc->blksz]; ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
dos_partition_t *pt; dos_partition_t *pt;
int i; int i;
@ -166,7 +166,7 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part
int relative, int part_num, int relative, int part_num,
int which_part, disk_partition_t *info) int which_part, disk_partition_t *info)
{ {
unsigned char buffer[dev_desc->blksz]; ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
dos_partition_t *pt; dos_partition_t *pt;
int i; int i;

View File

@ -9,7 +9,7 @@
*/ */
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/concat.h> #include <linux/mtd/concat.h>
#include <ubi_uboot.h> #include <ubi_uboot.h>

View File

@ -8,7 +8,7 @@
*/ */
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <ubi_uboot.h> #include <ubi_uboot.h>
struct mtd_info *mtd_table[MAX_MTD_DEVICES]; struct mtd_info *mtd_table[MAX_MTD_DEVICES];

View File

@ -17,7 +17,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
/* Our partition linked list */ /* Our partition linked list */
struct list_head mtd_partitions; struct list_head mtd_partitions;

View File

@ -29,7 +29,7 @@
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h> #include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h> #include <linux/mtd/nand_ecc.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <asm/errno.h> #include <asm/errno.h>
#include <asm/io.h> #include <asm/io.h>

View File

@ -39,7 +39,7 @@
#include <malloc.h> #include <malloc.h>
#include <watchdog.h> #include <watchdog.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h> #include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h> #include <linux/mtd/nand_ecc.h>

View File

@ -61,7 +61,7 @@
#include <common.h> #include <common.h>
#include <malloc.h> #include <malloc.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h> #include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h> #include <linux/mtd/nand_ecc.h>

View File

@ -20,7 +20,7 @@
*/ */
#include <common.h> #include <common.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/onenand.h> #include <linux/mtd/onenand.h>

View File

@ -15,7 +15,7 @@
*/ */
#include <common.h> #include <common.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/onenand.h> #include <linux/mtd/onenand.h>
#include <malloc.h> #include <malloc.h>

View File

@ -14,7 +14,7 @@
*/ */
#include <common.h> #include <common.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/onenand.h> #include <linux/mtd/onenand.h>

View File

@ -28,7 +28,7 @@
#include <common.h> #include <common.h>
#include <malloc.h> #include <malloc.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/onenand.h> #include <linux/mtd/onenand.h>
#include <linux/mtd/samsung_onenand.h> #include <linux/mtd/samsung_onenand.h>

View File

@ -671,7 +671,7 @@ static struct usb_request *s3c_alloc_request(struct usb_ep *ep,
debug("%s: %s %p\n", __func__, ep->name, ep); debug("%s: %s %p\n", __func__, ep->name, ep);
req = kmalloc(sizeof *req, gfp_flags); req = memalign(CONFIG_SYS_CACHELINE_SIZE, sizeof(*req));
if (!req) if (!req)
return 0; return 0;
@ -865,7 +865,8 @@ int s3c_udc_probe(struct s3c_plat_otg_data *pdata)
the_controller = dev; the_controller = dev;
for (i = 0; i < S3C_MAX_ENDPOINTS+1; i++) { for (i = 0; i < S3C_MAX_ENDPOINTS+1; i++) {
dev->dma_buf[i] = kmalloc(DMA_BUFFER_SIZE, GFP_KERNEL); dev->dma_buf[i] = memalign(CONFIG_SYS_CACHELINE_SIZE,
DMA_BUFFER_SIZE);
dev->dma_addr[i] = (dma_addr_t) dev->dma_buf[i]; dev->dma_addr[i] = (dma_addr_t) dev->dma_buf[i];
invalidate_dcache_range((unsigned long) dev->dma_buf[i], invalidate_dcache_range((unsigned long) dev->dma_buf[i],
(unsigned long) (dev->dma_buf[i] (unsigned long) (dev->dma_buf[i]

View File

@ -168,7 +168,7 @@ int setdma_tx(struct s3c_ep *ep, struct s3c_request *req)
length = req->req.length - req->req.actual; length = req->req.length - req->req.actual;
if (ep_num == EP0_CON) if (ep_num == EP0_CON)
length = min_t(length, (u32)ep_maxpacket(ep)); length = min(length, (u32)ep_maxpacket(ep));
ep->len = length; ep->len = length;
ep->dma_buf = buf; ep->dma_buf = buf;

View File

@ -27,9 +27,6 @@
static z_stream stream; static z_stream stream;
void *zalloc(void *, unsigned, unsigned);
void zfree(void *, void *, unsigned);
/* Returns length of decompressed data. */ /* Returns length of decompressed data. */
int cramfs_uncompress_block (void *dst, void *src, int srclen) int cramfs_uncompress_block (void *dst, void *src, int srclen)
{ {
@ -59,8 +56,8 @@ int cramfs_uncompress_init (void)
{ {
int err; int err;
stream.zalloc = zalloc; stream.zalloc = gzalloc;
stream.zfree = zfree; stream.zfree = gzfree;
stream.next_in = 0; stream.next_in = 0;
stream.avail_in = 0; stream.avail_in = 0;

View File

@ -31,6 +31,8 @@
#include <fat.h> #include <fat.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <part.h> #include <part.h>
#include <malloc.h>
#include <linux/compiler.h>
/* /*
* Convert a string to lowercase. * Convert a string to lowercase.
@ -62,7 +64,7 @@ static int disk_read(__u32 block, __u32 nr_blocks, void *buf)
int fat_register_device (block_dev_desc_t * dev_desc, int part_no) int fat_register_device (block_dev_desc_t * dev_desc, int part_no)
{ {
unsigned char buffer[dev_desc->blksz]; ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
/* First close any currently found FAT filesystem */ /* First close any currently found FAT filesystem */
cur_dev = NULL; cur_dev = NULL;
@ -293,7 +295,7 @@ get_cluster (fsdata *mydata, __u32 clustnum, __u8 *buffer,
return -1; return -1;
} }
if (size % mydata->sect_size) { if (size % mydata->sect_size) {
__u8 tmpbuf[mydata->sect_size]; ALLOC_CACHE_ALIGN_BUFFER(__u8, tmpbuf, mydata->sect_size);
idx = size / mydata->sect_size; idx = size / mydata->sect_size;
ret = disk_read(startsect + idx, 1, tmpbuf); ret = disk_read(startsect + idx, 1, tmpbuf);
@ -428,8 +430,8 @@ static int slot2str (dir_slot *slotptr, char *l_name, int *idx)
* into 'retdent' * into 'retdent'
* Return 0 on success, -1 otherwise. * Return 0 on success, -1 otherwise.
*/ */
__attribute__ ((__aligned__ (__alignof__ (dir_entry)))) __u8 get_vfatname_block[MAX_CLUSTSIZE]
__u8 get_vfatname_block[MAX_CLUSTSIZE]; __aligned(ARCH_DMA_MINALIGN);
static int static int
get_vfatname (fsdata *mydata, int curclust, __u8 *cluster, get_vfatname (fsdata *mydata, int curclust, __u8 *cluster,
@ -533,8 +535,8 @@ static __u8 mkcksum (const char *str)
* Get the directory entry associated with 'filename' from the directory * Get the directory entry associated with 'filename' from the directory
* starting at 'startsect' * starting at 'startsect'
*/ */
__attribute__ ((__aligned__ (__alignof__ (dir_entry)))) __u8 get_dentfromdir_block[MAX_CLUSTSIZE]
__u8 get_dentfromdir_block[MAX_CLUSTSIZE]; __aligned(ARCH_DMA_MINALIGN);
static dir_entry *get_dentfromdir (fsdata *mydata, int startsect, static dir_entry *get_dentfromdir (fsdata *mydata, int startsect,
char *filename, dir_entry *retdent, char *filename, dir_entry *retdent,
@ -709,7 +711,7 @@ read_bootsectandvi (boot_sector *bs, volume_info *volinfo, int *fatsize)
return -1; return -1;
} }
block = malloc(cur_dev->blksz); block = memalign(ARCH_DMA_MINALIGN, cur_dev->blksz);
if (block == NULL) { if (block == NULL) {
debug("Error: allocating block\n"); debug("Error: allocating block\n");
return -1; return -1;
@ -765,8 +767,8 @@ exit:
return ret; return ret;
} }
__attribute__ ((__aligned__ (__alignof__ (dir_entry)))) __u8 do_fat_read_block[MAX_CLUSTSIZE]
__u8 do_fat_read_block[MAX_CLUSTSIZE]; __aligned(ARCH_DMA_MINALIGN);
long long
do_fat_read (const char *filename, void *buffer, unsigned long maxsize, do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
@ -828,7 +830,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
} }
mydata->fatbufnum = -1; mydata->fatbufnum = -1;
mydata->fatbuf = malloc(FATBUFSIZE); mydata->fatbuf = memalign(ARCH_DMA_MINALIGN, FATBUFSIZE);
if (mydata->fatbuf == NULL) { if (mydata->fatbuf == NULL) {
debug("Error: allocating memory\n"); debug("Error: allocating memory\n");
return -1; return -1;

View File

@ -119,7 +119,7 @@
#include <watchdog.h> #include <watchdog.h>
#include <jffs2/jffs2.h> #include <jffs2/jffs2.h>
#include <jffs2/jffs2_1pass.h> #include <jffs2/jffs2_1pass.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <asm/errno.h> #include <asm/errno.h>
#include "jffs2_private.h" #include "jffs2_private.h"

View File

@ -48,5 +48,8 @@
#define BUG_ON(condition) do { if (condition) BUG(); } while(0) #define BUG_ON(condition) do { if (condition) BUG(); } while(0)
#endif /* BUG */ #endif /* BUG */
#define WARN_ON(x) if (x) {printf("WARNING in %s line %d\n" \
, __FILE__, __LINE__); }
#define PAGE_SIZE 4096 #define PAGE_SIZE 4096
#endif #endif

View File

@ -5,7 +5,7 @@
#if 0 #if 0
#include <linux/compiler.h> #include <linux/compiler.h>
#else #else
#include <linux/mtd/compat.h> #include <linux/compat.h>
#endif #endif
#include <asm/errno.h> #include <asm/errno.h>

View File

@ -8,7 +8,7 @@
#define __MTD_ABI_H__ #define __MTD_ABI_H__
#if 1 #if 1
#include <linux/mtd/compat.h> #include <linux/compat.h>
#endif #endif
struct erase_info_user { struct erase_info_user {

View File

@ -20,7 +20,7 @@
#include "config.h" #include "config.h"
#include "linux/mtd/compat.h" #include "linux/compat.h"
#include "linux/mtd/mtd.h" #include "linux/mtd/mtd.h"
#include "linux/mtd/bbm.h" #include "linux/mtd/bbm.h"

View File

@ -17,7 +17,7 @@
/* Note: The header order is impoertant */ /* Note: The header order is impoertant */
#include <onenand_uboot.h> #include <onenand_uboot.h>
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/bbm.h> #include <linux/mtd/bbm.h>
#define MAX_DIES 2 #define MAX_DIES 2

View File

@ -37,7 +37,7 @@
extern void nand_init(void); extern void nand_init(void);
#include <linux/mtd/compat.h> #include <linux/compat.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h> #include <linux/mtd/nand.h>

View File

@ -691,6 +691,9 @@ ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
struct internal_state {int dummy;}; /* hack for buggy compilers */ struct internal_state {int dummy;}; /* hack for buggy compilers */
#endif #endif
extern void *gzalloc(void *, unsigned, unsigned);
extern void gzfree(void *, void *, unsigned);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -23,6 +23,8 @@
#ifndef __LIN_COMPAT_H__ #ifndef __LIN_COMPAT_H__
#define __LIN_COMPAT_H__ #define __LIN_COMPAT_H__
#include <linux/compat.h>
/* common */ /* common */
#define spin_lock_init(...) #define spin_lock_init(...)
#define spin_lock(...) #define spin_lock(...)
@ -36,26 +38,12 @@
#define mutex_lock(...) #define mutex_lock(...)
#define mutex_unlock(...) #define mutex_unlock(...)
#define WARN_ON(x) if (x) {printf("WARNING in %s line %d\n" \
, __FILE__, __LINE__); }
#define KERN_WARNING
#define KERN_ERR
#define KERN_NOTICE
#define KERN_DEBUG
#define GFP_KERNEL 0 #define GFP_KERNEL 0
#define IRQ_HANDLED 1 #define IRQ_HANDLED 1
#define ENOTSUPP 524 /* Operation is not supported */ #define ENOTSUPP 524 /* Operation is not supported */
#define kmalloc(size, type) memalign(CONFIG_SYS_CACHELINE_SIZE, size)
#define kfree(addr) free(addr)
#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); })
#define __iomem
#define min_t min
#define dma_cache_maint(addr, size, mode) cache_flush() #define dma_cache_maint(addr, size, mode) cache_flush()
void cache_flush(void); void cache_flush(void);

View File

@ -36,10 +36,7 @@
#define RESERVED 0xe0 #define RESERVED 0xe0
#define DEFLATED 8 #define DEFLATED 8
void *zalloc(void *, unsigned, unsigned); void *gzalloc(void *x, unsigned items, unsigned size)
void zfree(void *, void *, unsigned);
void *zalloc(void *x, unsigned items, unsigned size)
{ {
void *p; void *p;
@ -51,7 +48,7 @@ void *zalloc(void *x, unsigned items, unsigned size)
return (p); return (p);
} }
void zfree(void *x, void *addr, unsigned nb) void gzfree(void *x, void *addr, unsigned nb)
{ {
free (addr); free (addr);
} }
@ -94,8 +91,8 @@ int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
z_stream s; z_stream s;
int r; int r;
s.zalloc = zalloc; s.zalloc = gzalloc;
s.zfree = zfree; s.zfree = gzfree;
r = inflateInit2(&s, -MAX_WBITS); r = inflateInit2(&s, -MAX_WBITS);
if (r != Z_OK) { if (r != Z_OK) {