1 From b620329db3d6646a172a599b0e960baca081fff1 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Sat, 12 Nov 2011 11:17:32 +0100
4 Subject: [PATCH 25/79] MIPS: BCM63XX: move flash registration out of
7 board_bcm963xx.c is already large enough.
9 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
11 arch/mips/bcm63xx/Makefile | 4 +-
12 arch/mips/bcm63xx/boards/board_bcm963xx.c | 49 +-------------
13 arch/mips/bcm63xx/dev-flash.c | 68 ++++++++++++++++++++
14 .../include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 6 ++
15 4 files changed, 78 insertions(+), 49 deletions(-)
16 create mode 100644 arch/mips/bcm63xx/dev-flash.c
17 create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
19 --- a/arch/mips/bcm63xx/Makefile
20 +++ b/arch/mips/bcm63xx/Makefile
22 obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
23 - dev-dsp.o dev-enet.o dev-pcmcia.o dev-spi.o dev-trng.o \
24 - dev-uart.o dev-wdt.o
25 + dev-dsp.o dev-enet.o dev-flash.o dev-pcmcia.o dev-spi.o \
26 + dev-trng.o dev-uart.o dev-wdt.o
27 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
30 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
31 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
33 #include <linux/kernel.h>
34 #include <linux/string.h>
35 #include <linux/platform_device.h>
36 -#include <linux/mtd/mtd.h>
37 -#include <linux/mtd/partitions.h>
38 -#include <linux/mtd/physmap.h>
39 #include <linux/ssb/ssb.h>
40 #include <linux/gpio_keys.h>
41 #include <linux/input.h>
43 #include <bcm63xx_dev_pci.h>
44 #include <bcm63xx_dev_enet.h>
45 #include <bcm63xx_dev_dsp.h>
46 +#include <bcm63xx_dev_flash.h>
47 #include <bcm63xx_dev_pcmcia.h>
48 #include <bcm63xx_dev_spi.h>
49 #include <board_bcm963xx.h>
50 @@ -865,40 +863,6 @@ void __init board_setup(void)
51 panic("unexpected CPU for bcm963xx board");
54 -static struct mtd_partition mtd_partitions[] = {
62 -static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL };
64 -static struct physmap_flash_data flash_data = {
66 - .nr_parts = ARRAY_SIZE(mtd_partitions),
67 - .parts = mtd_partitions,
68 - .part_probe_types = bcm63xx_part_types,
71 -static struct resource mtd_resources[] = {
73 - .start = 0, /* filled at runtime */
74 - .end = 0, /* filled at runtime */
75 - .flags = IORESOURCE_MEM,
79 -static struct platform_device mtd_dev = {
80 - .name = "physmap-flash",
81 - .resource = mtd_resources,
82 - .num_resources = ARRAY_SIZE(mtd_resources),
84 - .platform_data = &flash_data,
88 static struct gpio_led_platform_data bcm63xx_led_data;
90 static struct platform_device bcm63xx_gpio_leds = {
91 @@ -922,7 +886,6 @@ static struct platform_device bcm63xx_gp
93 int __init board_register_devices(void)
99 @@ -967,14 +930,7 @@ int __init board_register_devices(void)
101 spi_register_board_info(board.spis, board.num_spis);
103 - /* read base address of boot chip select (0) */
104 - val = bcm_mpi_readl(MPI_CSBASE_REG(0));
105 - val &= MPI_CSBASE_BASE_MASK;
107 - mtd_resources[0].start = val;
108 - mtd_resources[0].end = 0x1FFFFFFF;
110 - platform_device_register(&mtd_dev);
111 + bcm63xx_flash_register();
113 /* count number of LEDs defined by this device */
114 while (led_count < ARRAY_SIZE(board.leds) && board.leds[led_count].name)
116 +++ b/arch/mips/bcm63xx/dev-flash.c
119 + * Broadcom BCM63xx flash registration
121 + * This file is subject to the terms and conditions of the GNU General Public
122 + * License. See the file "COPYING" in the main directory of this archive
123 + * for more details.
125 + * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
128 +#include <linux/init.h>
129 +#include <linux/kernel.h>
130 +#include <linux/platform_device.h>
131 +#include <linux/mtd/mtd.h>
132 +#include <linux/mtd/partitions.h>
133 +#include <linux/mtd/physmap.h>
135 +#include <bcm63xx_cpu.h>
136 +#include <bcm63xx_dev_flash.h>
137 +#include <bcm63xx_regs.h>
138 +#include <bcm63xx_io.h>
140 +static struct mtd_partition mtd_partitions[] = {
148 +static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL };
150 +static struct physmap_flash_data flash_data = {
152 + .parts = mtd_partitions,
153 + .part_probe_types = bcm63xx_part_types,
156 +static struct resource mtd_resources[] = {
158 + .start = 0, /* filled at runtime */
159 + .end = 0, /* filled at runtime */
160 + .flags = IORESOURCE_MEM,
164 +static struct platform_device mtd_dev = {
165 + .name = "physmap-flash",
166 + .resource = mtd_resources,
167 + .num_resources = ARRAY_SIZE(mtd_resources),
169 + .platform_data = &flash_data,
173 +int __init bcm63xx_flash_register(void)
177 + /* read base address of boot chip select (0) */
178 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
179 + val &= MPI_CSBASE_BASE_MASK;
181 + mtd_resources[0].start = val;
182 + mtd_resources[0].end = 0x1FFFFFFF;
184 + return platform_device_register(&mtd_dev);
187 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
189 +#ifndef __BCM63XX_FLASH_H
190 +#define __BCM63XX_FLASH_H
192 +int __init bcm63xx_flash_register(void);
194 +#endif /* __BCM63XX_FLASH_H */