xref: /OK3568_Linux_fs/u-boot/include/jffs2/load_kernel.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 #ifndef load_kernel_h
2 #define load_kernel_h
3 /*-------------------------------------------------------------------------
4  * Filename:      load_kernel.h
5  * Version:       $Id: load_kernel.h,v 1.3 2002/01/25 01:34:11 nyet Exp $
6  * Copyright:     Copyright (C) 2001, Russ Dill
7  * Author:        Russ Dill <Russ.Dill@asu.edu>
8  * Description:   header for load kernel modules
9  *-----------------------------------------------------------------------*/
10 /*
11  * SPDX-License-Identifier:	GPL-2.0+
12  */
13 
14 #include <linux/list.h>
15 
16 /* mtd device types */
17 #define MTD_DEV_TYPE_NOR	0x0001
18 #define MTD_DEV_TYPE_NAND	0x0002
19 #define MTD_DEV_TYPE_ONENAND	0x0004
20 #define MTD_DEV_TYPE_SPINAND	0x0008
21 
22 #define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" :	\
23 			    (type == MTD_DEV_TYPE_NOR ? "nor" :		\
24 			     (type == MTD_DEV_TYPE_ONENAND ? "onenand" : \
25 			      "spi-nand")))				\
26 
27 struct mtd_device {
28 	struct list_head link;
29 	struct mtdids *id;		/* parent mtd id entry */
30 	u16 num_parts;			/* number of partitions on this device */
31 	struct list_head parts;		/* partitions */
32 };
33 
34 struct part_info {
35 	struct list_head link;
36 	char *name;			/* partition name */
37 	u8 auto_name;			/* set to 1 for generated name */
38 	u64 size;			/* total size of the partition */
39 	u64 offset;			/* offset within device */
40 	void *jffs2_priv;		/* used internaly by jffs2 */
41 	u32 mask_flags;			/* kernel MTD mask flags */
42 	u32 sector_size;		/* size of sector */
43 	struct mtd_device *dev;		/* parent device */
44 };
45 
46 struct mtdids {
47 	struct list_head link;
48 	u8 type;			/* device type */
49 	u8 num;				/* device number */
50 	u64 size;			/* device size */
51 	char *mtd_id;			/* linux kernel device id */
52 };
53 
54 #define ldr_strlen	strlen
55 #define ldr_strncmp	strncmp
56 #define ldr_memcpy	memcpy
57 #define putstr(x)	printf("%s", x)
58 #define mmalloc		malloc
59 #define UDEBUG		printf
60 
61 #define putnstr(str, size)	printf("%*.*s", size, size, str)
62 #define ldr_output_string(x)	puts(x)
63 #define putLabeledWord(x, y)	printf("%s %08x\n", x, (unsigned int)y)
64 #define led_blink(x, y, z, a)
65 
66 /* common/cmd_jffs2.c */
67 extern int mtdparts_init(void);
68 extern int find_dev_and_part(const char *id, struct mtd_device **dev,
69 				u8 *part_num, struct part_info **part);
70 extern struct mtd_device *device_find(u8 type, u8 num);
71 
72 #endif /* load_kernel_h */
73