183d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */ 2fe8c2806Swdenk #ifndef load_kernel_h 3fe8c2806Swdenk #define load_kernel_h 4fe8c2806Swdenk /*------------------------------------------------------------------------- 5fe8c2806Swdenk * Filename: load_kernel.h 6fe8c2806Swdenk * Version: $Id: load_kernel.h,v 1.3 2002/01/25 01:34:11 nyet Exp $ 7fe8c2806Swdenk * Copyright: Copyright (C) 2001, Russ Dill 8fe8c2806Swdenk * Author: Russ Dill <Russ.Dill@asu.edu> 9fe8c2806Swdenk * Description: header for load kernel modules 10fe8c2806Swdenk *-----------------------------------------------------------------------*/ 11fe8c2806Swdenk 12700a0c64SWolfgang Denk #include <linux/list.h> 13fe8c2806Swdenk 14700a0c64SWolfgang Denk /* mtd device types */ 15700a0c64SWolfgang Denk #define MTD_DEV_TYPE_NOR 0x0001 16700a0c64SWolfgang Denk #define MTD_DEV_TYPE_NAND 0x0002 171a7f8cceSKyungmin Park #define MTD_DEV_TYPE_ONENAND 0x0004 18*00ac922dSMiquel Raynal #define MTD_DEV_TYPE_SPINAND 0x0008 191a7f8cceSKyungmin Park 20*00ac922dSMiquel Raynal #define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" : \ 21*00ac922dSMiquel Raynal (type == MTD_DEV_TYPE_NOR ? "nor" : \ 22*00ac922dSMiquel Raynal (type == MTD_DEV_TYPE_ONENAND ? "onenand" : \ 23*00ac922dSMiquel Raynal "spi-nand"))) \ 24fe8c2806Swdenk 25700a0c64SWolfgang Denk struct mtd_device { 26700a0c64SWolfgang Denk struct list_head link; 27700a0c64SWolfgang Denk struct mtdids *id; /* parent mtd id entry */ 28700a0c64SWolfgang Denk u16 num_parts; /* number of partitions on this device */ 29700a0c64SWolfgang Denk struct list_head parts; /* partitions */ 30fe8c2806Swdenk }; 31fe8c2806Swdenk 32700a0c64SWolfgang Denk struct part_info { 33700a0c64SWolfgang Denk struct list_head link; 34700a0c64SWolfgang Denk char *name; /* partition name */ 35700a0c64SWolfgang Denk u8 auto_name; /* set to 1 for generated name */ 3639ac3447SPaul Burton u64 size; /* total size of the partition */ 3739ac3447SPaul Burton u64 offset; /* offset within device */ 38700a0c64SWolfgang Denk void *jffs2_priv; /* used internaly by jffs2 */ 39700a0c64SWolfgang Denk u32 mask_flags; /* kernel MTD mask flags */ 40e0b55325SIlya Yanok u32 sector_size; /* size of sector */ 41700a0c64SWolfgang Denk struct mtd_device *dev; /* parent device */ 42700a0c64SWolfgang Denk }; 43fe8c2806Swdenk 44700a0c64SWolfgang Denk struct mtdids { 45700a0c64SWolfgang Denk struct list_head link; 46700a0c64SWolfgang Denk u8 type; /* device type */ 47700a0c64SWolfgang Denk u8 num; /* device number */ 4839ac3447SPaul Burton u64 size; /* device size */ 49700a0c64SWolfgang Denk char *mtd_id; /* linux kernel device id */ 50fe8c2806Swdenk }; 51fe8c2806Swdenk 52fe8c2806Swdenk #define ldr_strlen strlen 53fe8c2806Swdenk #define ldr_strncmp strncmp 54fe8c2806Swdenk #define ldr_memcpy memcpy 55fe8c2806Swdenk #define putstr(x) printf("%s", x) 56fe8c2806Swdenk #define mmalloc malloc 57fe8c2806Swdenk #define UDEBUG printf 58fe8c2806Swdenk 59fe8c2806Swdenk #define putnstr(str, size) printf("%*.*s", size, size, str) 60fe8c2806Swdenk #define ldr_output_string(x) puts(x) 61fe8c2806Swdenk #define putLabeledWord(x, y) printf("%s %08x\n", x, (unsigned int)y) 62fe8c2806Swdenk #define led_blink(x, y, z, a) 63fe8c2806Swdenk 647e6ee7adSKyungmin Park /* common/cmd_jffs2.c */ 657e6ee7adSKyungmin Park extern int mtdparts_init(void); 667e6ee7adSKyungmin Park extern int find_dev_and_part(const char *id, struct mtd_device **dev, 677e6ee7adSKyungmin Park u8 *part_num, struct part_info **part); 683c950e2eSAnatolij Gustschin extern struct mtd_device *device_find(u8 type, u8 num); 697e6ee7adSKyungmin Park 70fe8c2806Swdenk #endif /* load_kernel_h */ 71