📄 quantum.c
字号:
/* * drivers/mtd/maps/quantum.c * * MTD mapping for the MKS Quantum board. * * Author: shlomo_kut@mksinst.com * * 2004 (C) MKS Instruments Inc. This file is licensed under * the terms of the GNU General Public License version 2. This program * is licensed "as is" without any warranty of any kind, whether express * or implied. */#include <linux/module.h>#include <linux/init.h>#include <linux/types.h>#include <linux/kernel.h>#include <asm/io.h>#include <linux/mtd/mtd.h>#include <linux/mtd/map.h>#include <linux/mtd/partitions.h>#define FLASH_ADDR 0xff000000#define FLASH_SIZE 0x1000000#ifndef CONFIG_MTD_PARTITIONS#error need to define CONFIG_MTD_PARTITIONS#endifstatic struct mtd_info *mymtd;struct map_info quantum_map = { name: "QUANTUM", size: FLASH_SIZE, buswidth: 4,};/* * The QUANTUM seems to be working OK with a High BootLoader. Using this configuration * The 16MB Flash is used in the following way: * 0xFF000000-0xFF6FFFFF - 7MB Kernel Image * 0xFF700000-0xFEFFFFFF - 8MB FFS * 0xFFF00000-0xFFF3FFFF - 256K BootLoader * 0xFFF40000-0xFFF7FFFF - 256K u-boot env1 * 0xFFF80000-0xFFFBFFFF - 256K u-boot env2 * 0xFFFC0000-0xFFFFFFFF - 256K u-boot FPGA image */static struct mtd_partition quantum_partition[] ={ { name: "Kernel Image", size: 0x00700000, offset: 0 }, { name: "Flash Filesystem", size: 0x00800000, offset: MTDPART_OFS_APPEND }, { name: "u-boot", size: 0x00040000, offset: MTDPART_OFS_APPEND }, { name: "u-boot-env1", size: 0x00040000, offset: MTDPART_OFS_APPEND }, { name: "u-boot-env2", size: 0x00040000, offset: MTDPART_OFS_APPEND }, { name: "u-boot-fpga", size: 0x00040000, offset: MTDPART_OFS_APPEND }};#define NB_OF(x) (sizeof(x)/sizeof(x[0]))static int __init init_quantum (void){ printk (KERN_ALERT "QUANTUM flash device: %x at %x\n", FLASH_SIZE, FLASH_ADDR); quantum_map.virt = (unsigned long) ioremap (FLASH_ADDR, FLASH_SIZE); quantum_map.phys = FLASH_ADDR; if (!quantum_map.virt) { printk (KERN_ALERT "Failed to ioremap\n"); return -EIO; } simple_map_init(&quantum_map); mymtd = do_map_probe ("cfi_probe", &quantum_map); if (!mymtd) { printk ("cfi_probe failed\n"); iounmap ((void *) quantum_map.virt); return -ENXIO; } mymtd->owner = THIS_MODULE; printk (KERN_NOTICE "Using static partition definition\n"); add_mtd_partitions (mymtd, quantum_partition, NB_OF (quantum_partition)); return 0;}static void __exit cleanup_quantum (void){ if (mymtd) { del_mtd_device (mymtd); map_destroy (mymtd); } if (quantum_map.virt) { iounmap ((void *) quantum_map.virt); quantum_map.virt = 0; }}module_init(init_quantum);module_exit(cleanup_quantum);MODULE_LICENSE("GPL");MODULE_AUTHOR("Shlomo Kut <shlomo_kut@mksinst.com>");MODULE_DESCRIPTION("MTD map driver for QUANTUM board");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -