blob: 9346d7ee9f1b6376097337181565f6202bc12f1b [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
wdenkfe8c2802002-11-03 00:38:21 +00002#ifndef load_kernel_h
3#define load_kernel_h
4/*-------------------------------------------------------------------------
5 * Filename: load_kernel.h
6 * Version: $Id: load_kernel.h,v 1.3 2002/01/25 01:34:11 nyet Exp $
7 * Copyright: Copyright (C) 2001, Russ Dill
8 * Author: Russ Dill <Russ.Dill@asu.edu>
9 * Description: header for load kernel modules
10 *-----------------------------------------------------------------------*/
wdenkfe8c2802002-11-03 00:38:21 +000011
Wolfgang Denk47f57792005-08-08 01:03:24 +020012#include <linux/list.h>
wdenkfe8c2802002-11-03 00:38:21 +000013
Wolfgang Denk47f57792005-08-08 01:03:24 +020014/* mtd device types */
Kyungmin Park25383742008-08-27 14:45:20 +090015#define MTD_DEV_TYPE_NOR 0x0001
16#define MTD_DEV_TYPE_NAND 0x0002
17#define MTD_DEV_TYPE_ONENAND 0x0004
Miquel Raynalceb9cae2018-09-06 09:08:45 +020018#define MTD_DEV_TYPE_SPINAND 0x0008
Kyungmin Park25383742008-08-27 14:45:20 +090019
Miquel Raynalceb9cae2018-09-06 09:08:45 +020020#define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" : \
21 (type == MTD_DEV_TYPE_NOR ? "nor" : \
22 (type == MTD_DEV_TYPE_ONENAND ? "onenand" : \
23 "spi-nand"))) \
wdenkfe8c2802002-11-03 00:38:21 +000024
Wolfgang Denk47f57792005-08-08 01:03:24 +020025struct mtd_device {
26 struct list_head link;
27 struct mtdids *id; /* parent mtd id entry */
28 u16 num_parts; /* number of partitions on this device */
29 struct list_head parts; /* partitions */
wdenkfe8c2802002-11-03 00:38:21 +000030};
31
Wolfgang Denk47f57792005-08-08 01:03:24 +020032struct part_info {
33 struct list_head link;
34 char *name; /* partition name */
35 u8 auto_name; /* set to 1 for generated name */
Paul Burton5f578df2013-09-04 15:16:57 +010036 u64 size; /* total size of the partition */
37 u64 offset; /* offset within device */
Wolfgang Denk47f57792005-08-08 01:03:24 +020038 void *jffs2_priv; /* used internaly by jffs2 */
39 u32 mask_flags; /* kernel MTD mask flags */
Ilya Yanok85cceb52008-11-13 19:49:32 +030040 u32 sector_size; /* size of sector */
Wolfgang Denk47f57792005-08-08 01:03:24 +020041 struct mtd_device *dev; /* parent device */
42};
wdenkfe8c2802002-11-03 00:38:21 +000043
Wolfgang Denk47f57792005-08-08 01:03:24 +020044struct mtdids {
45 struct list_head link;
46 u8 type; /* device type */
47 u8 num; /* device number */
Paul Burton5f578df2013-09-04 15:16:57 +010048 u64 size; /* device size */
Wolfgang Denk47f57792005-08-08 01:03:24 +020049 char *mtd_id; /* linux kernel device id */
wdenkfe8c2802002-11-03 00:38:21 +000050};
51
52#define ldr_strlen strlen
53#define ldr_strncmp strncmp
54#define ldr_memcpy memcpy
55#define putstr(x) printf("%s", x)
56#define mmalloc malloc
57#define UDEBUG printf
58
59#define putnstr(str, size) printf("%*.*s", size, size, str)
60#define ldr_output_string(x) puts(x)
61#define putLabeledWord(x, y) printf("%s %08x\n", x, (unsigned int)y)
62#define led_blink(x, y, z, a)
63
Kyungmin Parkad7ae362008-11-19 16:32:36 +010064/* common/cmd_jffs2.c */
65extern int mtdparts_init(void);
66extern int find_dev_and_part(const char *id, struct mtd_device **dev,
67 u8 *part_num, struct part_info **part);
Anatolij Gustschin6c44c382010-03-16 17:10:05 +010068extern struct mtd_device *device_find(u8 type, u8 num);
Kyungmin Parkad7ae362008-11-19 16:32:36 +010069
wdenkfe8c2802002-11-03 00:38:21 +000070#endif /* load_kernel_h */