Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4498
b: refs/heads/master
c: 002fa30
h: refs/heads/master
v: v3
  • Loading branch information
Pete Popov authored and Thomas Gleixner committed May 23, 2005
1 parent d1bccbc commit 54363ab
Show file tree
Hide file tree
Showing 8 changed files with 200 additions and 868 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d30f11d22549c54e9b05d153e37d166f88a2aa43
refs/heads/master: 002fa30170f9500ac31fa22931c689029af7f27b
73 changes: 5 additions & 68 deletions trunk/drivers/mtd/maps/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# drivers/mtd/maps/Kconfig
# $Id: Kconfig,v 1.44 2005/02/18 11:03:45 bjd Exp $
# $Id: Kconfig,v 1.45 2005/02/27 21:50:21 ppopov Exp $

menu "Mapping drivers for chip access"
depends on MTD!=n
Expand Down Expand Up @@ -213,74 +213,11 @@ config MTD_NETtel
help
Support for flash chips on NETtel/SecureEdge/SnapGear boards.

config MTD_PB1XXX
tristate "Flash devices on Alchemy PB1xxx boards"
depends on MIPS && ( MIPS_PB1000 || MIPS_PB1100 || MIPS_PB1500 )
config MTD_ALCHEMY
tristate ' AMD Alchemy Pb1xxx/Db1xxx/RDK MTD support'
depends on MIPS && SOC_AU1X00
help
Flash memory access on Alchemy Pb1000/Pb1100/Pb1500 boards

config MTD_PB1XXX_BOOT
bool "PB1x00 boot flash device"
depends on MTD_PB1XXX && ( MIPS_PB1100 || MIPS_PB1500 )
help
Use the first of the two 32MiB flash banks on Pb1100/Pb1500 board.
You can say 'Y' to both this and 'MTD_PB1XXX_USER' below, to use
both banks.

config MTD_PB1XXX_USER
bool "PB1x00 user flash device"
depends on MTD_PB1XXX && ( MIPS_PB1100 || MIPS_PB1500 )
default y if MTD_PB1XX_BOOT = n
help
Use the second of the two 32MiB flash banks on Pb1100/Pb1500 board.
You can say 'Y' to both this and 'MTD_PB1XXX_BOOT' above, to use
both banks.

config MTD_PB1550
tristate "Flash devices on Alchemy PB1550 board"
depends on MIPS && MIPS_PB1550
help
Flash memory access on Alchemy Pb1550 board

config MTD_PB1550_BOOT
bool "PB1550 boot flash device"
depends on MTD_PB1550
help
Use the first of the two 64MiB flash banks on Pb1550 board.
You can say 'Y' to both this and 'MTD_PB1550_USER' below, to use
both banks.

config MTD_PB1550_USER
bool "PB1550 user flash device"
depends on MTD_PB1550
default y if MTD_PB1550_BOOT = n
help
Use the second of the two 64MiB flash banks on Pb1550 board.
You can say 'Y' to both this and 'MTD_PB1550_BOOT' above, to use
both banks.

config MTD_DB1550
tristate "Flash devices on Alchemy DB1550 board"
depends on MIPS && MIPS_DB1550
help
Flash memory access on Alchemy Db1550 board

config MTD_DB1550_BOOT
bool "DB1550 boot flash device"
depends on MTD_DB1550
help
Use the first of the two 64MiB flash banks on Db1550 board.
You can say 'Y' to both this and 'MTD_DB1550_USER' below, to use
both banks.

config MTD_DB1550_USER
bool "DB1550 user flash device"
depends on MTD_DB1550
default y if MTD_DB1550_BOOT = n
help
Use the second of the two 64MiB flash banks on Db1550 board.
You can say 'Y' to both this and 'MTD_DB1550_BOOT' above, to use
both banks.
Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards

config MTD_DILNETPC
tristate "CFI Flash device mapped on DIL/Net PC"
Expand Down
7 changes: 2 additions & 5 deletions trunk/drivers/mtd/maps/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# linux/drivers/maps/Makefile
#
# $Id: Makefile.common,v 1.24 2005/01/24 00:35:21 bjd Exp $
# $Id: Makefile.common,v 1.25 2005/02/27 21:50:21 ppopov Exp $

ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y)
obj-$(CONFIG_MTD) += map_funcs.o
Expand Down Expand Up @@ -44,10 +44,7 @@ obj-$(CONFIG_MTD_DBOX2) += dbox2-flash.o
obj-$(CONFIG_MTD_OCELOT) += ocelot.o
obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
obj-$(CONFIG_MTD_PCI) += pci.o
obj-$(CONFIG_MTD_PB1XXX) += pb1xxx-flash.o
obj-$(CONFIG_MTD_DB1X00) += db1x00-flash.o
obj-$(CONFIG_MTD_PB1550) += pb1550-flash.o
obj-$(CONFIG_MTD_DB1550) += db1550-flash.o
obj-$(CONFIG_MTD_ALCHEMY) += alchemy-flash.o
obj-$(CONFIG_MTD_LASAT) += lasat.o
obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o
obj-$(CONFIG_MTD_EDB7312) += edb7312.o
Expand Down
192 changes: 192 additions & 0 deletions trunk/drivers/mtd/maps/alchemy-flash.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
/*
* Flash memory access on AMD Alchemy evaluation boards
*
* $Id: alchemy-flash.c,v 1.1 2005/02/27 21:50:21 ppopov Exp $
*
* (C) 2003, 2004 Pete Popov <ppopov@embeddedalley.com>
*
*/

#include <linux/config.h>
#include <linux/init.h>
#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 <asm/io.h>

#ifdef DEBUG_RW
#define DBG(x...) printk(x)
#else
#define DBG(x...)
#endif

#ifdef CONFIG_MIPS_PB1000
#define BOARD_MAP_NAME "Pb1000 Flash"
#define BOARD_FLASH_SIZE 0x00800000 /* 8MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif

#ifdef CONFIG_MIPS_PB1500
#define BOARD_MAP_NAME "Pb1500 Flash"
#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif

#ifdef CONFIG_MIPS_PB1100
#define BOARD_MAP_NAME "Pb1100 Flash"
#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif

#ifdef CONFIG_MIPS_PB1550
#define BOARD_MAP_NAME "Pb1550 Flash"
#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif

#ifdef CONFIG_MIPS_PB1200
#define BOARD_MAP_NAME "Pb1200 Flash"
#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
#define BOARD_FLASH_WIDTH 2 /* 16-bits */
#endif

#ifdef CONFIG_MIPS_DB1000
#define BOARD_MAP_NAME "Db1000 Flash"
#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif

#ifdef CONFIG_MIPS_DB1500
#define BOARD_MAP_NAME "Db1500 Flash"
#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif

#ifdef CONFIG_MIPS_DB1100
#define BOARD_MAP_NAME "Db1100 Flash"
#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif

#ifdef CONFIG_MIPS_DB1550
#define BOARD_MAP_NAME "Db1550 Flash"
#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#endif

#ifdef CONFIG_MIPS_DB1200
#define BOARD_MAP_NAME "Db1200 Flash"
#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
#define BOARD_FLASH_WIDTH 2 /* 16-bits */
#endif

#ifdef CONFIG_MIPS_HYDROGEN3
#define BOARD_MAP_NAME "Hydrogen3 Flash"
#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#define USE_LOCAL_ACCESSORS /* why? */
#endif

#ifdef CONFIG_MIPS_BOSPORUS
#define BOARD_MAP_NAME "Bosporus Flash"
#define BOARD_FLASH_SIZE 0x01000000 /* 16MB */
#define BOARD_FLASH_WIDTH 2 /* 16-bits */
#endif

#ifdef CONFIG_MIPS_MIRAGE
#define BOARD_MAP_NAME "Mirage Flash"
#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
#define BOARD_FLASH_WIDTH 4 /* 32-bits */
#define USE_LOCAL_ACCESSORS /* why? */
#endif

static struct map_info alchemy_map = {
.name = BOARD_MAP_NAME,
};

static struct mtd_partition alchemy_partitions[] = {
{
.name = "User FS",
.size = BOARD_FLASH_SIZE - 0x00400000,
.offset = 0x0000000
},{
.name = "YAMON",
.size = 0x0100000,
.offset = MTDPART_OFS_APPEND,
.mask_flags = MTD_WRITEABLE
},{
.name = "raw kernel",
.size = (0x300000 - 0x40000), /* last 256KB is yamon env */
.offset = MTDPART_OFS_APPEND,
}
};

#define NB_OF(x) (sizeof(x)/sizeof(x[0]))

static struct mtd_info *mymtd;

int __init alchemy_mtd_init(void)
{
struct mtd_partition *parts;
int nb_parts = 0;
unsigned long window_addr;
unsigned long window_size;

/* Default flash buswidth */
alchemy_map.bankwidth = BOARD_FLASH_WIDTH;

window_addr = 0x20000000 - BOARD_FLASH_SIZE;
window_size = BOARD_FLASH_SIZE;
#ifdef CONFIG_MIPS_MIRAGE_WHY
/* Boot ROM flash bank only; no user bank */
window_addr = 0x1C000000;
window_size = 0x04000000;
/* USERFS from 0x1C00 0000 to 0x1FC00000 */
alchemy_partitions[0].size = 0x03C00000;
#endif

/*
* Static partition definition selection
*/
parts = alchemy_partitions;
nb_parts = NB_OF(alchemy_partitions);
alchemy_map.size = window_size;

/*
* Now let's probe for the actual flash. Do it here since
* specific machine settings might have been set above.
*/
printk(KERN_NOTICE BOARD_MAP_NAME ": probing %d-bit flash bus\n",
alchemy_map.bankwidth*8);
alchemy_map.virt = ioremap(window_addr, window_size);
mymtd = do_map_probe("cfi_probe", &alchemy_map);
if (!mymtd) {
iounmap(alchemy_map.virt);
return -ENXIO;
}
mymtd->owner = THIS_MODULE;

add_mtd_partitions(mymtd, parts, nb_parts);
return 0;
}

static void __exit alchemy_mtd_cleanup(void)
{
if (mymtd) {
del_mtd_partitions(mymtd);
map_destroy(mymtd);
iounmap(alchemy_map.virt);
}
}

module_init(alchemy_mtd_init);
module_exit(alchemy_mtd_cleanup);

MODULE_AUTHOR("Embedded Alley Solutions, Inc");
MODULE_DESCRIPTION(BOARD_MAP_NAME " MTD driver");
MODULE_LICENSE("GPL");
Loading

0 comments on commit 54363ab

Please sign in to comment.