From 3d55cfd4e4de5b1110fe165f1956ba2e6893ef54 Mon Sep 17 00:00:00 2001 From: Eli Carter Date: Thu, 17 Apr 2003 23:59:27 +0100 Subject: [PATCH] [ARM PATCH] 1506/1: Add iq80321 MTD mapping Patch from Eli Carter # Thu Apr 17 14:05:58 CDT 2003 ejc@rnd-linux-c84 # iq80321-mtd # # Add the MTD mapping for the flash chip on the iq80321 board. # The drivers/mtd/maps/iq80321.c file comes from 2.4.19-rmk4-ds2, and is # essentially a copy of the iq80310.c file in the same directory. # This version used C99 initializers # # Diff'ed against 2.5.65-rmk1+1472-4+1502-3 # Applies cleanly to linux-2.5.67-rmk1+1502-3 # # arch/arm/def-configs/iq80321 | 61 ++++++++++----- # drivers/mtd/maps/Kconfig | 8 ++ # drivers/mtd/maps/Makefile | 1 # drivers/mtd/maps/iq80321.c | 169 +++++++++++++++++++++++++++++++++++++++++++ # 4 files changed, 218 insertions(+), 21 deletions(-) # --- arch/arm/def-configs/iq80321 | 61 ++++++++----- drivers/mtd/maps/Kconfig | 8 ++ drivers/mtd/maps/Makefile | 1 + drivers/mtd/maps/iq80321.c | 169 +++++++++++++++++++++++++++++++++++ 4 files changed, 218 insertions(+), 21 deletions(-) create mode 100644 drivers/mtd/maps/iq80321.c diff --git a/arch/arm/def-configs/iq80321 b/arch/arm/def-configs/iq80321 index 129def68e676..aa41684bc222 100644 --- a/arch/arm/def-configs/iq80321 +++ b/arch/arm/def-configs/iq80321 @@ -3,7 +3,6 @@ # CONFIG_ARM=y CONFIG_MMU=y -CONFIG_SWAP=y CONFIG_UID16=y CONFIG_RWSEM_GENERIC_SPINLOCK=y @@ -15,6 +14,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y # # General setup # +CONFIG_SWAP=y CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y @@ -284,6 +284,7 @@ CONFIG_NETDEVICES=y # Ethernet (10 or 100Mbit) # CONFIG_NET_ETHERNET=y +# CONFIG_MII is not set # CONFIG_HAPPYMEAL is not set # CONFIG_SUNGEM is not set # CONFIG_NET_VENDOR_3COM is not set @@ -299,6 +300,7 @@ CONFIG_NET_PCI=y # CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_DGRS is not set CONFIG_EEPRO100=y +# CONFIG_EEPRO100_PIO is not set # CONFIG_E100 is not set # CONFIG_FEALNX is not set # CONFIG_NATSEMI is not set @@ -504,6 +506,7 @@ CONFIG_UNIX98_PTY_COUNT=256 # CONFIG_AGP is not set # CONFIG_DRM is not set # CONFIG_RAW_DRIVER is not set +# CONFIG_HANGCHECK_TIMER is not set # # Multimedia devices @@ -536,50 +539,66 @@ CONFIG_VIDEO_DEV=y # # File systems # +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +# CONFIG_EXT3_FS is not set +# CONFIG_JBD is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_ROMFS_FS is not set # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_EXT3_FS is not set -# CONFIG_JBD is not set + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# # CONFIG_FAT_FS is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_DEVPTS_FS=y +CONFIG_TMPFS=y +CONFIG_RAMFS=y + +# +# Miscellaneous filesystems +# # CONFIG_JFFS_FS is not set CONFIG_JFFS2_FS=y CONFIG_JFFS2_FS_DEBUG=0 # CONFIG_CRAMFS is not set -CONFIG_TMPFS=y -CONFIG_RAMFS=y -# CONFIG_ISO9660_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_MINIX_FS is not set # CONFIG_VXFS_FS is not set -# CONFIG_NTFS_FS is not set # CONFIG_HPFS_FS is not set -CONFIG_PROC_FS=y -CONFIG_DEVPTS_FS=y # CONFIG_QNX4FS_FS is not set -# CONFIG_ROMFS_FS is not set -CONFIG_EXT2_FS=y -# CONFIG_EXT2_FS_XATTR is not set # CONFIG_SYSV_FS is not set -# CONFIG_UDF_FS is not set # CONFIG_UFS_FS is not set -# CONFIG_XFS_FS is not set # # Network File Systems # -# CONFIG_CODA_FS is not set CONFIG_NFS_FS=y # CONFIG_NFS_V3 is not set -CONFIG_ROOT_NFS=y # CONFIG_NFSD is not set -CONFIG_SUNRPC=y +CONFIG_ROOT_NFS=y CONFIG_LOCKD=y # CONFIG_EXPORTFS is not set -# CONFIG_CIFS is not set # CONFIG_SMB_FS is not set +# CONFIG_CIFS is not set # CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +CONFIG_SUNRPC=y # # Partition Types diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 109df882cccb..3ab0183ebc86 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig @@ -283,6 +283,14 @@ config MTD_IQ80310 IQ80310 evaluation board. If you have one of these boards and would like to use the flash chips on it, say 'Y'. +config MTD_IQ80321 + tristate "CFI Flash device mapped on the XScale IQ80321 board" + depends on ARM && MTD_CFI && ARCH_IQ80321 + help + This enables access routines for the flash chips on the Intel XScale + IQ80321 evaluation board. If you have one of these boards and would + like to use the flash chips on it, say 'Y'. + config MTD_EPXA10DB tristate "CFI Flash device mapped on Epxa10db" depends on ARM && MTD_CFI && MTD_PARTITIONS && ARCH_CAMELOT diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 3044c7b6a904..a6dec0139c63 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_MTD_DC21285) += dc21285.o obj-$(CONFIG_MTD_ELAN_104NC) += elan-104nc.o obj-$(CONFIG_MTD_EPXA10DB) += epxa10db-flash.o obj-$(CONFIG_MTD_IQ80310) += iq80310.o +obj-$(CONFIG_MTD_IQ80321) += iq80321.o obj-$(CONFIG_MTD_L440GX) += l440gx.o obj-$(CONFIG_MTD_NORA) += nora.o obj-$(CONFIG_MTD_CEIVA) += ceiva.o diff --git a/drivers/mtd/maps/iq80321.c b/drivers/mtd/maps/iq80321.c new file mode 100644 index 000000000000..0562fc9ab9c2 --- /dev/null +++ b/drivers/mtd/maps/iq80321.c @@ -0,0 +1,169 @@ +/* + * $Id: iq80321.c,v 1.1.2.1 2003/03/04 16:14:31 ejc Exp $ + * + * Mapping for the Intel XScale IQ80321 evaluation board + * + * Author: Rory Bolt + * Copyright: (C) 2002 Rory Bolt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include + + +#define WINDOW_ADDR 0xf0000000 +#define WINDOW_SIZE 8*1024*1024 +#define BUSWIDTH 1 + +static struct mtd_info *mymtd; + +static __u8 iq80321_read8(struct map_info *map, unsigned long ofs) +{ + return *(__u8 *)(map->map_priv_1 + ofs); +} + +static __u16 iq80321_read16(struct map_info *map, unsigned long ofs) +{ + return *(__u16 *)(map->map_priv_1 + ofs); +} + +static __u32 iq80321_read32(struct map_info *map, unsigned long ofs) +{ + return *(__u32 *)(map->map_priv_1 + ofs); +} + +static void iq80321_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 iq80321_write8(struct map_info *map, __u8 d, unsigned long adr) +{ + *(__u8 *)(map->map_priv_1 + adr) = d; +} + +static void iq80321_write16(struct map_info *map, __u16 d, unsigned long adr) +{ + *(__u16 *)(map->map_priv_1 + adr) = d; +} + +static void iq80321_write32(struct map_info *map, __u32 d, unsigned long adr) +{ + *(__u32 *)(map->map_priv_1 + adr) = d; +} + +static void iq80321_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 iq80321_map = { + name = "IQ80321 flash", + size = WINDOW_SIZE, + buswidth = BUSWIDTH, + read8 = iq80321_read8, + read16 = iq80321_read16, + read32 = iq80321_read32, + copy_from = iq80321_copy_from, + write8 = iq80321_write8, + write16 = iq80321_write16, + write32 = iq80321_write32, + copy_to = iq80321_copy_to +}; + +static struct mtd_partition iq80321_partitions[4] = { + { + .name = "Firmware", + .size = 0x00080000, + .offset = 0, + .mask_flags = MTD_WRITEABLE /* force read-only */ + },{ + .name = "Kernel", + .size = 0x000a0000, + .offset = 0x00080000, + },{ + .name = "Filesystem", + .size = 0x00600000, + .offset = 0x00120000 + },{ + .name = "RedBoot", + .size = 0x000e0000, + .offset = 0x00720000, + .mask_flags = MTD_WRITEABLE + } +}; + +#define NB_OF(x) (sizeof(x)/sizeof(x[0])) + +static struct mtd_info *mymtd; +static struct mtd_partition *parsed_parts; + +extern int parse_redboot_partitions(struct mtd_info *master, struct mtd_partition **pparts); + +static int __init init_iq80321(void) +{ + struct mtd_partition *parts; + int nb_parts = 0; + int parsed_nr_parts = 0; + char *part_type = "Static"; + + iq80321_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE); + if (!iq80321_map.map_priv_1) { + printk("Failed to ioremap\n"); + return -EIO; + } + mymtd = do_map_probe("cfi_probe", &iq80321_map); + if (!mymtd) { + iounmap((void *)iq80321_map.map_priv_1); + return -ENXIO; + } + mymtd->module = THIS_MODULE; + +#ifdef CONFIG_MTD_REDBOOT_PARTS + if (parsed_nr_parts == 0) { + int ret = parse_redboot_partitions(mymtd, &parsed_parts); + + if (ret > 0) { + part_type = "RedBoot"; + parsed_nr_parts = ret; + } + } +#endif + + if (parsed_nr_parts > 0) { + parts = parsed_parts; + nb_parts = parsed_nr_parts; + } else { + parts = iq80321_partitions; + nb_parts = NB_OF(iq80321_partitions); + } + printk(KERN_NOTICE "Using %s partition definition\n", part_type); + add_mtd_partitions(mymtd, parts, nb_parts); + return 0; +} + +static void __exit cleanup_iq80321(void) +{ + if (mymtd) { + del_mtd_partitions(mymtd); + map_destroy(mymtd); + if (parsed_parts) + kfree(parsed_parts); + } + if (iq80321_map.map_priv_1) + iounmap((void *)iq80321_map.map_priv_1); +} + +module_init(init_iq80321); +module_exit(cleanup_iq80321); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("MTD map driver for Intel XScale IQ80321 evaluation board"); -- 2.39.5