mtd/drivers/mtd/maps map_funcs.c,NONE,1.1 Config.in,1.47,1.48
GNUmakefile,1.9,1.10 Kconfig,1.6,1.7 Makefile,1.40,1.41
amd76xrom.c,1.3,1.4 arctic-mtd.c,1.4,1.5 autcpu12-nvram.c,1.1,1.2
beech-mtd.c,1.3,1.4 cdb89712.c,1.3,1.4 ceiva.c,1.3,1.4
cfi_flagadm.c,1.7,1.8 cstm_mips_ixx.c,1.5,1.6 dbox2-flash.c,1.5,1.6
dc21285.c,1.10,1.11 dilnetpc.c,1.8,1.9 ebony.c,1.3,1.4
edb7312.c,1.3,1.4 elan-104nc.c,1.13,1.14 epxa10db-flash.c,1.5,1.6
fortunet.c,1.2,1.3 h720x-flash.c,1.1,1.2 ich2rom.c,1.3,1.4
impa7.c,1.3,1.4 integrator-flash.c,1.8,1.9 iq80310.c,1.10,1.11
l440gx.c,1.8,1.9 lasat.c,1.1,1.2 lubbock-flash.c,1.2,1.3
mbx860.c,1.1,1.2 netsc520.c,1.5,1.6 nettel.c,1.1,1.2
ocelot.c,1.7,1.8 octagon-5066.c,1.20,1.21 pb1xxx-flash.c,1.4,1.5
pci.c,1.2,1.3 pcmciamtd.c,1.40,1.41 physmap.c,1.22,1.23
pnc2000.c,1.10,1.11 redwood.c,1.2,1.3 rpxlite.c,1.15,1.16
sa1100-flash.c,1.30,1.31 sbc_gxx.c,1.21,1.22 sc520cdp.c,1.11,1.12
scb2_flash.c,1.2,1.3 scx200_docflash.c,1.1,1.2
solutionengine.c,1.5,1.6 sun_uflash.c,1.4,1.5 tqm8xxl.c,1.4,1.5
tsunami_flash.c,1.1,1.2 uclinux.c,1.2,1.3 vmax301.c,1.24,1.25
physmap64.c,1.1,NONE
David Woodhouse
dwmw2 at infradead.org
Wed May 14 11:05:19 EDT 2003
Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv26387/drivers/mtd/maps
Modified Files:
Config.in GNUmakefile Kconfig Makefile amd76xrom.c
arctic-mtd.c autcpu12-nvram.c beech-mtd.c cdb89712.c ceiva.c
cfi_flagadm.c cstm_mips_ixx.c dbox2-flash.c dc21285.c
dilnetpc.c ebony.c edb7312.c elan-104nc.c epxa10db-flash.c
fortunet.c h720x-flash.c ich2rom.c impa7.c integrator-flash.c
iq80310.c l440gx.c lasat.c lubbock-flash.c mbx860.c netsc520.c
nettel.c ocelot.c octagon-5066.c pb1xxx-flash.c pci.c
pcmciamtd.c physmap.c pnc2000.c redwood.c rpxlite.c
sa1100-flash.c sbc_gxx.c sc520cdp.c scb2_flash.c
scx200_docflash.c solutionengine.c sun_uflash.c tqm8xxl.c
tsunami_flash.c uclinux.c vmax301.c
Added Files:
map_funcs.c
Removed Files:
physmap64.c
Log Message:
Make support for non-linear mappings conditional
***** Error reading new file: [Errno 2] No such file or directory: 'map_funcs.c'
Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Config.in,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- Config.in 20 Apr 2003 08:38:01 -0000 1.47
+++ Config.in 14 May 2003 15:05:14 -0000 1.48
@@ -21,19 +21,19 @@
dep_tristate ' CFI Flash device mapped on Photron PNC-2000' CONFIG_MTD_PNC2000 $CONFIG_MTD_CFI $CONFIG_MTD_PARTITIONS
dep_tristate ' CFI Flash device mapped on AMD SC520 CDP' CONFIG_MTD_SC520CDP $CONFIG_MTD_CFI
dep_tristate ' CFI Flash device mapped on AMD NetSc520' CONFIG_MTD_NETSC520 $CONFIG_MTD_CFI $CONFIG_MTD_PARTITIONS
- dep_tristate ' CFI Flash device mapped on Arcom SBC-GXx boards' CONFIG_MTD_SBC_GXX $CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_PARTITIONS
- dep_tristate ' CFI Flash device mapped on Arcom ELAN-104NC' CONFIG_MTD_ELAN_104NC $CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_PARTITIONS
+ dep_tristate ' CFI Flash device mapped on Arcom SBC-GXx boards' CONFIG_MTD_SBC_GXX $CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_PARTITIONS $CONFIG_MTD_COMPLEX_MAPPINGS
+ dep_tristate ' CFI Flash device mapped on Arcom ELAN-104NC' CONFIG_MTD_ELAN_104NC $CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_PARTITIONS $CONFIG_MTD_COMPLEX_MAPPINGS
dep_tristate ' CFI Flash device mapped on DIL/Net PC' CONFIG_MTD_DILNETPC $CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_PARTITIONS $CONFIG_MTD_CONCAT
if [ "$CONFIG_MTD_DILNETPC" = "y" -o "$CONFIG_MTD_DILNETPC" = "m" ]; then
hex ' Size of boot partition' CONFIG_MTD_DILNETPC_BOOTSIZE 0x80000
fi
dep_tristate ' JEDEC Flash device mapped on Mixcom piggyback card' CONFIG_MTD_MIXMEM $CONFIG_MTD_JEDEC
- dep_tristate ' JEDEC Flash device mapped on Octagon 5066 SBC' CONFIG_MTD_OCTAGON $CONFIG_MTD_JEDEC
- dep_tristate ' JEDEC Flash device mapped on Tempustech VMAX SBC301' CONFIG_MTD_VMAX $CONFIG_MTD_JEDEC
+ dep_tristate ' JEDEC Flash device mapped on Octagon 5066 SBC' CONFIG_MTD_OCTAGON $CONFIG_MTD_JEDEC $CONFIG_MTD_COMPLEX_MAPPINGS
+ dep_tristate ' JEDEC Flash device mapped on Tempustech VMAX SBC301' CONFIG_MTD_VMAX $CONFIG_MTD_JEDEC $CONFIG_MTD_COMPLEX_MAPPINGS
dep_tristate ' Flash device mapped with DOCCS on NatSemi SCx200' CONFIG_MTD_SCx200_DOCFLASH $CONFIG_MTD_CFI
dep_tristate ' BIOS flash chip on Intel L440GX boards' CONFIG_MTD_L440GX $CONFIG_MTD_JEDECPROBE
dep_tristate ' ROM connected to AMD76X southbridge' CONFIG_MTD_AMD76XROM $CONFIG_MTD_GEN_PROBE
- dep_tristate ' ROM connected to Intel Hub Controller 2' CONFIG_MTD_ICH2ROM $CONFIG_MTD_JEDECPROBE
+ dep_tristate ' ROM connected to Intel Hub Controller 2' CONFIG_MTD_ICH2ROM $CONFIG_MTD_JEDECPROBE $CONFIG_MTD_COMPLEX_MAPPINGS
dep_tristate ' CFI Flash device mapped on SnapGear/SecureEdge' CONFIG_MTD_NETtel $CONFIG_MTD_PARTITIONS
dep_tristate ' BIOS flash chip on Intel SCB2 boards' CONFIG_MTD_SCB2_FLASH $CONFIG_MTD_GEN_PROBE
fi
@@ -94,11 +94,10 @@
fi
if [ "$CONFIG_ARM" = "y" ]; then
- dep_tristate ' CFI Flash device mapped on Nora' CONFIG_MTD_NORA $CONFIG_MTD_CFI
dep_tristate ' CFI Flash device mapped on ARM Integrator/P720T' CONFIG_MTD_ARM_INTEGRATOR $CONFIG_MTD_CFI
dep_tristate ' Cirrus CDB89712 evaluation board mappings' CONFIG_MTD_CDB89712 $CONFIG_MTD_CFI $CONFIG_ARCH_CDB89712
dep_tristate ' CFI Flash device mapped on StrongARM SA11x0' CONFIG_MTD_SA1100 $CONFIG_MTD_CFI $CONFIG_ARCH_SA1100 $CONFIG_MTD_PARTITIONS
- dep_tristate ' CFI Flash device mapped on DC21285 Footbridge' CONFIG_MTD_DC21285 $CONFIG_MTD_CFI $CONFIG_ARCH_FOOTBRIDGE
+ dep_tristate ' CFI Flash device mapped on DC21285 Footbridge' CONFIG_MTD_DC21285 $CONFIG_MTD_CFI $CONFIG_ARCH_FOOTBRIDGE $CONFIG_MTD_COMPLEX_MAPPINGS
dep_tristate ' CFI Flash device mapped on the XScale IQ80310 board' CONFIG_MTD_IQ80310 $CONFIG_MTD_CFI $CONFIG_ARCH_IQ80310
dep_tristate ' CFI Flash device mapped on the XScale Lubbock board' CONFIG_MTD_LUBBOCK $CONFIG_MTD_CFI $CONFIG_ARCH_LUBBOCK
dep_tristate ' CFI Flash device mapped on Epxa10db' CONFIG_MTD_EPXA10DB $CONFIG_MTD_CFI $CONFIG_MTD_PARTITIONS $CONFIG_ARCH_CAMELOT
@@ -110,7 +109,7 @@
dep_tristate ' JEDEC Flash device mapped on Ceiva/Polaroid PhotoMax Digital Picture Frame' CONFIG_MTD_CEIVA $CONFIG_MTD_JEDECPROBE $CONFIG_ARCH_CEIVA
fi
if [ "$CONFIG_ALPHA" = "y" ]; then
- dep_tristate ' Flash chip mapping on TSUNAMI' CONFIG_MTD_TSUNAMI $CONFIG_MTD_GENPROBE
+ dep_tristate ' Flash chip mapping on TSUNAMI' CONFIG_MTD_TSUNAMI $CONFIG_MTD_GENPROBE $CONFIG_MTD_COMPLEX_MAPPINGS
fi
if [ "$CONFIG_UCLINUX" = "y" ]; then
@@ -118,7 +117,7 @@
fi
# This needs CFI or JEDEC, depending on the cards found.
-dep_tristate ' PCI MTD driver' CONFIG_MTD_PCI $CONFIG_MTD $CONFIG_PCI
-dep_tristate ' PCMCIA MTD driver' CONFIG_MTD_PCMCIA $CONFIG_MTD $CONFIG_PCMCIA
+dep_tristate ' PCI MTD driver' CONFIG_MTD_PCI $CONFIG_MTD $CONFIG_PCI $CONFIG_MTD_COMPLEX_MAPPINGS
+dep_tristate ' PCMCIA MTD driver' CONFIG_MTD_PCMCIA $CONFIG_MTD $CONFIG_PCMCIA $CONFIG_MTD_COMPLEX_MAPPINGS
endmenu
Index: GNUmakefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/GNUmakefile,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- GNUmakefile 13 Sep 2002 15:22:50 -0000 1.9
+++ GNUmakefile 14 May 2003 15:05:14 -0000 1.10
@@ -3,7 +3,6 @@
ifndef CONFIG_MTD
# We're being invoked outside a normal kernel build. Fake it
-
# CONFIG_MTD_ARM := m
CONFIG_MTD_CFI_FLAGADM := m
# CONFIG_MTD_CSTM_MIPS_IXX := m
Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Kconfig,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Kconfig 20 Apr 2003 08:38:01 -0000 1.6
+++ Kconfig 14 May 2003 15:05:14 -0000 1.7
@@ -4,6 +4,13 @@
menu "Mapping drivers for chip access"
depends on MTD!=n
+config MTD_COMPLEX_MAPPINGS
+ bool "Support non-linear mappings of flash chips"
+ depends on MTD
+ help
+ This causes the chip drivers to allow for complicated
+ paged mappings of flash chips.
+
config MTD_PHYSMAP
tristate "CFI Flash device in physical memory map"
depends on MTD_CFI
@@ -80,7 +87,7 @@
config MTD_SBC_GXX
tristate "CFI Flash device mapped on Arcom SBC-GXx boards"
- depends on X86 && MTD_CFI_INTELEXT && MTD_PARTITIONS
+ depends on X86 && MTD_CFI_INTELEXT && MTD_PARTITIONS && MTD_COMPLEX_MAPPINGS
help
This provides a driver for the on-board flash of Arcom Control
Systems' SBC-GXn family of boards, formerly known as SBC-MediaGX.
@@ -91,7 +98,7 @@
config MTD_ELAN_104NC
tristate "CFI Flash device mapped on Arcom ELAN-104NC"
- depends on X86 && MTD_CFI_INTELEXT && MTD_PARTITIONS
+ depends on X86 && MTD_CFI_INTELEXT && MTD_PARTITIONS && MTD_COMPLEX_MAPPINGS
help
This provides a driver for the on-board flash of the Arcom Control
System's ELAN-104NC development board. By default the flash
@@ -119,7 +126,7 @@
config MTD_OCTAGON
tristate "JEDEC Flash device mapped on Octagon 5066 SBC"
- depends on X86 && MTD_JEDEC
+ depends on X86 && MTD_JEDEC && MTD_COMPLEX_MAPPINGS
help
This provides a 'mapping' driver which supports the way in which
the flash chips are connected in the Octagon-5066 Single Board
@@ -128,7 +135,7 @@
config MTD_VMAX
tristate "JEDEC Flash device mapped on Tempustech VMAX SBC301"
- depends on X86 && MTD_JEDEC
+ depends on X86 && MTD_JEDEC && MTD_COMPLEX_MAPPINGS
help
This provides a 'mapping' driver which supports the way in which
the flash chips are connected in the Tempustech VMAX SBC301 Single
@@ -281,12 +288,6 @@
This enables access to the flash chips on the Hitachi SolutionEngine and
similar boards. Say 'Y' if you are building a kernel for such a board.
-config MTD_NORA
- tristate "CFI Flash device mapped on Nora"
- depends on ARM && MTD_CFI
- help
- If you had to ask, you don't have one. Say 'N'.
-
config MTD_ARM_INTEGRATOR
tristate "CFI Flash device mapped on ARM Integrator/P720T"
depends on ARM && MTD_CFI
@@ -308,7 +309,7 @@
config MTD_DC21285
tristate "CFI Flash device mapped on DC21285 Footbridge"
- depends on ARM && MTD_CFI && ARCH_FOOTBRIDGE
+ depends on ARM && MTD_CFI && ARCH_FOOTBRIDGE && MTD_COMPLEX_MAPPINGS
help
This provides a driver for the flash accessed using Intel's
21285 bridge used with Intel's StrongARM processors. More info at
Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- Makefile 20 Apr 2003 08:38:01 -0000 1.40
+++ Makefile 14 May 2003 15:05:14 -0000 1.41
@@ -9,6 +9,12 @@
O_TARGET := mapslink.o
endif
+export-objs := map_funcs.o
+
+ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y)
+obj-m += map_funcs.o
+endif
+
# Chip mappings
obj-$(CONFIG_MTD_CDB89712) += cdb89712.o
obj-$(CONFIG_MTD_ARM_INTEGRATOR)+= integrator-flash.o
@@ -25,16 +31,9 @@
obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o
obj-$(CONFIG_MTD_LUBBOCK) += lubbock-flash.o
obj-$(CONFIG_MTD_MBX860) += mbx860.o
-obj-$(CONFIG_MTD_NORA) += nora.o
obj-$(CONFIG_MTD_CEIVA) += ceiva.o
obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o
-ifneq ($(CONFIG_MTD_PHYSMAP),n)
- ifeq ($(CONFIG_MTD_PHYSMAP_BUSWIDTH),8)
- obj-$(CONFIG_MTD_PHYSMAP) += physmap64.o
- else
- obj-$(CONFIG_MTD_PHYSMAP) += physmap.o
- endif
-endif
+obj-$(CONFIG_MTD_PHYSMAP) += physmap.o
obj-$(CONFIG_MTD_PNC2000) += pnc2000.o
obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o
obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o
Index: amd76xrom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/amd76xrom.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- amd76xrom.c 8 Apr 2003 13:26:06 -0000 1.3
+++ amd76xrom.c 14 May 2003 15:05:14 -0000 1.4
@@ -24,68 +24,15 @@
struct pci_dev *pdev;
};
-static __u8 amd76xrom_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 amd76xrom_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static __u32 amd76xrom_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-static void amd76xrom_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void amd76xrom_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void amd76xrom_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void amd76xrom_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void amd76xrom_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
static struct amd76xrom_map_info amd76xrom_map = {
- map: {
- name: "AMD76X rom",
- size: 0,
- buswidth: 1,
- read8: amd76xrom_read8,
- read16: amd76xrom_read16,
- read32: amd76xrom_read32,
- copy_from: amd76xrom_copy_from,
- write8: amd76xrom_write8,
- write16: amd76xrom_write16,
- write32: amd76xrom_write32,
- copy_to: amd76xrom_copy_to,
- /* The standard rom socket is for single power supply chips
- * that don't have an extra vpp.
- */
+ .map = {
+ .name = "AMD76X rom",
+ .size = 0,
+ .buswidth = 1,
},
- mtd: 0,
- window_addr: 0,
+ .mtd = 0,
+ .window_addr = 0,
};
static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
@@ -154,9 +101,11 @@
if (rom_size > window->size) {
continue;
}
- info->map.map_priv_1 =
+ info->map.phys = window->start + window->size - rom_size
+ info->map.virt =
info->window_addr + window->size - rom_size;
info->map.size = rom_size;
+ simple_map_init(&info->map);
chip_type = rom_probe_types;
for(; !info->mtd && *chip_type; chip_type++) {
info->mtd = do_map_probe(*chip_type, &amd76xrom_map.map);
@@ -168,7 +117,7 @@
if (!info->mtd) {
goto err_out_iounmap;
}
- printk(KERN_NOTICE "amd76xrom chip at offset: %x\n",
+ printk(KERN_NOTICE "amd76xrom chip at offset: 0x%x\n",
window->size - rom_size);
info->mtd->module = THIS_MODULE;
@@ -196,7 +145,7 @@
del_mtd_device(info->mtd);
map_destroy(info->mtd);
info->mtd = 0;
- info->map.map_priv_1 = 0;
+ info->map.virt = 0;
iounmap((void *)(info->window_addr));
info->window_addr = 0;
@@ -223,10 +172,10 @@
#if 0
static struct pci_driver amd76xrom_driver = {
- name: "amd76xrom",
- id_table: amd76xrom_pci_tbl,
- probe: amd76xrom_init_one,
- remove: amd76xrom_remove_one,
+ .name = "amd76xrom",
+ .id_table = amd76xrom_pci_tbl,
+ .probe = amd76xrom_init_one,
+ .remove = amd76xrom_remove_one,
};
#endif
Index: arctic-mtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/arctic-mtd.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- arctic-mtd.c 2 Apr 2003 18:57:15 -0000 1.4
+++ arctic-mtd.c 14 May 2003 15:05:14 -0000 1.5
@@ -59,64 +59,6 @@
/* Flash memories on these boards are memory resources, accessed big-endian. */
-static u8
-arctic_mtd_read8(struct map_info *map, unsigned long offset)
-{
- return __raw_readb(map->map_priv_1 + offset);
-}
-
-static u16
-arctic_mtd_read16(struct map_info *map, unsigned long offset)
-{
- return __raw_readw(map->map_priv_1 + offset);
-}
-
-static u32
-arctic_mtd_read32(struct map_info *map, unsigned long offset)
-{
- return __raw_readl(map->map_priv_1 + offset);
-}
-
-static void
-arctic_mtd_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, (void *) (map->map_priv_1 + from), len);
-}
-
-static void
-arctic_mtd_write8(struct map_info *map, u8 data, unsigned long address)
-{
- __raw_writeb(data, map->map_priv_1 + address);
- mb();
-}
-
-static void
-arctic_mtd_write16(struct map_info *map, u16 data, unsigned long address)
-{
- __raw_writew(data, map->map_priv_1 + address);
- mb();
-}
-
-static void
-arctic_mtd_write32(struct map_info *map, u32 data, unsigned long address)
-{
- __raw_writel(data, map->map_priv_1 + address);
- mb();
-}
-
-static void
-arctic_mtd_copy_to(struct map_info *map,
- unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio((void *) (map->map_priv_1 + to), from, len);
-}
-
-u_char * arctic_mtd_point(struct map_info *map, loff_t from, size_t len)
-{
- return (u_char *)(map->map_priv_1 + (unsigned long)from);
-}
-
-void arctic_mtd_unpoint(struct map_info *map, u_char *adr, loff_t from, size_t len)
{
/* do nothing for now */
}
@@ -125,16 +67,7 @@
.name = NAME,
.size = SIZE,
.buswidth = BUSWIDTH,
- .read8 = arctic_mtd_read8,
- .read16 = arctic_mtd_read16,
- .read32 = arctic_mtd_read32,
- .point = arctic_mtd_point,
- .unpoint = arctic_mtd_unpoint,
- .copy_from = arctic_mtd_copy_from,
- .write8 = arctic_mtd_write8,
- .write16 = arctic_mtd_write16,
- .write32 = arctic_mtd_write32,
- .copy_to = arctic_mtd_copy_to,
+ .phys = PADDR,
};
static struct mtd_info *arctic_mtd;
@@ -157,12 +90,13 @@
{
printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR);
- arctic_mtd_map.map_priv_1 = (unsigned long) ioremap(PADDR, SIZE);
+ arctic_mtd_map.virt = (unsigned long) ioremap(PADDR, SIZE);
- if (!arctic_mtd_map.map_priv_1) {
+ if (!arctic_mtd_map.virt) {
printk("%s: failed to ioremap 0x%x\n", NAME, PADDR);
return -EIO;
}
+ simple_map_init(&arctic_mtd_map);
printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8);
arctic_mtd = do_map_probe("cfi_probe", &arctic_mtd_map);
@@ -181,7 +115,7 @@
if (arctic_mtd) {
del_mtd_partitions(arctic_mtd);
map_destroy(arctic_mtd);
- iounmap((void *) arctic_mtd_map.map_priv_1);
+ iounmap((void *) arctic_mtd_map.virt);
}
}
Index: autcpu12-nvram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/autcpu12-nvram.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- autcpu12-nvram.c 22 Feb 2002 09:30:24 -0000 1.1
+++ autcpu12-nvram.c 14 May 2003 15:05:14 -0000 1.2
@@ -32,81 +32,28 @@
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
-__u8 autcpu12_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 autcpu12_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 autcpu12_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void autcpu12_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-void autcpu12_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-void autcpu12_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-void autcpu12_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void autcpu12_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- while(len) {
- __raw_writeb(*(unsigned char *) from, map->map_priv_1 + to);
- from++;
- to++;
- len--;
- }
-}
static struct mtd_info *sram_mtd;
struct map_info autcpu12_sram_map = {
- name: "SRAM",
- size: 32768,
- buswidth: 8,
- read8: autcpu12_read8,
- read16: autcpu12_read16,
- read32: autcpu12_read32,
- copy_from: autcpu12_copy_from,
- write8: autcpu12_write8,
- write16: autcpu12_write16,
- write32: autcpu12_write32,
- copy_to: autcpu12_copy_to
+ .name = "SRAM",
+ .size = 32768,
+ .buswidth = 4,
+ .phys = 0x12000000,
};
static int __init init_autcpu12_sram (void)
{
int err, save0, save1;
- autcpu12_sram_map.map_priv_1 = (unsigned long)ioremap(0x12000000, SZ_128K);
- if (!autcpu12_sram_map.map_priv_1) {
+ autcpu12_sram_map.virt = (unsigned long)ioremap(0x12000000, SZ_128K);
+ if (!autcpu12_sram_map.virt) {
printk("Failed to ioremap autcpu12 NV-RAM space\n");
err = -EIO;
goto out;
}
-
+ simple_map_init(&autcpu_sram_map);
+
/*
* Check for 32K/128K
* read ofs 0
@@ -115,20 +62,20 @@
* Read and check result on ofs 0x0
* Restore contents
*/
- save0 = autcpu12_read32(&autcpu12_sram_map,0);
- save1 = autcpu12_read32(&autcpu12_sram_map,0x10000);
- autcpu12_write32(&autcpu12_sram_map,~save0,0x10000);
+ save0 = map_read32(&autcpu12_sram_map,0);
+ save1 = map_read32(&autcpu12_sram_map,0x10000);
+ map_write32(&autcpu12_sram_map,~save0,0x10000);
/* if we find this pattern on 0x0, we have 32K size
* restore contents and exit
*/
- if ( autcpu12_read32(&autcpu12_sram_map,0) != save0) {
- autcpu12_write32(&autcpu12_sram_map,save0,0x0);
+ if ( map_read32(&autcpu12_sram_map,0) != save0) {
+ map_write32(&autcpu12_sram_map,save0,0x0);
goto map;
}
/* We have a 128K found, restore 0x10000 and set size
* to 128K
*/
- autcpu12_write32(&autcpu12_sram_map,save1,0x10000);
+ ma[_write32(&autcpu12_sram_map,save1,0x10000);
autcpu12_sram_map.size = SZ_128K;
map:
@@ -148,7 +95,7 @@
goto out_probe;
}
- printk("NV-RAM device size %ldK registered on AUTCPU12\n",autcpu12_sram_map.size/SZ_1K);
+ printk("NV-RAM device size %ldKiB registered on AUTCPU12\n",autcpu12_sram_map.size/SZ_1K);
return 0;
@@ -157,7 +104,7 @@
sram_mtd = 0;
out_ioremap:
- iounmap((void *)autcpu12_sram_map.map_priv_1);
+ iounmap((void *)autcpu12_sram_map.virt);
out:
return err;
}
@@ -167,7 +114,7 @@
if (sram_mtd) {
del_mtd_device(sram_mtd);
map_destroy(sram_mtd);
- iounmap((void *)autcpu12_sram_map.map_priv_1);
+ iounmap((void *)autcpu12_sram_map.virt);
}
}
Index: beech-mtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/beech-mtd.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- beech-mtd.c 31 Jan 2003 08:27:38 -0000 1.3
+++ beech-mtd.c 14 May 2003 15:05:14 -0000 1.4
@@ -46,96 +46,25 @@
/* Flash memories on these boards are memory resources, accessed big-endian. */
-static __u8
-beech_mtd_read8(struct map_info *map, unsigned long offset)
-{
- return __raw_readb(map->map_priv_1 + offset);
-}
-
-static __u16
-beech_mtd_read16(struct map_info *map, unsigned long offset)
-{
- return __raw_readw(map->map_priv_1 + offset);
-}
-
-static __u32
-beech_mtd_read32(struct map_info *map, unsigned long offset)
-{
- return __raw_readl(map->map_priv_1 + offset);
-}
-
-static void
-beech_mtd_copy_from(struct map_info *map,
- void *to, unsigned long from, ssize_t len)
-{
- memcpy(to, (void *) (map->map_priv_1 + from), len);
-}
-
-static void
-beech_mtd_write8(struct map_info *map, __u8 data, unsigned long address)
-{
- __raw_writeb(data, map->map_priv_1 + address);
- mb();
-}
-
-static void
-beech_mtd_write16(struct map_info *map, __u16 data, unsigned long address)
-{
- __raw_writew(data, map->map_priv_1 + address);
- mb();
-}
-
-static void
-beech_mtd_write32(struct map_info *map, __u32 data, unsigned long address)
-{
- __raw_writel(data, map->map_priv_1 + address);
- mb();
-}
-
-static void
-beech_mtd_copy_to(struct map_info *map,
- unsigned long to, const void *from, ssize_t len)
-{
- memcpy((void *) (map->map_priv_1 + to), from, len);
-}
-
-u_char * beech_mtd_point(struct map_info *map, loff_t from, size_t len)
-{
- return (u_char *)(map->map_priv_1 + (unsigned long)from);
-}
-
-void beech_mtd_unpoint(struct map_info *map, u_char *adr, loff_t from, size_t len)
-{
- /* do nothing for now */
-}
static struct map_info beech_mtd_map = {
- name: NAME,
- size: SIZE,
- buswidth: BUSWIDTH,
- read8: beech_mtd_read8,
- read16: beech_mtd_read16,
- read32: beech_mtd_read32,
- point: beech_mtd_point,
- unpoint: beech_mtd_unpoint,
- copy_from: beech_mtd_copy_from,
- write8: beech_mtd_write8,
- write16: beech_mtd_write16,
- write32: beech_mtd_write32,
- copy_to: beech_mtd_copy_to
+ .name = NAME,
+ .size = SIZE,
+ .buswidth = BUSWIDTH,
+ .phys = PADDR
};
static struct mtd_info *beech_mtd;
static struct mtd_partition beech_partitions[2] = {
{
- name:"Linux Kernel",
- size:BEECH_KERNEL_SIZE,
- offset:BEECH_KERNEL_OFFSET
+ .name = "Linux Kernel",
+ .size = BEECH_KERNEL_SIZE,
+ .offset = BEECH_KERNEL_OFFSET
}, {
- name:"Free Area",
- size:BEECH_FREE_AREA_SIZE,
- offset:BEECH_FREE_AREA_OFFSET
+ .name = "Free Area",
+ .size = BEECH_FREE_AREA_SIZE,
+ .offset = BEECH_FREE_AREA_OFFSET
}
};
@@ -144,13 +73,15 @@
{
printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR);
- beech_mtd_map.map_priv_1 = (unsigned long) ioremap(PADDR, SIZE);
+ beech_mtd_map.virt = (unsigned long) ioremap(PADDR, SIZE);
- if (!beech_mtd_map.map_priv_1) {
+ if (!beech_mtd_map.virt) {
printk("%s: failed to ioremap 0x%x\n", NAME, PADDR);
return -EIO;
}
+ simple_map_init(&beech_mtd_map);
+
printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8);
beech_mtd = do_map_probe("cfi_probe", &beech_mtd_map);
@@ -168,7 +99,7 @@
if (beech_mtd) {
del_mtd_partitions(beech_mtd);
map_destroy(beech_mtd);
- iounmap((void *) beech_mtd_map.map_priv_1);
+ iounmap((void *) beech_mtd_map.virt);
}
}
Index: cdb89712.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cdb89712.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cdb89712.c 2 Oct 2001 15:14:43 -0000 1.3
+++ cdb89712.c 14 May 2003 15:05:14 -0000 1.4
@@ -16,77 +16,21 @@
-__u8 cdb89712_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 cdb89712_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 cdb89712_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void cdb89712_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-void cdb89712_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-void cdb89712_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-void cdb89712_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- // printk ("cdb89712_copy_from: 0x%x at 0x%x -> 0x%x\n", len, from, to);
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void cdb89712_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- while(len) {
- __raw_writeb(*(unsigned char *) from, map->map_priv_1 + to);
- from++;
- to++;
- len--;
- }
-}
-
static struct mtd_info *flash_mtd;
struct map_info cdb89712_flash_map = {
- name: "flash",
- size: FLASH_SIZE,
- buswidth: FLASH_WIDTH,
- read8: cdb89712_read8,
- read16: cdb89712_read16,
- read32: cdb89712_read32,
- copy_from: cdb89712_copy_from,
- write8: cdb89712_write8,
- write16: cdb89712_write16,
- write32: cdb89712_write32,
- copy_to: cdb89712_copy_to
+ .name = "flash",
+ .size = FLASH_SIZE,
+ .buswidth = FLASH_WIDTH,
+ .phys = FLASH_START,
};
struct resource cdb89712_flash_resource = {
- name: "Flash",
- start: FLASH_START,
- end: FLASH_START + FLASH_SIZE - 1,
- flags: IORESOURCE_IO | IORESOURCE_BUSY,
+ .name = "Flash",
+ .start = FLASH_START,
+ .end = FLASH_START + FLASH_SIZE - 1,
+ .flags = IORESOURCE_IO | IORESOURCE_BUSY,
};
static int __init init_cdb89712_flash (void)
@@ -99,13 +43,13 @@
goto out;
}
- cdb89712_flash_map.map_priv_1 = (unsigned long)ioremap(FLASH_START, FLASH_SIZE);
- if (!cdb89712_flash_map.map_priv_1) {
+ cdb89712_flash_map.virt = (unsigned long)ioremap(FLASH_START, FLASH_SIZE);
+ if (!cdb89712_flash_map.virt) {
printk(KERN_NOTICE "Failed to ioremap Cdb89712 FLASH space\n");
err = -EIO;
goto out_resource;
}
-
+ simple_map_init(&cdb89712_flash_map);
flash_mtd = do_map_probe("cfi_probe", &cdb89712_flash_map);
if (!flash_mtd) {
flash_mtd = do_map_probe("map_rom", &cdb89712_flash_map);
@@ -132,7 +76,7 @@
map_destroy(flash_mtd);
flash_mtd = 0;
out_ioremap:
- iounmap((void *)cdb89712_flash_map.map_priv_1);
+ iounmap((void *)cdb89712_flash_map.virt);
out_resource:
release_resource (&cdb89712_flash_resource);
out:
@@ -146,24 +90,17 @@
static struct mtd_info *sram_mtd;
struct map_info cdb89712_sram_map = {
- name: "SRAM",
- size: SRAM_SIZE,
- buswidth: SRAM_WIDTH,
- read8: cdb89712_read8,
- read16: cdb89712_read16,
- read32: cdb89712_read32,
- copy_from: cdb89712_copy_from,
- write8: cdb89712_write8,
- write16: cdb89712_write16,
- write32: cdb89712_write32,
- copy_to: cdb89712_copy_to
+ .name = "SRAM",
+ .size = SRAM_SIZE,
+ .buswidth = SRAM_WIDTH,
+ .phys = SRAM_START,
};
struct resource cdb89712_sram_resource = {
- name: "SRAM",
- start: SRAM_START,
- end: SRAM_START + SRAM_SIZE - 1,
- flags: IORESOURCE_IO | IORESOURCE_BUSY,
+ .name = "SRAM",
+ .start = SRAM_START,
+ .end = SRAM_START + SRAM_SIZE - 1,
+ .flags = IORESOURCE_IO | IORESOURCE_BUSY,
};
static int __init init_cdb89712_sram (void)
@@ -176,13 +113,13 @@
goto out;
}
- cdb89712_sram_map.map_priv_1 = (unsigned long)ioremap(SRAM_START, SRAM_SIZE);
- if (!cdb89712_sram_map.map_priv_1) {
+ cdb89712_sram_map.virt = (unsigned long)ioremap(SRAM_START, SRAM_SIZE);
+ if (!cdb89712_sram_map.virt) {
printk(KERN_NOTICE "Failed to ioremap Cdb89712 SRAM space\n");
err = -EIO;
goto out_resource;
}
-
+ simple_map_init(&cdb89712_sram_map);
sram_mtd = do_map_probe("map_ram", &cdb89712_sram_map);
if (!sram_mtd) {
printk("SRAM probe failed\n");
@@ -205,7 +142,7 @@
map_destroy(sram_mtd);
sram_mtd = 0;
out_ioremap:
- iounmap((void *)cdb89712_sram_map.map_priv_1);
+ iounmap((void *)cdb89712_sram_map.virt);
out_resource:
release_resource (&cdb89712_sram_resource);
out:
@@ -221,20 +158,17 @@
static struct mtd_info *bootrom_mtd;
struct map_info cdb89712_bootrom_map = {
- name: "BootROM",
- size: BOOTROM_SIZE,
- buswidth: BOOTROM_WIDTH,
- read8: cdb89712_read8,
- read16: cdb89712_read16,
- read32: cdb89712_read32,
- copy_from: cdb89712_copy_from,
+ .name = "BootROM",
+ .size = BOOTROM_SIZE,
+ .buswidth = BOOTROM_WIDTH,
+ .phys = BOOTROM_START,
};
struct resource cdb89712_bootrom_resource = {
- name: "BootROM",
- start: BOOTROM_START,
- end: BOOTROM_START + BOOTROM_SIZE - 1,
- flags: IORESOURCE_IO | IORESOURCE_BUSY,
+ .name = "BootROM",
+ .start = BOOTROM_START,
+ .end = BOOTROM_START + BOOTROM_SIZE - 1,
+ .flags = IORESOURCE_IO | IORESOURCE_BUSY,
};
static int __init init_cdb89712_bootrom (void)
@@ -247,13 +181,13 @@
goto out;
}
- cdb89712_bootrom_map.map_priv_1 = (unsigned long)ioremap(BOOTROM_START, BOOTROM_SIZE);
- if (!cdb89712_bootrom_map.map_priv_1) {
+ cdb89712_bootrom_map.virt = (unsigned long)ioremap(BOOTROM_START, BOOTROM_SIZE);
+ if (!cdb89712_bootrom_map.virt) {
printk(KERN_NOTICE "Failed to ioremap Cdb89712 BootROM space\n");
err = -EIO;
goto out_resource;
}
-
+ simple_map_init(&cdb89712_bootrom_map);
bootrom_mtd = do_map_probe("map_rom", &cdb89712_bootrom_map);
if (!bootrom_mtd) {
printk("BootROM probe failed\n");
@@ -276,7 +210,7 @@
map_destroy(bootrom_mtd);
bootrom_mtd = 0;
out_ioremap:
- iounmap((void *)cdb89712_bootrom_map.map_priv_1);
+ iounmap((void *)cdb89712_bootrom_map.virt);
out_resource:
release_resource (&cdb89712_bootrom_resource);
out:
@@ -306,21 +240,21 @@
if (sram_mtd) {
del_mtd_device(sram_mtd);
map_destroy(sram_mtd);
- iounmap((void *)cdb89712_sram_map.map_priv_1);
+ iounmap((void *)cdb89712_sram_map.virt);
release_resource (&cdb89712_sram_resource);
}
if (flash_mtd) {
del_mtd_device(flash_mtd);
map_destroy(flash_mtd);
- iounmap((void *)cdb89712_flash_map.map_priv_1);
+ iounmap((void *)cdb89712_flash_map.virt);
release_resource (&cdb89712_flash_resource);
}
if (bootrom_mtd) {
del_mtd_device(bootrom_mtd);
map_destroy(bootrom_mtd);
- iounmap((void *)cdb89712_bootrom_map.map_priv_1);
+ iounmap((void *)cdb89712_bootrom_map.virt);
release_resource (&cdb89712_bootrom_resource);
}
}
Index: ceiva.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ceiva.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ceiva.c 17 Feb 2003 21:49:10 -0000 1.3
+++ ceiva.c 14 May 2003 15:05:14 -0000 1.4
@@ -31,62 +31,10 @@
#include <asm/sizes.h>
/*
- * This isnt complete yet, so...
+ * This isn't complete yet, so...
*/
#define CONFIG_MTD_CEIVA_STATICMAP
-static __u8 clps_read8(struct map_info *map, unsigned long ofs)
-{
- return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 clps_read16(struct map_info *map, unsigned long ofs)
-{
- return readw(map->map_priv_1 + ofs);
-}
-
-static __u32 clps_read32(struct map_info *map, unsigned long ofs)
-{
- return readl(map->map_priv_1 + ofs);
-}
-
-static void clps_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void clps_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- writeb(d, map->map_priv_1 + adr);
-}
-
-static void clps_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- writew(d, map->map_priv_1 + adr);
-}
-
-static void clps_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- writel(d, map->map_priv_1 + adr);
-}
-
-static void clps_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy((void *)(map->map_priv_1 + to), from, len);
-}
-
-static struct map_info clps_map __initdata = {
- name: "clps flash",
- read8: clps_read8,
- read16: clps_read16,
- read32: clps_read32,
- copy_from: clps_copy_from,
- write8: clps_write8,
- write16: clps_write16,
- write32: clps_write32,
- copy_to: clps_copy_to,
-};
-
#ifdef CONFIG_MTD_CEIVA_STATICMAP
/*
* See include/linux/mtd/partitions.h for definition of the mtd_partition
@@ -176,7 +124,7 @@
maps = kmalloc(sizeof(struct map_info) * nr, GFP_KERNEL);
if (!maps)
return -ENOMEM;
-
+ memset(maps, 0, sizeof(struct map_info) * nr);
/*
* Claim and then map the memory regions.
*/
@@ -191,7 +139,9 @@
}
clps[i].map = maps + i;
- memcpy(clps[i].map, &clps_map, sizeof(struct map_info));
+
+ clps[i].map->name = "clps flash";
+ clps[i].map->phys = clps[i].base;
clps[i].vbase = ioremap(clps[i].base, clps[i].size);
if (!clps[i].vbase) {
@@ -199,9 +149,11 @@
break;
}
- clps[i].map->map_priv_1 = (unsigned long)clps[i].vbase;
+ clps[i].map->virt = (unsigned long)clps[i].vbase;
clps[i].map->buswidth = clps[i].width;
clps[i].map->size = clps[i].size;
+
+ simple_map_init(&clps[i].map);
clps[i].mtd = do_map_probe("jedec_probe", clps[i].map);
if (clps[i].mtd == NULL) {
Index: cfi_flagadm.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cfi_flagadm.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cfi_flagadm.c 2 Oct 2001 15:05:13 -0000 1.7
+++ cfi_flagadm.c 14 May 2003 15:05:14 -0000 1.8
@@ -55,83 +55,33 @@
#define FLASH_PARTITION3_ADDR 0x00240000
#define FLASH_PARTITION3_SIZE 0x001C0000
-__u8 flagadm_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 flagadm_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 flagadm_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void flagadm_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void flagadm_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-void flagadm_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-void flagadm_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-void flagadm_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
struct map_info flagadm_map = {
- name: "FlagaDM flash device",
- size: FLASH_SIZE,
- buswidth: 2,
- read8: flagadm_read8,
- read16: flagadm_read16,
- read32: flagadm_read32,
- copy_from: flagadm_copy_from,
- write8: flagadm_write8,
- write16: flagadm_write16,
- write32: flagadm_write32,
- copy_to: flagadm_copy_to
+ .name = "FlagaDM flash device",
+ .size = FLASH_SIZE,
+ .buswidth = 2,
};
struct mtd_partition flagadm_parts[] = {
{
- name : "Bootloader",
- offset : FLASH_PARTITION0_ADDR,
- size : FLASH_PARTITION0_SIZE
+ .name = "Bootloader",
+ .offset = FLASH_PARTITION0_ADDR,
+ .size = FLASH_PARTITION0_SIZE
},
{
- name : "Kernel image",
- offset : FLASH_PARTITION1_ADDR,
- size : FLASH_PARTITION1_SIZE
+ .name = "Kernel image",
+ .offset = FLASH_PARTITION1_ADDR,
+ .size = FLASH_PARTITION1_SIZE
},
{
- name : "Initial ramdisk image",
- offset : FLASH_PARTITION2_ADDR,
- size : FLASH_PARTITION2_SIZE
+ .name = "Initial ramdisk image",
+ .offset = FLASH_PARTITION2_ADDR,
+ .size = FLASH_PARTITION2_SIZE
},
{
- name : "Persistant storage",
- offset : FLASH_PARTITION3_ADDR,
- size : FLASH_PARTITION3_SIZE
+ .name = "Persistant storage",
+ .offset = FLASH_PARTITION3_ADDR,
+ .size = FLASH_PARTITION3_SIZE
}
};
@@ -144,13 +94,17 @@
printk(KERN_NOTICE "FlagaDM flash device: %x at %x\n",
FLASH_SIZE, FLASH_PHYS_ADDR);
- flagadm_map.map_priv_1 = (unsigned long)ioremap(FLASH_PHYS_ADDR,
+ flagadm_map.phys = FLASH_PHYS_ADDR;
+ flagadm_map.virt = (unsigned long)ioremap(FLASH_PHYS_ADDR,
FLASH_SIZE);
- if (!flagadm_map.map_priv_1) {
+ if (!flagadm_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
+
+ simple_map_init(&flagadm_map);
+
mymtd = do_map_probe("cfi_probe", &flagadm_map);
if (mymtd) {
mymtd->module = THIS_MODULE;
@@ -159,7 +113,7 @@
return 0;
}
- iounmap((void *)flagadm_map.map_priv_1);
+ iounmap((void *)flagadm_map.virt);
return -ENXIO;
}
@@ -169,9 +123,9 @@
del_mtd_partitions(mymtd);
map_destroy(mymtd);
}
- if (flagadm_map.map_priv_1) {
- iounmap((void *)flagadm_map.map_priv_1);
- flagadm_map.map_priv_1 = 0;
+ if (flagadm_map.virt) {
+ iounmap((void *)flagadm_map.virt);
+ flagadm_map.virt = 0;
}
}
Index: cstm_mips_ixx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/cstm_mips_ixx.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- cstm_mips_ixx.c 2 Oct 2001 15:05:14 -0000 1.5
+++ cstm_mips_ixx.c 14 May 2003 15:05:14 -0000 1.6
@@ -38,50 +38,7 @@
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/config.h>
-
-#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
#include <linux/delay.h>
-#endif
-
-__u8 cstm_mips_ixx_read8(struct map_info *map, unsigned long ofs)
-{
- return *(__u8 *)(map->map_priv_1 + ofs);
-}
-
-__u16 cstm_mips_ixx_read16(struct map_info *map, unsigned long ofs)
-{
- return *(__u16 *)(map->map_priv_1 + ofs);
-}
-
-__u32 cstm_mips_ixx_read32(struct map_info *map, unsigned long ofs)
-{
- return *(__u32 *)(map->map_priv_1 + ofs);
-}
-
-void cstm_mips_ixx_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void cstm_mips_ixx_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- *(__u8 *)(map->map_priv_1 + adr) = d;
-}
-
-void cstm_mips_ixx_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- *(__u16 *)(map->map_priv_1 + adr) = d;
-}
-
-void cstm_mips_ixx_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- *(__u32 *)(map->map_priv_1 + adr) = d;
-}
-
-void cstm_mips_ixx_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
#define CC_GCR 0xB4013818
@@ -97,56 +54,47 @@
#define CC_GPAICR 0xB4013804
#endif /* defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR) */
+#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
void cstm_mips_ixx_set_vpp(struct map_info *map,int vpp)
{
- if (vpp) {
-#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
- __u16 data;
- __u8 data1;
- static u8 first = 1;
-
- // Set GPIO port B pin3 to high
- data = *(__u16 *)(CC_GPBCR);
- data = (data & 0xff0f) | 0x0040;
- *(__u16 *)CC_GPBCR = data;
- *(__u8 *)CC_GPBDR = (*(__u8*)CC_GPBDR) | 0x08;
- if (first) {
- first = 0;
- /* need to have this delay for first
- enabling vpp after powerup */
- udelay(40);
+ static spinlock_t vpp_lock = SPIN_LOCK_UNLOCKED;
+ static int vpp_count = 0;
+ unsigned long flags;
+
+ spin_lock_irqsave(&vpp_lock, flags);
+
+ if (vpp) {
+ if (!vpp_count++) {
+ __u16 data;
+ __u8 data1;
+ static u8 first = 1;
+
+ // Set GPIO port B pin3 to high
+ data = *(__u16 *)(CC_GPBCR);
+ data = (data & 0xff0f) | 0x0040;
+ *(__u16 *)CC_GPBCR = data;
+ *(__u8 *)CC_GPBDR = (*(__u8*)CC_GPBDR) | 0x08;
+ if (first) {
+ first = 0;
+ /* need to have this delay for first
+ enabling vpp after powerup */
+ udelay(40);
+ }
+ }
+ } else {
+ if (!--vpp_count) {
+ __u16 data;
+
+ // Set GPIO port B pin3 to high
+ data = *(__u16 *)(CC_GPBCR);
+ data = (data & 0xff3f) | 0x0040;
+ *(__u16 *)CC_GPBCR = data;
+ *(__u8 *)CC_GPBDR = (*(__u8*)CC_GPBDR) & 0xf7;
+ }
}
-#endif /* CONFIG_MIPS_ITE8172 */
- }
- else {
-#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
- __u16 data;
-
- // Set GPIO port B pin3 to high
- data = *(__u16 *)(CC_GPBCR);
- data = (data & 0xff3f) | 0x0040;
- *(__u16 *)CC_GPBCR = data;
- *(__u8 *)CC_GPBDR = (*(__u8*)CC_GPBDR) & 0xf7;
-#endif /* CONFIG_MIPS_ITE8172 */
- }
+ spin_unlock_irqrestore(&vpp_lock, flags);
}
-
-const struct map_info basic_cstm_mips_ixx_map = {
- NULL,
- 0,
- 0,
- cstm_mips_ixx_read8,
- cstm_mips_ixx_read16,
- cstm_mips_ixx_read32,
- cstm_mips_ixx_copy_from,
- cstm_mips_ixx_write8,
- cstm_mips_ixx_write16,
- cstm_mips_ixx_write32,
- cstm_mips_ixx_copy_to,
- cstm_mips_ixx_set_vpp,
- 0,
- 0
-};
+#endif
/* board and partition description */
@@ -175,9 +123,9 @@
static struct mtd_partition cstm_mips_ixx_partitions[PHYSMAP_NUMBER][MAX_PHYSMAP_PARTITIONS] = {
{ // 28F128J3A in 2x16 configuration
{
- name: "main partition ",
- size: 0x02000000, // 128 x 2 x 128k byte sectors
- offset: 0,
+ .name = "main partition ",
+ .size = 0x02000000, // 128 x 2 x 128k byte sectors
+ .offset = 0,
},
},
};
@@ -197,9 +145,9 @@
static struct mtd_partition cstm_mips_ixx_partitions[PHYSMAP_NUMBER][MAX_PHYSMAP_PARTITIONS] = {
{
{
- name: "main partition",
- size: CONFIG_MTD_CSTM_MIPS_IXX_LEN,
- offset: 0,
+ .name = "main partition",
+ .size = CONFIG_MTD_CSTM_MIPS_IXX_LEN,
+ .offset = 0,
},
},
};
@@ -216,17 +164,24 @@
/* Initialize mapping */
for (i=0;i<PHYSMAP_NUMBER;i++) {
- printk(KERN_NOTICE "cstm_mips_ixx flash device: %lx at %lx\n", cstm_mips_ixx_board_desc[i].window_size, cstm_mips_ixx_board_desc[i].window_addr);
- memcpy((char *)&cstm_mips_ixx_map[i],(char *)&basic_cstm_mips_ixx_map,sizeof(struct map_info));
- cstm_mips_ixx_map[i].map_priv_1 = (unsigned long)ioremap(cstm_mips_ixx_board_desc[i].window_addr, cstm_mips_ixx_board_desc[i].window_size);
- if (!cstm_mips_ixx_map[i].map_priv_1) {
+ printk(KERN_NOTICE "cstm_mips_ixx flash device: 0x%lx at 0x%lx\n",
+ cstm_mips_ixx_board_desc[i].window_size, cstm_mips_ixx_board_desc[i].window_addr);
+
+
+ cstm_mips_ixx_map[i].phys = cstm_mips_ixx_board_desc[i].window_addr;
+ cstm_mips_ixx_map[i].virt = (unsigned long)ioremap(cstm_mips_ixx_board_desc[i].window_addr, cstm_mips_ixx_board_desc[i].window_size);
+ if (!cstm_mips_ixx_map[i].virt) {
printk(KERN_WARNING "Failed to ioremap\n");
return -EIO;
}
cstm_mips_ixx_map[i].name = cstm_mips_ixx_board_desc[i].name;
cstm_mips_ixx_map[i].size = cstm_mips_ixx_board_desc[i].window_size;
cstm_mips_ixx_map[i].buswidth = cstm_mips_ixx_board_desc[i].buswidth;
- //printk(KERN_NOTICE "cstm_mips_ixx: ioremap is %x\n",(unsigned int)(cstm_mips_ixx_map[i].map_priv_1));
+#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
+ cstm_mips_ixx_map[i].set_vpp = cstm_mips_ixx_set_vpp;
+#endif
+ simple_map_init(&cstm_mips_ixx_map[i]);
+ //printk(KERN_NOTICE "cstm_mips_ixx: ioremap is %x\n",(unsigned int)(cstm_mips_ixx_map[i].virt));
}
#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
@@ -266,9 +221,9 @@
del_mtd_partitions(mymtd);
map_destroy(mymtd);
}
- if (cstm_mips_ixx_map[i].map_priv_1) {
- iounmap((void *)cstm_mips_ixx_map[i].map_priv_1);
- cstm_mips_ixx_map[i].map_priv_1 = 0;
+ if (cstm_mips_ixx_map[i].virt) {
+ iounmap((void *)cstm_mips_ixx_map[i].virt);
+ cstm_mips_ixx_map[i].virt = 0;
}
}
}
Index: dbox2-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dbox2-flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- dbox2-flash.c 11 Apr 2003 11:15:34 -0000 1.5
+++ dbox2-flash.c 14 May 2003 15:05:14 -0000 1.6
@@ -62,72 +62,24 @@
static struct mtd_info *mymtd;
-__u8 dbox2_flash_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 dbox2_flash_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 dbox2_flash_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void dbox2_flash_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void dbox2_flash_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-void dbox2_flash_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-void dbox2_flash_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-void dbox2_flash_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
struct map_info dbox2_flash_map = {
.name = "D-Box 2 flash memory",
.size = WINDOW_SIZE,
.buswidth = 4,
- .read8 = dbox2_flash_read8,
- .read16 = dbox2_flash_read16,
- .read32 = dbox2_flash_read32,
- .copy_from = dbox2_flash_copy_from,
- .write8 = dbox2_flash_write8,
- .write16 = dbox2_flash_write16,
- .write32 = dbox2_flash_write32,
- .copy_to = dbox2_flash_copy_to
+ .phys = WINDOW_ADDR,
};
int __init init_dbox2_flash(void)
{
printk(KERN_NOTICE "D-Box 2 flash driver (size->0x%X mem->0x%X)\n", WINDOW_SIZE, WINDOW_ADDR);
- dbox2_flash_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+ dbox2_flash_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
- if (!dbox2_flash_map.map_priv_1) {
+ if (!dbox2_flash_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
+ simple_map_init(&dbox2_flash_map);
// Probe for dual Intel 28F320 or dual AMD
mymtd = do_map_probe("cfi_probe", &dbox2_flash_map);
@@ -147,7 +99,7 @@
return 0;
}
- iounmap((void *)dbox2_flash_map.map_priv_1);
+ iounmap((void *)dbox2_flash_map.virt);
return -ENXIO;
}
@@ -157,9 +109,9 @@
del_mtd_partitions(mymtd);
map_destroy(mymtd);
}
- if (dbox2_flash_map.map_priv_1) {
- iounmap((void *)dbox2_flash_map.map_priv_1);
- dbox2_flash_map.map_priv_1 = 0;
+ if (dbox2_flash_map.virt) {
+ iounmap((void *)dbox2_flash_map.virt);
+ dbox2_flash_map.virt = 0;
}
}
Index: dc21285.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dc21285.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- dc21285.c 17 Feb 2003 21:49:10 -0000 1.10
+++ dc21285.c 14 May 2003 15:05:14 -0000 1.11
@@ -92,16 +92,17 @@
}
struct map_info dc21285_map = {
- name: "DC21285 flash",
- size: 16*1024*1024,
- read8: dc21285_read8,
- read16: dc21285_read16,
- read32: dc21285_read32,
- copy_from: dc21285_copy_from,
- write8: dc21285_write8,
- write16: dc21285_write16,
- write32: dc21285_write32,
- copy_to: dc21285_copy_to
+ .name = "DC21285 flash",
+ .phys = NO_XIP,
+ .size = 16*1024*1024,
+ .read8 = dc21285_read8,
+ .read16 = dc21285_read16,
+ .read32 = dc21285_read32,
+ .copy_from = dc21285_copy_from,
+ .write8 = dc21285_write8,
+ .write16 = dc21285_write16,
+ .write32 = dc21285_write32,
+ .copy_to = dc21285_copy_to
};
Index: dilnetpc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/dilnetpc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- dilnetpc.c 12 Mar 2002 13:07:26 -0000 1.8
+++ dilnetpc.c 14 May 2003 15:05:14 -0000 1.9
@@ -36,7 +36,7 @@
#include <linux/mtd/concat.h>
/*
-** The DIL/NetPC keeps it's BIOS in two distinct flash blocks.
+** The DIL/NetPC keeps its BIOS in two distinct flash blocks.
** Destroying any of these blocks transforms the DNPC into
** a paperweight (albeit not a very useful one, considering
** it only weighs a few grams).
@@ -189,45 +189,6 @@
}
-static __u8 dnpc_read8(struct map_info *map, unsigned long ofs)
-{
- return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 dnpc_read16(struct map_info *map, unsigned long ofs)
-{
- return readw(map->map_priv_1 + ofs);
-}
-
-static __u32 dnpc_read32(struct map_info *map, unsigned long ofs)
-{
- return readl(map->map_priv_1 + ofs);
-}
-
-static void dnpc_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void dnpc_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- writeb(d, map->map_priv_1 + adr);
-}
-
-static void dnpc_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- writew(d, map->map_priv_1 + adr);
-}
-
-static void dnpc_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- writel(d, map->map_priv_1 + adr);
-}
-
-static void dnpc_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
/*
************************************************************
@@ -285,22 +246,14 @@
#define DNP_WINDOW_SIZE 0x00200000 /* DNP flash size is 2MiB */
#define ADNP_WINDOW_SIZE 0x00400000 /* ADNP flash size is 4MiB */
-#define WINDOW_ADDR FLASH_BASE
+#define WINDOW_ADDR FLASH_BASE
static struct map_info dnpc_map = {
- name: "ADNP Flash Bank",
- size: ADNP_WINDOW_SIZE,
- buswidth: 1,
- read8: dnpc_read8,
- read16: dnpc_read16,
- read32: dnpc_read32,
- copy_from: dnpc_copy_from,
- write8: dnpc_write8,
- write16: dnpc_write16,
- write32: dnpc_write32,
- copy_to: dnpc_copy_to,
- set_vpp: adnp_set_vpp,
- map_priv_2: WINDOW_ADDR
+ .name = "ADNP Flash Bank",
+ .size = ADNP_WINDOW_SIZE,
+ .buswidth = 1,
+ .set_vpp = adnp_set_vpp,
+ .phys = WINDOW_ADDR
};
/*
@@ -316,29 +269,29 @@
static struct mtd_partition partition_info[]=
{
{
- name: "ADNP boot",
- offset: 0,
- size: 0xf0000,
+ .name = "ADNP boot",
+ .offset = 0,
+ .size = 0xf0000,
},
{
- name: "ADNP system BIOS",
- offset: MTDPART_OFS_NXTBLK,
- size: 0x10000,
+ .name = "ADNP system BIOS",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x10000,
#ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
- mask_flags: MTD_WRITEABLE,
+ .mask_flags = MTD_WRITEABLE,
#endif
},
{
- name: "ADNP file system",
- offset: MTDPART_OFS_NXTBLK,
- size: 0x2f0000,
+ .name = "ADNP file system",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x2f0000,
},
{
- name: "ADNP system BIOS entry",
- offset: MTDPART_OFS_NXTBLK,
- size: MTDPART_SIZ_FULL,
+ .name = "ADNP system BIOS entry",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = MTDPART_SIZ_FULL,
#ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
- mask_flags: MTD_WRITEABLE,
+ .mask_flags = MTD_WRITEABLE,
#endif
},
};
@@ -369,21 +322,21 @@
static struct mtd_partition higlvl_partition_info[]=
{
{
- name: "ADNP boot block",
- offset: 0,
- size: CONFIG_MTD_DILNETPC_BOOTSIZE,
+ .name = "ADNP boot block",
+ .offset = 0,
+ .size = CONFIG_MTD_DILNETPC_BOOTSIZE,
},
{
- name: "ADNP file system space",
- offset: MTDPART_OFS_NXTBLK,
- size: ADNP_WINDOW_SIZE-CONFIG_MTD_DILNETPC_BOOTSIZE-0x20000,
+ .name = "ADNP file system space",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = ADNP_WINDOW_SIZE-CONFIG_MTD_DILNETPC_BOOTSIZE-0x20000,
},
{
- name: "ADNP system BIOS + BIOS Entry",
- offset: MTDPART_OFS_NXTBLK,
- size: MTDPART_SIZ_FULL,
+ .name = "ADNP system BIOS + BIOS Entry",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = MTDPART_SIZ_FULL,
#ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
- mask_flags: MTD_WRITEABLE,
+ .mask_flags = MTD_WRITEABLE,
#endif
},
};
@@ -447,18 +400,19 @@
}
printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%lx\n",
- is_dnp ? "DNPC" : "ADNP", dnpc_map.size, dnpc_map.map_priv_2);
+ is_dnp ? "DNPC" : "ADNP", dnpc_map.size, dnpc_map.phys);
- dnpc_map.map_priv_1 = (unsigned long)ioremap_nocache(dnpc_map.map_priv_2, dnpc_map.size);
+ dnpc_map.virt = (unsigned long)ioremap_nocache(dnpc_map.phys, dnpc_map.size);
- dnpc_map_flash(dnpc_map.map_priv_2, dnpc_map.size);
+ dnpc_map_flash(dnpc_map.phys, dnpc_map.size);
- if (!dnpc_map.map_priv_1) {
+ if (!dnpc_map.virt) {
printk("Failed to ioremap_nocache\n");
return -EIO;
}
+ simple_map_init(&dnpc_map);
- printk("FLASH virtual address: 0x%lx\n", dnpc_map.map_priv_1);
+ printk("FLASH virtual address: 0x%lx\n", dnpc_map.virt);
mymtd = do_map_probe("jedec_probe", &dnpc_map);
@@ -475,7 +429,7 @@
mymtd->erasesize = 0x10000;
if (!mymtd) {
- iounmap((void *)dnpc_map.map_priv_1);
+ iounmap((void *)dnpc_map.virt);
return -ENXIO;
}
@@ -525,10 +479,10 @@
del_mtd_partitions(mymtd);
map_destroy(mymtd);
}
- if (dnpc_map.map_priv_1) {
- iounmap((void *)dnpc_map.map_priv_1);
+ if (dnpc_map.virt) {
+ iounmap((void *)dnpc_map.virt);
dnpc_unmap_flash();
- dnpc_map.map_priv_1 = 0;
+ dnpc_map.virt = 0;
}
}
Index: ebony.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ebony.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ebony.c 31 Jan 2003 08:27:38 -0000 1.3
+++ ebony.c 14 May 2003 15:05:14 -0000 1.4
@@ -26,109 +26,36 @@
static struct mtd_info *flash;
-static __u8 ebony_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 ebony_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static __u32 ebony_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-static void ebony_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void ebony_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void ebony_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void ebony_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void ebony_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
-u_char * ebony_point(struct map_info *map, loff_t from, size_t len)
-{
- return (u_char *)(map->map_priv_1 + (unsigned long)from);
-}
-
-void ebony_unpoint(struct map_info *map, u_char *adr, loff_t from, size_t len)
-{
- /* do nothing for now */
-}
-
static struct map_info ebony_small_map = {
- name: "Ebony small flash",
- size: EBONY_SMALL_FLASH_SIZE,
- buswidth: 1,
- read8: ebony_read8,
- read16: ebony_read16,
- read32: ebony_read32,
- point: ebony_point,
- unpoint: ebony_unpoint,
- copy_from: ebony_copy_from,
- write8: ebony_write8,
- write16: ebony_write16,
- write32: ebony_write32,
- copy_to: ebony_copy_to,
+ .name = "Ebony small flash",
+ .size = EBONY_SMALL_FLASH_SIZE,
+ .buswidth = 1,
};
static struct map_info ebony_large_map = {
- name: "Ebony large flash",
- size: EBONY_LARGE_FLASH_SIZE,
- buswidth: 1,
- read8: ebony_read8,
- read16: ebony_read16,
- read32: ebony_read32,
- point: ebony_point,
- unpoint: ebony_unpoint,
- copy_from: ebony_copy_from,
- write8: ebony_write8,
- write16: ebony_write16,
- write32: ebony_write32,
- copy_to: ebony_copy_to,
+ .name = "Ebony large flash",
+ .size = EBONY_LARGE_FLASH_SIZE,
+ .buswidth = 1,
};
static struct mtd_partition ebony_small_partitions[] = {
{
- name: "OpenBIOS",
- offset: 0x0,
- size: 0x80000,
+ .name = "OpenBIOS",
+ .offset = 0x0,
+ .size = 0x80000,
}
};
static struct mtd_partition ebony_large_partitions[] = {
{
- name: "fs",
- offset: 0,
- size: 0x380000,
+ .name = "fs",
+ .offset = 0,
+ .size = 0x380000,
},
{
- name: "firmware",
- offset: 0x380000,
- size: 0x80000,
+ .name = "firmware",
+ .offset = 0x380000,
+ .size = 0x80000,
}
};
@@ -137,9 +64,15 @@
int __init init_ebony(void)
{
u8 fpga0_reg;
+ unsigned long fpga0_adr;
unsigned long long small_flash_base, large_flash_base;
- fpga0_reg = readb(ioremap64(EBONY_FPGA_ADDR, 16));
+ fpga0_adr = ioremap64(EBONY_FPGA_ADDR, 16);
+ if (!fpga0_adr)
+ return -ENOMEM;
+
+ fpga0_reg = readb(fpga0_adr);
+ iounmap64(fpga0_adr);
if (EBONY_BOOT_SMALL_FLASH(fpga0_reg) &&
!EBONY_FLASH_SEL(fpga0_reg))
@@ -159,15 +92,18 @@
else
large_flash_base = EBONY_LARGE_FLASH_HIGH;
- ebony_small_map.map_priv_1 =
+ ebony_small_map.phys = small_flash_base;
+ ebony_small_map.virt =
(unsigned long)ioremap64(small_flash_base,
ebony_small_map.size);
- if (!ebony_small_map.map_priv_1) {
+ if (!ebony_small_map.virt) {
printk("Failed to ioremap flash\n");
return -EIO;
}
+ simple_map_init(&ebony_small_map);
+
flash = do_map_probe("map_rom", &ebony_small_map);
if (flash) {
flash->module = THIS_MODULE;
@@ -178,15 +114,18 @@
return -ENXIO;
}
- ebony_large_map.map_priv_1 =
+ ebony_large_map.phys = large_flash_base;
+ ebony_large_map.virt =
(unsigned long)ioremap64(large_flash_base,
ebony_large_map.size);
- if (!ebony_large_map.map_priv_1) {
+ if (!ebony_large_map.virt) {
printk("Failed to ioremap flash\n");
return -EIO;
}
+ simple_map_init(&ebony_large_map);
+
flash = do_map_probe("cfi_probe", &ebony_large_map);
if (flash) {
flash->module = THIS_MODULE;
@@ -207,14 +146,14 @@
map_destroy(flash);
}
- if (ebony_small_map.map_priv_1) {
- iounmap((void *)ebony_small_map.map_priv_1);
- ebony_small_map.map_priv_1 = 0;
+ if (ebony_small_map.virt) {
+ iounmap((void *)ebony_small_map.virt);
+ ebony_small_map.virt = 0;
}
- if (ebony_large_map.map_priv_1) {
- iounmap((void *)ebony_large_map.map_priv_1);
- ebony_large_map.map_priv_1 = 0;
+ if (ebony_large_map.virt) {
+ iounmap((void *)ebony_large_map.virt);
+ ebony_large_map.virt = 0;
}
}
Index: edb7312.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/edb7312.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- edb7312.c 17 Feb 2003 21:49:10 -0000 1.3
+++ edb7312.c 14 May 2003 15:05:14 -0000 1.4
@@ -35,61 +35,11 @@
static struct mtd_info *mymtd;
-__u8 edb7312nor_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 edb7312nor_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 edb7312nor_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void edb7312nor_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void edb7312nor_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-void edb7312nor_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-void edb7312nor_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-void edb7312nor_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
struct map_info edb7312nor_map = {
- name: "NOR flash on EDB7312",
- size: WINDOW_SIZE,
- buswidth: BUSWIDTH,
- read8: edb7312nor_read8,
- read16: edb7312nor_read16,
- read32: edb7312nor_read32,
- copy_from: edb7312nor_copy_from,
- write8: edb7312nor_write8,
- write16: edb7312nor_write16,
- write32: edb7312nor_write32,
- copy_to: edb7312nor_copy_to
+ .name = "NOR flash on EDB7312",
+ .size = WINDOW_SIZE,
+ .buswidth = BUSWIDTH,
+ .phys = WINDOW_ADDR,
};
#ifdef CONFIG_MTD_PARTITIONS
@@ -99,21 +49,21 @@
*/
static struct mtd_partition static_partitions[3] =
{
- {
- name: "ARMboot",
- size: 0x40000,
- offset: 0
- },
- {
- name: "Kernel",
- size: 0x200000,
- offset: 0x40000
- },
- {
- name: "RootFS",
- size: 0xDC0000,
- offset: 0x240000
- },
+ {
+ .name = "ARMboot",
+ .size = 0x40000,
+ .offset = 0
+ },
+ {
+ .name = "Kernel",
+ .size = 0x200000,
+ .offset = 0x40000
+ },
+ {
+ .name = "RootFS",
+ .size = 0xDC0000,
+ .offset = 0x240000
+ },
};
#define NB_OF(x) (sizeof (x) / sizeof (x[0]))
@@ -131,13 +81,15 @@
printk(KERN_NOTICE MSG_PREFIX "0x%08x at 0x%08x\n",
WINDOW_SIZE, WINDOW_ADDR);
- edb7312nor_map.map_priv_1 = (unsigned long)
+ edb7312nor_map.virt = (unsigned long)
ioremap(WINDOW_ADDR, WINDOW_SIZE);
- if (!edb7312nor_map.map_priv_1) {
+ if (!edb7312nor_map.virt) {
printk(MSG_PREFIX "failed to ioremap\n");
return -EIO;
}
+
+ simple_map_init(&edb7312nor_map);
mymtd = 0;
type = rom_probe_types;
@@ -172,7 +124,7 @@
return 0;
}
- iounmap((void *)edb7312nor_map.map_priv_1);
+ iounmap((void *)edb7312nor_map.virt);
return -ENXIO;
}
@@ -182,9 +134,9 @@
del_mtd_device(mymtd);
map_destroy(mymtd);
}
- if (edb7312nor_map.map_priv_1) {
- iounmap((void *)edb7312nor_map.map_priv_1);
- edb7312nor_map.map_priv_1 = 0;
+ if (edb7312nor_map.virt) {
+ iounmap((void *)edb7312nor_map.virt);
+ edb7312nor_map.virt = 0;
}
}
Index: elan-104nc.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/elan-104nc.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- elan-104nc.c 13 Feb 2002 15:30:20 -0000 1.13
+++ elan-104nc.c 14 May 2003 15:05:14 -0000 1.14
@@ -59,14 +59,14 @@
* single flash device into. If the size if zero we use up to the end of the
* device. */
static struct mtd_partition partition_info[]={
- { name: "ELAN-104NC flash boot partition",
- offset: 0,
- size: 640*1024 },
- { name: "ELAN-104NC flash partition 1",
- offset: 640*1024,
- size: 896*1024 },
- { name: "ELAN-104NC flash partition 2",
- offset: (640+896)*1024 }
+ { .name = "ELAN-104NC flash boot partition",
+ .offset = 0,
+ .size = 640*1024 },
+ { .name = "ELAN-104NC flash partition 1",
+ .offset = 640*1024,
+ .size = 896*1024 },
+ { .name = "ELAN-104NC flash partition 2",
+ .offset = (640+896)*1024 }
};
#define NUM_PARTITIONS (sizeof(partition_info)/sizeof(partition_info[0]))
@@ -195,19 +195,20 @@
}
static struct map_info elan_104nc_map = {
- name: "ELAN-104NC flash",
- size: 8*1024*1024, /* this must be set to a maximum possible amount
+ .name = "ELAN-104NC flash",
+ .phys = NO_XIP,
+ .size = 8*1024*1024, /* this must be set to a maximum possible amount
of flash so the cfi probe routines find all
the chips */
- buswidth: 2,
- read8: elan_104nc_read8,
- read16: elan_104nc_read16,
- read32: elan_104nc_read32,
- copy_from: elan_104nc_copy_from,
- write8: elan_104nc_write8,
- write16: elan_104nc_write16,
- write32: elan_104nc_write32,
- copy_to: elan_104nc_copy_to
+ .buswidth = 2,
+ .read8 = elan_104nc_read8,
+ .read16 = elan_104nc_read16,
+ .read32 = elan_104nc_read32,
+ .copy_from = elan_104nc_copy_from,
+ .write8 = elan_104nc_write8,
+ .write16 = elan_104nc_write16,
+ .write32 = elan_104nc_write32,
+ .copy_to = elan_104nc_copy_to
};
/* MTD device for all of the flash. */
Index: epxa10db-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/epxa10db-flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- epxa10db-flash.c 17 Feb 2003 21:49:10 -0000 1.5
+++ epxa10db-flash.c 14 May 2003 15:05:14 -0000 1.6
@@ -45,63 +45,12 @@
static int epxa_default_partitions(struct mtd_info *master, struct mtd_partition **pparts);
-static __u8 epxa_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 epxa_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static __u32 epxa_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-static void epxa_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void epxa_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void epxa_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void epxa_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void epxa_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
-
-
static struct map_info epxa_map = {
- name: "EPXA flash",
- size: FLASH_SIZE,
- buswidth: 2,
- read8: epxa_read8,
- read16: epxa_read16,
- read32: epxa_read32,
- copy_from: epxa_copy_from,
- write8: epxa_write8,
- write16: epxa_write16,
- write32: epxa_write32,
- copy_to: epxa_copy_to
+ .name = "EPXA flash",
+ .size = FLASH_SIZE,
+ .buswidth = 2,
+ .phys = FLASH_START,
};
@@ -109,16 +58,18 @@
{
int i;
- printk(KERN_NOTICE "%s flash device: %x at %x\n", BOARD_NAME, FLASH_SIZE, FLASH_START);
- epxa_map.map_priv_1 = (unsigned long)ioremap(FLASH_START, FLASH_SIZE);
- if (!epxa_map.map_priv_1) {
+ printk(KERN_NOTICE "%s flash device: 0x%x at 0x%x\n", BOARD_NAME, FLASH_SIZE, FLASH_START);
+
+ epxa_map.virt = (unsigned long)ioremap(FLASH_START, FLASH_SIZE);
+ if (!epxa_map.virt) {
printk("Failed to ioremap %s flash\n",BOARD_NAME);
return -EIO;
}
+ simple_map_init(&epxa_map);
mymtd = do_map_probe("cfi_probe", &epxa_map);
if (!mymtd) {
- iounmap((void *)epxa_map.map_priv_1);
+ iounmap((void *)epxa_map.virt);
return -ENXIO;
}
@@ -172,9 +123,9 @@
del_mtd_device(mymtd);
map_destroy(mymtd);
}
- if (epxa_map.map_priv_1) {
- iounmap((void *)epxa_map.map_priv_1);
- epxa_map.map_priv_1 = 0;
+ if (epxa_map.virt) {
+ iounmap((void *)epxa_map.virt);
+ epxa_map.virt = 0;
}
}
Index: fortunet.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/fortunet.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- fortunet.c 14 Oct 2002 12:50:22 -0000 1.2
+++ fortunet.c 14 May 2003 15:05:14 -0000 1.3
@@ -23,7 +23,7 @@
struct map_region
{
- int window_addr_phyical;
+ int window_addr_physical;
int altbuswidth;
struct map_info map_info;
struct mtd_info *mymtd;
@@ -37,57 +37,10 @@
static int map_regions_parts[MAX_NUM_REGIONS] = {0,0,0,0};
-__u8 fortunet_read8(struct map_info *map, unsigned long ofs)
-{
- return *(__u8 *)(map->map_priv_1 + ofs);
-}
-
-__u16 fortunet_read16(struct map_info *map, unsigned long ofs)
-{
- return *(__u16 *)(map->map_priv_1 + ofs);
-}
-
-__u32 fortunet_read32(struct map_info *map, unsigned long ofs)
-{
- return *(__u32 *)(map->map_priv_1 + ofs);
-}
-
-void fortunet_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void fortunet_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- *(__u8 *)(map->map_priv_1 + adr) = d;
-}
-
-void fortunet_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- *(__u16 *)(map->map_priv_1 + adr) = d;
-}
-
-void fortunet_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- *(__u32 *)(map->map_priv_1 + adr) = d;
-}
-
-void fortunet_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy((void *)(map->map_priv_1 + to), from, len);
-}
struct map_info default_map = {
- size: DEF_WINDOW_SIZE,
- buswidth: 4,
- read8: fortunet_read8,
- read16: fortunet_read16,
- read32: fortunet_read32,
- copy_from: fortunet_copy_from,
- write8: fortunet_write8,
- write16: fortunet_write16,
- write32: fortunet_write32,
- copy_to: fortunet_copy_to
+ .size = DEF_WINDOW_SIZE,
+ .buswidth = 4,
};
static char * __init get_string_option(char *dest,int dest_size,char *sor)
@@ -147,7 +100,7 @@
get_options (get_string_option(string,sizeof(string),line),6,params);
if(params[0]<1)
{
- printk(MTD_FORTUNET_PK "Bad paramters for MTD Region "
+ printk(MTD_FORTUNET_PK "Bad parameters for MTD Region "
" name,region-number[,base,size,buswidth,altbuswidth]\n");
return 1;
}
@@ -161,14 +114,14 @@
memcpy(&map_regions[params[1]].map_info,
&default_map,sizeof(map_regions[params[1]].map_info));
map_regions_set[params[1]] = 1;
- map_regions[params[1]].window_addr_phyical = DEF_WINDOW_ADDR_PHY;
+ map_regions[params[1]].window_addr_physical = DEF_WINDOW_ADDR_PHY;
map_regions[params[1]].altbuswidth = 2;
map_regions[params[1]].mymtd = NULL;
map_regions[params[1]].map_info.name = map_regions[params[1]].map_name;
strcpy(map_regions[params[1]].map_info.name,string);
if(params[0]>1)
{
- map_regions[params[1]].window_addr_phyical = params[2];
+ map_regions[params[1]].window_addr_physical = params[2];
}
if(params[0]>2)
{
@@ -185,14 +138,14 @@
return 1;
}
-static int __init MTD_New_Partion(char *line)
+static int __init MTD_New_Partition(char *line)
{
char string[MAX_NAME_SIZE];
int params[4];
get_options (get_string_option(string,sizeof(string),line),4,params);
if(params[0]<3)
{
- printk(MTD_FORTUNET_PK "Bad paramters for MTD Partion "
+ printk(MTD_FORTUNET_PK "Bad parameters for MTD Partition "
" name,region-number,size,offset\n");
return 1;
}
@@ -204,7 +157,7 @@
}
if(map_regions_parts[params[1]]>=MAX_NUM_PARTITIONS)
{
- printk(MTD_FORTUNET_PK "Out of space for partion in this region\n");
+ printk(MTD_FORTUNET_PK "Out of space for partition in this region\n");
return 1;
}
map_regions[params[1]].parts[map_regions_parts[params[1]]].name =
@@ -220,7 +173,10 @@
}
__setup("MTD_Region=", MTD_New_Region);
-__setup("MTD_Partion=", MTD_New_Partion);
+__setup("MTD_Partition=", MTD_New_Partition);
+
+/* Backwards-spelling-compatibility */
+__setup("MTD_Partion=", MTD_New_Partition);
int __init init_fortunet(void)
{
@@ -229,13 +185,13 @@
{
if(map_regions_parts[ix]&&(!map_regions_set[ix]))
{
- printk(MTD_FORTUNET_PK "Region %d is not setup (Seting to default)\n",
+ printk(MTD_FORTUNET_PK "Region %d is not setup (Setting to default)\n",
ix);
memset(&map_regions[ix],0,sizeof(map_regions[ix]));
memcpy(&map_regions[ix].map_info,&default_map,
sizeof(map_regions[ix].map_info));
map_regions_set[ix] = 1;
- map_regions[ix].window_addr_phyical = DEF_WINDOW_ADDR_PHY;
+ map_regions[ix].window_addr_physical = DEF_WINDOW_ADDR_PHY;
map_regions[ix].altbuswidth = 2;
map_regions[ix].mymtd = NULL;
map_regions[ix].map_info.name = map_regions[ix].map_name;
@@ -244,30 +200,35 @@
if(map_regions_set[ix])
{
iy++;
- printk(KERN_NOTICE MTD_FORTUNET_PK "%s flash device at phyicaly "
+ printk(KERN_NOTICE MTD_FORTUNET_PK "%s flash device at physically "
" address %x size %x\n",
map_regions[ix].map_info.name,
- map_regions[ix].window_addr_phyical,
+ map_regions[ix].window_addr_physical,
map_regions[ix].map_info.size);
- map_regions[ix].map_info.map_priv_1 =
+
+ map_regions[ix].map_info.phys = map_regions[ix].window_addr_physical,
+
+ map_regions[ix].map_info.virt =
(int)ioremap_nocache(
- map_regions[ix].window_addr_phyical,
+ map_regions[ix].window_addr_physical,
map_regions[ix].map_info.size);
- if(!map_regions[ix].map_info.map_priv_1)
+ if(!map_regions[ix].map_info.virt)
{
printk(MTD_FORTUNET_PK "%s flash failed to ioremap!\n",
map_regions[ix].map_info.name);
return -ENXIO;
}
- printk(KERN_NOTICE MTD_FORTUNET_PK "%s flash is veritualy at: %x\n",
+ simple_map_init(&map_regions[ix].map_info);
+
+ printk(KERN_NOTICE MTD_FORTUNET_PK "%s flash is virtually at: %x\n",
map_regions[ix].map_info.name,
- map_regions[ix].map_info.map_priv_1);
+ map_regions[ix].map_info.virt);
map_regions[ix].mymtd = do_map_probe("cfi_probe",
&map_regions[ix].map_info);
if((!map_regions[ix].mymtd)&&(
map_regions[ix].altbuswidth!=map_regions[ix].map_info.buswidth))
{
- printk(KERN_NOTICE MTD_FORTUNET_PK "Trying alternet buswidth "
+ printk(KERN_NOTICE MTD_FORTUNET_PK "Trying alternate buswidth "
"for %s flash.\n",
map_regions[ix].map_info.name);
map_regions[ix].map_info.buswidth =
@@ -297,7 +258,7 @@
del_mtd_partitions( map_regions[ix].mymtd );
map_destroy( map_regions[ix].mymtd );
}
- iounmap((void *)map_regions[ix].map_info.map_priv_1);
+ iounmap((void *)map_regions[ix].map_info.virt);
}
}
}
Index: h720x-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/h720x-flash.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- h720x-flash.c 20 Apr 2003 08:38:01 -0000 1.1
+++ h720x-flash.c 14 May 2003 15:05:14 -0000 1.2
@@ -20,85 +20,38 @@
static struct mtd_info *mymtd;
-static __u8 h720x_read8(struct map_info *map, unsigned long ofs)
-{
- return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 h720x_read16(struct map_info *map, unsigned long ofs)
-{
- return readw(map->map_priv_1 + ofs);
-}
-
-static __u32 h720x_read32(struct map_info *map, unsigned long ofs)
-{
- return readl(map->map_priv_1 + ofs);
-}
-
-static void h720x_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void h720x_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- writeb(d, map->map_priv_1 + adr);
-}
-
-static void h720x_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- writew(d, map->map_priv_1 + adr);
-}
-
-static void h720x_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- writel(d, map->map_priv_1 + adr);
-}
-
-static void h720x_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
static struct map_info h720x_map = {
- name: "H720X",
- read8: h720x_read8,
- read16: h720x_read16,
- read32: h720x_read32,
- copy_from: h720x_copy_from,
- write8: h720x_write8,
- write16: h720x_write16,
- write32: h720x_write32,
- copy_to: h720x_copy_to,
- buswidth: 4,
- size: FLASH_SIZE
+ .name = "H720X",
+ .buswidth = 4,
+ .size = FLASH_SIZE,
+ .phys = FLASH_PHYS,
};
static struct mtd_partition h720x_partitions[] = {
{
- name: "ArMon",
- size: 0x00080000,
- offset: 0,
- mask_flags: MTD_WRITEABLE
+ .name = "ArMon",
+ .size = 0x00080000,
+ .offset = 0,
+ .mask_flags = MTD_WRITEABLE
},{
- name: "Env",
- size: 0x00040000,
- offset: 0x00080000,
- mask_flags: MTD_WRITEABLE
+ .name = "Env",
+ .size = 0x00040000,
+ .offset = 0x00080000,
+ .mask_flags = MTD_WRITEABLE
},{
- name: "Kernel",
- size: 0x00180000,
- offset: 0x000c0000,
- mask_flags: MTD_WRITEABLE
+ .name = "Kernel",
+ .size = 0x00180000,
+ .offset = 0x000c0000,
+ .mask_flags = MTD_WRITEABLE
},{
- name: "Ramdisk",
- size: 0x00400000,
- offset: 0x00240000,
- mask_flags: MTD_WRITEABLE
+ .name = "Ramdisk",
+ .size = 0x00400000,
+ .offset = 0x00240000,
+ .mask_flags = MTD_WRITEABLE
},{
- name: "jffs2",
- size: MTDPART_SIZ_FULL,
- offset: MTDPART_OFS_APPEND
+ .name = "jffs2",
+ .size = MTDPART_SIZ_FULL,
+ .offset = MTDPART_OFS_APPEND
}
};
@@ -115,13 +68,15 @@
char *part_type = NULL;
- h720x_map.map_priv_1 = (unsigned long)ioremap(FLASH_PHYS, FLASH_SIZE);
+ h720x_map.virt = (unsigned long)ioremap(FLASH_PHYS, FLASH_SIZE);
- if (!h720x_map.map_priv_1) {
+ if (!h720x_map.virt) {
printk(KERN_ERR "H720x-MTD: ioremap failed\n");
return -EIO;
}
+ simple_map_init(&h720x_map);
+
// Probe for flash buswidth 4
printk (KERN_INFO "H720x-MTD probing 32bit FLASH\n");
mymtd = do_map_probe("cfi_probe", &h720x_map);
@@ -150,7 +105,7 @@
return 0;
}
- iounmap((void *)h720x_map.map_priv_1);
+ iounmap((void *)h720x_map.virt);
return -ENXIO;
}
@@ -169,9 +124,9 @@
if (mtd_parts && (mtd_parts != h720x_partitions))
kfree (mtd_parts);
- if (h720x_map.map_priv_1) {
- iounmap((void *)h720x_map.map_priv_1);
- h720x_map.map_priv_1 = 0;
+ if (h720x_map.virt) {
+ iounmap((void *)h720x_map.virt);
+ h720x_map.virt = 0;
}
}
Index: ich2rom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ich2rom.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ich2rom.c 20 Feb 2003 20:44:28 -0000 1.3
+++ ich2rom.c 14 May 2003 15:05:14 -0000 1.4
@@ -90,25 +90,26 @@
}
static struct ich2rom_map_info ich2rom_map = {
- map: {
- name: "ICH2 rom",
- size: 0,
- buswidth: 1,
- read8: ich2rom_read8,
- read16: ich2rom_read16,
- read32: ich2rom_read32,
- copy_from: ich2rom_copy_from,
- write8: ich2rom_write8,
- write16: ich2rom_write16,
- write32: ich2rom_write32,
- copy_to: ich2rom_copy_to,
+ .map = {
+ .name = "ICH2 rom",
+ .phys = NO_XIP,
+ .size = 0,
+ .buswidth = 1,
+ .read8 = ich2rom_read8,
+ .read16 = ich2rom_read16,
+ .read32 = ich2rom_read32,
+ .copy_from = ich2rom_copy_from,
+ .write8 = ich2rom_write8,
+ .write16 = ich2rom_write16,
+ .write32 = ich2rom_write32,
+ .copy_to = ich2rom_copy_to,
/* Firmware hubs only use vpp when being programmed
* in a factory setting. So in place programming
* needs to use a different method.
*/
},
- mtd: 0,
- window_addr: 0,
+ .mtd = 0,
+ .window_addr = 0,
};
enum fwh_lock_state {
@@ -196,7 +197,7 @@
goto err_out_free_mmio_region;
}
- /* For now assume the firmware has setup all relavent firmware
+ /* For now assume the firmware has setup all relevant firmware
* windows. We don't have enough information to handle this case
* intelligently.
*/
@@ -272,10 +273,10 @@
#if 0
static struct pci_driver ich2rom_driver = {
- name: "ich2rom",
- id_table: ich2rom_pci_tbl,
- probe: ich2rom_init_one,
- remove: ich2rom_remove_one,
+ .name = "ich2rom",
+ .id_table = ich2rom_pci_tbl,
+ .probe = ich2rom_init_one,
+ .remove = ich2rom_remove_one,
};
#endif
Index: impa7.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/impa7.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- impa7.c 17 Feb 2003 21:49:10 -0000 1.3
+++ impa7.c 14 May 2003 15:05:14 -0000 1.4
@@ -37,75 +37,17 @@
static struct mtd_info *impa7_mtd[NUM_FLASHBANKS] = { 0 };
-__u8 impa7_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 impa7_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 impa7_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void impa7_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void impa7_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-void impa7_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-void impa7_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-void impa7_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
static struct map_info impa7_map[NUM_FLASHBANKS] = {
{
- name: "impA7 NOR Flash Bank #0",
- size: WINDOW_SIZE0,
- buswidth: BUSWIDTH,
- read8: impa7_read8,
- read16: impa7_read16,
- read32: impa7_read32,
- copy_from: impa7_copy_from,
- write8: impa7_write8,
- write16: impa7_write16,
- write32: impa7_write32,
- copy_to: impa7_copy_to
+ .name = "impA7 NOR Flash Bank #0",
+ .size = WINDOW_SIZE0,
+ .buswidth = BUSWIDTH,
},
{
- name: "impA7 NOR Flash Bank #1",
- size: WINDOW_SIZE1,
- buswidth: BUSWIDTH,
- read8: impa7_read8,
- read16: impa7_read16,
- read32: impa7_read32,
- copy_from: impa7_copy_from,
- write8: impa7_write8,
- write16: impa7_write16,
- write32: impa7_write32,
- copy_to: impa7_copy_to
+ .name = "impA7 NOR Flash Bank #1",
+ .size = WINDOW_SIZE1,
+ .buswidth = BUSWIDTH,
},
};
@@ -116,11 +58,11 @@
*/
static struct mtd_partition static_partitions[] =
{
- {
- name: "FileSystem",
- size: 0x800000,
- offset: 0x00000000
- },
+ {
+ .name = "FileSystem",
+ .size = 0x800000,
+ .offset = 0x00000000
+ },
};
#define NB_OF(x) (sizeof (x) / sizeof (x[0]))
@@ -147,13 +89,15 @@
{
printk(KERN_NOTICE MSG_PREFIX "probing 0x%08lx at 0x%08lx\n",
pt[i].size, pt[i].addr);
- impa7_map[i].map_priv_1 = (unsigned long)
- ioremap(pt[i].addr, pt[i].size);
- if (!impa7_map[i].map_priv_1) {
+ impa7_map[i].phys = pt[i].addr;
+ impa7_map[i].virt = (unsigned long)
+ ioremap(pt[i].addr, pt[i].size);
+ if (!impa7_map[i].virt) {
printk(MSG_PREFIX "failed to ioremap\n");
return -EIO;
}
+ simple_map_init(&impa7_map[i]);
impa7_mtd[i] = 0;
type = rom_probe_types;
@@ -197,7 +141,7 @@
#endif
}
else
- iounmap((void *)impa7_map[i].map_priv_1);
+ iounmap((void *)impa7_map[i].virt);
}
return devicesfound == 0 ? -ENXIO : 0;
}
@@ -212,10 +156,10 @@
del_mtd_device(impa7_mtd[i]);
map_destroy(impa7_mtd[i]);
}
- if (impa7_map[i].map_priv_1)
+ if (impa7_map[i].virt)
{
- iounmap((void *)impa7_map[i].map_priv_1);
- impa7_map[i].map_priv_1 = 0;
+ iounmap((void *)impa7_map[i].virt);
+ impa7_map[i].virt = 0;
}
}
}
Index: integrator-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/integrator-flash.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- integrator-flash.c 17 Feb 2003 21:49:10 -0000 1.8
+++ integrator-flash.c 14 May 2003 15:05:14 -0000 1.9
@@ -151,58 +151,12 @@
}
#endif
-static __u8 armflash_read8(struct map_info *map, unsigned long ofs)
-{
- return readb(ofs + map->map_priv_2);
-}
-
-static __u16 armflash_read16(struct map_info *map, unsigned long ofs)
-{
- return readw(ofs + map->map_priv_2);
-}
-
-static __u32 armflash_read32(struct map_info *map, unsigned long ofs)
-{
- return readl(ofs + map->map_priv_2);
-}
-
-static void armflash_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy(to, (void *) (from + map->map_priv_2), len);
-}
-
-static void armflash_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- writeb(d, adr + map->map_priv_2);
-}
-
-static void armflash_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- writew(d, adr + map->map_priv_2);
-}
-
-static void armflash_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- writel(d, adr + map->map_priv_2);
-}
-
-static void armflash_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy((void *) (to + map->map_priv_2), from, len);
-}
static struct map_info armflash_map =
{
- name: "AFS",
- read8: armflash_read8,
- read16: armflash_read16,
- read32: armflash_read32,
- copy_from: armflash_copy_from,
- write8: armflash_write8,
- write16: armflash_write16,
- write32: armflash_write32,
- copy_to: armflash_copy_to,
- set_vpp: armflash_set_vpp,
+ .name = "AFS",
+ .set_vpp = armflash_set_vpp,
+ .phys = FLASH_BASE,
};
static struct mtd_info *mtd;
@@ -220,7 +174,9 @@
*/
armflash_map.size = size;
armflash_map.buswidth = 4;
- armflash_map.map_priv_2 = (unsigned long) base;
+ armflash_map.virt = (unsigned long) base;
+
+ simple_map_init(&armflash_map);
/*
* Also, the CFI layer automatically works out what size
@@ -288,7 +244,7 @@
static void __exit armflash_exit(void)
{
armflash_cfi_exit();
- iounmap((void *)armflash_map.map_priv_2);
+ iounmap((void *)armflash_map.virt);
release_mem_region(FLASH_BASE, FLASH_SIZE);
armflash_flash_exit();
}
Index: iq80310.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/iq80310.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- iq80310.c 17 Feb 2003 21:49:10 -0000 1.10
+++ iq80310.c 14 May 2003 15:05:15 -0000 1.11
@@ -26,79 +26,32 @@
static struct mtd_info *mymtd;
-static __u8 iq80310_read8(struct map_info *map, unsigned long ofs)
-{
- return *(__u8 *)(map->map_priv_1 + ofs);
-}
-
-static __u16 iq80310_read16(struct map_info *map, unsigned long ofs)
-{
- return *(__u16 *)(map->map_priv_1 + ofs);
-}
-
-static __u32 iq80310_read32(struct map_info *map, unsigned long ofs)
-{
- return *(__u32 *)(map->map_priv_1 + ofs);
-}
-
-static void iq80310_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void iq80310_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- *(__u8 *)(map->map_priv_1 + adr) = d;
-}
-
-static void iq80310_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- *(__u16 *)(map->map_priv_1 + adr) = d;
-}
-
-static void iq80310_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- *(__u32 *)(map->map_priv_1 + adr) = d;
-}
-
-static void iq80310_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy((void *)(map->map_priv_1 + to), from, len);
-}
-
static struct map_info iq80310_map = {
- name: "IQ80310 flash",
- size: WINDOW_SIZE,
- buswidth: BUSWIDTH,
- read8: iq80310_read8,
- read16: iq80310_read16,
- read32: iq80310_read32,
- copy_from: iq80310_copy_from,
- write8: iq80310_write8,
- write16: iq80310_write16,
- write32: iq80310_write32,
- copy_to: iq80310_copy_to
+ .name = "IQ80310 flash",
+ .size = WINDOW_SIZE,
+ .buswidth = BUSWIDTH,
+ .phys = WINDOW_ADDR
};
static struct mtd_partition iq80310_partitions[4] = {
{
- name: "Firmware",
- size: 0x00080000,
- offset: 0,
- mask_flags: MTD_WRITEABLE /* force read-only */
+ .name = "Firmware",
+ .size = 0x00080000,
+ .offset = 0,
+ .mask_flags = MTD_WRITEABLE /* force read-only */
},{
- name: "Kernel",
- size: 0x000a0000,
- offset: 0x00080000,
+ .name = "Kernel",
+ .size = 0x000a0000,
+ .offset = 0x00080000,
},{
- name: "Filesystem",
- size: 0x00600000,
- offset: 0x00120000
+ .name = "Filesystem",
+ .size = 0x00600000,
+ .offset = 0x00120000
},{
- name: "RedBoot",
- size: 0x000e0000,
- offset: 0x00720000,
- mask_flags: MTD_WRITEABLE
+ .name = "RedBoot",
+ .size = 0x000e0000,
+ .offset = 0x00720000,
+ .mask_flags = MTD_WRITEABLE
}
};
@@ -114,14 +67,16 @@
int parsed_nr_parts = 0;
char *part_type = "static";
- iq80310_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
- if (!iq80310_map.map_priv_1) {
+ iq80310_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+ if (!iq80310_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
+ simple_map_init(&iq80310_map);
+
mymtd = do_map_probe("cfi_probe", &iq80310_map);
if (!mymtd) {
- iounmap((void *)iq80310_map.map_priv_1);
+ iounmap((void *)iq80310_map.virt);
return -ENXIO;
}
mymtd->module = THIS_MODULE;
@@ -157,8 +112,8 @@
if (parsed_parts)
kfree(parsed_parts);
}
- if (iq80310_map.map_priv_1)
- iounmap((void *)iq80310_map.map_priv_1);
+ if (iq80310_map.virt)
+ iounmap((void *)iq80310_map.virt);
}
module_init(init_iq80310);
Index: l440gx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/l440gx.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- l440gx.c 10 Jan 2002 20:27:40 -0000 1.8
+++ l440gx.c 14 May 2003 15:05:15 -0000 1.9
@@ -27,48 +27,6 @@
static struct mtd_info *mymtd;
-__u8 l440gx_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 l440gx_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 l440gx_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void l440gx_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void l440gx_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-void l440gx_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-void l440gx_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-void l440gx_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
/* Is this really the vpp port? */
void l440gx_set_vpp(struct map_info *map, int vpp)
@@ -85,22 +43,15 @@
}
struct map_info l440gx_map = {
- name: "L440GX BIOS",
- size: WINDOW_SIZE,
- buswidth: BUSWIDTH,
- read8: l440gx_read8,
- read16: l440gx_read16,
- read32: l440gx_read32,
- copy_from: l440gx_copy_from,
- write8: l440gx_write8,
- write16: l440gx_write16,
- write32: l440gx_write32,
- copy_to: l440gx_copy_to,
+ .name = "L440GX BIOS",
+ .size = WINDOW_SIZE,
+ .buswidth = BUSWIDTH,
+ .phys = WINDOW_ADDR,
#if 0
/* FIXME verify that this is the
* appripriate code for vpp enable/disable
*/
- set_vpp: l440gx_set_vpp
+ .set_vpp = l440gx_set_vpp
#endif
};
@@ -113,7 +64,6 @@
dev = pci_find_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82371AB_0, NULL);
-
pm_dev = pci_find_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
@@ -122,15 +72,14 @@
return -ENODEV;
}
+ l440gx_map.virt = (unsigned long)ioremap_nocache(WINDOW_ADDR, WINDOW_SIZE);
- l440gx_map.map_priv_1 = (unsigned long)ioremap_nocache(WINDOW_ADDR, WINDOW_SIZE);
-
- if (!l440gx_map.map_priv_1) {
+ if (!l440gx_map.virt) {
printk(KERN_WARNING "Failed to ioremap L440GX flash region\n");
return -ENOMEM;
}
-
- printk(KERN_NOTICE "window_addr = 0x%08lx\n", (unsigned long)l440gx_map.map_priv_1);
+ simple_map_init(&l440gx_map);
+ printk(KERN_NOTICE "window_addr = 0x%08lx\n", (unsigned long)l440gx_map.virt);
/* Setup the pm iobase resource
* This code should move into some kind of generic bridge
@@ -153,7 +102,7 @@
/* Allocate the resource region */
if (pci_assign_resource(pm_dev, PIIXE_IOBASE_RESOURCE) != 0) {
printk(KERN_WARNING "Could not allocate pm iobase resource\n");
- iounmap((void *)l440gx_map.map_priv_1);
+ iounmap((void *)l440gx_map.virt);
return -ENXIO;
}
}
@@ -187,7 +136,7 @@
return 0;
}
- iounmap((void *)l440gx_map.map_priv_1);
+ iounmap((void *)l440gx_map.virt);
return -ENXIO;
}
@@ -196,7 +145,7 @@
del_mtd_device(mymtd);
map_destroy(mymtd);
- iounmap((void *)l440gx_map.map_priv_1);
+ iounmap((void *)l440gx_map.virt);
}
module_init(init_l440gx);
Index: lasat.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lasat.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- lasat.c 24 Jan 2003 14:26:38 -0000 1.1
+++ lasat.c 14 May 2003 15:05:15 -0000 1.2
@@ -25,60 +25,9 @@
static struct mtd_info *mymtd;
-static __u8 sp_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 sp_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static __u32 sp_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-static void sp_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void sp_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void sp_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void sp_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void sp_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
static struct map_info sp_map = {
.name = "SP flash",
.buswidth = 4,
- .read8 = sp_read8,
- .read16 = sp_read16,
- .read32 = sp_read32,
- .copy_from = sp_copy_from,
- .write8 = sp_write8,
- .write16 = sp_write16,
- .write32 = sp_write32,
- .copy_to = sp_copy_to
};
static struct mtd_partition partition_info[LASAT_MTD_LAST];
@@ -89,14 +38,18 @@
int i;
/* this does not play well with the old flash code which
* protects and uprotects the flash when necessary */
+ /* FIXME: Implement set_vpp() */
printk(KERN_NOTICE "Unprotecting flash\n");
*lasat_misc->flash_wp_reg |= 1 << lasat_misc->flash_wp_bit;
- sp_map.map_priv_1 = lasat_flash_partition_start(LASAT_MTD_BOOTLOADER);
+ sp_map.virt = lasat_flash_partition_start(LASAT_MTD_BOOTLOADER);
+ sp_map.phys = virt_to_phys(sp_map.virt);
sp_map.size = lasat_board_info.li_flash_size;
+ simple_map_init(&sp_map);
+
printk(KERN_NOTICE "sp flash device: %lx at %lx\n",
- sp_map.size, sp_map.map_priv_1);
+ sp_map.size, sp_map.phys);
for (i=0; i < LASAT_MTD_LAST; i++)
partition_info[i].name = lasat_mtd_partnames[i];
@@ -127,8 +80,8 @@
del_mtd_partitions(mymtd);
map_destroy(mymtd);
}
- if (sp_map.map_priv_1) {
- sp_map.map_priv_1 = 0;
+ if (sp_map.virt) {
+ sp_map.virt = 0;
}
}
Index: lubbock-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/lubbock-flash.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lubbock-flash.c 13 May 2003 15:29:58 -0000 1.2
+++ lubbock-flash.c 14 May 2003 15:05:15 -0000 1.3
@@ -26,82 +26,12 @@
#define WINDOW_SIZE 64*1024*1024
-static __u8 lubbock_read8(struct map_info *map, unsigned long ofs)
-{
- return *(__u8 *)(map->map_priv_1 + ofs);
-}
-
-static __u16 lubbock_read16(struct map_info *map, unsigned long ofs)
-{
- return *(__u16 *)(map->map_priv_1 + ofs);
-}
-
-static __u32 lubbock_read32(struct map_info *map, unsigned long ofs)
-{
- return *(__u32 *)(map->map_priv_1 + ofs);
-}
-
-static void lubbock_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void lubbock_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- *(__u8 *)(map->map_priv_1 + adr) = d;
-}
-
-static void lubbock_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- *(__u16 *)(map->map_priv_1 + adr) = d;
-}
-
-static void lubbock_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- *(__u32 *)(map->map_priv_1 + adr) = d;
-}
-
-static void lubbock_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy((void *)(map->map_priv_1 + to), from, len);
-}
-
-static u_char *lubbock_point(struct map_info *map, loff_t ofs, size_t len)
-{
- return (u_char *)map->map_priv_1 + ofs;
-}
-
-static void lubbock_unpoint(struct map_info *map, u_char *ptr, loff_t ofs, size_t len)
-{
- return;
-}
-
static struct map_info lubbock_maps[2] = { {
.size = WINDOW_SIZE,
- .read8 = lubbock_read8,
- .read16 = lubbock_read16,
- .read32 = lubbock_read32,
- .copy_from = lubbock_copy_from,
- .write8 = lubbock_write8,
- .write16 = lubbock_write16,
- .write32 = lubbock_write32,
- .copy_to = lubbock_copy_to,
- .point = lubbock_point,
- .unpoint = lubbock_unpoint,
- .map_priv_2 = 0x00000000,
+ .phys = 0x00000000,
}, {
.size = WINDOW_SIZE,
- .read8 = lubbock_read8,
- .read16 = lubbock_read16,
- .read32 = lubbock_read32,
- .copy_from = lubbock_copy_from,
- .write8 = lubbock_write8,
- .write16 = lubbock_write16,
- .write32 = lubbock_write32,
- .copy_to = lubbock_copy_to,
- .point = lubbock_point,
- .unpoint = lubbock_unpoint,
- .map_priv_2 = 0x04000000,
+ .phys = 0x04000000,
} };
static struct mtd_partition lubbock_partitions[] = {
@@ -144,22 +74,23 @@
lubbock_maps[flashboot].name = "Lubbock Boot ROM";
for (i = 0; i < 2; i++) {
- lubbock_maps[i].map_priv_1 = (unsigned long)__ioremap(lubbock_maps[i].map_priv_2, WINDOW_SIZE, 0);
- if (!lubbock_maps[i].map_priv_1) {
+ lubbock_maps[i].virt = (unsigned long)__ioremap(lubbock_maps[i].phys, WINDOW_SIZE, 0);
+ if (!lubbock_maps[i].virt) {
printk(KERN_WARNING "Failed to ioremap %s\n", lubbock_maps[i].name);
if (!ret)
ret = -ENOMEM;
continue;
}
+ simple_map_init(&lubbock_maps[i]);
printk(KERN_NOTICE "Probing %s at physical address 0x%08lx (%d-bit buswidth)\n",
- lubbock_maps[i].name, lubbock_maps[i].map_priv_2,
+ lubbock_maps[i].name, lubbock_maps[i].phys,
lubbock_maps[i].buswidth * 8);
mymtds[i] = do_map_probe("cfi_probe", &lubbock_maps[i]);
if (!mymtds[i]) {
- iounmap((void *)lubbock_maps[i].map_priv_1);
+ iounmap((void *)lubbock_maps[i].virt);
if (!ret)
ret = -EIO;
continue;
@@ -210,7 +141,7 @@
del_mtd_device(mymtds[i]);
map_destroy(mymtds[i]);
- iounmap((void *)lubbock_maps[i].map_priv_1);
+ iounmap((void *)lubbock_maps[i].virt);
if (parsed_parts[i])
kfree(parsed_parts[i]);
Index: mbx860.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/mbx860.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mbx860.c 18 Nov 2001 19:43:09 -0000 1.1
+++ mbx860.c 14 May 2003 15:05:15 -0000 1.2
@@ -36,82 +36,37 @@
* single flash device into. If the size if zero we use up to the end of the
* device. */
static struct mtd_partition partition_info[]={
- { name: "MBX flash BOOT partition",
- offset: 0,
- size: BOOT_PARTITION_SIZE_KiB*1024 },
- { name: "MBX flash DATA partition",
- offset: BOOT_PARTITION_SIZE_KiB*1024,
- size: (KERNEL_PARTITION_SIZE_KiB)*1024 },
- { name: "MBX flash APPLICATION partition",
- offset: (BOOT_PARTITION_SIZE_KiB+KERNEL_PARTITION_SIZE_KiB)*1024 }
+ { .name = "MBX flash BOOT partition",
+ .offset = 0,
+ .size = BOOT_PARTITION_SIZE_KiB*1024 },
+ { .name = "MBX flash DATA partition",
+ .offset = BOOT_PARTITION_SIZE_KiB*1024,
+ .size = (KERNEL_PARTITION_SIZE_KiB)*1024 },
+ { .name = "MBX flash APPLICATION partition",
+ .offset = (BOOT_PARTITION_SIZE_KiB+KERNEL_PARTITION_SIZE_KiB)*1024 }
};
static struct mtd_info *mymtd;
-__u8 mbx_read8(struct map_info *map, unsigned long ofs)
-{
- return readb(map->map_priv_1 + ofs);
-}
-
-__u16 mbx_read16(struct map_info *map, unsigned long ofs)
-{
- return readw(map->map_priv_1 + ofs);
-}
-
-__u32 mbx_read32(struct map_info *map, unsigned long ofs)
-{
- return readl(map->map_priv_1 + ofs);
-}
-
-void mbx_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void mbx_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- writeb(d, map->map_priv_1 + adr);
-}
-
-void mbx_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- writew(d, map->map_priv_1 + adr);
-}
-
-void mbx_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- writel(d, map->map_priv_1 + adr);
-}
-
-void mbx_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
-
struct map_info mbx_map = {
- name: "MBX flash",
- size: WINDOW_SIZE,
- buswidth: 4,
- read8: mbx_read8,
- read16: mbx_read16,
- read32: mbx_read32,
- copy_from: mbx_copy_from,
- write8: mbx_write8,
- write16: mbx_write16,
- write32: mbx_write32,
- copy_to: mbx_copy_to
+ .name = "MBX flash",
+ .size = WINDOW_SIZE,
+ .phys = WINDOW_ADDR,
+ .buswidth = 4,
};
int __init init_mbx(void)
{
- printk(KERN_NOTICE "Motorola MBX flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR);
- mbx_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
+ printk(KERN_NOTICE "Motorola MBX flash device: 0x%x at 0x%x\n", WINDOW_SIZE*4, WINDOW_ADDR);
+ mbx_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
- if (!mbx_map.map_priv_1) {
+ if (!mbx_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
+ simple_map_init(&mbx_map);
+
mymtd = do_map_probe("jedec_probe", &mbx_map);
if (mymtd) {
mymtd->module = THIS_MODULE;
@@ -120,7 +75,7 @@
return 0;
}
- iounmap((void *)mbx_map.map_priv_1);
+ iounmap((void *)mbx_map.virt);
return -ENXIO;
}
@@ -130,9 +85,9 @@
del_mtd_device(mymtd);
map_destroy(mymtd);
}
- if (mbx_map.map_priv_1) {
- iounmap((void *)mbx_map.map_priv_1);
- mbx_map.map_priv_1 = 0;
+ if (mbx_map.virt) {
+ iounmap((void *)mbx_map.virt);
+ mbx_map.virt = 0;
}
}
Index: netsc520.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/netsc520.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- netsc520.c 2 Oct 2001 15:05:14 -0000 1.5
+++ netsc520.c 14 May 2003 15:05:15 -0000 1.6
@@ -50,95 +50,41 @@
** recoverable afterwards.
*/
-static __u8 netsc520_read8(struct map_info *map, unsigned long ofs)
-{
- return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 netsc520_read16(struct map_info *map, unsigned long ofs)
-{
- return readw(map->map_priv_1 + ofs);
-}
-
-static __u32 netsc520_read32(struct map_info *map, unsigned long ofs)
-{
- return readl(map->map_priv_1 + ofs);
-}
-
-static void netsc520_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void netsc520_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- writeb(d, map->map_priv_1 + adr);
-}
-
-static void netsc520_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- writew(d, map->map_priv_1 + adr);
-}
-
-static void netsc520_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- writel(d, map->map_priv_1 + adr);
-}
-
-static void netsc520_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
-
/* partition_info gives details on the logical partitions that the split the
* single flash device into. If the size if zero we use up to the end of the
* device. */
static struct mtd_partition partition_info[]={
{
- name: "NetSc520 boot kernel",
- offset: 0,
- size: 0xc0000
+ .name = "NetSc520 boot kernel",
+ .offset = 0,
+ .size = 0xc0000
},
{
- name: "NetSc520 Low BIOS",
- offset: 0xc0000,
- size: 0x40000
+ .name = "NetSc520 Low BIOS",
+ .offset = 0xc0000,
+ .size = 0x40000
},
{
- name: "NetSc520 file system",
- offset: 0x100000,
- size: 0xe80000
+ .name = "NetSc520 file system",
+ .offset = 0x100000,
+ .size = 0xe80000
},
{
- name: "NetSc520 High BIOS",
- offset: 0xf80000,
- size: 0x80000
+ .name = "NetSc520 High BIOS",
+ .offset = 0xf80000,
+ .size = 0x80000
},
};
#define NUM_PARTITIONS (sizeof(partition_info)/sizeof(partition_info[0]))
-/*
- * If no idea what is going on here. This is taken from the FlashFX stuff.
- */
-#define ROMCS 1
-
-
#define WINDOW_SIZE 0x00100000
#define WINDOW_ADDR 0x00200000
static struct map_info netsc520_map = {
- name: "netsc520 Flash Bank",
- size: WINDOW_SIZE,
- buswidth: 4,
- read8: netsc520_read8,
- read16: netsc520_read16,
- read32: netsc520_read32,
- copy_from: netsc520_copy_from,
- write8: netsc520_write8,
- write16: netsc520_write16,
- write32: netsc520_write32,
- copy_to: netsc520_copy_to,
- map_priv_2: WINDOW_ADDR
+ .name = "netsc520 Flash Bank",
+ .size = WINDOW_SIZE,
+ .buswidth = 4,
+ .phys = WINDOW_ADDR,
};
#define NUM_FLASH_BANKS (sizeof(netsc520_map)/sizeof(struct map_info))
@@ -147,13 +93,16 @@
static int __init init_netsc520(void)
{
- printk(KERN_NOTICE "NetSc520 flash device: %lx at %lx\n", netsc520_map.size, netsc520_map.map_priv_2);
- netsc520_map.map_priv_1 = (unsigned long)ioremap_nocache(netsc520_map.map_priv_2, netsc520_map.size);
+ printk(KERN_NOTICE "NetSc520 flash device: 0x%lx at 0x%lx\n", netsc520_map.size, netsc520_map.phys);
+ netsc520_map.virt = (unsigned long)ioremap_nocache(netsc520_map.phys, netsc520_map.size);
- if (!netsc520_map.map_priv_1) {
+ if (!netsc520_map.virt) {
printk("Failed to ioremap_nocache\n");
return -EIO;
}
+
+ simple_map_init(&netsc520_map);
+
mymtd = do_map_probe("cfi_probe", &netsc520_map);
if(!mymtd)
mymtd = do_map_probe("map_ram", &netsc520_map);
@@ -161,7 +110,7 @@
mymtd = do_map_probe("map_rom", &netsc520_map);
if (!mymtd) {
- iounmap((void *)netsc520_map.map_priv_1);
+ iounmap((void *)netsc520_map.virt);
return -ENXIO;
}
@@ -176,9 +125,9 @@
del_mtd_partitions(mymtd);
map_destroy(mymtd);
}
- if (netsc520_map.map_priv_1) {
- iounmap((void *)netsc520_map.map_priv_1);
- netsc520_map.map_priv_1 = 0;
+ if (netsc520_map.virt) {
+ iounmap((void *)netsc520_map.virt);
+ netsc520_map.virt = 0;
}
}
Index: nettel.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/nettel.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- nettel.c 8 Aug 2002 06:30:13 -0000 1.1
+++ nettel.c 14 May 2003 15:05:15 -0000 1.2
@@ -59,128 +59,72 @@
/****************************************************************************/
-static __u8 nettel_read8(struct map_info *map, unsigned long ofs)
-{
- return(readb(map->map_priv_1 + ofs));
-}
-
-static __u16 nettel_read16(struct map_info *map, unsigned long ofs)
-{
- return(readw(map->map_priv_1 + ofs));
-}
-
-static __u32 nettel_read32(struct map_info *map, unsigned long ofs)
-{
- return(readl(map->map_priv_1 + ofs));
-}
-
-static void nettel_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void nettel_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- writeb(d, map->map_priv_1 + adr);
-}
-
-static void nettel_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- writew(d, map->map_priv_1 + adr);
-}
-
-static void nettel_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- writel(d, map->map_priv_1 + adr);
-}
-
-static void nettel_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
/****************************************************************************/
#ifdef CONFIG_MTD_CFI_INTELEXT
static struct map_info nettel_intel_map = {
- name: "SnapGear Intel",
- size: 0,
- buswidth: INTEL_BUSWIDTH,
- read8: nettel_read8,
- read16: nettel_read16,
- read32: nettel_read32,
- copy_from: nettel_copy_from,
- write8: nettel_write8,
- write16: nettel_write16,
- write32: nettel_write32,
- copy_to: nettel_copy_to
+ .name = "SnapGear Intel",
+ .size = 0,
+ .buswidth = INTEL_BUSWIDTH,
};
static struct mtd_partition nettel_intel_partitions[] = {
{
- name: "SnapGear kernel",
- offset: 0,
- size: 0x000e0000
+ .name = "SnapGear kernel",
+ .offset = 0,
+ .size = 0x000e0000
},
{
- name: "SnapGear filesystem",
- offset: 0x00100000,
+ .name = "SnapGear filesystem",
+ .offset = 0x00100000,
},
{
- name: "SnapGear config",
- offset: 0x000e0000,
- size: 0x00020000
+ .name = "SnapGear config",
+ .offset = 0x000e0000,
+ .size = 0x00020000
},
{
- name: "SnapGear Intel",
- offset: 0
+ .name = "SnapGear Intel",
+ .offset = 0
},
{
- name: "SnapGear BIOS Config",
- offset: 0x007e0000,
- size: 0x00020000
+ .name = "SnapGear BIOS Config",
+ .offset = 0x007e0000,
+ .size = 0x00020000
},
{
- name: "SnapGear BIOS",
- offset: 0x007e0000,
- size: 0x00020000
+ .name = "SnapGear BIOS",
+ .offset = 0x007e0000,
+ .size = 0x00020000
},
};
#endif
static struct map_info nettel_amd_map = {
- name: "SnapGear AMD",
- size: AMD_WINDOW_MAXSIZE,
- buswidth: AMD_BUSWIDTH,
- read8: nettel_read8,
- read16: nettel_read16,
- read32: nettel_read32,
- copy_from: nettel_copy_from,
- write8: nettel_write8,
- write16: nettel_write16,
- write32: nettel_write32,
- copy_to: nettel_copy_to
+ .name = "SnapGear AMD",
+ .size = AMD_WINDOW_MAXSIZE,
+ .buswidth = AMD_BUSWIDTH,
};
static struct mtd_partition nettel_amd_partitions[] = {
{
- name: "SnapGear BIOS config",
- offset: 0x000e0000,
- size: 0x00010000
+ .name = "SnapGear BIOS config",
+ .offset = 0x000e0000,
+ .size = 0x00010000
},
{
- name: "SnapGear BIOS",
- offset: 0x000f0000,
- size: 0x00010000
+ .name = "SnapGear BIOS",
+ .offset = 0x000f0000,
+ .size = 0x00010000
},
{
- name: "SnapGear AMD",
- offset: 0
+ .name = "SnapGear AMD",
+ .offset = 0
},
{
- name: "SnapGear high BIOS",
- offset: 0x001f0000,
- size: 0x00010000
+ .name = "SnapGear high BIOS",
+ .offset = 0x001f0000,
+ .size = 0x00010000
}
};
@@ -328,12 +272,14 @@
*amdpar = SC520_PAR(SC520_PAR_BOOTCS, amdaddr, maxsize);
__asm__ ("wbinvd");
- nettel_amd_map.map_priv_1 = (unsigned long)
+ nettel_amd_map.phys = amdaddr;
+ nettel_amd_map.virt = (unsigned long)
ioremap_nocache(amdaddr, maxsize);
- if (!nettel_amd_map.map_priv_1) {
+ if (!nettel_amd_map.virt) {
printk("SNAPGEAR: failed to ioremap() BOOTCS\n");
return(-EIO);
}
+ simple_map_init(&nettel_amd_map);
if ((amd_mtd = do_map_probe("jedec_probe", &nettel_amd_map))) {
printk(KERN_NOTICE "SNAPGEAR: AMD flash device size = %dK\n",
@@ -387,8 +333,8 @@
/* Destroy useless AMD MTD mapping */
amd_mtd = NULL;
- iounmap((void *) nettel_amd_map.map_priv_1);
- nettel_amd_map.map_priv_1 = (unsigned long) NULL;
+ iounmap((void *) nettel_amd_map.virt);
+ nettel_amd_map.virt = (unsigned long) NULL;
#else
/* Only AMD flash supported */
return(-ENXIO);
@@ -411,16 +357,18 @@
/* Probe for the the size of the first Intel flash */
nettel_intel_map.size = maxsize;
- nettel_intel_map.map_priv_1 = (unsigned long)
+ nettel_intel_map.phys = intel0addr;
+ nettel_intel_map.virt = (unsigned long)
ioremap_nocache(intel0addr, maxsize);
- if (!nettel_intel_map.map_priv_1) {
+ if (!nettel_intel_map.virt) {
printk("SNAPGEAR: failed to ioremap() ROMCS1\n");
return(-EIO);
}
+ simple_map_init(&nettel_intel_map);
intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map);
if (! intel_mtd) {
- iounmap((void *) nettel_intel_map.map_priv_1);
+ iounmap((void *) nettel_intel_map.virt);
return(-ENXIO);
}
@@ -441,19 +389,19 @@
/* Delete the old map and probe again to do both chips */
map_destroy(intel_mtd);
intel_mtd = NULL;
- iounmap((void *) nettel_intel_map.map_priv_1);
+ iounmap((void *) nettel_intel_map.virt);
nettel_intel_map.size = maxsize;
- nettel_intel_map.map_priv_1 = (unsigned long)
+ nettel_intel_map.virt = (unsigned long)
ioremap_nocache(intel0addr, maxsize);
- if (!nettel_intel_map.map_priv_1) {
+ if (!nettel_intel_map.virt) {
printk("SNAPGEAR: failed to ioremap() ROMCS1/2\n");
return(-EIO);
}
intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map);
if (! intel_mtd) {
- iounmap((void *) nettel_intel_map.map_priv_1);
+ iounmap((void *) nettel_intel_map.virt);
return(-ENXIO);
}
@@ -523,18 +471,18 @@
del_mtd_partitions(amd_mtd);
map_destroy(amd_mtd);
}
- if (nettel_amd_map.map_priv_1) {
- iounmap((void *)nettel_amd_map.map_priv_1);
- nettel_amd_map.map_priv_1 = 0;
+ if (nettel_amd_map.virt) {
+ iounmap((void *)nettel_amd_map.virt);
+ nettel_amd_map.virt = 0;
}
#ifdef CONFIG_MTD_CFI_INTELEXT
if (intel_mtd) {
del_mtd_partitions(intel_mtd);
map_destroy(intel_mtd);
}
- if (nettel_intel_map.map_priv_1) {
- iounmap((void *)nettel_intel_map.map_priv_1);
- nettel_intel_map.map_priv_1 = 0;
+ if (nettel_intel_map.virt) {
+ iounmap((void *)nettel_intel_map.virt);
+ nettel_intel_map.virt = 0;
}
#endif
}
Index: ocelot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ocelot.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ocelot.c 17 Feb 2003 21:49:10 -0000 1.7
+++ ocelot.c 14 May 2003 15:05:15 -0000 1.8
@@ -25,40 +25,18 @@
static struct mtd_info *flash_mtd;
static struct mtd_info *nvram_mtd;
-__u8 ocelot_read8(struct map_info *map, unsigned long ofs)
+static void ocelot_ram_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf)
{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-void ocelot_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- cacheflush = 1;
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-void ocelot_copy_from_cache(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- if (cacheflush) {
- dma_cache_inv(map->map_priv_2, map->size);
- cacheflush = 0;
- }
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void ocelot_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
+ struct map_info *map = (struct map_info *)mtd->priv;
+ size_t done = 0;
-void ocelot_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
/* If we use memcpy, it does word-wide writes. Even though we told the
GT64120A that it's an 8-bit wide region, word-wide writes don't work.
We end up just writing the first byte of the four to all four bytes.
So we have this loop instead */
+ *retlen = len;
while(len) {
- __raw_writeb(*(unsigned char *) from, map->map_priv_1 + to);
+ __raw_writeb(*(unsigned char *) from, map->virt + to);
from++;
to++;
len--;
@@ -68,22 +46,17 @@
static struct mtd_partition *parsed_parts;
struct map_info ocelot_flash_map = {
- name: "Ocelot boot flash",
- size: FLASH_WINDOW_SIZE,
- buswidth: FLASH_BUSWIDTH,
- read8: ocelot_read8,
- copy_from: ocelot_copy_from_cache,
- write8: ocelot_write8,
+ .name = "Ocelot boot flash",
+ .size = FLASH_WINDOW_SIZE,
+ .buswidth = FLASH_BUSWIDTH,
+ .phys = FLASH_WINDOW_ADDR,
};
struct map_info ocelot_nvram_map = {
- name: "Ocelot NVRAM",
- size: NVRAM_WINDOW_SIZE,
- buswidth: NVRAM_BUSWIDTH,
- read8: ocelot_read8,
- copy_from: ocelot_copy_from,
- write8: ocelot_write8,
- copy_to: ocelot_copy_to
+ .name = "Ocelot NVRAM",
+ .size = NVRAM_WINDOW_SIZE,
+ .buswidth = NVRAM_BUSWIDTH,
+ .phys = NVRAM_WINDOW_ADDR,
};
static int __init init_ocelot_maps(void)
@@ -105,12 +78,13 @@
iounmap(pld);
/* Now ioremap the NVRAM space */
- ocelot_nvram_map.map_priv_1 = (unsigned long)ioremap_nocache(NVRAM_WINDOW_ADDR, NVRAM_WINDOW_SIZE);
- if (!ocelot_nvram_map.map_priv_1) {
+ ocelot_nvram_map.virt = (unsigned long)ioremap_nocache(NVRAM_WINDOW_ADDR, NVRAM_WINDOW_SIZE);
+ if (!ocelot_nvram_map.virt) {
printk(KERN_NOTICE "Failed to ioremap Ocelot NVRAM space\n");
return -EIO;
}
- // ocelot_nvram_map.map_priv_2 = ocelot_nvram_map.map_priv_1;
+
+ simple_map_init(&ocelot_nvram_map);
/* And do the RAM probe on it to get an MTD device */
nvram_mtd = do_map_probe("map_ram", &ocelot_nvram_map);
@@ -120,20 +94,19 @@
}
nvram_mtd->module = THIS_MODULE;
nvram_mtd->erasesize = 16;
+ /* Override the write() method */
+ nvram_mtd->write = ocelot_ram_write;
/* Now map the flash space */
- ocelot_flash_map.map_priv_1 = (unsigned long)ioremap_nocache(FLASH_WINDOW_ADDR, FLASH_WINDOW_SIZE);
- if (!ocelot_flash_map.map_priv_1) {
+ ocelot_flash_map.virt = (unsigned long)ioremap_nocache(FLASH_WINDOW_ADDR, FLASH_WINDOW_SIZE);
+ if (!ocelot_flash_map.virt) {
printk(KERN_NOTICE "Failed to ioremap Ocelot flash space\n");
goto fail_2;
}
/* Now the cached version */
- ocelot_flash_map.map_priv_2 = (unsigned long)__ioremap(FLASH_WINDOW_ADDR, FLASH_WINDOW_SIZE, 0);
+ ocelot_flash_map.cached = (unsigned long)__ioremap(FLASH_WINDOW_ADDR, FLASH_WINDOW_SIZE, 0);
- if (!ocelot_flash_map.map_priv_2) {
- /* Doesn't matter if it failed. Just use the uncached version */
- ocelot_flash_map.map_priv_2 = ocelot_flash_map.map_priv_1;
- }
+ simple_map_init(&ocelot_flash_map);
/* Only probe for flash if the write jumper is present */
if (brd_status & 0x40) {
@@ -164,14 +137,13 @@
return 0;
fail3:
- iounmap((void *)ocelot_flash_map.map_priv_1);
- if (ocelot_flash_map.map_priv_2 &&
- ocelot_flash_map.map_priv_2 != ocelot_flash_map.map_priv_1)
- iounmap((void *)ocelot_flash_map.map_priv_2);
+ iounmap((void *)ocelot_flash_map.virt);
+ if (ocelot_flash_map.cached)
+ iounmap((void *)ocelot_flash_map.cached);
fail_2:
map_destroy(nvram_mtd);
fail_1:
- iounmap((void *)ocelot_nvram_map.map_priv_1);
+ iounmap((void *)ocelot_nvram_map.virt);
return -ENXIO;
}
@@ -180,16 +152,16 @@
{
del_mtd_device(nvram_mtd);
map_destroy(nvram_mtd);
- iounmap((void *)ocelot_nvram_map.map_priv_1);
+ iounmap((void *)ocelot_nvram_map.virt);
if (parsed_parts)
del_mtd_partitions(flash_mtd);
else
del_mtd_device(flash_mtd);
map_destroy(flash_mtd);
- iounmap((void *)ocelot_flash_map.map_priv_1);
- if (ocelot_flash_map.map_priv_2 != ocelot_flash_map.map_priv_1)
- iounmap((void *)ocelot_flash_map.map_priv_2);
+ iounmap((void *)ocelot_flash_map.virt);
+ if (ocelot_flash_map.cached)
+ iounmap((void *)ocelot_flash_map.cached);
}
module_init(init_ocelot_maps);
Index: octagon-5066.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/octagon-5066.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- octagon-5066.c 7 Jan 2003 17:21:55 -0000 1.20
+++ octagon-5066.c 14 May 2003 15:05:15 -0000 1.21
@@ -151,32 +151,34 @@
static struct map_info oct5066_map[2] = {
{
- name: "Octagon 5066 Socket",
- size: 512 * 1024,
- buswidth: 1,
- read8: oct5066_read8,
- read16: oct5066_read16,
- read32: oct5066_read32,
- copy_from: oct5066_copy_from,
- write8: oct5066_write8,
- write16: oct5066_write16,
- write32: oct5066_write32,
- copy_to: oct5066_copy_to,
- map_priv_1: 1<<6
+ .name = "Octagon 5066 Socket",
+ .phys = NO_XIP,
+ .size = 512 * 1024,
+ .buswidth = 1,
+ .read8 = oct5066_read8,
+ .read16 = oct5066_read16,
+ .read32 = oct5066_read32,
+ .copy_from = oct5066_copy_from,
+ .write8 = oct5066_write8,
+ .write16 = oct5066_write16,
+ .write32 = oct5066_write32,
+ .copy_to = oct5066_copy_to,
+ .map_priv_1 = 1<<6
},
{
- name: "Octagon 5066 Internal Flash",
- size: 2 * 1024 * 1024,
- buswidth: 1,
- read8: oct5066_read8,
- read16: oct5066_read16,
- read32: oct5066_read32,
- copy_from: oct5066_copy_from,
- write8: oct5066_write8,
- write16: oct5066_write16,
- write32: oct5066_write32,
- copy_to: oct5066_copy_to,
- map_priv_1: 2<<6
+ .name = "Octagon 5066 Internal Flash",
+ .phys = NO_XIP,
+ .size = 2 * 1024 * 1024,
+ .buswidth = 1,
+ .read8 = oct5066_read8,
+ .read16 = oct5066_read16,
+ .read32 = oct5066_read32,
+ .copy_from = oct5066_copy_from,
+ .write8 = oct5066_write8,
+ .write16 = oct5066_write16,
+ .write32 = oct5066_write32,
+ .copy_to = oct5066_copy_to,
+ .map_priv_1 = 2<<6
}
};
Index: pb1xxx-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pb1xxx-flash.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- pb1xxx-flash.c 13 Sep 2002 13:51:54 -0000 1.4
+++ pb1xxx-flash.c 14 May 2003 15:05:15 -0000 1.5
@@ -29,75 +29,9 @@
#define WINDOW_SIZE 0x800000
#endif
-__u8 physmap_read8(struct map_info *map, unsigned long ofs)
-{
- __u8 ret;
- ret = __raw_readb(map->map_priv_1 + ofs);
- DBG("read8 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret);
- return ret;
-}
-
-__u16 physmap_read16(struct map_info *map, unsigned long ofs)
-{
- __u16 ret;
- ret = __raw_readw(map->map_priv_1 + ofs);
- DBG("read16 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret);
- return ret;
-}
-
-__u32 physmap_read32(struct map_info *map, unsigned long ofs)
-{
- __u32 ret;
- ret = __raw_readl(map->map_priv_1 + ofs);
- DBG("read32 from %x, %x\n", (unsigned)(map->map_priv_1 + ofs), ret);
- return ret;
-}
-
-void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- DBG("physmap_copy from %x to %x\n", (unsigned)from, (unsigned)to);
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void physmap_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- DBG("write8 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d);
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-void physmap_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- DBG("write16 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d);
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-void physmap_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- DBG("write32 at %x, %x\n", (unsigned)(map->map_priv_1 + adr), d);
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- DBG("physmap_copy_to %x from %x\n", (unsigned)to, (unsigned)from);
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
-
static struct map_info pb1xxx_map = {
- name: "Pb1xxx flash",
- read8: physmap_read8,
- read16: physmap_read16,
- read32: physmap_read32,
- copy_from: physmap_copy_from,
- write8: physmap_write8,
- write16: physmap_write16,
- write32: physmap_write32,
- copy_to: physmap_copy_to,
+ .name = "Pb1xxx flash",
};
@@ -107,23 +41,23 @@
static unsigned char flash_buswidth = 4;
static struct mtd_partition pb1xxx_partitions[] = {
{
- name: "yamon env",
- size: 0x00020000,
- offset: 0,
- mask_flags: MTD_WRITEABLE
- },{
- name: "User FS",
- size: 0x003e0000,
- offset: 0x20000,
- },{
- name: "boot code",
- size: 0x100000,
- offset: 0x400000,
- mask_flags: MTD_WRITEABLE
- },{
- name: "raw/kernel",
- size: 0x300000,
- offset: 0x500000
+ .name = "yamon env",
+ .size = 0x00020000,
+ .offset = 0,
+ .mask_flags = MTD_WRITEABLE
+ },{
+ .name = "User FS",
+ .size = 0x003e0000,
+ .offset = 0x20000,
+ },{
+ .name = "boot code",
+ .size = 0x100000,
+ .offset = 0x400000,
+ .mask_flags = MTD_WRITEABLE
+ },{
+ .name = "raw/kernel",
+ .size = 0x300000,
+ .offset = 0x500000
}
};
@@ -140,18 +74,18 @@
#define WINDOW_SIZE 0x4000000
static struct mtd_partition pb1xxx_partitions[] = {
{
- name: "User FS",
- size: 0x3c00000,
- offset: 0x0000000
- },{
- name: "yamon",
- size: 0x0100000,
- offset: 0x3c00000,
- mask_flags: MTD_WRITEABLE
- },{
- name: "raw kernel",
- size: 0x02c0000,
- offset: 0x3d00000
+ .name = "User FS",
+ .size = 0x3c00000,
+ .offset = 0x0000000
+ },{
+ .name = "yamon",
+ .size = 0x0100000,
+ .offset = 0x3c00000,
+ .mask_flags = MTD_WRITEABLE
+ },{
+ .name = "raw kernel",
+ .size = 0x02c0000,
+ .offset = 0x3d00000
}
};
#elif defined(CONFIG_MTD_PB1500_BOOT) && !defined(CONFIG_MTD_PB1500_USER)
@@ -160,18 +94,18 @@
#define WINDOW_SIZE 0x2000000
static struct mtd_partition pb1xxx_partitions[] = {
{
- name: "User FS",
- size: 0x1c00000,
- offset: 0x0000000
- },{
- name: "yamon",
- size: 0x0100000,
- offset: 0x1c00000,
- mask_flags: MTD_WRITEABLE
- },{
- name: "raw kernel",
- size: 0x02c0000,
- offset: 0x1d00000
+ .name = "User FS",
+ .size = 0x1c00000,
+ .offset = 0x0000000
+ },{
+ .name = "yamon",
+ .size = 0x0100000,
+ .offset = 0x1c00000,
+ .mask_flags = MTD_WRITEABLE
+ },{
+ .name = "raw kernel",
+ .size = 0x02c0000,
+ .offset = 0x1d00000
}
};
#elif !defined(CONFIG_MTD_PB1500_BOOT) && defined(CONFIG_MTD_PB1500_USER)
@@ -180,13 +114,13 @@
#define WINDOW_SIZE 0x2000000
static struct mtd_partition pb1xxx_partitions[] = {
{
- name: "User FS",
- size: 0x1e00000,
- offset: 0x0000000
- },{
- name: "raw kernel",
- size: 0x0200000,
- offset: 0x1e00000,
+ .name = "User FS",
+ .size = 0x1e00000,
+ .offset = 0x0000000
+ },{
+ .name = "raw kernel",
+ .size = 0x0200000,
+ .offset = 0x1e00000,
}
};
#else
@@ -225,10 +159,16 @@
*/
printk(KERN_NOTICE "Pb1xxx flash: probing %d-bit flash bus\n",
pb1xxx_map.buswidth*8);
- pb1xxx_map.map_priv_1 =
- (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+ pb1xxx_map.phys = WINDOW_ADDR;
+ pb1xxx_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+
+ simple_map_init(&pb1xxx_map);
+
mymtd = do_map_probe("cfi_probe", &pb1xxx_map);
- if (!mymtd) return -ENXIO;
+ if (!mymtd) {
+ iounmap(pb1xxx_map.virt);
+ return -ENXIO;
+ }
mymtd->module = THIS_MODULE;
add_mtd_partitions(mymtd, parts, nb_parts);
@@ -243,6 +183,8 @@
if (parsed_parts)
kfree(parsed_parts);
}
+ if (pb1xxx_map.virt)
+ iounmap(pb1xxx_map.virt);
}
module_init(pb1xxx_mtd_init);
Index: pci.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pci.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pci.c 24 Jan 2003 13:11:43 -0000 1.2
+++ pci.c 14 May 2003 15:05:15 -0000 1.3
@@ -98,10 +98,10 @@
}
static struct mtd_pci_info intel_iq80310_info = {
- init: intel_iq80310_init,
- exit: intel_iq80310_exit,
- translate: intel_iq80310_translate,
- map_name: "cfi_probe",
+ .init = intel_iq80310_init,
+ .exit = intel_iq80310_exit,
+ .translate = intel_iq80310_translate,
+ .map_name = "cfi_probe",
};
/*
@@ -181,10 +181,10 @@
}
static struct mtd_pci_info intel_dc21285_info = {
- init: intel_dc21285_init,
- exit: intel_dc21285_exit,
- translate: intel_dc21285_translate,
- map_name: "jedec_probe",
+ .init = intel_dc21285_init,
+ .exit = intel_dc21285_exit,
+ .translate = intel_dc21285_translate,
+ .map_name = "jedec_probe",
};
/*
@@ -193,22 +193,20 @@
static struct pci_device_id mtd_pci_ids[] __devinitdata = {
{
- vendor: PCI_VENDOR_ID_INTEL,
- device: 0x530d,
- subvendor: PCI_ANY_ID,
- subdevice: PCI_ANY_ID,
- class: PCI_CLASS_MEMORY_OTHER << 8,
- class_mask: 0xffff00,
- driver_data: (unsigned long)&intel_iq80310_info,
+ .vendor = PCI_VENDOR_ID_INTEL,
+ .device = 0x530d,
+ .subvendor = PCI_ANY_ID,
+ .subdevice = PCI_ANY_ID,
+ .class = PCI_CLASS_MEMORY_OTHER << 8,
+ .class_mask = 0xffff00,
+ .driver_data = (unsigned long)&intel_iq80310_info,
},
{
- vendor: PCI_VENDOR_ID_DEC,
- device: PCI_DEVICE_ID_DEC_21285,
- subvendor: 0, /* DC21285 defaults to 0 on reset */
- subdevice: 0, /* DC21285 defaults to 0 on reset */
- class: 0,
- class_mask: 0,
- driver_data: (unsigned long)&intel_dc21285_info,
+ .vendor = PCI_VENDOR_ID_DEC,
+ .device = PCI_DEVICE_ID_DEC_21285,
+ .subvendor = 0, /* DC21285 defaults to 0 on reset */
+ .subdevice = 0, /* DC21285 defaults to 0 on reset */
+ .driver_data = (unsigned long)&intel_dc21285_info,
},
{ 0, }
};
@@ -275,14 +273,15 @@
}
static struct map_info mtd_pci_map = {
- read8: mtd_pci_read8,
- read16: mtd_pci_read16,
- read32: mtd_pci_read32,
- copy_from: mtd_pci_copyfrom,
- write8: mtd_pci_write8,
- write16: mtd_pci_write16,
- write32: mtd_pci_write32,
- copy_to: mtd_pci_copyto,
+ .phys = NO_XIP,
+ .read8 = mtd_pci_read8,
+ .read16 = mtd_pci_read16,
+ .read32 = mtd_pci_read32,
+ .copy_from = mtd_pci_copyfrom,
+ .write8 = mtd_pci_write8,
+ .write16 = mtd_pci_write16,
+ .write32 = mtd_pci_write32,
+ .copy_to = mtd_pci_copyto,
};
static int __devinit
@@ -359,10 +358,10 @@
}
static struct pci_driver mtd_pci_driver = {
- name: "MTD PCI",
- probe: mtd_pci_probe,
- remove: __devexit_p(mtd_pci_remove),
- id_table: mtd_pci_ids,
+ .name = "MTD PCI",
+ .probe = mtd_pci_probe,
+ .remove = __devexit_p(mtd_pci_remove),
+ .id_table = mtd_pci_ids,
};
static int __init mtd_pci_maps_init(void)
Index: pcmciamtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pcmciamtd.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- pcmciamtd.c 7 May 2003 10:13:47 -0000 1.40
+++ pcmciamtd.c 14 May 2003 15:05:15 -0000 1.41
@@ -531,6 +531,7 @@
card_settings(dev, link, &new_name);
+ dev->pcmcia_map.phys = NO_XIP;
dev->pcmcia_map.read8 = pcmcia_read8_remap;
dev->pcmcia_map.read16 = pcmcia_read16_remap;
dev->pcmcia_map.copy_from = pcmcia_copy_from_remap;
Index: physmap.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/physmap.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- physmap.c 29 Jan 2003 23:45:41 -0000 1.22
+++ physmap.c 14 May 2003 15:05:15 -0000 1.23
@@ -22,73 +22,12 @@
static struct mtd_info *mymtd;
-__u8 physmap_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 physmap_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 physmap_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void physmap_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-void physmap_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-void physmap_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
-
-u_char * physmap_point(struct map_info *map, loff_t from, size_t len)
-{
- return (u_char *)(map->map_priv_1 + (unsigned long)from);
-}
-
-void physmap_unpoint(struct map_info *map, u_char *adr, loff_t from, size_t len)
-{
- /* do nothing for now */
-}
struct map_info physmap_map = {
- name: "Physically mapped flash",
- size: WINDOW_SIZE,
- buswidth: BUSWIDTH,
- read8: physmap_read8,
- read16: physmap_read16,
- read32: physmap_read32,
- point: physmap_point,
- unpoint: physmap_unpoint,
- copy_from: physmap_copy_from,
- write8: physmap_write8,
- write16: physmap_write16,
- write32: physmap_write32,
- copy_to: physmap_copy_to
+ .name = "Physically mapped flash",
+ .size = WINDOW_SIZE,
+ .buswidth = BUSWIDTH,
+ .phys = WINDOW_ADDR,
};
#ifdef CONFIG_MTD_PARTITIONS
@@ -100,24 +39,24 @@
/* Put your own partition definitions here */
#if 0
{
- name: "bootROM",
- size: 0x80000,
- offset: 0,
- mask_flags: MTD_WRITEABLE, /* force read-only */
+ .name = "bootROM",
+ .size = 0x80000,
+ .offset = 0,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
- name: "zImage",
- size: 0x100000,
- offset: MTDPART_OFS_APPEND,
- mask_flags: MTD_WRITEABLE, /* force read-only */
+ .name = "zImage",
+ .size = 0x100000,
+ .offset = MTDPART_OFS_APPEND,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
- name: "ramdisk.gz",
- size: 0x300000,
- offset: MTDPART_OFS_APPEND,
- mask_flags: MTD_WRITEABLE, /* force read-only */
+ .name = "ramdisk.gz",
+ .size = 0x300000,
+ .offset = MTDPART_OFS_APPEND,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
- name: "User FS",
- size: MTDPART_SIZ_FULL,
- offset: MTDPART_OFS_APPEND,
+ .name = "User FS",
+ .size = MTDPART_SIZ_FULL,
+ .offset = MTDPART_OFS_APPEND,
}
#endif
};
@@ -133,13 +72,15 @@
const char **type;
printk(KERN_NOTICE "physmap flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
- physmap_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+ physmap_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
- if (!physmap_map.map_priv_1) {
+ if (!physmap_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
-
+
+ simple_map_init(&physmap_map);
+
mymtd = 0;
type = rom_probe_types;
for(; !mymtd && *type; type++) {
@@ -172,7 +113,7 @@
return 0;
}
- iounmap((void *)physmap_map.map_priv_1);
+ iounmap((void *)physmap_map.virt);
return -ENXIO;
}
@@ -182,9 +123,9 @@
del_mtd_device(mymtd);
map_destroy(mymtd);
}
- if (physmap_map.map_priv_1) {
- iounmap((void *)physmap_map.map_priv_1);
- physmap_map.map_priv_1 = 0;
+ if (physmap_map.virt) {
+ iounmap((void *)physmap_map.virt);
+ physmap_map.virt = 0;
}
}
Index: pnc2000.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pnc2000.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- pnc2000.c 2 Oct 2001 15:05:14 -0000 1.10
+++ pnc2000.c 14 May 2003 15:05:15 -0000 1.11
@@ -24,58 +24,13 @@
* MAP DRIVER STUFF
*/
-__u8 pnc_read8(struct map_info *map, unsigned long ofs)
-{
- return *(__u8 *)(WINDOW_ADDR + ofs);
-}
-
-__u16 pnc_read16(struct map_info *map, unsigned long ofs)
-{
- return *(__u16 *)(WINDOW_ADDR + ofs);
-}
-
-__u32 pnc_read32(struct map_info *map, unsigned long ofs)
-{
- return *(volatile unsigned int *)(WINDOW_ADDR + ofs);
-}
-
-void pnc_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy(to, (void *)(WINDOW_ADDR + from), len);
-}
-
-void pnc_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- *(__u8 *)(WINDOW_ADDR + adr) = d;
-}
-
-void pnc_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- *(__u16 *)(WINDOW_ADDR + adr) = d;
-}
-
-void pnc_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- *(__u32 *)(WINDOW_ADDR + adr) = d;
-}
-
-void pnc_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy((void *)(WINDOW_ADDR + to), from, len);
-}
struct map_info pnc_map = {
- name: "PNC-2000",
- size: WINDOW_SIZE,
- buswidth: 4,
- read8: pnc_read8,
- read16: pnc_read16,
- read32: pnc_read32,
- copy_from: pnc_copy_from,
- write8: pnc_write8,
- write16: pnc_write16,
- write32: pnc_write32,
- copy_to: pnc_copy_to
+ .name = "PNC-2000",
+ .size = WINDOW_SIZE,
+ .buswidth = 4,
+ .phys = 0xFFFFFFFF,
+ .virt = WINDOW_ADDR,
};
@@ -84,19 +39,19 @@
*/
static struct mtd_partition pnc_partitions[3] = {
{
- name: "PNC-2000 boot firmware",
- size: 0x20000,
- offset: 0
+ .name = "PNC-2000 boot firmware",
+ .size = 0x20000,
+ .offset = 0
},
{
- name: "PNC-2000 kernel",
- size: 0x1a0000,
- offset: 0x20000
+ .name = "PNC-2000 kernel",
+ .size = 0x1a0000,
+ .offset = 0x20000
},
{
- name: "PNC-2000 filesystem",
- size: 0x240000,
- offset: 0x1c0000
+ .name = "PNC-2000 filesystem",
+ .size = 0x240000,
+ .offset = 0x1c0000
}
};
@@ -109,6 +64,8 @@
int __init init_pnc2000(void)
{
printk(KERN_NOTICE "Photron PNC-2000 flash mapping: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
+
+ simple_map_init(&pnc_map);
mymtd = do_map_probe("cfi_probe", &pnc_map);
if (mymtd) {
Index: redwood.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/redwood.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- redwood.c 1 Apr 2003 18:07:13 -0000 1.2
+++ redwood.c 14 May 2003 15:05:15 -0000 1.3
@@ -1,5 +1,5 @@
/*
- * $Id:
+ * $Id$
*
* drivers/mtd/maps/redwood.c
*
@@ -24,11 +24,9 @@
#include <linux/mtd/partitions.h>
#include <asm/io.h>
-#define STBXX_VPD_SZ 0x10000
-#define STBXX_OB_SZ 0x20000
-#define STBXX_4MB 0x4000000
#if !defined (CONFIG_REDWOOD_6)
+
#define WINDOW_ADDR 0xffc00000
#define WINDOW_SIZE 0x00400000
@@ -42,131 +40,84 @@
#define RW_PART3_SZ 0x200000 - (0x10000 + 0x20000)
#define RW_PART4_OF 0x3e0000
#define RW_PART4_SZ 0x20000
+
static struct mtd_partition redwood_flash_partitions[] = {
{
- name: "Redwood OpenBIOS Vital Product Data",
- offset: RW_PART0_OF,
- size: RW_PART0_SZ,
- mask_flags: MTD_WRITEABLE /* force read-only */
+ .name = "Redwood OpenBIOS Vital Product Data",
+ .offset = RW_PART0_OF,
+ .size = RW_PART0_SZ,
+ .mask_flags = MTD_WRITEABLE /* force read-only */
},
{
- name: "Redwood kernel",
- offset: RW_PART1_OF,
- size: RW_PART1_SZ
+ .name = "Redwood kernel",
+ .offset = RW_PART1_OF,
+ .size = RW_PART1_SZ
},
{
- name: "Redwood OpenBIOS non-volatile storage",
- offset: RW_PART2_OF,
- size: RW_PART2_SZ,
- mask_flags: MTD_WRITEABLE /* force read-only */
+ .name = "Redwood OpenBIOS non-volatile storage",
+ .offset = RW_PART2_OF,
+ .size = RW_PART2_SZ,
+ .mask_flags = MTD_WRITEABLE /* force read-only */
},
{
- name: "Redwood filesystem",
- offset: RW_PART3_OF,
- size: RW_PART3_SZ
+ .name = "Redwood filesystem",
+ .offset = RW_PART3_OF,
+ .size = RW_PART3_SZ
},
{
- name: "Redwood OpenBIOS",
- offset: RW_PART4_OF,
- size: RW_PART4_SZ,
- mask_flags: MTD_WRITEABLE /* force read-only */
+ .name = "Redwood OpenBIOS",
+ .offset = RW_PART4_OF,
+ .size = RW_PART4_SZ,
+ .mask_flags = MTD_WRITEABLE /* force read-only */
}
};
-#else
+#else /* CONFIG_REDWOOD_6 */
/* FIXME: the window is bigger - armin */
#define WINDOW_ADDR 0xff800000
#define WINDOW_SIZE 0x00800000
#define RW_PART0_OF 0
-#define RW_PART0_SZ 0x400000 /* 4 MB data */
+#define RW_PART0_SZ 0x400000 /* 4 MiB data */
#define RW_PART1_OF RW_PART0_OF + RW_PART0_SZ
#define RW_PART1_SZ 0x10000 /* 64K VPD */
#define RW_PART2_OF RW_PART1_OF + RW_PART1_SZ
#define RW_PART2_SZ 0x400000 - (0x10000 + 0x20000)
#define RW_PART3_OF RW_PART2_OF + RW_PART2_SZ
#define RW_PART3_SZ 0x20000
+
static struct mtd_partition redwood_flash_partitions[] = {
{
- name: "Redwood kernel",
- offset: RW_PART0_OF,
- size: RW_PART0_SZ
+ .name = "Redwood kernel",
+ .offset = RW_PART0_OF,
+ .size = RW_PART0_SZ
},
{
- name: "Redwood OpenBIOS Vital Product Data",
- offset: RW_PART1_OF,
- size: RW_PART1_SZ,
- mask_flags: MTD_WRITEABLE /* force read-only */
+ .name = "Redwood OpenBIOS Vital Product Data",
+ .offset = RW_PART1_OF,
+ .size = RW_PART1_SZ,
+ .mask_flags = MTD_WRITEABLE /* force read-only */
},
{
- name: "Redwood filesystem",
- offset: RW_PART2_OF,
- size: RW_PART2_SZ
+ .name = "Redwood filesystem",
+ .offset = RW_PART2_OF,
+ .size = RW_PART2_SZ
},
{
- name: "Redwood OpenBIOS",
- offset: RW_PART3_OF,
- size: RW_PART3_SZ,
- mask_flags: MTD_WRITEABLE /* force read-only */
+ .name = "Redwood OpenBIOS",
+ .offset = RW_PART3_OF,
+ .size = RW_PART3_SZ,
+ .mask_flags = MTD_WRITEABLE /* force read-only */
}
};
-#endif
-
-__u8 redwood_flash_read8(struct map_info *map, unsigned long ofs)
-{
- return *(__u8 *)(map->map_priv_1 + ofs);
-}
-
-__u16 redwood_flash_read16(struct map_info *map, unsigned long ofs)
-{
- return *(__u16 *)(map->map_priv_1 + ofs);
-}
-
-__u32 redwood_flash_read32(struct map_info *map, unsigned long ofs)
-{
- return *(volatile unsigned int *)(map->map_priv_1 + ofs);
-}
-
-void redwood_flash_copy_from(struct map_info *map, void *to,
- unsigned long from, ssize_t len)
-{
- memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void redwood_flash_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- *(__u8 *)(map->map_priv_1 + adr) = d;
-}
-
-void redwood_flash_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- *(__u16 *)(map->map_priv_1 + adr) = d;
-}
-
-void redwood_flash_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- *(__u32 *)(map->map_priv_1 + adr) = d;
-}
-
-void redwood_flash_copy_to(struct map_info *map, unsigned long to,
- const void *from, ssize_t len)
-{
- memcpy((void *)(map->map_priv_1 + to), from, len);
-}
+#endif /* CONFIG_REDWOOD_6 */
struct map_info redwood_flash_map = {
- name: "IBM Redwood",
- size: WINDOW_SIZE,
- buswidth: 2,
- read8: redwood_flash_read8,
- read16: redwood_flash_read16,
- read32: redwood_flash_read32,
- copy_from: redwood_flash_copy_from,
- write8: redwood_flash_write8,
- write16: redwood_flash_write16,
- write32: redwood_flash_write32,
- copy_to: redwood_flash_copy_to
+ .name = "IBM Redwood",
+ .size = WINDOW_SIZE,
+ .buswidth = 2,
+ .phys = WINDOW_ADDR,
};
@@ -180,13 +131,14 @@
printk(KERN_NOTICE "redwood: flash mapping: %x at %x\n",
WINDOW_SIZE, WINDOW_ADDR);
- redwood_flash_map.map_priv_1 =
+ redwood_flash_map.virt =
(unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
- if (!redwood_flash_map.map_priv_1) {
+ if (!redwood_flash_map.virt) {
printk("init_redwood_flash: failed to ioremap\n");
return -EIO;
}
+ simple_map_init(&redwood_flash_map);
redwood_mtd = do_map_probe("cfi_probe",&redwood_flash_map);
@@ -206,7 +158,7 @@
del_mtd_partitions(redwood_mtd);
/* moved iounmap after map_destroy - armin */
map_destroy(redwood_mtd);
- iounmap((void *)redwood_flash_map.map_priv_1);
+ iounmap((void *)redwood_flash_map.virt);
}
}
Index: rpxlite.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/rpxlite.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- rpxlite.c 2 Oct 2001 15:05:14 -0000 1.15
+++ rpxlite.c 14 May 2003 15:05:15 -0000 1.16
@@ -17,72 +17,23 @@
static struct mtd_info *mymtd;
-__u8 rpxlite_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-__u16 rpxlite_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-__u32 rpxlite_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void rpxlite_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void rpxlite_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-void rpxlite_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-void rpxlite_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-void rpxlite_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
-
-struct map_info rpxlite_map = {
- name: "RPX",
- size: WINDOW_SIZE,
- buswidth: 4,
- read8: rpxlite_read8,
- read16: rpxlite_read16,
- read32: rpxlite_read32,
- copy_from: rpxlite_copy_from,
- write8: rpxlite_write8,
- write16: rpxlite_write16,
- write32: rpxlite_write32,
- copy_to: rpxlite_copy_to
+static struct map_info rpxlite_map = {
+ .name = "RPX",
+ .size = WINDOW_SIZE,
+ .buswidth = 4,
+ .phys = WINDOW_ADDR,
};
int __init init_rpxlite(void)
{
printk(KERN_NOTICE "RPX Lite or CLLF flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR);
- rpxlite_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
+ rpxlite_map.virt = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
- if (!rpxlite_map.map_priv_1) {
+ if (!rpxlite_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
+ simple_map_init(&rpxlite_map);
mymtd = do_map_probe("cfi_probe", &rpxlite_map);
if (mymtd) {
mymtd->module = THIS_MODULE;
@@ -90,7 +41,7 @@
return 0;
}
- iounmap((void *)rpxlite_map.map_priv_1);
+ iounmap((void *)rpxlite_map.virt);
return -ENXIO;
}
@@ -100,9 +51,9 @@
del_mtd_device(mymtd);
map_destroy(mymtd);
}
- if (rpxlite_map.map_priv_1) {
- iounmap((void *)rpxlite_map.map_priv_1);
- rpxlite_map.map_priv_1 = 0;
+ if (rpxlite_map.virt) {
+ iounmap((void *)rpxlite_map.virt);
+ rpxlite_map.virt = 0;
}
}
Index: sa1100-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sa1100-flash.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- sa1100-flash.c 17 Feb 2003 21:49:10 -0000 1.30
+++ sa1100-flash.c 14 May 2003 15:05:15 -0000 1.31
@@ -27,59 +27,11 @@
#define WINDOW_ADDR 0xe8000000
-static __u8 sa1100_read8(struct map_info *map, unsigned long ofs)
-{
- return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 sa1100_read16(struct map_info *map, unsigned long ofs)
-{
- return readw(map->map_priv_1 + ofs);
[...1119 lines suppressed...]
- release_mem_region(sa1100_map.map_priv_2, sa1100_map.size);
+ if (sa1100_map.virt != WINDOW_ADDR) {
+ iounmap((void *)sa1100_map.virt);
+ release_mem_region(sa1100_map.phys, sa1100_map.size);
}
return ret;
}
@@ -1011,9 +968,9 @@
if (parsed_parts)
kfree(parsed_parts);
}
- if (sa1100_map.map_priv_2 != -1) {
- iounmap((void *)sa1100_map.map_priv_1);
- release_mem_region(sa1100_map.map_priv_2, sa1100_map.size);
+ if (sa1100_map.virt != WINDOW_ADDR) {
+ iounmap((void *)sa1100_map.virt);
+ release_mem_region(sa1100_map.phys, sa1100_map.size);
}
}
Index: sbc_gxx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sbc_gxx.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- sbc_gxx.c 24 Jan 2003 13:40:14 -0000 1.21
+++ sbc_gxx.c 14 May 2003 15:05:16 -0000 1.22
@@ -91,14 +91,14 @@
* single flash device into. If the size if zero we use up to the end of the
* device. */
static struct mtd_partition partition_info[]={
- { name: "SBC-GXx flash boot partition",
- offset: 0,
- size: BOOT_PARTITION_SIZE_KiB*1024 },
- { name: "SBC-GXx flash data partition",
- offset: BOOT_PARTITION_SIZE_KiB*1024,
- size: (DATA_PARTITION_SIZE_KiB)*1024 },
- { name: "SBC-GXx flash application partition",
- offset: (BOOT_PARTITION_SIZE_KiB+DATA_PARTITION_SIZE_KiB)*1024 }
+ { .name = "SBC-GXx flash boot partition",
+ .offset = 0,
+ .size = BOOT_PARTITION_SIZE_KiB*1024 },
+ { .name = "SBC-GXx flash data partition",
+ .offset = BOOT_PARTITION_SIZE_KiB*1024,
+ .size = (DATA_PARTITION_SIZE_KiB)*1024 },
+ { .name = "SBC-GXx flash application partition",
+ .offset = (BOOT_PARTITION_SIZE_KiB+DATA_PARTITION_SIZE_KiB)*1024 }
};
#define NUM_PARTITIONS 3
@@ -203,19 +203,20 @@
}
static struct map_info sbc_gxx_map = {
- name: "SBC-GXx flash",
- size: MAX_SIZE_KiB*1024, /* this must be set to a maximum possible amount
+ .name = "SBC-GXx flash",
+ .phys = NO_XIP,
+ .size = MAX_SIZE_KiB*1024, /* this must be set to a maximum possible amount
of flash so the cfi probe routines find all
the chips */
- buswidth: 1,
- read8: sbc_gxx_read8,
- read16: sbc_gxx_read16,
- read32: sbc_gxx_read32,
- copy_from: sbc_gxx_copy_from,
- write8: sbc_gxx_write8,
- write16: sbc_gxx_write16,
- write32: sbc_gxx_write32,
- copy_to: sbc_gxx_copy_to
+ .buswidth = 1,
+ .read8 = sbc_gxx_read8,
+ .read16 = sbc_gxx_read16,
+ .read32 = sbc_gxx_read32,
+ .copy_from = sbc_gxx_copy_from,
+ .write8 = sbc_gxx_write8,
+ .write16 = sbc_gxx_write16,
+ .write32 = sbc_gxx_write32,
+ .copy_to = sbc_gxx_copy_to
};
/* MTD device for all of the flash. */
Index: sc520cdp.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sc520cdp.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- sc520cdp.c 8 Mar 2002 16:34:35 -0000 1.11
+++ sc520cdp.c 14 May 2003 15:05:16 -0000 1.12
@@ -84,88 +84,25 @@
#define WINDOW_SIZE_1 0x00800000
#define WINDOW_SIZE_2 0x00080000
-static __u8 sc520cdp_read8(struct map_info *map, unsigned long ofs)
-{
- return readb(map->map_priv_1 + ofs);
-}
-
-static __u16 sc520cdp_read16(struct map_info *map, unsigned long ofs)
-{
- return readw(map->map_priv_1 + ofs);
-}
-
-static __u32 sc520cdp_read32(struct map_info *map, unsigned long ofs)
-{
- return readl(map->map_priv_1 + ofs);
-}
-
-static void sc520cdp_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-static void sc520cdp_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- writeb(d, map->map_priv_1 + adr);
-}
-
-static void sc520cdp_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- writew(d, map->map_priv_1 + adr);
-}
-
-static void sc520cdp_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- writel(d, map->map_priv_1 + adr);
-}
-
-static void sc520cdp_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
static struct map_info sc520cdp_map[] = {
{
- name: "SC520CDP Flash Bank #0",
- size: WINDOW_SIZE_0,
- buswidth: 4,
- read8: sc520cdp_read8,
- read16: sc520cdp_read16,
- read32: sc520cdp_read32,
- copy_from: sc520cdp_copy_from,
- write8: sc520cdp_write8,
- write16: sc520cdp_write16,
- write32: sc520cdp_write32,
- copy_to: sc520cdp_copy_to,
- map_priv_2: WINDOW_ADDR_0
+ .name = "SC520CDP Flash Bank #0",
+ .size = WINDOW_SIZE_0,
+ .buswidth = 4,
+ .phys = WINDOW_ADDR_0
},
{
- name: "SC520CDP Flash Bank #1",
- size: WINDOW_SIZE_1,
- buswidth: 4,
- read8: sc520cdp_read8,
- read16: sc520cdp_read16,
- read32: sc520cdp_read32,
- copy_from: sc520cdp_copy_from,
- write8: sc520cdp_write8,
- write16: sc520cdp_write16,
- write32: sc520cdp_write32,
- copy_to: sc520cdp_copy_to,
- map_priv_2: WINDOW_ADDR_1
+ .name = "SC520CDP Flash Bank #1",
+ .size = WINDOW_SIZE_1,
+ .buswidth = 4,
+ .phys = WINDOW_ADDR_1
},
{
- name: "SC520CDP DIL Flash",
- size: WINDOW_SIZE_2,
- buswidth: 1,
- read8: sc520cdp_read8,
- read16: sc520cdp_read16,
- read32: sc520cdp_read32,
- copy_from: sc520cdp_copy_from,
- write8: sc520cdp_write8,
- write16: sc520cdp_write16,
- write32: sc520cdp_write32,
- copy_to: sc520cdp_copy_to,
- map_priv_2: WINDOW_ADDR_2
+ .name = "SC520CDP DIL Flash",
+ .size = WINDOW_SIZE_2,
+ .buswidth = 1,
+ .phys = WINDOW_ADDR_2
},
};
@@ -255,9 +192,9 @@
/* map in SC520's MMCR area */
mmcr = (unsigned long *)ioremap_nocache(SC520_MMCR_BASE, SC520_MMCR_EXTENT);
if(!mmcr) { /* ioremap_nocache failed: skip the PAR reprogramming */
- /* force map_priv_2 fields to BIOS defaults: */
+ /* force physical address fields to BIOS defaults: */
for(i = 0; i < NUM_FLASH_BANKS; i++)
- sc520cdp_map[i].map_priv_2 = par_table[i].default_address;
+ sc520cdp_map[i].phys = par_table[i].default_address;
return;
}
@@ -282,7 +219,7 @@
sc520cdp_map[i].name);
printk(KERN_NOTICE "Trying default address 0x%lx\n",
par_table[i].default_address);
- sc520cdp_map[i].map_priv_2 = par_table[i].default_address;
+ sc520cdp_map[i].phys = par_table[i].default_address;
}
}
iounmap((void *)mmcr);
@@ -300,13 +237,18 @@
#endif
for (i = 0; i < NUM_FLASH_BANKS; i++) {
- printk(KERN_NOTICE "SC520 CDP flash device: %lx at %lx\n", sc520cdp_map[i].size, sc520cdp_map[i].map_priv_2);
- sc520cdp_map[i].map_priv_1 = (unsigned long)ioremap_nocache(sc520cdp_map[i].map_priv_2, sc520cdp_map[i].size);
+ printk(KERN_NOTICE "SC520 CDP flash device: 0x%lx at 0x%lx\n",
+ sc520cdp_map[i].size, sc520cdp_map[i].phys);
- if (!sc520cdp_map[i].map_priv_1) {
+ sc520cdp_map[i].virt = (unsigned long)ioremap_nocache(sc520cdp_map[i].phys, sc520cdp_map[i].size);
+
+ if (!sc520cdp_map[i].virt) {
printk("Failed to ioremap_nocache\n");
return -EIO;
}
+
+ simple_map_init(&sc520cdp_map[i]);
+
mymtd[i] = do_map_probe("cfi_probe", &sc520cdp_map[i]);
if(!mymtd[i])
mymtd[i] = do_map_probe("jedec_probe", &sc520cdp_map[i]);
@@ -318,7 +260,7 @@
++devices_found;
}
else {
- iounmap((void *)sc520cdp_map[i].map_priv_1);
+ iounmap((void *)sc520cdp_map[i].virt);
}
}
if(devices_found >= 2) {
@@ -346,9 +288,9 @@
for (i = 0; i < NUM_FLASH_BANKS; i++) {
if (mymtd[i])
map_destroy(mymtd[i]);
- if (sc520cdp_map[i].map_priv_1) {
- iounmap((void *)sc520cdp_map[i].map_priv_1);
- sc520cdp_map[i].map_priv_1 = 0;
+ if (sc520cdp_map[i].virt) {
+ iounmap((void *)sc520cdp_map[i].virt);
+ sc520cdp_map[i].virt = 0;
}
}
}
Index: scb2_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/scb2_flash.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- scb2_flash.c 24 Jan 2003 13:09:56 -0000 1.2
+++ scb2_flash.c 14 May 2003 15:05:16 -0000 1.3
@@ -14,7 +14,7 @@
* try to request it here, but if it fails, we carry on anyway.
*
* This is how the chip is attached, so said the schematic:
- * * a 4 MiB (32 Mb) 16 bit chip
+ * * a 4 MiB (32 Mib) 16 bit chip
* * a 1 MiB memory region
* * A20 and A21 pulled up
* * D8-D15 ignored
@@ -60,65 +60,13 @@
#define SCB2_ADDR 0xfff00000
#define SCB2_WINDOW 0x00100000
-static __u8 scb2_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 scb2_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static __u32 scb2_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-static void scb2_copy_from(struct map_info *map, void *to,
- unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void scb2_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void scb2_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void scb2_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void scb2_copy_to(struct map_info *map, unsigned long to,
- const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
static void *scb2_ioaddr;
static struct mtd_info *scb2_mtd;
struct map_info scb2_map = {
- name: "SCB2 BIOS Flash",
- size: 0,
- buswidth: 1,
- read8: scb2_read8,
- read16: scb2_read16,
- read32: scb2_read32,
- copy_from: scb2_copy_from,
- write8: scb2_write8,
- write16: scb2_write16,
- write32: scb2_write32,
- copy_to: scb2_copy_to,
+ .name = "SCB2 BIOS Flash",
+ .size = 0,
+ .buswidth = 1,
};
static int region_fail;
@@ -137,6 +85,8 @@
return -1;
}
+ /* I wasn't here. I didn't see. dwmw2. */
+
/* the chip is sometimes bigger than the map - what a waste */
mtd->size = map->size;
@@ -211,9 +161,12 @@
return -ENOMEM;
}
- scb2_map.map_priv_1 = (unsigned long)scb2_ioaddr;
+ scb2_map.phys = SCB2_ADDR;
+ scb2_map.virt = (unsigned long)scb2_ioaddr;
scb2_map.size = SCB2_WINDOW;
+ simple_map_init(&scb2_map);
+
/* try to find a chip */
scb2_mtd = do_map_probe("cfi_probe", &scb2_map);
@@ -235,7 +188,7 @@
return -ENODEV;
}
- printk(KERN_NOTICE MODNAME ": chip size %x at offset %x\n",
+ printk(KERN_NOTICE MODNAME ": chip size 0x%x at offset 0x%x\n",
scb2_mtd->size, SCB2_WINDOW - scb2_mtd->size);
add_mtd_device(scb2_mtd);
@@ -266,19 +219,19 @@
static struct pci_device_id scb2_flash_pci_ids[] __devinitdata = {
{
- vendor: PCI_VENDOR_ID_SERVERWORKS,
- device: PCI_DEVICE_ID_SERVERWORKS_CSB5,
- subvendor: PCI_ANY_ID,
- subdevice: PCI_ANY_ID
+ .vendor = PCI_VENDOR_ID_SERVERWORKS,
+ .device = PCI_DEVICE_ID_SERVERWORKS_CSB5,
+ .subvendor = PCI_ANY_ID,
+ .subdevice = PCI_ANY_ID
},
{ 0, }
};
static struct pci_driver scb2_flash_driver = {
- name: "Intel SCB2 BIOS Flash",
- id_table: scb2_flash_pci_ids,
- probe: scb2_flash_probe,
- remove: __devexit_p(scb2_flash_remove),
+ .name = "Intel SCB2 BIOS Flash",
+ .id_table = scb2_flash_pci_ids,
+ .probe = scb2_flash_probe,
+ .remove = __devexit_p(scb2_flash_remove),
};
static int __init
Index: scx200_docflash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/scx200_docflash.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- scx200_docflash.c 24 Jan 2003 13:20:40 -0000 1.1
+++ scx200_docflash.c 14 May 2003 15:05:16 -0000 1.2
@@ -75,46 +75,9 @@
#define NUM_PARTITIONS (sizeof(partition_info)/sizeof(partition_info[0]))
#endif
-static __u8 scx200_docflash_read8(struct map_info *map, unsigned long ofs)
-{
- return __raw_readb(map->map_priv_1 + ofs);
-}
-
-static __u16 scx200_docflash_read16(struct map_info *map, unsigned long ofs)
-{
- return __raw_readw(map->map_priv_1 + ofs);
-}
-
-static void scx200_docflash_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-static void scx200_docflash_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void scx200_docflash_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
- mb();
-}
-
-static void scx200_docflash_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
static struct map_info scx200_docflash_map = {
.name = "NatSemi SCx200 DOCCS Flash",
- .read8 = scx200_docflash_read8,
- .read16 = scx200_docflash_read16,
- .copy_from = scx200_docflash_copy_from,
- .write8 = scx200_docflash_write8,
- .write16 = scx200_docflash_write16,
- .copy_to = scx200_docflash_copy_to
};
int __init init_scx200_docflash(void)
@@ -213,8 +176,11 @@
else
scx200_docflash_map.buswidth = 2;
- scx200_docflash_map.map_priv_1 = (unsigned long)ioremap(docmem.start, scx200_docflash_map.size);
- if (!scx200_docflash_map.map_priv_1) {
+ simple_map_init(&scx200_docflash_map);
+
+ scx200_docflash_map.phys = docmem.start;
+ scx200_docflash_map.virt = (unsigned long)ioremap(docmem.start, scx200_docflash_map.size);
+ if (!scx200_docflash_map.virt) {
printk(KERN_ERR NAME ": failed to ioremap the flash\n");
release_resource(&docmem);
return -EIO;
@@ -223,7 +189,7 @@
mymtd = do_map_probe(flashtype, &scx200_docflash_map);
if (!mymtd) {
printk(KERN_ERR NAME ": unable to detect flash\n");
- iounmap((void *)scx200_docflash_map.map_priv_1);
+ iounmap((void *)scx200_docflash_map.virt);
release_resource(&docmem);
return -ENXIO;
}
@@ -253,8 +219,8 @@
#endif
map_destroy(mymtd);
}
- if (scx200_docflash_map.map_priv_1) {
- iounmap((void *)scx200_docflash_map.map_priv_1);
+ if (scx200_docflash_map.virt) {
+ iounmap((void *)scx200_docflash_map.virt);
release_resource(&docmem);
}
}
Index: solutionengine.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/solutionengine.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- solutionengine.c 17 Feb 2003 21:49:10 -0000 1.5
+++ solutionengine.c 14 May 2003 15:05:16 -0000 1.6
@@ -18,58 +18,37 @@
#include <linux/config.h>
-__u32 soleng_read32(struct map_info *map, unsigned long ofs)
-{
- return __raw_readl(map->map_priv_1 + ofs);
-}
-
-void soleng_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
- mb();
-}
-
-void soleng_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-
static struct mtd_info *flash_mtd;
static struct mtd_info *eprom_mtd;
static struct mtd_partition *parsed_parts;
struct map_info soleng_eprom_map = {
- name: "Solution Engine EPROM",
- size: 0x400000,
- buswidth: 4,
- copy_from: soleng_copy_from,
+ .name = "Solution Engine EPROM",
+ .size = 0x400000,
+ .buswidth = 4,
};
struct map_info soleng_flash_map = {
- name: "Solution Engine FLASH",
- size: 0x400000,
- buswidth: 4,
- read32: soleng_read32,
- copy_from: soleng_copy_from,
- write32: soleng_write32,
+ .name = "Solution Engine FLASH",
+ .size = 0x400000,
+ .buswidth = 4,
};
#ifdef CONFIG_MTD_SUPERH_RESERVE
static struct mtd_partition superh_se_partitions[] = {
/* Reserved for boot code, read-only */
{
- name: "flash_boot",
- offset: 0x00000000,
- size: CONFIG_MTD_SUPERH_RESERVE,
- mask_flags: MTD_WRITEABLE,
+ .name = "flash_boot",
+ .offset = 0x00000000,
+ .size = CONFIG_MTD_SUPERH_RESERVE,
+ .mask_flags = MTD_WRITEABLE,
},
/* All else is writable (e.g. JFFS) */
{
- name: "Flash FS",
- offset: MTDPART_OFS_NXTBLK,
- size: MTDPART_SIZ_FULL,
+ .name = "Flash FS",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = MTDPART_SIZ_FULL,
}
};
#endif /* CONFIG_MTD_SUPERH_RESERVE */
@@ -79,16 +58,22 @@
int nr_parts = 0;
/* First probe at offset 0 */
- soleng_flash_map.map_priv_1 = P2SEGADDR(0);
- soleng_eprom_map.map_priv_1 = P1SEGADDR(0x01000000);
-
+ soleng_flash_map.phys = 0;
+ soleng_flash_map.virt = P2SEGADDR(0);
+ soleng_eprom_map.phys = 0x01000000;
+ soleng_eprom_map.virt = P1SEGADDR(0x01000000);
+ simple_map_init(&soleng_eprom_map);
+ simple_map_init(&soleng_flash_map);
+
printk(KERN_NOTICE "Probing for flash chips at 0x00000000:\n");
flash_mtd = do_map_probe("cfi_probe", &soleng_flash_map);
if (!flash_mtd) {
/* Not there. Try swapping */
printk(KERN_NOTICE "Probing for flash chips at 0x01000000:\n");
- soleng_flash_map.map_priv_1 = P2SEGADDR(0x01000000);
- soleng_eprom_map.map_priv_1 = P1SEGADDR(0);
+ soleng_flash_map.phys = 0x01000000;
+ soleng_flash_map.virt = P2SEGADDR(0x01000000);
+ soleng_eprom_map.phys = 0;
+ soleng_eprom_map.virt = P1SEGADDR(0);
flash_mtd = do_map_probe("cfi_probe", &soleng_flash_map);
if (!flash_mtd) {
/* Eep. */
@@ -97,8 +82,8 @@
}
}
printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
- soleng_flash_map.map_priv_1 & 0x1fffffff,
- soleng_eprom_map.map_priv_1 & 0x1fffffff);
+ soleng_flash_map.phys & 0x1fffffff,
+ soleng_eprom_map.phys & 0x1fffffff);
flash_mtd->module = THIS_MODULE;
eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map);
Index: sun_uflash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sun_uflash.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- sun_uflash.c 2 Oct 2001 15:05:14 -0000 1.4
+++ sun_uflash.c 14 May 2003 15:05:16 -0000 1.5
@@ -48,60 +48,11 @@
struct list_head list;
};
-__u8 uflash_read8(struct map_info *map, unsigned long ofs)
-{
- return(__raw_readb(map->map_priv_1 + ofs));
-}
-
-__u16 uflash_read16(struct map_info *map, unsigned long ofs)
-{
- return(__raw_readw(map->map_priv_1 + ofs));
-}
-
-__u32 uflash_read32(struct map_info *map, unsigned long ofs)
-{
- return(__raw_readl(map->map_priv_1 + ofs));
-}
-
-void uflash_copy_from(struct map_info *map, void *to, unsigned long from,
- ssize_t len)
-{
- memcpy_fromio(to, map->map_priv_1 + from, len);
-}
-
-void uflash_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- __raw_writeb(d, map->map_priv_1 + adr);
-}
-
-void uflash_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- __raw_writew(d, map->map_priv_1 + adr);
-}
-
-void uflash_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- __raw_writel(d, map->map_priv_1 + adr);
-}
-
-void uflash_copy_to(struct map_info *map, unsigned long to, const void *from,
- ssize_t len)
-{
- memcpy_toio(map->map_priv_1 + to, from, len);
-}
struct map_info uflash_map_templ = {
- name: "SUNW,???-????",
- size: UFLASH_WINDOW_SIZE,
- buswidth: UFLASH_BUSWIDTH,
- read8: uflash_read8,
- read16: uflash_read16,
- read32: uflash_read32,
- copy_from: uflash_copy_from,
- write8: uflash_write8,
- write16: uflash_write16,
- write32: uflash_write32,
- copy_to: uflash_copy_to
+ .name = "SUNW,???-????",
+ .size = UFLASH_WINDOW_SIZE,
+ .buswidth = UFLASH_BUSWIDTH,
};
int uflash_devinit(struct linux_ebus_device* edev)
@@ -145,20 +96,22 @@
if(0 != pdev->name && 0 < strlen(pdev->name)) {
pdev->map.name = pdev->name;
}
-
- pdev->map.map_priv_1 =
+ pdev->phys = edev->resource[0].start;
+ pdev->virt =
(unsigned long)ioremap_nocache(edev->resource[0].start, pdev->map.size);
- if(0 == pdev->map.map_priv_1) {
+ if(0 == pdev->map.virt) {
printk("%s: failed to map device\n", __FUNCTION__);
kfree(pdev->name);
kfree(pdev);
return(-1);
}
+ simple_map_init(&pdev->map);
+
/* MTD registration */
pdev->mtd = do_map_probe("cfi_probe", &pdev->map);
if(0 == pdev->mtd) {
- iounmap((void *)pdev->map.map_priv_1);
+ iounmap((void *)pdev->map.virt);
kfree(pdev->name);
kfree(pdev);
return(-ENXIO);
@@ -211,9 +164,9 @@
del_mtd_device(udev->mtd);
map_destroy(udev->mtd);
}
- if(0 != udev->map.map_priv_1) {
- iounmap((void*)udev->map.map_priv_1);
- udev->map.map_priv_1 = 0;
+ if(0 != udev->map.virt) {
+ iounmap((void*)udev->map.virt);
+ udev->map.virt = 0;
}
if(0 != udev->name) {
kfree(udev->name);
Index: tqm8xxl.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tqm8xxl.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- tqm8xxl.c 20 Jun 2002 13:41:20 -0000 1.4
+++ tqm8xxl.c 14 May 2003 15:05:16 -0000 1.5
@@ -51,46 +51,6 @@
static unsigned long num_banks;
static unsigned long start_scan_addr;
-__u8 tqm8xxl_read8(struct map_info *map, unsigned long ofs)
-{
- return *((__u8 *)(map->map_priv_1 + ofs));
-}
-
-__u16 tqm8xxl_read16(struct map_info *map, unsigned long ofs)
-{
- return *((__u16 *)(map->map_priv_1 + ofs));
-}
-
-__u32 tqm8xxl_read32(struct map_info *map, unsigned long ofs)
-{
- return *((__u32 *)(map->map_priv_1 + ofs));
-}
-
-void tqm8xxl_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy_fromio(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void tqm8xxl_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- *((__u8 *)(map->map_priv_1 + adr)) = d;
-}
-
-void tqm8xxl_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- *((__u16 *)( map->map_priv_1 + adr)) = d;
-}
-
-void tqm8xxl_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- *((__u32 *)(map->map_priv_1 + adr)) = d;
-}
-
-void tqm8xxl_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy_toio((void *)(map->map_priv_1 + to), from, len);
-}
-
/*
* Here are partition information for all known TQM8xxL series devices.
* See include/linux/mtd/partitions.h for definition of the mtd_partition
@@ -107,44 +67,44 @@
static unsigned long tqm8xxl_max_flash_size = 0x00800000;
/* partition definition for first flash bank
- * also ref. to "drivers\char\flash_config.c"
+ * (cf. "drivers/char/flash_config.c")
*/
static struct mtd_partition tqm8xxl_partitions[] = {
{
- name: "ppcboot",
- offset: 0x00000000,
- size: 0x00020000, /* 128KB */
- mask_flags: MTD_WRITEABLE, /* force read-only */
+ .name = "ppcboot",
+ .offset = 0x00000000,
+ .size = 0x00020000, /* 128KB */
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
},
{
- name: "kernel", /* default kernel image */
- offset: 0x00020000,
- size: 0x000e0000,
- mask_flags: MTD_WRITEABLE, /* force read-only */
+ .name = "kernel", /* default kernel image */
+ .offset = 0x00020000,
+ .size = 0x000e0000,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
},
{
- name: "user",
- offset: 0x00100000,
- size: 0x00100000,
+ .name = "user",
+ .offset = 0x00100000,
+ .size = 0x00100000,
},
{
- name: "initrd",
- offset: 0x00200000,
- size: 0x00200000,
+ .name = "initrd",
+ .offset = 0x00200000,
+ .size = 0x00200000,
}
};
-/* partition definition for second flahs bank */
+/* partition definition for second flash bank */
static struct mtd_partition tqm8xxl_fs_partitions[] = {
{
- name: "cramfs",
- offset: 0x00000000,
- size: 0x00200000,
+ .name = "cramfs",
+ .offset = 0x00000000,
+ .size = 0x00200000,
},
{
- name: "jffs",
- offset: 0x00200000,
- size: 0x00200000,
- //size: MTDPART_SIZ_FULL,
+ .name = "jffs",
+ .offset = 0x00200000,
+ .size = 0x00200000,
+ .//size = MTDPART_SIZ_FULL,
}
};
#endif
@@ -160,67 +120,73 @@
flash_addr = bd->bi_flashstart;
flash_size = bd->bi_flashsize;
- //request maximum flash size address spzce
+
+ //request maximum flash size address space
start_scan_addr = (unsigned long)ioremap(flash_addr, flash_size);
if (!start_scan_addr) {
- //printk("%s:Failed to ioremap address:0x%x\n", __FUNCTION__, FLASH_ADDR);
- printk("%s:Failed to ioremap address:0x%x\n", __FUNCTION__, flash_addr);
+ printk(KERN_WARNING "%s:Failed to ioremap address:0x%x\n", __FUNCTION__, flash_addr);
return -EIO;
}
- for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++)
- {
+
+ for (idx = 0 ; idx < FLASH_BANK_MAX ; idx++) {
if(mtd_size >= flash_size)
break;
- printk("%s: chip probing count %d\n", __FUNCTION__, idx);
+ printk(KERN_INFO "%s: chip probing count %d\n", __FUNCTION__, idx);
map_banks[idx] = (struct map_info *)kmalloc(sizeof(struct map_info), GFP_KERNEL);
- if(map_banks[idx] == NULL)
- {
- //return -ENOMEM;
+ if(map_banks[idx] == NULL) {
ret = -ENOMEM;
+ /* FIXME: What if some MTD devices were probed already? */
goto error_mem;
}
+
memset((void *)map_banks[idx], 0, sizeof(struct map_info));
map_banks[idx]->name = (char *)kmalloc(16, GFP_KERNEL);
- if(map_banks[idx]->name == NULL)
- {
- //return -ENOMEM;
+
+ if (!map_banks[idx]->name) {
ret = -ENOMEM;
+ /* FIXME: What if some MTD devices were probed already? */
goto error_mem;
}
- memset((void *)map_banks[idx]->name, 0, 16);
-
sprintf(map_banks[idx]->name, "TQM8xxL%d", idx);
+
map_banks[idx]->size = flash_size;
map_banks[idx]->buswidth = 4;
- map_banks[idx]->read8 = tqm8xxl_read8;
- map_banks[idx]->read16 = tqm8xxl_read16;
- map_banks[idx]->read32 = tqm8xxl_read32;
- map_banks[idx]->copy_from = tqm8xxl_copy_from;
- map_banks[idx]->write8 = tqm8xxl_write8;
- map_banks[idx]->write16 = tqm8xxl_write16;
- map_banks[idx]->write32 = tqm8xxl_write32;
- map_banks[idx]->copy_to = tqm8xxl_copy_to;
- map_banks[idx]->map_priv_1 =
- start_scan_addr + ((idx > 0) ?
+
+ simple_map_init(map_banks[idx]);
+
+ map_banks[idx]->virt = start_scan_addr;
+ map_banks[idx]->phys = flash_addr;
+ /* FIXME: This looks utterly bogus, but I'm trying to
+ preserve the behaviour of the original (shown here)...
+
+ map_banks[idx]->map_priv_1 =
+ start_scan_addr + ((idx > 0) ?
(mtd_banks[idx-1] ? mtd_banks[idx-1]->size : 0) : 0);
+ */
+
+ if (idx && mtd_banks[idx-1]) {
+ map_banks[idx]->virt += mtd_banks[idx-1]->size;
+ map_banks[idx]->phys += mtd_banks[idx-1]->size;
+ }
+
//start to probe flash chips
mtd_banks[idx] = do_map_probe("cfi_probe", map_banks[idx]);
- if(mtd_banks[idx])
- {
+
+ if (mtd_banks[idx]) {
mtd_banks[idx]->module = THIS_MODULE;
mtd_size += mtd_banks[idx]->size;
num_banks++;
- printk("%s: bank%d, name:%s, size:%dbytes \n", __FUNCTION__, num_banks,
+
+ printk(KERN_INFO "%s: bank%d, name:%s, size:%dbytes \n", __FUNCTION__, num_banks,
mtd_banks[idx]->name, mtd_banks[idx]->size);
}
}
/* no supported flash chips found */
- if(!num_banks)
- {
- printk("TQM8xxL: No support flash chips found!\n");
+ if (!num_banks) {
+ printk(KERN_NOTICE "TQM8xxL: No support flash chips found!\n");
ret = -ENXIO;
goto error_mem;
}
@@ -232,11 +198,12 @@
part_banks[0].mtd_part = tqm8xxl_partitions;
part_banks[0].type = "Static image";
part_banks[0].nums = NB_OF(tqm8xxl_partitions);
+
part_banks[1].mtd_part = tqm8xxl_fs_partitions;
part_banks[1].type = "Static file system";
part_banks[1].nums = NB_OF(tqm8xxl_fs_partitions);
- for(idx = 0; idx < num_banks ; idx++)
- {
+
+ for(idx = 0; idx < num_banks ; idx++) {
if (part_banks[idx].nums == 0) {
printk(KERN_NOTICE "TQM flash%d: no partition info available, registering whole flash at once\n", idx);
add_mtd_device(mtd_banks[idx]);
@@ -254,12 +221,9 @@
#endif
return 0;
error_mem:
- for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++)
- {
- if(map_banks[idx] != NULL)
- {
- if(map_banks[idx]->name != NULL)
- {
+ for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++) {
+ if(map_banks[idx] != NULL) {
+ if(map_banks[idx]->name != NULL) {
kfree(map_banks[idx]->name);
map_banks[idx]->name = NULL;
}
@@ -267,18 +231,15 @@
map_banks[idx] = NULL;
}
}
- //return -ENOMEM;
error:
iounmap((void *)start_scan_addr);
- //return -ENXIO;
return ret;
}
static void __exit cleanup_tqm_mtd(void)
{
unsigned int idx = 0;
- for(idx = 0 ; idx < num_banks ; idx++)
- {
+ for(idx = 0 ; idx < num_banks ; idx++) {
/* destroy mtd_info previously allocated */
if (mtd_banks[idx]) {
del_mtd_partitions(mtd_banks[idx]);
@@ -288,6 +249,7 @@
kfree(map_banks[idx]->name);
kfree(map_banks[idx]);
}
+
if (start_scan_addr) {
iounmap((void *)start_scan_addr);
start_scan_addr = 0;
Index: tsunami_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tsunami_flash.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tsunami_flash.c 10 Jan 2002 22:59:13 -0000 1.1
+++ tsunami_flash.c 14 May 2003 15:05:16 -0000 1.2
@@ -58,18 +58,12 @@
static struct map_info tsunami_flash_map = {
.name = "flash chip on the Tsunami TIG bus",
.size = MAX_TIG_FLASH_SIZE,
+ .phys = NO_XIP;
.buswidth = 1,
.read8 = tsunami_flash_read8,
- .read16 = 0,
- .read32 = 0,
.copy_from = tsunami_flash_copy_from,
.write8 = tsunami_flash_write8,
- .write16 = 0,
- .write32 = 0,
.copy_to = tsunami_flash_copy_to,
- .set_vpp = 0,
- .map_priv_1 = 0,
-
};
static struct mtd_info *tsunami_flash_mtd;
Index: uclinux.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/uclinux.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- uclinux.c 7 Aug 2002 00:43:45 -0000 1.2
+++ uclinux.c 14 May 2003 15:05:16 -0000 1.3
@@ -24,58 +24,11 @@
/****************************************************************************/
-__u8 uclinux_read8(struct map_info *map, unsigned long ofs)
-{
- return(*((__u8 *) (map->map_priv_1 + ofs)));
-}
-
-__u16 uclinux_read16(struct map_info *map, unsigned long ofs)
-{
- return(*((__u16 *) (map->map_priv_1 + ofs)));
-}
-
-__u32 uclinux_read32(struct map_info *map, unsigned long ofs)
-{
- return(*((__u32 *) (map->map_priv_1 + ofs)));
-}
-
-void uclinux_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
-{
- memcpy(to, (void *)(map->map_priv_1 + from), len);
-}
-
-void uclinux_write8(struct map_info *map, __u8 d, unsigned long adr)
-{
- *((__u8 *) (map->map_priv_1 + adr)) = d;
-}
-
-void uclinux_write16(struct map_info *map, __u16 d, unsigned long adr)
-{
- *((__u16 *) (map->map_priv_1 + adr)) = d;
-}
-
-void uclinux_write32(struct map_info *map, __u32 d, unsigned long adr)
-{
- *((__u32 *) (map->map_priv_1 + adr)) = d;
-}
-
-void uclinux_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
-{
- memcpy((void *) (map->map_priv_1 + to), from, len);
-}
/****************************************************************************/
struct map_info uclinux_ram_map = {
- name: "RAM",
- read8: uclinux_read8,
- read16: uclinux_read16,
- read32: uclinux_read32,
- copy_from: uclinux_copy_from,
- write8: uclinux_write8,
- write16: uclinux_write16,
- write32: uclinux_write32,
- copy_to: uclinux_copy_to,
+ .name = "RAM",
};
struct mtd_info *uclinux_ram_mtdinfo;
@@ -83,7 +36,7 @@
/****************************************************************************/
struct mtd_partition uclinux_romfs[] = {
- { name: "ROMfs", offset: 0 }
+ { .name = "ROMfs" }
};
#define NUM_PARTITIONS (sizeof(uclinux_romfs) / sizeof(uclinux_romfs[0]))
@@ -94,7 +47,7 @@
size_t *retlen, u_char **mtdbuf)
{
struct map_info *map = (struct map_info *) mtd->priv;
- *mtdbuf = (u_char *) (map->map_priv_1 + ((int) from));
+ *mtdbuf = (u_char *) (map->virt + ((int) from));
*retlen = len;
return(0);
}
@@ -108,25 +61,27 @@
extern char _ebss;
mapp = &uclinux_ram_map;
- mapp->map_priv_2 = (unsigned long) &_ebss;
+ mapp->phys = (unsigned long) &_ebss;
mapp->size = PAGE_ALIGN(*((unsigned long *)((&_ebss) + 8)));
mapp->buswidth = 4;
printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
(int) mapp->map_priv_2, (int) mapp->size);
- mapp->map_priv_1 = (unsigned long)
- ioremap_nocache(mapp->map_priv_2, mapp->size);
+ mapp->virt = (unsigned long)
+ ioremap_nocache(mapp->phys, mapp->size);
- if (mapp->map_priv_1 == 0) {
+ if (mapp->virt == 0) {
printk("uclinux[mtd]: ioremap_nocache() failed\n");
return(-EIO);
}
+ simple_map_init(mapp);
+
mtd = do_map_probe("map_ram", mapp);
if (!mtd) {
printk("uclinux[mtd]: failed to find a mapping?\n");
- iounmap((void *) mapp->map_priv_1);
+ iounmap((void *) mapp->virt);
return(-ENXIO);
}
@@ -155,8 +110,8 @@
uclinux_ram_mtdinfo = NULL;
}
if (uclinux_ram_map.map_priv_1) {
- iounmap((void *) uclinux_ram_map.map_priv_1);
- uclinux_ram_map.map_priv_1 = 0;
+ iounmap((void *) uclinux_ram_map.virt);
+ uclinux_ram_map.virt = 0;
}
}
Index: vmax301.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/vmax301.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- vmax301.c 2 Oct 2001 15:05:14 -0000 1.24
+++ vmax301.c 14 May 2003 15:05:16 -0000 1.25
@@ -142,34 +142,36 @@
static struct map_info vmax_map[2] = {
{
- name: "VMAX301 Internal Flash",
- size: 3*2*1024*1024,
- buswidth: 1,
- read8: vmax301_read8,
- read16: vmax301_read16,
- read32: vmax301_read32,
- copy_from: vmax301_copy_from,
- write8: vmax301_write8,
- write16: vmax301_write16,
- write32: vmax301_write32,
- copy_to: vmax301_copy_to,
- map_priv_1: WINDOW_START + WINDOW_LENGTH,
- map_priv_2: 0xFFFFFFFF
+ .name = "VMAX301 Internal Flash",
+ .phys = NO_XIP,
+ .size = 3*2*1024*1024,
+ .buswidth = 1,
+ .read8 = vmax301_read8,
+ .read16 = vmax301_read16,
+ .read32 = vmax301_read32,
+ .copy_from = vmax301_copy_from,
+ .write8 = vmax301_write8,
+ .write16 = vmax301_write16,
+ .write32 = vmax301_write32,
+ .copy_to = vmax301_copy_to,
+ .map_priv_1 = WINDOW_START + WINDOW_LENGTH,
+ .map_priv_2 = 0xFFFFFFFF
},
{
- name: "VMAX301 Socket",
- size: 0,
- buswidth: 1,
- read8: vmax301_read8,
- read16: vmax301_read16,
- read32: vmax301_read32,
- copy_from: vmax301_copy_from,
- write8: vmax301_write8,
- write16: vmax301_write16,
- write32: vmax301_write32,
- copy_to: vmax301_copy_to,
- map_priv_1: WINDOW_START + (3*WINDOW_LENGTH),
- map_priv_2: 0xFFFFFFFF
+ .name = "VMAX301 Socket",
+ .phys = NO_XIP,
+ .size = 0,
+ .buswidth = 1,
+ .read8 = vmax301_read8,
+ .read16 = vmax301_read16,
+ .read32 = vmax301_read32,
+ .copy_from = vmax301_copy_from,
+ .write8 = vmax301_write8,
+ .write16 = vmax301_write16,
+ .write32 = vmax301_write32,
+ .copy_to = vmax301_copy_to,
+ .map_priv_1 = WINDOW_START + (3*WINDOW_LENGTH),
+ .map_priv_2 = 0xFFFFFFFF
}
};
@@ -206,8 +208,8 @@
address of the first half, because it's used more
often.
*/
- vmax_map[0].map_priv_1 = iomapadr + WINDOW_START;
- vmax_map[1].map_priv_1 = iomapadr + (3*WINDOW_START);
+ vmax_map[0].map_priv_2 = iomapadr + WINDOW_START;
+ vmax_map[1].map_priv_2 = iomapadr + (3*WINDOW_START);
for (i=0; i<2; i++) {
vmax_mtd[i] = do_map_probe("cfi_probe", &vmax_map[i]);
--- physmap64.c DELETED ---
More information about the linux-mtd-cvs
mailing list