2 * Broadcom BCM63xx flash registration
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
9 * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
12 #include <linux/init.h>
13 #include <linux/kernel.h>
14 #include <linux/platform_device.h>
15 #include <linux/mtd/mtd.h>
16 #include <linux/mtd/partitions.h>
17 #include <linux/mtd/physmap.h>
19 #include <bcm63xx_cpu.h>
20 #include <bcm63xx_dev_flash.h>
21 #include <bcm63xx_regs.h>
22 #include <bcm63xx_io.h>
24 static struct mtd_partition mtd_partitions[] = {
32 static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL };
34 static struct physmap_flash_data flash_data = {
36 .parts = mtd_partitions,
37 .part_probe_types = bcm63xx_part_types,
40 static struct resource mtd_resources[] = {
42 .start = 0, /* filled at runtime */
43 .end = 0, /* filled at runtime */
44 .flags = IORESOURCE_MEM,
48 static struct platform_device mtd_dev = {
49 .name = "physmap-flash",
50 .resource = mtd_resources,
51 .num_resources = ARRAY_SIZE(mtd_resources),
53 .platform_data = &flash_data,
57 int __init bcm63xx_flash_register(void)
61 /* read base address of boot chip select (0) */
62 val = bcm_mpi_readl(MPI_CSBASE_REG(0));
63 val &= MPI_CSBASE_BASE_MASK;
65 mtd_resources[0].start = val;
66 mtd_resources[0].end = 0x1FFFFFFF;
68 return platform_device_register(&mtd_dev);