bcm63xx: update patches to latest upstream versions
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-3.3 / 022-MIPS-BCM63XX-Move-flash-registration-out-of-board_bc.patch
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
5
6 board_bcm963xx.c is already large enough.
7
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>
16 ---
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
24
25 --- a/arch/mips/bcm63xx/Makefile
26 +++ b/arch/mips/bcm63xx/Makefile
27 @@ -1,6 +1,6 @@
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
34
35 obj-y += boards/
36 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
37 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
38 @@ -11,9 +11,6 @@
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>
48 @@ -24,6 +21,7 @@
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");
58 }
59
60 -static struct mtd_partition mtd_partitions[] = {
61 - {
62 - .name = "cfe",
63 - .offset = 0x0,
64 - .size = 0x40000,
65 - }
66 -};
67 -
68 -static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL };
69 -
70 -static struct physmap_flash_data flash_data = {
71 - .width = 2,
72 - .nr_parts = ARRAY_SIZE(mtd_partitions),
73 - .parts = mtd_partitions,
74 - .part_probe_types = bcm63xx_part_types,
75 -};
76 -
77 -static struct resource mtd_resources[] = {
78 - {
79 - .start = 0, /* filled at runtime */
80 - .end = 0, /* filled at runtime */
81 - .flags = IORESOURCE_MEM,
82 - }
83 -};
84 -
85 -static struct platform_device mtd_dev = {
86 - .name = "physmap-flash",
87 - .resource = mtd_resources,
88 - .num_resources = ARRAY_SIZE(mtd_resources),
89 - .dev = {
90 - .platform_data = &flash_data,
91 - },
92 -};
93 -
94 static struct gpio_led_platform_data bcm63xx_led_data;
95
96 static struct platform_device bcm63xx_gpio_leds = {
97 @@ -856,8 +820,6 @@ static struct platform_device bcm63xx_gp
98 */
99 int __init board_register_devices(void)
100 {
101 - u32 val;
102 -
103 if (board.has_uart0)
104 bcm63xx_uart_register(0);
105
106 @@ -893,14 +855,7 @@ int __init board_register_devices(void)
107
108 bcm63xx_spi_register();
109
110 - /* read base address of boot chip select (0) */
111 - val = bcm_mpi_readl(MPI_CSBASE_REG(0));
112 - val &= MPI_CSBASE_BASE_MASK;
113 -
114 - mtd_resources[0].start = val;
115 - mtd_resources[0].end = 0x1FFFFFFF;
116 -
117 - platform_device_register(&mtd_dev);
118 + bcm63xx_flash_register();
119
120 bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds);
121 bcm63xx_led_data.leds = board.leds;
122 --- /dev/null
123 +++ b/arch/mips/bcm63xx/dev-flash.c
124 @@ -0,0 +1,69 @@
125 +/*
126 + * Broadcom BCM63xx flash registration
127 + *
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.
131 + *
132 + * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
133 + * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
134 + */
135 +
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>
142 +
143 +#include <bcm63xx_cpu.h>
144 +#include <bcm63xx_dev_flash.h>
145 +#include <bcm63xx_regs.h>
146 +#include <bcm63xx_io.h>
147 +
148 +static struct mtd_partition mtd_partitions[] = {
149 + {
150 + .name = "cfe",
151 + .offset = 0x0,
152 + .size = 0x40000,
153 + }
154 +};
155 +
156 +static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL };
157 +
158 +static struct physmap_flash_data flash_data = {
159 + .width = 2,
160 + .parts = mtd_partitions,
161 + .part_probe_types = bcm63xx_part_types,
162 +};
163 +
164 +static struct resource mtd_resources[] = {
165 + {
166 + .start = 0, /* filled at runtime */
167 + .end = 0, /* filled at runtime */
168 + .flags = IORESOURCE_MEM,
169 + }
170 +};
171 +
172 +static struct platform_device mtd_dev = {
173 + .name = "physmap-flash",
174 + .resource = mtd_resources,
175 + .num_resources = ARRAY_SIZE(mtd_resources),
176 + .dev = {
177 + .platform_data = &flash_data,
178 + },
179 +};
180 +
181 +int __init bcm63xx_flash_register(void)
182 +{
183 + u32 val;
184 +
185 + /* read base address of boot chip select (0) */
186 + val = bcm_mpi_readl(MPI_CSBASE_REG(0));
187 + val &= MPI_CSBASE_BASE_MASK;
188 +
189 + mtd_resources[0].start = val;
190 + mtd_resources[0].end = 0x1FFFFFFF;
191 +
192 + return platform_device_register(&mtd_dev);
193 +}
194 --- /dev/null
195 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
196 @@ -0,0 +1,6 @@
197 +#ifndef __BCM63XX_FLASH_H
198 +#define __BCM63XX_FLASH_H
199 +
200 +int __init bcm63xx_flash_register(void);
201 +
202 +#endif /* __BCM63XX_FLASH_H */