1 From bfe47f0f68b5f7a3a92d07266cba58b188fe10e7 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Tue, 12 Jun 2012 10:23:38 +0200
4 Subject: [PATCH 1/8] MIPS: BCM63XX: Move flash registration out of board_bcm963xx.c
6 board_bcm963xx.c is already large enough.
8 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
9 Cc: linux-mips@linux-mips.org
10 Cc: Maxime Bizon <mbizon@freebox.fr>
11 Cc: Florian Fainelli <florian@openwrt.org>
12 Cc: Kevin Cernekee <cernekee@gmail.com>
13 Patchwork: https://patchwork.linux-mips.org/patch/3952/
14 Reviewed-by: Florian Fainelli <florian@openwrt.org>
15 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
17 arch/mips/bcm63xx/Makefile | 4 +-
18 arch/mips/bcm63xx/boards/board_bcm963xx.c | 49 +-------------
19 arch/mips/bcm63xx/dev-flash.c | 69 ++++++++++++++++++++
20 .../include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 6 ++
21 4 files changed, 79 insertions(+), 49 deletions(-)
22 create mode 100644 arch/mips/bcm63xx/dev-flash.c
23 create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
25 --- a/arch/mips/bcm63xx/Makefile
26 +++ b/arch/mips/bcm63xx/Makefile
28 obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
29 - dev-dsp.o dev-enet.o dev-pcmcia.o dev-rng.o dev-spi.o \
30 - dev-uart.o dev-wdt.o
31 + dev-dsp.o dev-enet.o dev-flash.o dev-pcmcia.o dev-rng.o \
32 + dev-spi.o dev-uart.o dev-wdt.o
33 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
36 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
37 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
39 #include <linux/kernel.h>
40 #include <linux/string.h>
41 #include <linux/platform_device.h>
42 -#include <linux/mtd/mtd.h>
43 -#include <linux/mtd/partitions.h>
44 -#include <linux/mtd/physmap.h>
45 #include <linux/ssb/ssb.h>
46 #include <asm/addrspace.h>
47 #include <bcm63xx_board.h>
49 #include <bcm63xx_dev_pci.h>
50 #include <bcm63xx_dev_enet.h>
51 #include <bcm63xx_dev_dsp.h>
52 +#include <bcm63xx_dev_flash.h>
53 #include <bcm63xx_dev_pcmcia.h>
54 #include <bcm63xx_dev_spi.h>
55 #include <board_bcm963xx.h>
56 @@ -809,40 +807,6 @@ void __init board_setup(void)
57 panic("unexpected CPU for bcm963xx board");
60 -static struct mtd_partition mtd_partitions[] = {
68 -static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL };
70 -static struct physmap_flash_data flash_data = {
72 - .nr_parts = ARRAY_SIZE(mtd_partitions),
73 - .parts = mtd_partitions,
74 - .part_probe_types = bcm63xx_part_types,
77 -static struct resource mtd_resources[] = {
79 - .start = 0, /* filled at runtime */
80 - .end = 0, /* filled at runtime */
81 - .flags = IORESOURCE_MEM,
85 -static struct platform_device mtd_dev = {
86 - .name = "physmap-flash",
87 - .resource = mtd_resources,
88 - .num_resources = ARRAY_SIZE(mtd_resources),
90 - .platform_data = &flash_data,
94 static struct gpio_led_platform_data bcm63xx_led_data;
96 static struct platform_device bcm63xx_gpio_leds = {
97 @@ -856,8 +820,6 @@ static struct platform_device bcm63xx_gp
99 int __init board_register_devices(void)
104 bcm63xx_uart_register(0);
106 @@ -893,14 +855,7 @@ int __init board_register_devices(void)
108 bcm63xx_spi_register();
110 - /* read base address of boot chip select (0) */
111 - val = bcm_mpi_readl(MPI_CSBASE_REG(0));
112 - val &= MPI_CSBASE_BASE_MASK;
114 - mtd_resources[0].start = val;
115 - mtd_resources[0].end = 0x1FFFFFFF;
117 - platform_device_register(&mtd_dev);
118 + bcm63xx_flash_register();
120 bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds);
121 bcm63xx_led_data.leds = board.leds;
123 +++ b/arch/mips/bcm63xx/dev-flash.c
126 + * Broadcom BCM63xx flash registration
128 + * This file is subject to the terms and conditions of the GNU General Public
129 + * License. See the file "COPYING" in the main directory of this archive
130 + * for more details.
132 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
133 + * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
136 +#include <linux/init.h>
137 +#include <linux/kernel.h>
138 +#include <linux/platform_device.h>
139 +#include <linux/mtd/mtd.h>
140 +#include <linux/mtd/partitions.h>
141 +#include <linux/mtd/physmap.h>
143 +#include <bcm63xx_cpu.h>
144 +#include <bcm63xx_dev_flash.h>
145 +#include <bcm63xx_regs.h>
146 +#include <bcm63xx_io.h>
148 +static struct mtd_partition mtd_partitions[] = {
156 +static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL };
158 +static struct physmap_flash_data flash_data = {
160 + .parts = mtd_partitions,
161 + .part_probe_types = bcm63xx_part_types,
164 +static struct resource mtd_resources[] = {
166 + .start = 0, /* filled at runtime */
167 + .end = 0, /* filled at runtime */
168 + .flags = IORESOURCE_MEM,
172 +static struct platform_device mtd_dev = {
173 + .name = "physmap-flash",
174 + .resource = mtd_resources,
175 + .num_resources = ARRAY_SIZE(mtd_resources),
177 + .platform_data = &flash_data,
181 +int __init bcm63xx_flash_register(void)
185 + /* read base address of boot chip select (0) */
186 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
187 + val &= MPI_CSBASE_BASE_MASK;
189 + mtd_resources[0].start = val;
190 + mtd_resources[0].end = 0x1FFFFFFF;
192 + return platform_device_register(&mtd_dev);
195 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
197 +#ifndef __BCM63XX_FLASH_H
198 +#define __BCM63XX_FLASH_H
200 +int __init bcm63xx_flash_register(void);
202 +#endif /* __BCM63XX_FLASH_H */