1 diff -urN linux-2.6.16.7/drivers/mtd/maps/bcm963xx.c linux-2.6.16.7-brcm63xx/drivers/mtd/maps/bcm963xx.c
2 --- linux-2.6.16.7/drivers/mtd/maps/bcm963xx.c 1970-01-01 01:00:00.000000000 +0100
3 +++ linux-2.6.16.7-brcm63xx/drivers/mtd/maps/bcm963xx.c 2006-07-07 22:00:36.000000000 +0200
6 + * A simple flash mapping code for BCM963xx board flash memory
7 + * It is simple because it only treats all the flash memory as ROM
8 + * It is used with chips/map_rom.c
10 + * Song Wang (songw@broadcom.com)
13 +#include <linux/module.h>
14 +#include <linux/types.h>
15 +#include <linux/kernel.h>
16 +#include <linux/init.h>
18 +#include <linux/mtd/mtd.h>
19 +#include <linux/mtd/map.h>
20 +#include <linux/config.h>
24 +#define VERSION "1.0"
26 +extern PFILE_TAG kerSysImageTagGet(void);
28 +static struct mtd_info *mymtd;
30 +static map_word brcm_physmap_read16(struct map_info *map, unsigned long ofs)
34 + val.x[0] = __raw_readw(map->map_priv_1 + ofs);
39 +static void brcm_physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
41 + memcpy_fromio(to, map->map_priv_1 + from, len);
44 +static struct map_info brcm_physmap_map = {
45 + .name = "Physically mapped flash",
47 + .read = brcm_physmap_read16,
48 + .copy_from = brcm_physmap_copy_from
51 +static int __init init_brcm_physmap(void)
53 + PFILE_TAG pTag = NULL;
54 + u_int32_t rootfs_addr, kernel_addr;
55 + FLASH_ADDR_INFO info;
57 + printk("bcm963xx_mtd driver v%s\n", VERSION);
58 + kerSysFlashAddrInfoGet( &info );
60 + /* Read the flash memory map from flash memory. */
61 + if (!(pTag = kerSysImageTagGet())) {
62 + printk("Failed to read image tag from flash\n");
66 + rootfs_addr = (u_int32_t) simple_strtoul(pTag->rootfsAddress, NULL, 10);
67 + kernel_addr = (u_int32_t) simple_strtoul(pTag->kernelAddress, NULL, 10);
69 + brcm_physmap_map.size = kernel_addr - rootfs_addr;
70 + brcm_physmap_map.map_priv_1 = (unsigned long)rootfs_addr;
72 + if (!brcm_physmap_map.map_priv_1) {
73 + printk("Wrong rootfs starting address\n");
77 + if (brcm_physmap_map.size <= 0) {
78 + printk("Wrong rootfs size\n");
82 + mymtd = do_map_probe("map_rom", &brcm_physmap_map);
84 + mymtd->owner = THIS_MODULE;
85 + add_mtd_device(mymtd);
93 +static void __exit cleanup_brcm_physmap(void)
96 + del_mtd_device(mymtd);
99 + if (brcm_physmap_map.map_priv_1) {
100 + brcm_physmap_map.map_priv_1 = 0;
104 +module_init(init_brcm_physmap);
105 +module_exit(cleanup_brcm_physmap);
108 +MODULE_LICENSE("GPL");
109 +MODULE_AUTHOR("Song Wang songw@broadcom.com");
110 +MODULE_DESCRIPTION("Configurable MTD map driver for read-only root file system");
111 diff -urN linux-2.6.16.7/drivers/mtd/maps/Kconfig linux-2.6.16.7-brcm63xx/drivers/mtd/maps/Kconfig
112 --- linux-2.6.16.7/drivers/mtd/maps/Kconfig 2006-04-17 23:53:25.000000000 +0200
113 +++ linux-2.6.16.7-brcm63xx/drivers/mtd/maps/Kconfig 2006-07-07 22:02:13.000000000 +0200
115 Flash memory access on 4G Systems MTX-1 Board. If you have one of
116 these boards and would like to use the flash chips on it, say 'Y'.
119 + tristate "BCM963xx Flash device"
120 + depends on MIPS && MIPS_BRCM
122 + This driver seems to detect and provide a valid flash map to the system
123 + of course, it needs checking and testing.
126 tristate "CFI Flash device mapped on DIL/Net PC"
127 depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT
128 diff -urN linux-2.6.16.7/drivers/mtd/maps/Makefile linux-2.6.16.7-brcm63xx/drivers/mtd/maps/Makefile
129 --- linux-2.6.16.7/drivers/mtd/maps/Makefile 2006-04-17 23:53:25.000000000 +0200
130 +++ linux-2.6.16.7-brcm63xx/drivers/mtd/maps/Makefile 2006-07-07 22:01:29.000000000 +0200
132 obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
133 obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o
134 obj-$(CONFIG_MTD_TQM834x) += tqm834x.o
135 +obj-$(CONFIG_MTD_BCM963XX) += bcm963xx.o