diff options
author | Jonas Gorski <jonas.gorski@gmail.com> | 2012-07-24 10:33:11 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2012-07-24 10:33:11 -0400 |
commit | 4b897d5483da5c3f3c4d52440a994aad574b62b4 (patch) | |
tree | 1c3b344446d98cf2d774bb58c3f2156f0a2d0bea /arch/mips/bcm63xx/dev-flash.c | |
parent | 553072b27e0990ab1d73d43efb4ab518f953fcc3 (diff) |
MIPS: BCM63XX: Move flash registration out of board_bcm963xx.c
board_bcm963xx.c is already large enough.
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Maxime Bizon <mbizon@freebox.fr>
Cc: Florian Fainelli <florian@openwrt.org>
Cc: Kevin Cernekee <cernekee@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/3952/
Reviewed-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/bcm63xx/dev-flash.c')
-rw-r--r-- | arch/mips/bcm63xx/dev-flash.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/arch/mips/bcm63xx/dev-flash.c b/arch/mips/bcm63xx/dev-flash.c new file mode 100644 index 000000000000..af5273868baa --- /dev/null +++ b/arch/mips/bcm63xx/dev-flash.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Broadcom BCM63xx flash registration | ||
3 | * | ||
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 | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> | ||
9 | * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org> | ||
10 | */ | ||
11 | |||
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> | ||
18 | |||
19 | #include <bcm63xx_cpu.h> | ||
20 | #include <bcm63xx_dev_flash.h> | ||
21 | #include <bcm63xx_regs.h> | ||
22 | #include <bcm63xx_io.h> | ||
23 | |||
24 | static struct mtd_partition mtd_partitions[] = { | ||
25 | { | ||
26 | .name = "cfe", | ||
27 | .offset = 0x0, | ||
28 | .size = 0x40000, | ||
29 | } | ||
30 | }; | ||
31 | |||
32 | static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL }; | ||
33 | |||
34 | static struct physmap_flash_data flash_data = { | ||
35 | .width = 2, | ||
36 | .parts = mtd_partitions, | ||
37 | .part_probe_types = bcm63xx_part_types, | ||
38 | }; | ||
39 | |||
40 | static struct resource mtd_resources[] = { | ||
41 | { | ||
42 | .start = 0, /* filled at runtime */ | ||
43 | .end = 0, /* filled at runtime */ | ||
44 | .flags = IORESOURCE_MEM, | ||
45 | } | ||
46 | }; | ||
47 | |||
48 | static struct platform_device mtd_dev = { | ||
49 | .name = "physmap-flash", | ||
50 | .resource = mtd_resources, | ||
51 | .num_resources = ARRAY_SIZE(mtd_resources), | ||
52 | .dev = { | ||
53 | .platform_data = &flash_data, | ||
54 | }, | ||
55 | }; | ||
56 | |||
57 | int __init bcm63xx_flash_register(void) | ||
58 | { | ||
59 | u32 val; | ||
60 | |||
61 | /* read base address of boot chip select (0) */ | ||
62 | val = bcm_mpi_readl(MPI_CSBASE_REG(0)); | ||
63 | val &= MPI_CSBASE_BASE_MASK; | ||
64 | |||
65 | mtd_resources[0].start = val; | ||
66 | mtd_resources[0].end = 0x1FFFFFFF; | ||
67 | |||
68 | return platform_device_register(&mtd_dev); | ||
69 | } | ||