/openbmc/u-boot/drivers/mtd/ |
H A D | mtdcore.c | 3 * Core registration and callback routines for MTD 34 #include <linux/mtd/mtd.h> 35 #include <linux/mtd/partitions.h> 73 .name = "mtd", 178 /* REVISIT once MTD uses the driver model better, whoever allocates 183 struct mtd_info __maybe_unused *mtd = dev_get_drvdata(dev); in mtd_release() local 184 dev_t index = MTD_DEVT(mtd->index); in mtd_release() 193 struct mtd_info *mtd = dev_get_drvdata(dev); in mtd_cls_suspend() local 195 return mtd ? mtd_suspend(mtd) : 0; in mtd_cls_suspend() 200 struct mtd_info *mtd = dev_get_drvdata(dev); in mtd_cls_resume() local [all …]
|
H A D | cfi_mtd.c | 13 #include <linux/mtd/mtd.h> 14 #include <linux/mtd/concat.h> 15 #include <mtd/cfi_flash.h> 23 static int cfi_mtd_erase(struct mtd_info *mtd, struct erase_info *instr) in cfi_mtd_erase() argument 25 flash_info_t *fi = mtd->priv; in cfi_mtd_erase() 67 static int cfi_mtd_read(struct mtd_info *mtd, loff_t from, size_t len, in cfi_mtd_read() argument 70 flash_info_t *fi = mtd->priv; in cfi_mtd_read() 79 static int cfi_mtd_write(struct mtd_info *mtd, loff_t to, size_t len, in cfi_mtd_write() argument 82 flash_info_t *fi = mtd->priv; in cfi_mtd_write() 98 static void cfi_mtd_sync(struct mtd_info *mtd) in cfi_mtd_sync() argument [all …]
|
H A D | altera_qspi.c | 12 #include <mtd.h> 58 static void altera_qspi_get_locked_range(struct mtd_info *mtd, loff_t *ofs, 63 struct mtd_info *mtd = info->mtd; in flash_print_info() local 69 altera_qspi_get_locked_range(mtd, &ofs, &len); in flash_print_info() 85 struct mtd_info *mtd = info->mtd; in flash_erase() local 90 instr.mtd = mtd; in flash_erase() 91 instr.addr = mtd->erasesize * s_first; in flash_erase() 92 instr.len = mtd->erasesize * (s_last + 1 - s_first); in flash_erase() 94 ret = mtd_erase(mtd, &instr); in flash_erase() 105 struct mtd_info *mtd = info->mtd; in write_buff() local [all …]
|
H A D | mtdpart.c | 3 * Simple MTD partitioning layer 26 #include <linux/mtd/mtd.h> 27 #include <linux/mtd/partitions.h> 87 * @partition: MTD partition structure to fill 187 * Stateless function that takes a @parent MTD device, a string @_mtdparts 189 * the corresponding MTD partition structure array @_parts. Both the name and 193 * @parent: MTD device which contains the partitions 285 * MTD methods which simply translate the effective address and pass through 289 static int part_read(struct mtd_info *mtd, loff_t from, size_t len, in part_read() argument 295 stats = mtd->parent->ecc_stats; in part_read() [all …]
|
/openbmc/linux/drivers/mtd/ |
H A D | mtdcore.c | 3 * Core registration and callback routines for MTD 34 #include <linux/mtd/mtd.h> 35 #include <linux/mtd/partitions.h> 45 struct mtd_info *mtd = dev_get_drvdata(dev); in mtd_cls_suspend() local 47 return mtd ? mtd_suspend(mtd) : 0; in mtd_cls_suspend() 52 struct mtd_info *mtd = dev_get_drvdata(dev); in mtd_cls_resume() local 54 if (mtd) in mtd_cls_resume() 55 mtd_resume(mtd); in mtd_cls_resume() 66 .name = "mtd", 88 /* REVISIT once MTD uses the driver model better, whoever allocates [all …]
|
H A D | mtdpstore.c | 8 #include <linux/mtd/mtd.h> 16 struct mtd_info *mtd; member 30 struct mtd_info *mtd = cxt->mtd; in mtdpstore_block_isbad() local 33 off = ALIGN_DOWN(off, mtd->erasesize); in mtdpstore_block_isbad() 34 blknum = div_u64(off, mtd->erasesize); in mtdpstore_block_isbad() 38 ret = mtd_block_isbad(mtd, off); in mtdpstore_block_isbad() 40 dev_err(&mtd->dev, "mtd_block_isbad failed, aborting\n"); in mtdpstore_block_isbad() 52 struct mtd_info *mtd = cxt->mtd; in mtdpstore_panic_block_isbad() local 55 off = ALIGN_DOWN(off, mtd->erasesize); in mtdpstore_panic_block_isbad() 56 blknum = div_u64(off, mtd->erasesize); in mtdpstore_panic_block_isbad() [all …]
|
H A D | mtdchar.c | 22 #include <linux/mtd/mtd.h> 23 #include <linux/mtd/partitions.h> 24 #include <linux/mtd/map.h> 31 * Data structure to hold the pointer to the mtd device as well 35 struct mtd_info *mtd; member 42 return fixed_size_llseek(file, offset, orig, mfi->mtd->size); in mtdchar_lseek() 50 struct mtd_info *mtd; in mtdchar_open() local 59 mtd = get_mtd_device(NULL, devnum); in mtdchar_open() 61 if (IS_ERR(mtd)) in mtdchar_open() 62 return PTR_ERR(mtd); in mtdchar_open() [all …]
|
/openbmc/linux/include/linux/mtd/ |
H A D | mtd.h | 17 #include <mtd/mtd-abi.h> 37 uint64_t offset; /* At which this region starts, from the beginning of the MTD */ 64 * Note, some MTD drivers do not allow you to write more than one OOB area at 65 * one go. If you try to do that on such an MTD device, -EINVAL will be 66 * returned. If you want to make your implementation portable on all kind of MTD 107 int (*ecc)(struct mtd_info *mtd, int section, 109 int (*free)(struct mtd_info *mtd, int section, 168 * write-unit <-> (pair + group) conversions, we ask the MTD drivers to 171 * MTD users will then be able to query these information by using the 174 * @ngroups is here to help MTD users iterating over all the pages in a [all …]
|
/openbmc/u-boot/include/linux/mtd/ |
H A D | mtd.h | 16 #include <mtd/mtd-abi.h> 21 #include <mtd/mtd-abi.h> 46 struct mtd_info *mtd; member 62 uint64_t offset; /* At which this region starts, from the beginning of the MTD */ 130 int (*ecc)(struct mtd_info *mtd, int section, 132 int (*free)(struct mtd_info *mtd, int section, 138 * similar, smaller struct nand_ecclayout_user (in mtd-abi.h) that is retained 154 uint64_t size; // Total size of the MTD 171 * Size of the write buffer used by the MTD. MTD devices having a write 174 * buffer the MTD driver can (but doesn't have to) do 2 writesize [all …]
|
/openbmc/u-boot/cmd/ |
H A D | mtd.c | 3 * mtd.c 16 #include <mtd.h> 22 struct mtd_info *mtd; in get_mtd_by_name() local 26 mtd = get_mtd_device_nm(name); in get_mtd_by_name() 27 if (IS_ERR_OR_NULL(mtd)) in get_mtd_by_name() 28 printf("MTD device %s not found, ret %ld\n", name, in get_mtd_by_name() 29 PTR_ERR(mtd)); in get_mtd_by_name() 31 return mtd; in get_mtd_by_name() 34 static uint mtd_len_to_pages(struct mtd_info *mtd, u64 len) in mtd_len_to_pages() argument 36 do_div(len, mtd->writesize); in mtd_len_to_pages() [all …]
|
/openbmc/u-boot/drivers/mtd/nand/raw/ |
H A D | mxs_nand_spl.c | 11 static struct mtd_info *mtd; variable 14 static void mxs_nand_command(struct mtd_info *mtd, unsigned int command, in mxs_nand_command() argument 17 register struct nand_chip *chip = mtd_to_nand(mtd); in mxs_nand_command() 21 chip->cmd_ctrl(mtd, command, NAND_CLE); in mxs_nand_command() 25 chip->cmd_ctrl(mtd, column, NAND_ALE); in mxs_nand_command() 26 chip->cmd_ctrl(mtd, column >> 8, NAND_ALE); in mxs_nand_command() 29 chip->cmd_ctrl(mtd, page_addr, NAND_ALE); in mxs_nand_command() 30 chip->cmd_ctrl(mtd, page_addr >> 8, NAND_ALE); in mxs_nand_command() 33 chip->cmd_ctrl(mtd, page_addr >> 16, NAND_ALE); in mxs_nand_command() 35 chip->cmd_ctrl(mtd, NAND_CMD_NONE, 0); in mxs_nand_command() [all …]
|
H A D | nand_base.c | 3 * This is the generic MTD driver for NAND flash devices. It should be 7 * http://www.linux-mtd.infradead.org/doc/nand.html 20 * Check, if mtd->ecctype should be set to MTD_ECC_HW 39 #include <linux/mtd/mtd.h> 40 #include <linux/mtd/rawnand.h> 41 #include <linux/mtd/nand_ecc.h> 42 #include <linux/mtd/nand_bch.h> 44 #include <linux/mtd/partitions.h> 95 static int nand_get_device(struct mtd_info *mtd, int new_state); 97 static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, [all …]
|
H A D | nand_util.c | 3 * drivers/mtd/nand/raw/nand_util.c 10 * @references: borrowed heavily from Linux mtd-utils code: 16 * Artem Bityutskiy <dedekind1@gmail.com> from mtd-utils 29 #include <linux/mtd/mtd.h> 44 * @param mtd nand mtd instance to erase 48 * This code is ported from flash_eraseall.c from Linux mtd utils by 51 int nand_erase_opts(struct mtd_info *mtd, in nand_erase_opts() argument 59 const char *mtd_device = mtd->name; in nand_erase_opts() 61 struct nand_chip *chip = mtd_to_nand(mtd); in nand_erase_opts() 63 if ((opts->offset & (mtd->erasesize - 1)) != 0) { in nand_erase_opts() [all …]
|
H A D | vf610_nfc.c | 27 #include <linux/mtd/mtd.h> 28 #include <linux/mtd/rawnand.h> 29 #include <linux/mtd/partitions.h> 197 static inline u32 vf610_nfc_read(struct mtd_info *mtd, uint reg) in vf610_nfc_read() argument 199 struct vf610_nfc *nfc = mtd_to_nfc(mtd); in vf610_nfc_read() 204 static inline void vf610_nfc_write(struct mtd_info *mtd, uint reg, u32 val) in vf610_nfc_write() argument 206 struct vf610_nfc *nfc = mtd_to_nfc(mtd); in vf610_nfc_write() 211 static inline void vf610_nfc_set(struct mtd_info *mtd, uint reg, u32 bits) in vf610_nfc_set() argument 213 vf610_nfc_write(mtd, reg, vf610_nfc_read(mtd, reg) | bits); in vf610_nfc_set() 216 static inline void vf610_nfc_clear(struct mtd_info *mtd, uint reg, u32 bits) in vf610_nfc_clear() argument [all …]
|
/openbmc/linux/drivers/mtd/nand/onenand/ |
H A D | onenand_base.c | 26 #include <linux/mtd/mtd.h> 27 #include <linux/mtd/onenand.h> 28 #include <linux/mtd/partitions.h> 66 static int flexonenand_ooblayout_ecc(struct mtd_info *mtd, int section, in flexonenand_ooblayout_ecc() argument 78 static int flexonenand_ooblayout_free(struct mtd_info *mtd, int section, in flexonenand_ooblayout_free() argument 102 static int onenand_ooblayout_128_ecc(struct mtd_info *mtd, int section, in onenand_ooblayout_128_ecc() argument 114 static int onenand_ooblayout_128_free(struct mtd_info *mtd, int section, in onenand_ooblayout_128_free() argument 138 static int onenand_ooblayout_32_64_ecc(struct mtd_info *mtd, int section, in onenand_ooblayout_32_64_ecc() argument 150 static int onenand_ooblayout_32_64_free(struct mtd_info *mtd, int section, in onenand_ooblayout_32_64_free() argument 153 int sections = (mtd->oobsize / 32) * 2; in onenand_ooblayout_32_64_free() [all …]
|
/openbmc/u-boot/drivers/mtd/onenand/ |
H A D | onenand_base.c | 2 * linux/drivers/mtd/onenand/onenand_base.c 25 #include <linux/mtd/mtd.h> 26 #include "linux/mtd/flashchip.h" 27 #include <linux/mtd/onenand.h> 290 * @param mtd MTD device structure 293 int flexonenand_region(struct mtd_info *mtd, loff_t addr) in flexonenand_region() argument 297 for (i = 0; i < mtd->numeraseregions; i++) in flexonenand_region() 298 if (addr < mtd->eraseregions[i].offset) in flexonenand_region() 317 * @param mtd MTD device structure 325 static int onenand_command(struct mtd_info *mtd, int cmd, loff_t addr, in onenand_command() argument [all …]
|
/openbmc/linux/drivers/mtd/ubi/ |
H A D | gluebi.c | 9 * This is a small driver which implements fake MTD devices on top of UBI 11 * MTD-oriented software (including all the legacy software) work on top of 14 * Gluebi emulates MTD devices of "MTD_UBIVOLUME" type. Their minimal I/O unit 15 * size (@mtd->writesize) is equivalent to the UBI minimal I/O unit. The 26 #include <linux/mtd/ubi.h> 27 #include <linux/mtd/mtd.h> 36 * @mtd: emulated MTD device description object 44 struct mtd_info mtd; member 77 * gluebi_get_device - get MTD device reference. 78 * @mtd: the MTD device description object [all …]
|
/openbmc/linux/drivers/mtd/nand/raw/ |
H A D | mpc5121_nfc.c | 21 #include <linux/mtd/mtd.h> 22 #include <linux/mtd/rawnand.h> 23 #include <linux/mtd/partitions.h> 119 static void mpc5121_nfc_done(struct mtd_info *mtd); 122 static inline u16 nfc_read(struct mtd_info *mtd, uint reg) in nfc_read() argument 124 struct nand_chip *chip = mtd_to_nand(mtd); in nfc_read() 131 static inline void nfc_write(struct mtd_info *mtd, uint reg, u16 val) in nfc_write() argument 133 struct nand_chip *chip = mtd_to_nand(mtd); in nfc_write() 140 static inline void nfc_set(struct mtd_info *mtd, uint reg, u16 bits) in nfc_set() argument 142 nfc_write(mtd, reg, nfc_read(mtd, reg) | bits); in nfc_set() [all …]
|
/openbmc/linux/Documentation/ABI/testing/ |
H A D | sysfs-class-mtd | 1 What: /sys/class/mtd/ 4 Contact: linux-mtd@lists.infradead.org 6 The mtd/ class subdirectory belongs to the MTD subsystem 7 (MTD core). 9 What: /sys/class/mtd/mtdX/ 12 Contact: linux-mtd@lists.infradead.org 14 The /sys/class/mtd/mtd{0,1,2,3,...} directories correspond 19 What: /sys/class/mtd/mtdXro/ 22 Contact: linux-mtd@lists.infradead.org 25 nodes for /sys/class/mtd/mtdX/ . [all …]
|
/openbmc/linux/drivers/mtd/chips/ |
H A D | map_ram.c | 15 #include <linux/mtd/mtd.h> 16 #include <linux/mtd/map.h> 24 static int mapram_point (struct mtd_info *mtd, loff_t from, size_t len, 26 static int mapram_unpoint(struct mtd_info *mtd, loff_t from, size_t len); 37 struct mtd_info *mtd; in map_ram_probe() local 60 mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); in map_ram_probe() 61 if (!mtd) in map_ram_probe() 65 mtd->priv = map; in map_ram_probe() 66 mtd->name = map->name; in map_ram_probe() 67 mtd->type = MTD_RAM; in map_ram_probe() [all …]
|
H A D | map_rom.c | 16 #include <linux/mtd/mtd.h> 17 #include <linux/mtd/map.h> 23 static int maprom_erase (struct mtd_info *mtd, struct erase_info *info); 24 static int maprom_point (struct mtd_info *mtd, loff_t from, size_t len, 26 static int maprom_unpoint(struct mtd_info *mtd, loff_t from, size_t len); 46 struct mtd_info *mtd; in map_rom_probe() local 48 mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); in map_rom_probe() 49 if (!mtd) in map_rom_probe() 53 mtd->priv = map; in map_rom_probe() 54 mtd->name = map->name; in map_rom_probe() [all …]
|
H A D | map_absent.c | 6 * This map driver is used to allocate "placeholder" MTD 9 * registration of MTD device nodes regardless of probe outcome. 27 #include <linux/mtd/mtd.h> 28 #include <linux/mtd/map.h> 47 struct mtd_info *mtd; in map_absent_probe() local 49 mtd = kzalloc(sizeof(*mtd), GFP_KERNEL); in map_absent_probe() 50 if (!mtd) { in map_absent_probe() 55 mtd->priv = map; in map_absent_probe() 56 mtd->name = map->name; in map_absent_probe() 57 mtd->type = MTD_ABSENT; in map_absent_probe() [all …]
|
/openbmc/linux/drivers/mtd/devices/ |
H A D | mtdram.c | 2 * mtdram - a test mtd device 18 #include <linux/mtd/mtd.h> 19 #include <linux/mtd/mtdram.h> 34 // We could store these in the mtd structure, but we only support 1 device.. 37 static int check_offs_len(struct mtd_info *mtd, loff_t ofs, uint64_t len) in check_offs_len() argument 42 if (mtd_mod_by_eb(ofs, mtd)) { in check_offs_len() 48 if (mtd_mod_by_eb(len, mtd)) { in check_offs_len() 56 static int ram_erase(struct mtd_info *mtd, struct erase_info *instr) in ram_erase() argument 58 if (check_offs_len(mtd, instr->addr, instr->len)) in ram_erase() 60 memset((char *)mtd->priv + instr->addr, 0xff, instr->len); in ram_erase() [all …]
|
/openbmc/linux/drivers/mtd/tests/ |
H A D | stresstest.c | 5 * Test random reads, writes and erases on MTD device. 16 #include <linux/mtd/mtd.h> 26 MODULE_PARM_DESC(dev, "MTD device number to use"); 32 static struct mtd_info *mtd; variable 73 if (offs >= mtd->erasesize) in do_read() 74 offs -= mtd->erasesize; in do_read() 75 if (offs + len > mtd->erasesize) in do_read() 76 len = mtd->erasesize - offs; in do_read() 78 addr = (loff_t)eb * mtd->erasesize + offs; in do_read() 79 return mtdtest_read(mtd, addr, len, readbuf); in do_read() [all …]
|
H A D | pagetest.c | 5 * Test page read and write on MTD device. 17 #include <linux/mtd/mtd.h> 26 MODULE_PARM_DESC(dev, "MTD device number to use"); 28 static struct mtd_info *mtd; variable 43 loff_t addr = (loff_t)ebnum * mtd->erasesize; in write_eraseblock() 45 prandom_bytes_state(&rnd_state, writebuf, mtd->erasesize); in write_eraseblock() 47 return mtdtest_write(mtd, addr, mtd->erasesize, writebuf); in write_eraseblock() 55 loff_t addr = (loff_t)ebnum * mtd->erasesize; in verify_eraseblock() 59 addr0 += mtd->erasesize; in verify_eraseblock() 61 addrn = mtd->size; in verify_eraseblock() [all …]
|