Commit 3d55cfd4 authored by Eli Carter's avatar Eli Carter Committed by Russell King

[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(-)
#
parent f270bc9e
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
# #
CONFIG_ARM=y CONFIG_ARM=y
CONFIG_MMU=y CONFIG_MMU=y
CONFIG_SWAP=y
CONFIG_UID16=y CONFIG_UID16=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y CONFIG_RWSEM_GENERIC_SPINLOCK=y
...@@ -15,6 +14,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y ...@@ -15,6 +14,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
# #
# General setup # General setup
# #
CONFIG_SWAP=y
CONFIG_SYSVIPC=y CONFIG_SYSVIPC=y
# CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_SYSCTL=y CONFIG_SYSCTL=y
...@@ -284,6 +284,7 @@ CONFIG_NETDEVICES=y ...@@ -284,6 +284,7 @@ CONFIG_NETDEVICES=y
# Ethernet (10 or 100Mbit) # Ethernet (10 or 100Mbit)
# #
CONFIG_NET_ETHERNET=y CONFIG_NET_ETHERNET=y
# CONFIG_MII is not set
# CONFIG_HAPPYMEAL is not set # CONFIG_HAPPYMEAL is not set
# CONFIG_SUNGEM is not set # CONFIG_SUNGEM is not set
# CONFIG_NET_VENDOR_3COM is not set # CONFIG_NET_VENDOR_3COM is not set
...@@ -299,6 +300,7 @@ CONFIG_NET_PCI=y ...@@ -299,6 +300,7 @@ CONFIG_NET_PCI=y
# CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_ADAPTEC_STARFIRE is not set
# CONFIG_DGRS is not set # CONFIG_DGRS is not set
CONFIG_EEPRO100=y CONFIG_EEPRO100=y
# CONFIG_EEPRO100_PIO is not set
# CONFIG_E100 is not set # CONFIG_E100 is not set
# CONFIG_FEALNX is not set # CONFIG_FEALNX is not set
# CONFIG_NATSEMI is not set # CONFIG_NATSEMI is not set
...@@ -504,6 +506,7 @@ CONFIG_UNIX98_PTY_COUNT=256 ...@@ -504,6 +506,7 @@ CONFIG_UNIX98_PTY_COUNT=256
# CONFIG_AGP is not set # CONFIG_AGP is not set
# CONFIG_DRM is not set # CONFIG_DRM is not set
# CONFIG_RAW_DRIVER is not set # CONFIG_RAW_DRIVER is not set
# CONFIG_HANGCHECK_TIMER is not set
# #
# Multimedia devices # Multimedia devices
...@@ -536,50 +539,66 @@ CONFIG_VIDEO_DEV=y ...@@ -536,50 +539,66 @@ CONFIG_VIDEO_DEV=y
# #
# File systems # 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_QUOTA is not set
# CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS_FS is not set
# CONFIG_AUTOFS4_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_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_JFFS_FS is not set
CONFIG_JFFS2_FS=y CONFIG_JFFS2_FS=y
CONFIG_JFFS2_FS_DEBUG=0 CONFIG_JFFS2_FS_DEBUG=0
# CONFIG_CRAMFS is not set # 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_VXFS_FS is not set
# CONFIG_NTFS_FS is not set
# CONFIG_HPFS_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_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_SYSV_FS is not set
# CONFIG_UDF_FS is not set
# CONFIG_UFS_FS is not set # CONFIG_UFS_FS is not set
# CONFIG_XFS_FS is not set
# #
# Network File Systems # Network File Systems
# #
# CONFIG_CODA_FS is not set
CONFIG_NFS_FS=y CONFIG_NFS_FS=y
# CONFIG_NFS_V3 is not set # CONFIG_NFS_V3 is not set
CONFIG_ROOT_NFS=y
# CONFIG_NFSD is not set # CONFIG_NFSD is not set
CONFIG_SUNRPC=y CONFIG_ROOT_NFS=y
CONFIG_LOCKD=y CONFIG_LOCKD=y
# CONFIG_EXPORTFS is not set # CONFIG_EXPORTFS is not set
# CONFIG_CIFS is not set
# CONFIG_SMB_FS is not set # CONFIG_SMB_FS is not set
# CONFIG_CIFS is not set
# CONFIG_NCP_FS is not set # CONFIG_NCP_FS is not set
# CONFIG_CODA_FS is not set
CONFIG_SUNRPC=y
# #
# Partition Types # Partition Types
......
...@@ -283,6 +283,14 @@ config MTD_IQ80310 ...@@ -283,6 +283,14 @@ config MTD_IQ80310
IQ80310 evaluation board. If you have one of these boards and would IQ80310 evaluation board. If you have one of these boards and would
like to use the flash chips on it, say 'Y'. 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 config MTD_EPXA10DB
tristate "CFI Flash device mapped on Epxa10db" tristate "CFI Flash device mapped on Epxa10db"
depends on ARM && MTD_CFI && MTD_PARTITIONS && ARCH_CAMELOT depends on ARM && MTD_CFI && MTD_PARTITIONS && ARCH_CAMELOT
......
...@@ -12,6 +12,7 @@ obj-$(CONFIG_MTD_DC21285) += dc21285.o ...@@ -12,6 +12,7 @@ obj-$(CONFIG_MTD_DC21285) += dc21285.o
obj-$(CONFIG_MTD_ELAN_104NC) += elan-104nc.o obj-$(CONFIG_MTD_ELAN_104NC) += elan-104nc.o
obj-$(CONFIG_MTD_EPXA10DB) += epxa10db-flash.o obj-$(CONFIG_MTD_EPXA10DB) += epxa10db-flash.o
obj-$(CONFIG_MTD_IQ80310) += iq80310.o obj-$(CONFIG_MTD_IQ80310) += iq80310.o
obj-$(CONFIG_MTD_IQ80321) += iq80321.o
obj-$(CONFIG_MTD_L440GX) += l440gx.o obj-$(CONFIG_MTD_L440GX) += l440gx.o
obj-$(CONFIG_MTD_NORA) += nora.o obj-$(CONFIG_MTD_NORA) += nora.o
obj-$(CONFIG_MTD_CEIVA) += ceiva.o obj-$(CONFIG_MTD_CEIVA) += ceiva.o
......
/*
* $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 <rorybolt@pacbell.net>
* 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 <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <asm/io.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#define 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");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment