mtd/drivers/mtd/maps arctic-mtd.c,NONE,1.1 beech-mtd.c,NONE,1.1 ebony.c,NONE,1.1 Config.in,1.43,1.44 Makefile,1.37,1.38
Marius Groeger
mag at infradead.org
Thu Jan 30 03:45:12 EST 2003
- Previous message: mtd/drivers/mtd/maps physmap.c,1.21,1.22
- Next message: mtd/drivers/mtd/maps Kconfig,1.1,1.2 arctic-mtd.c,1.1,1.2 beech-mtd.c,1.1,1.2 ebony.c,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv23245/mtd/maps
Modified Files:
Config.in Makefile
Added Files:
arctic-mtd.c beech-mtd.c ebony.c
Log Message:
Add MTD support for IBM 405LP Arctic, IBM 440GP Ebony, IBM 405LP Beech
Slight reorganisation of PPC section in maps/Config.in
--- NEW FILE arctic-mtd.c ---
/*
* drivers/mtd/maps/arctic-mtd.c MTD mappings and partition tables for
* IBM 405LP Arctic boards.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Copyright (C) 2002, International Business Machines Corporation
* All Rights Reserved.
*
* Bishop Brock
* IBM Research, Austin Center for Low-Power Computing
* bcbrock at us.ibm.com
* March 2002
*
* modified for Arctic by,
* David Gibson
* IBM OzLabs, Canberra, Australia
* <arctic at gibson.dropbear.id.au>
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#include <asm/ibm4xx.h>
#define ARCTIC_FFS_SIZE 0x1a00000 /* 26 M */
#define NAME "Arctic Linux Flash"
#define PADDR SUBZERO_BOOTFLASH_PADDR
#define SIZE SUBZERO_BOOTFLASH_SIZE
#define BUSWIDTH 2
/* 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);
}
static void
arctic_mtd_write16(struct map_info *map, u16 data, unsigned long address)
{
__raw_writew(data, map->map_priv_1 + address);
}
static void
arctic_mtd_write32(struct map_info *map, u32 data, unsigned long address)
{
__raw_writel(data, map->map_priv_1 + address);
}
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 */
}
static struct map_info arctic_mtd_map = {
.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,
};
static struct mtd_info *arctic_mtd;
static struct mtd_partition arctic_partitions[2] = {
{ .name = "Arctic FFS",
.size = ARCTIC_FFS_SIZE,
.offset = 0,},
{ .name = "Kernel & firmware",
.size = (SUBZERO_BOOTFLASH_SIZE - ARCTIC_FFS_SIZE),
.offset = ARCTIC_FFS_SIZE,},
};
static int __init
init_arctic_mtd(void)
{
printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR);
arctic_mtd_map.map_priv_1 = (unsigned long) ioremap(PADDR, SIZE);
if (!arctic_mtd_map.map_priv_1) {
printk("%s: failed to ioremap 0x%x\n", NAME, PADDR);
return -EIO;
}
printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8);
arctic_mtd = do_map_probe("cfi_probe", &arctic_mtd_map);
if (!arctic_mtd)
return -ENXIO;
arctic_mtd->module = THIS_MODULE;
return add_mtd_partitions(arctic_mtd, arctic_partitions, 2);
}
static void __exit
cleanup_arctic_mtd(void)
{
if (arctic_mtd) {
del_mtd_partitions(arctic_mtd);
map_destroy(arctic_mtd);
iounmap((void *) arctic_mtd_map.map_priv_1);
}
}
module_init(init_arctic_mtd);
module_exit(cleanup_arctic_mtd);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("David Gibson <arctic at gibson.dropbear.id.au>");
MODULE_DESCRIPTION("MTD map and partitions for IBM 405LP Arctic boards");
--- NEW FILE beech-mtd.c ---
/*
* drivers/mtd/maps/beech-mtd.c MTD mappings and partition tables for
* IBM 405LP Beech boards.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Copyright (C) 2002, International Business Machines Corporation
* All Rights Reserved.
*
* Bishop Brock
* IBM Research, Austin Center for Low-Power Computing
* bcbrock at us.ibm.com
* March 2002
*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#include <asm/ibm4xx.h>
#define NAME "Beech Linux Flash"
#define PADDR BEECH_BIGFLASH_PADDR
#define SIZE BEECH_BIGFLASH_SIZE
#define BUSWIDTH 1
/* 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);
}
static void
beech_mtd_write16(struct map_info *map, __u16 data, unsigned long address)
{
__raw_writew(data, map->map_priv_1 + address);
}
static void
beech_mtd_write32(struct map_info *map, __u32 data, unsigned long address)
{
__raw_writel(data, map->map_priv_1 + address);
}
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
};
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:"Free Area",
size:BEECH_FREE_AREA_SIZE,
offset:BEECH_FREE_AREA_OFFSET
}
};
static int __init
init_beech_mtd(void)
{
printk("%s: 0x%08x at 0x%08x\n", NAME, SIZE, PADDR);
beech_mtd_map.map_priv_1 = (unsigned long) ioremap(PADDR, SIZE);
if (!beech_mtd_map.map_priv_1) {
printk("%s: failed to ioremap 0x%x\n", NAME, PADDR);
return -EIO;
}
printk("%s: probing %d-bit flash bus\n", NAME, BUSWIDTH * 8);
beech_mtd = do_map_probe("cfi_probe", &beech_mtd_map);
if (!beech_mtd)
return -ENXIO;
beech_mtd->module = THIS_MODULE;
return add_mtd_partitions(beech_mtd, beech_partitions, 2);
}
static void __exit
cleanup_beech_mtd(void)
{
if (beech_mtd) {
del_mtd_partitions(beech_mtd);
map_destroy(beech_mtd);
iounmap((void *) beech_mtd_map.map_priv_1);
}
}
module_init(init_beech_mtd);
module_exit(cleanup_beech_mtd);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Bishop Brock, bcbrock at us.ibm.com");
MODULE_DESCRIPTION("MTD map and partitions for IBM 405LP Beech boards");
--- NEW FILE ebony.c ---
/*
* Mapping for Ebony user flash
*
* Matt Porter <mporter at mvista.com>
*
* Copyright 2002 MontaVista Software Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/config.h>
#include <asm/io.h>
#include <asm/ibm440.h>
#include <platforms/ebony.h>
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);
}
static void ebony_write16(struct map_info *map, __u16 d, unsigned long adr)
{
__raw_writew(d, map->map_priv_1 + adr);
}
static void ebony_write32(struct map_info *map, __u32 d, unsigned long adr)
{
__raw_writel(d, map->map_priv_1 + adr);
}
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,
};
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,
};
static struct mtd_partition ebony_small_partitions[] = {
{
name: "OpenBIOS",
offset: 0x0,
size: 0x80000,
}
};
static struct mtd_partition ebony_large_partitions[] = {
{
name: "fs",
offset: 0,
size: 0x380000,
},
{
name: "firmware",
offset: 0x380000,
size: 0x80000,
}
};
#define NB_OF(x) (sizeof(x)/sizeof(x[0]))
int __init init_ebony(void)
{
u8 fpga0_reg;
unsigned long long small_flash_base, large_flash_base;
fpga0_reg = readb(ioremap64(EBONY_FPGA_ADDR, 16));
if (EBONY_BOOT_SMALL_FLASH(fpga0_reg) &&
!EBONY_FLASH_SEL(fpga0_reg))
small_flash_base = EBONY_SMALL_FLASH_HIGH2;
else if (EBONY_BOOT_SMALL_FLASH(fpga0_reg) &&
EBONY_FLASH_SEL(fpga0_reg))
small_flash_base = EBONY_SMALL_FLASH_HIGH1;
else if (!EBONY_BOOT_SMALL_FLASH(fpga0_reg) &&
!EBONY_FLASH_SEL(fpga0_reg))
small_flash_base = EBONY_SMALL_FLASH_LOW2;
else
small_flash_base = EBONY_SMALL_FLASH_LOW1;
if (EBONY_BOOT_SMALL_FLASH(fpga0_reg) &&
!EBONY_ONBRD_FLASH_EN(fpga0_reg))
large_flash_base = EBONY_LARGE_FLASH_LOW;
else
large_flash_base = EBONY_LARGE_FLASH_HIGH;
ebony_small_map.map_priv_1 =
(unsigned long)ioremap64(small_flash_base,
ebony_small_map.size);
if (!ebony_small_map.map_priv_1) {
printk("Failed to ioremap flash\n");
return -EIO;
}
flash = do_map_probe("map_rom", &ebony_small_map);
if (flash) {
flash->module = THIS_MODULE;
add_mtd_partitions(flash, ebony_small_partitions,
NB_OF(ebony_small_partitions));
} else {
printk("map probe failed for flash\n");
return -ENXIO;
}
ebony_large_map.map_priv_1 =
(unsigned long)ioremap64(large_flash_base,
ebony_large_map.size);
if (!ebony_large_map.map_priv_1) {
printk("Failed to ioremap flash\n");
return -EIO;
}
flash = do_map_probe("cfi_probe", &ebony_large_map);
if (flash) {
flash->module = THIS_MODULE;
add_mtd_partitions(flash, ebony_large_partitions,
NB_OF(ebony_large_partitions));
} else {
printk("map probe failed for flash\n");
return -ENXIO;
}
return 0;
}
static void __exit cleanup_ebony(void)
{
if (flash) {
del_mtd_partitions(flash);
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_large_map.map_priv_1) {
iounmap((void *)ebony_large_map.map_priv_1);
ebony_large_map.map_priv_1 = 0;
}
}
module_init(init_ebony);
module_exit(cleanup_ebony);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Ebony flash map");
Index: Config.in
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Config.in,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- Config.in 24 Jan 2003 14:26:38 -0000 1.43
+++ Config.in 30 Jan 2003 08:45:04 -0000 1.44
@@ -38,13 +38,30 @@
dep_tristate ' BIOS flash chip on Intel SCB2 boards' CONFIG_MTD_SCB2_FLASH $CONFIG_MTD_GEN_PROBE
fi
-if [ "$CONFIG_PPC" = "y" ]; then
- dep_tristate ' CFI Flash device mapped on TQM8XXL' CONFIG_MTD_TQM8XXL $CONFIG_MTD_CFI $CONFIG_TQM8xxL
- dep_tristate ' CFI Flash device mapped on RPX Lite or CLLF' CONFIG_MTD_RPXLITE $CONFIG_MTD_CFI
- dep_tristate ' System flash on MBX860 board' CONFIG_MTD_MBX860 $CONFIG_MTD_CFI
- dep_tristate ' CFI Flash device mapped on D-Box2' CONFIG_MTD_DBOX2 $CONFIG_MTD_CFI
- dep_tristate ' CFI Flash device mapping on FlagaDM' CONFIG_MTD_CFI_FLAGADM $CONFIG_MTD_CFI
- dep_tristate ' CFI Flash device mapped on IBM Redwood-4/5' CONFIG_MTD_REDWOOD $CONFIG_MTD_CFI
+if [ "$CONFIG_PPC32" = "y" ]; then
+ if [ "$CONFIG_8xx" = "y" ]; then
+ if [ "$CONFIG_TQM8xxL" = "y" ]; then
+ dep_tristate ' CFI Flash device mapped on TQM8XXL' CONFIG_MTD_TQM8XXL $CONFIG_MTD_CFI
+ fi
+ if [ "$CONFIG_RPXLITE" = "y" -o "$CONFIG_RPXCLASSIC" = "y" ]; then
+ dep_tristate ' CFI Flash device mapped on RPX Lite or CLLF' CONFIG_MTD_RPXLITE $CONFIG_MTD_CFI
+ fi
+ dep_tristate ' System flash on MBX860 board' CONFIG_MTD_MBX860 $CONFIG_MTD_CFI
+ dep_tristate ' CFI Flash device mapped on D-Box2' CONFIG_MTD_DBOX2 $CONFIG_MTD_CFI
+ dep_tristate ' CFI Flash device mapping on FlagaDM' CONFIG_MTD_CFI_FLAGADM $CONFIG_MTD_CFI
+ fi
+ if [ "$CONFIG_4xx" = "y" ]; then
+ if [ "$CONFIG_40x" = "y" ]; then
+ if [ "$CONFIG_REDWOOD_4" = "y" -o "$CONFIG_REDWOOD_5" = "y" -o "$CONFIG_REDWOOD_6" = "y" ]; then
+ dep_tristate ' CFI Flash device mapped on IBM Redwood' CONFIG_MTD_REDWOOD $CONFIG_MTD_CFI
+ fi
+ dep_tristate ' CFI Flash device mapped on IBM Beech' CONFIG_MTD_BEECH $CONFIG_MTD_CFI $CONFIG_BEECH
+ dep_tristate ' CFI Flash device mapped on IBM Arctic' CONFIG_MTD_ARCTIC $CONFIG_MTD_CFI $CONFIG_ARCTIC2
+ fi
+ if [ "$CONFIG_440" = "y" ]; then
+ dep_tristate ' Flash devices mapped on IBM Ebony' CONFIG_MTD_EBONY $CONFIG_MTD_CFI $CONFIG_EBONY
+ fi
+ fi
fi
if [ "$CONFIG_MIPS" = "y" ]; then
Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- Makefile 24 Jan 2003 14:26:38 -0000 1.37
+++ Makefile 30 Jan 2003 08:45:04 -0000 1.38
@@ -61,5 +61,8 @@
obj-$(CONFIG_MTD_UCLINUX) += uclinux.o
obj-$(CONFIG_MTD_NETtel) += nettel.o
obj-$(CONFIG_MTD_SCB2_FLASH) += scb2_flash.o
+obj-$(CONFIG_MTD_EBONY) += ebony.o
+obj-$(CONFIG_MTD_BEECH) += beech-mtd.o
+obj-$(CONFIG_MTD_ARCTIC) += arctic-mtd.o
include $(TOPDIR)/Rules.make
- Previous message: mtd/drivers/mtd/maps physmap.c,1.21,1.22
- Next message: mtd/drivers/mtd/maps Kconfig,1.1,1.2 arctic-mtd.c,1.1,1.2 beech-mtd.c,1.1,1.2 ebony.c,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the linux-mtd-cvs
mailing list