xref: /rk3399_rockchip-uboot/include/jffs2/load_kernel.h (revision 7e6ee7ad27de5216db1baef76f38c3429c8f4a2a)
1fe8c2806Swdenk #ifndef load_kernel_h
2fe8c2806Swdenk #define load_kernel_h
3fe8c2806Swdenk /*-------------------------------------------------------------------------
4fe8c2806Swdenk  * Filename:      load_kernel.h
5fe8c2806Swdenk  * Version:       $Id: load_kernel.h,v 1.3 2002/01/25 01:34:11 nyet Exp $
6fe8c2806Swdenk  * Copyright:     Copyright (C) 2001, Russ Dill
7fe8c2806Swdenk  * Author:        Russ Dill <Russ.Dill@asu.edu>
8fe8c2806Swdenk  * Description:   header for load kernel modules
9fe8c2806Swdenk  *-----------------------------------------------------------------------*/
10fe8c2806Swdenk /*
11fe8c2806Swdenk  *
12fe8c2806Swdenk  * This program is free software; you can redistribute it and/or modify
13fe8c2806Swdenk  * it under the terms of the GNU General Public License as published by
14fe8c2806Swdenk  * the Free Software Foundation; either version 2 of the License, or
15fe8c2806Swdenk  * (at your option) any later version.
16fe8c2806Swdenk  *
17fe8c2806Swdenk  * This program is distributed in the hope that it will be useful,
18fe8c2806Swdenk  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19fe8c2806Swdenk  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20fe8c2806Swdenk  * GNU General Public License for more details.
21fe8c2806Swdenk  *
22fe8c2806Swdenk  * You should have received a copy of the GNU General Public License
23fe8c2806Swdenk  * along with this program; if not, write to the Free Software
24fe8c2806Swdenk  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25fe8c2806Swdenk  *
26fe8c2806Swdenk  */
27fe8c2806Swdenk 
28700a0c64SWolfgang Denk #include <linux/list.h>
29fe8c2806Swdenk 
30700a0c64SWolfgang Denk /* mtd device types */
31700a0c64SWolfgang Denk #define MTD_DEV_TYPE_NOR	0x0001
32700a0c64SWolfgang Denk #define MTD_DEV_TYPE_NAND	0x0002
331a7f8cceSKyungmin Park #define MTD_DEV_TYPE_ONENAND	0x0004
341a7f8cceSKyungmin Park 
351a7f8cceSKyungmin Park #define MTD_DEV_TYPE(type) ((type == MTD_DEV_TYPE_NAND) ? "nand" :	\
361a7f8cceSKyungmin Park 			(type == MTD_DEV_TYPE_ONENAND) ? "onenand" : "nor")
37fe8c2806Swdenk 
38700a0c64SWolfgang Denk struct mtd_device {
39700a0c64SWolfgang Denk 	struct list_head link;
40700a0c64SWolfgang Denk 	struct mtdids *id;		/* parent mtd id entry */
41700a0c64SWolfgang Denk 	u16 num_parts;			/* number of partitions on this device */
42700a0c64SWolfgang Denk 	struct list_head parts;		/* partitions */
43fe8c2806Swdenk };
44fe8c2806Swdenk 
45700a0c64SWolfgang Denk struct part_info {
46700a0c64SWolfgang Denk 	struct list_head link;
47700a0c64SWolfgang Denk 	char *name;			/* partition name */
48700a0c64SWolfgang Denk 	u8 auto_name;			/* set to 1 for generated name */
49700a0c64SWolfgang Denk 	u32 size;			/* total size of the partition */
50700a0c64SWolfgang Denk 	u32 offset;			/* offset within device */
51700a0c64SWolfgang Denk 	void *jffs2_priv;		/* used internaly by jffs2 */
52700a0c64SWolfgang Denk 	u32 mask_flags;			/* kernel MTD mask flags */
53700a0c64SWolfgang Denk 	struct mtd_device *dev;		/* parent device */
54700a0c64SWolfgang Denk };
55fe8c2806Swdenk 
56700a0c64SWolfgang Denk struct mtdids {
57700a0c64SWolfgang Denk 	struct list_head link;
58700a0c64SWolfgang Denk 	u8 type;			/* device type */
59700a0c64SWolfgang Denk 	u8 num;				/* device number */
60700a0c64SWolfgang Denk 	u32 size;			/* device size */
61700a0c64SWolfgang Denk 	char *mtd_id;			/* linux kernel device id */
62fe8c2806Swdenk };
63fe8c2806Swdenk 
64fe8c2806Swdenk #define ldr_strlen	strlen
65fe8c2806Swdenk #define ldr_strncmp	strncmp
66fe8c2806Swdenk #define ldr_memcpy	memcpy
67fe8c2806Swdenk #define putstr(x)	printf("%s", x)
68fe8c2806Swdenk #define mmalloc		malloc
69fe8c2806Swdenk #define UDEBUG		printf
70fe8c2806Swdenk 
71fe8c2806Swdenk #define putnstr(str, size)	printf("%*.*s", size, size, str)
72fe8c2806Swdenk #define ldr_output_string(x)	puts(x)
73fe8c2806Swdenk #define putLabeledWord(x, y)	printf("%s %08x\n", x, (unsigned int)y)
74fe8c2806Swdenk #define led_blink(x, y, z, a)
75fe8c2806Swdenk 
76*7e6ee7adSKyungmin Park /* common/cmd_jffs2.c */
77*7e6ee7adSKyungmin Park extern int mtdparts_init(void);
78*7e6ee7adSKyungmin Park extern int find_dev_and_part(const char *id, struct mtd_device **dev,
79*7e6ee7adSKyungmin Park 				u8 *part_num, struct part_info **part);
80*7e6ee7adSKyungmin Park 
81fe8c2806Swdenk #endif /* load_kernel_h */
82