📄 sa1100-flash.c
字号:
static unsigned long graphicsmaster_max_flash_size = 0x01000000;static struct mtd_partition graphicsmaster_partitions[] = { { name: "zImage", offset: 0, size: 0x100000 }, { name: "ramdisk.gz", offset: MTDPART_OFS_APPEND, size: 0x300000 }, { name: "User FS", offset: MTDPART_OFS_APPEND, size: MTDPART_SIZ_FULL }};#endif#ifdef CONFIG_SA1100_PANGOLINstatic unsigned long pangolin_max_flash_size = 0x04000000;static struct mtd_partition pangolin_partitions[] = { { name: "boot firmware", offset: 0x00000000, size: 0x00080000, mask_flags: MTD_WRITEABLE, /* force read-only */ }, { name: "kernel", offset: 0x00080000, size: 0x00100000, }, { name: "initrd", offset: 0x00180000, size: 0x00280000, }, { name: "initrd-test", offset: 0x00400000, size: 0x03C00000, }};#endif#ifdef CONFIG_SA1100_YOPYstatic unsigned long yopy_max_flash_size = 0x08000000;static struct mtd_partition yopy_partitions[] = { { name: "boot firmware", offset: 0x00000000, size: 0x00040000, mask_flags: MTD_WRITEABLE, /* force read-only */ }, { name: "kernel", offset: 0x00080000, size: 0x00080000, }, { name: "initrd", offset: 0x00100000, size: 0x00300000, }, { name: "root", offset: 0x00400000, size: 0x01000000, },};#endif#ifdef CONFIG_SA1100_JORNADA720static unsigned long jornada720_max_flash_size = 0x02000000;static struct mtd_partition jornada720_partitions[] = { { name: "JORNADA720 boot firmware", size: 0x00040000, offset: 0, mask_flags: MTD_WRITEABLE /* force read-only */ },{ name: "JORNADA720 kernel", size: 0x000c0000, offset: 0x40000 },{ name: "JORNADA720 params", size: 0x00040000, offset: 0x100000 },{ name: "JORNADA720 initrd", size: 0x00100000, offset: 0x00140000 },{ name: "JORNADA720 root cramfs", size: 0x00300000, offset: 0x00240000 },{ name: "JORNADA720 usr cramfs", size: 0x00800000, offset: 0x00540000 },{ name: "JORNADA720 usr local", offset: 0x00d00000, size: 0 /* will expand to the end of the flash */ }};#endif#ifdef CONFIG_SA1100_SHERMANstatic unsigned long sherman_max_flash_size = 0x02000000;static struct mtd_partition sherman_partitions[] = { { offset: 0, size: 0x50000 }, { offset: MTDPART_OFS_APPEND, size: 0x70000 }, { offset: MTDPART_OFS_APPEND, size: 0x600000 }, { offset: MTDPART_OFS_APPEND, size: 0xA0000 }};#endif#ifdef CONFIG_SA1100_STORKstatic unsigned long stork_max_flash_size = 0x02000000;static struct mtd_partition stork_partitions[] = { { name: "STORK boot firmware", size: 0x00040000, offset: 0, mask_flags: MTD_WRITEABLE /* force read-only */ },{ name: "STORK params", size: 0x00040000, offset: 0x40000 },{ name: "STORK kernel", size: 0x00100000, offset: 0x80000 },{#ifdef CONFIG_JFFS2_FS name: "STORK root jffs2", offset: 0x00180000, size: MTDPART_SIZ_FULL#else name: "STORK initrd", size: 0x00100000, offset: 0x00180000 },{ name: "STORK root cramfs", size: 0x00300000, offset: 0x00280000 },{ name: "STORK usr cramfs", size: 0x00800000, offset: 0x00580000 },{ name: "STORK usr local", offset: 0x00d80000, size: MTDPART_SIZ_FULL#endif }};#endif#define NB_OF(x) (sizeof(x)/sizeof(x[0]))extern int parse_redboot_partitions(struct mtd_info *master, struct mtd_partition **pparts);extern int parse_bootldr_partitions(struct mtd_info *master, struct mtd_partition **pparts);static struct mtd_partition *parsed_parts;static struct mtd_info *mymtd;int __init sa1100_mtd_init(void){ struct mtd_partition *parts; int nb_parts = 0; int parsed_nr_parts = 0; char *part_type; /* Default flash buswidth */ sa1100_map.buswidth = (MSC0 & MSC_RBW) ? 2 : 4; /* * Static partition definition selection */ part_type = "static";#ifdef CONFIG_SA1100_ASSABET if (machine_is_assabet()) { parts = assabet_partitions; nb_parts = NB_OF(assabet_partitions); sa1100_map.size = assabet_max_flash_size; }#endif#ifdef CONFIG_SA1100_HUW_WEBPANEL if (machine_is_huw_webpanel()) { parts = huw_webpanel_partitions; nb_parts = NB_OF(huw_webpanel_partitions); sa1100_map.size = huw_webpanel_max_flash_size; }#endif#ifdef CONFIG_SA1100_H3600 if (machine_is_h3600()) { parts = h3600_partitions; nb_parts = NB_OF(h3600_partitions); sa1100_map.size = h3600_max_flash_size; sa1100_map.set_vpp = h3600_set_vpp; }#endif#ifdef CONFIG_SA1100_FREEBIRD if (machine_is_freebird()) { parts = freebird_partitions; nb_parts = NB_OF(freebird_partitions); sa1100_map.size = freebird_max_flash_size; }#endif#ifdef CONFIG_SA1100_CERF if (machine_is_cerf()) { parts = cerf_partitions; nb_parts = NB_OF(cerf_partitions); sa1100_map.size = cerf_max_flash_size; }#endif#ifdef CONFIG_SA1100_GRAPHICSCLIENT if (machine_is_graphicsclient()) { parts = graphicsclient_partitions; nb_parts = NB_OF(graphicsclient_partitions); sa1100_map.size = graphicsclient_max_flash_size; sa1100_map.buswidth = (MSC1 & MSC_RBW) ? 2:4; }#endif#ifdef CONFIG_SA1100_GRAPHICSMASTER if (machine_is_graphicsmaster()) { parts = graphicsmaster_partitions; nb_parts = NB_OF(graphicsmaster_partitions); sa1100_map.size = graphicsmaster_max_flash_size; sa1100_map.buswidth = (MSC1 & MSC_RBW) ? 2:4; }#endif#ifdef CONFIG_SA1100_PANGOLIN if (machine_is_pangolin()) { parts = pangolin_partitions; nb_parts = NB_OF(pangolin_partitions); sa1100_map.size = pangolin_max_flash_size; }#endif#ifdef CONFIG_SA1100_JORNADA720 if (machine_is_jornada720()) { parts = jornada720_partitions; nb_parts = NB_OF(jornada720_partitions); sa1100_map.size = jornada720_max_flash_size; sa1100_map.set_vpp = jornada720_set_vpp; }#endif#ifdef CONFIG_SA1100_YOPY if (machine_is_yopy()) { parts = yopy_partitions; nb_parts = NB_OF(yopy_partitions); sa1100_map.size = yopy_max_flash_size; }#endif#ifdef CONFIG_SA1100_SHERMAN if (machine_is_sherman()) { parts = sherman_partitions; nb_parts = NB_OF(sherman_partitions); sa1100_map.size = sherman_max_flash_size; }#endif#ifdef CONFIG_SA1100_FLEXANET if (machine_is_flexanet()) { parts = flexanet_partitions; nb_parts = NB_OF(flexanet_partitions); sa1100_map.size = flexanet_max_flash_size; }#endif#ifdef CONFIG_SA1100_STORK if (machine_is_stork()) { parts = stork_partitions; nb_parts = NB_OF(stork_partitions); sa1100_map.size = stork_max_flash_size; }#endif /* * Now let's probe for the actual flash. Do it here since * specific machine settings might have been set above. */ printk(KERN_NOTICE "SA1100 flash: probing %d-bit flash bus\n", sa1100_map.buswidth*8); mymtd = do_map_probe("cfi_probe", &sa1100_map); if (!mymtd) return -ENXIO; mymtd->module = THIS_MODULE; /* * Dynamic partition selection stuff (might override the static ones) */#ifdef CONFIG_MTD_REDBOOT_PARTS if (parsed_nr_parts == 0) { int ret = parse_redboot_partitions(mymtd, &parsed_parts); if (ret > 0) { part_type = "RedBoot"; parsed_nr_parts = ret; } }#endif#ifdef CONFIG_MTD_BOOTLDR_PARTS if (parsed_nr_parts == 0) { int ret = parse_bootldr_partitions(mymtd, &parsed_parts); if (ret > 0) { part_type = "Compaq bootldr"; parsed_nr_parts = ret; } }#endif if (parsed_nr_parts > 0) { parts = parsed_parts; nb_parts = parsed_nr_parts; } if (nb_parts == 0) { printk(KERN_NOTICE "SA1100 flash: no partition info available, registering whole flash at once\n"); add_mtd_device(mymtd); } else { printk(KERN_NOTICE "Using %s partition definition\n", part_type); add_mtd_partitions(mymtd, parts, nb_parts); } return 0;}static void __exit sa1100_mtd_cleanup(void){ if (mymtd) { del_mtd_partitions(mymtd); map_destroy(mymtd); if (parsed_parts) kfree(parsed_parts); }}module_init(sa1100_mtd_init);module_exit(sa1100_mtd_cleanup);MODULE_AUTHOR("Nicolas Pitre");MODULE_DESCRIPTION("SA1100 CFI map driver");MODULE_LICENSE("GPL");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -