uclinux.c (cf9ce948f47640797bd19980e1d99c6d17d0bdc3) | uclinux.c (81f53ff89c136b72fc35a91d676aca2bc332bd33) |
---|---|
1/****************************************************************************/ 2 3/* 4 * uclinux.c -- generic memory mapped MTD driver for uclinux 5 * 6 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) 7 */ 8 --- 9 unchanged lines hidden (view full) --- 18#include <linux/mtd/mtd.h> 19#include <linux/mtd/map.h> 20#include <linux/mtd/partitions.h> 21#include <asm/io.h> 22#include <asm/sections.h> 23 24/****************************************************************************/ 25 | 1/****************************************************************************/ 2 3/* 4 * uclinux.c -- generic memory mapped MTD driver for uclinux 5 * 6 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) 7 */ 8 --- 9 unchanged lines hidden (view full) --- 18#include <linux/mtd/mtd.h> 19#include <linux/mtd/map.h> 20#include <linux/mtd/partitions.h> 21#include <asm/io.h> 22#include <asm/sections.h> 23 24/****************************************************************************/ 25 |
26#ifdef CONFIG_MTD_ROM 27#define MAP_NAME "rom" 28#else 29#define MAP_NAME "ram" 30#endif 31 |
|
26struct map_info uclinux_ram_map = { | 32struct map_info uclinux_ram_map = { |
27 .name = "RAM", 28 .phys = (unsigned long)__bss_stop, | 33 .name = MAP_NAME, |
29 .size = 0, 30}; 31 | 34 .size = 0, 35}; 36 |
37static unsigned long physaddr = -1; 38module_param(physaddr, ulong, S_IRUGO); 39 |
|
32static struct mtd_info *uclinux_ram_mtdinfo; 33 34/****************************************************************************/ 35 36static struct mtd_partition uclinux_romfs[] = { 37 { .name = "ROMfs" } 38}; 39 --- 15 unchanged lines hidden (view full) --- 55/****************************************************************************/ 56 57static int __init uclinux_mtd_init(void) 58{ 59 struct mtd_info *mtd; 60 struct map_info *mapp; 61 62 mapp = &uclinux_ram_map; | 40static struct mtd_info *uclinux_ram_mtdinfo; 41 42/****************************************************************************/ 43 44static struct mtd_partition uclinux_romfs[] = { 45 { .name = "ROMfs" } 46}; 47 --- 15 unchanged lines hidden (view full) --- 63/****************************************************************************/ 64 65static int __init uclinux_mtd_init(void) 66{ 67 struct mtd_info *mtd; 68 struct map_info *mapp; 69 70 mapp = &uclinux_ram_map; |
71 72 if (physaddr == -1) 73 mapp->phys = (resource_size_t)__bss_stop; 74 else 75 mapp->phys = physaddr; 76 |
|
63 if (!mapp->size) 64 mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8)))); 65 mapp->bankwidth = 4; 66 | 77 if (!mapp->size) 78 mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8)))); 79 mapp->bankwidth = 4; 80 |
67 printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n", | 81 printk("uclinux[mtd]: probe address=0x%x size=0x%x\n", |
68 (int) mapp->phys, (int) mapp->size); 69 70 /* 71 * The filesystem is guaranteed to be in direct mapped memory. It is 72 * directly following the kernels own bss region. Following the same 73 * mechanism used by architectures setting up traditional initrds we 74 * use phys_to_virt to get the virtual address of its start. 75 */ 76 mapp->virt = phys_to_virt(mapp->phys); 77 78 if (mapp->virt == 0) { 79 printk("uclinux[mtd]: no virtual mapping?\n"); 80 return(-EIO); 81 } 82 83 simple_map_init(mapp); 84 | 82 (int) mapp->phys, (int) mapp->size); 83 84 /* 85 * The filesystem is guaranteed to be in direct mapped memory. It is 86 * directly following the kernels own bss region. Following the same 87 * mechanism used by architectures setting up traditional initrds we 88 * use phys_to_virt to get the virtual address of its start. 89 */ 90 mapp->virt = phys_to_virt(mapp->phys); 91 92 if (mapp->virt == 0) { 93 printk("uclinux[mtd]: no virtual mapping?\n"); 94 return(-EIO); 95 } 96 97 simple_map_init(mapp); 98 |
85 mtd = do_map_probe("map_ram", mapp); | 99 mtd = do_map_probe("map_" MAP_NAME, mapp); |
86 if (!mtd) { 87 printk("uclinux[mtd]: failed to find a mapping?\n"); 88 return(-ENXIO); 89 } 90 91 mtd->owner = THIS_MODULE; 92 mtd->_point = uclinux_point; 93 mtd->priv = mapp; --- 19 unchanged lines hidden (view full) --- 113 114/****************************************************************************/ 115 116module_init(uclinux_mtd_init); 117module_exit(uclinux_mtd_cleanup); 118 119MODULE_LICENSE("GPL"); 120MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>"); | 100 if (!mtd) { 101 printk("uclinux[mtd]: failed to find a mapping?\n"); 102 return(-ENXIO); 103 } 104 105 mtd->owner = THIS_MODULE; 106 mtd->_point = uclinux_point; 107 mtd->priv = mapp; --- 19 unchanged lines hidden (view full) --- 127 128/****************************************************************************/ 129 130module_init(uclinux_mtd_init); 131module_exit(uclinux_mtd_cleanup); 132 133MODULE_LICENSE("GPL"); 134MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>"); |
121MODULE_DESCRIPTION("Generic RAM based MTD for uClinux"); | 135MODULE_DESCRIPTION("Generic MTD for uClinux"); |
122 123/****************************************************************************/ | 136 137/****************************************************************************/ |