aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMarkus Brunner <super.firetwister@gmail.com>2007-09-21 02:27:35 -0400
committerPaul Mundt <lethal@linux-sh.org>2007-09-21 02:27:35 -0400
commite87ab0c43c30faa0f4b337bfa87bce7923e67485 (patch)
tree7d2235f31282ef3c725227bcaf3a21ec4a9a4234 /arch
parent02353f5d2a317861536b8c38fea44196bdd5787c (diff)
sh: Magic Panel MTD mapping update.
This update moves the flash mapping for the Magic Panel into the board setup. It also removes references to the old MTD mapping option in the defconfig. Signed-off by: Markus Brunner <super.firetwister@gmail.com> Signed-off by: Mark Jonas <toertel@gmail.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/sh/boards/magicpanelr2/setup.c88
-rw-r--r--arch/sh/configs/magicpanelr2_defconfig8
2 files changed, 90 insertions, 6 deletions
diff --git a/arch/sh/boards/magicpanelr2/setup.c b/arch/sh/boards/magicpanelr2/setup.c
index c5930656654f..f3b8b07ea5d6 100644
--- a/arch/sh/boards/magicpanelr2/setup.c
+++ b/arch/sh/boards/magicpanelr2/setup.c
@@ -12,14 +12,19 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/ide.h>
16#include <linux/irq.h>
17#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/mtd/mtd.h>
17#include <linux/mtd/partitions.h>
18#include <linux/mtd/physmap.h>
19#include <linux/mtd/map.h>
18#include <asm/magicpanelr2.h> 20#include <asm/magicpanelr2.h>
19#include <asm/heartbeat.h> 21#include <asm/heartbeat.h>
20 22
21#define LAN9115_READY (ctrl_inl(0xA8000084UL) & 0x00000001UL) 23#define LAN9115_READY (ctrl_inl(0xA8000084UL) & 0x00000001UL)
22 24
25/* Prefer cmdline over RedBoot */
26static const char *probes[] = { "cmdlinepart", "RedBoot", NULL };
27
23/* Wait until reset finished. Timeout is 100ms. */ 28/* Wait until reset finished. Timeout is 100ms. */
24static int __init ethernet_reset_finished(void) 29static int __init ethernet_reset_finished(void)
25{ 30{
@@ -270,13 +275,90 @@ static struct platform_device heartbeat_device = {
270 .resource = heartbeat_resources, 275 .resource = heartbeat_resources,
271}; 276};
272 277
278static struct mtd_partition *parsed_partitions;
279
280static struct mtd_partition mpr2_partitions[] = {
281 /* Reserved for bootloader, read-only */
282 {
283 .name = "Bootloader",
284 .offset = 0x00000000UL,
285 .size = MPR2_MTD_BOOTLOADER_SIZE,
286 .mask_flags = MTD_WRITEABLE,
287 },
288 /* Reserved for kernel image */
289 {
290 .name = "Kernel",
291 .offset = MTDPART_OFS_NXTBLK,
292 .size = MPR2_MTD_KERNEL_SIZE,
293 },
294 /* Rest is used for Flash FS */
295 {
296 .name = "Flash_FS",
297 .offset = MTDPART_OFS_NXTBLK,
298 .size = MTDPART_SIZ_FULL,
299 }
300};
301
302static struct physmap_flash_data flash_data = {
303 .width = 2,
304};
305
306static struct resource flash_resource = {
307 .start = 0x00000000,
308 .end = 0x2000000UL,
309 .flags = IORESOURCE_MEM,
310};
311
312static struct platform_device flash_device = {
313 .name = "physmap-flash",
314 .id = -1,
315 .resource = &flash_resource,
316 .num_resources = 1,
317 .dev = {
318 .platform_data = &flash_data,
319 },
320};
321
322static struct mtd_info *flash_mtd;
323
324static struct map_info mpr2_flash_map = {
325 .name = "Magic Panel R2 Flash",
326 .size = 0x2000000UL,
327 .bankwidth = 2,
328};
329
330static void __init set_mtd_partitions(void)
331{
332 int nr_parts = 0;
333
334 simple_map_init(&mpr2_flash_map);
335 flash_mtd = do_map_probe("cfi_probe", &mpr2_flash_map);
336 nr_parts = parse_mtd_partitions(flash_mtd, probes,
337 &parsed_partitions, 0);
338 /* If there is no partition table, used the hard coded table */
339 if (nr_parts <= 0) {
340 flash_data.parts = mpr2_partitions;
341 flash_data.nr_parts = ARRAY_SIZE(mpr2_partitions);
342 } else {
343 flash_data.nr_parts = nr_parts;
344 flash_data.parts = parsed_partitions;
345 }
346}
347
348/*
349 * Add all resources to the platform_device
350 */
351
273static struct platform_device *mpr2_devices[] __initdata = { 352static struct platform_device *mpr2_devices[] __initdata = {
274 &heartbeat_device, 353 &heartbeat_device,
275 &smc911x_device, 354 &smc911x_device,
355 &flash_device,
276}; 356};
277 357
358
278static int __init mpr2_devices_setup(void) 359static int __init mpr2_devices_setup(void)
279{ 360{
361 set_mtd_partitions();
280 return platform_add_devices(mpr2_devices, ARRAY_SIZE(mpr2_devices)); 362 return platform_add_devices(mpr2_devices, ARRAY_SIZE(mpr2_devices));
281} 363}
282device_initcall(mpr2_devices_setup); 364device_initcall(mpr2_devices_setup);
@@ -308,5 +390,5 @@ static void __init init_mpr2_IRQ(void)
308static struct sh_machine_vector mv_mpr2 __initmv = { 390static struct sh_machine_vector mv_mpr2 __initmv = {
309 .mv_name = "mpr2", 391 .mv_name = "mpr2",
310 .mv_setup = mpr2_setup, 392 .mv_setup = mpr2_setup,
311 .mv_init_irq = init_mpr2_IRQ, 393 .mv_init_irq = init_mpr2_IRQ,
312}; 394};
diff --git a/arch/sh/configs/magicpanelr2_defconfig b/arch/sh/configs/magicpanelr2_defconfig
index ce4e76491be1..f8398a5f10ee 100644
--- a/arch/sh/configs/magicpanelr2_defconfig
+++ b/arch/sh/configs/magicpanelr2_defconfig
@@ -185,7 +185,7 @@ CONFIG_SH_MAGIC_PANEL_R2=y
185# 185#
186# Magic Panel R2 options 186# Magic Panel R2 options
187# 187#
188CONFIG_SH_MAGIC_PANEL_R2_VERSION=2 188CONFIG_SH_MAGIC_PANEL_R2_VERSION=3
189 189
190# 190#
191# Timer and clock configuration 191# Timer and clock configuration
@@ -404,9 +404,11 @@ CONFIG_MTD_CFI_UTIL=y
404# Mapping drivers for chip access 404# Mapping drivers for chip access
405# 405#
406# CONFIG_MTD_COMPLEX_MAPPINGS is not set 406# CONFIG_MTD_COMPLEX_MAPPINGS is not set
407# CONFIG_MTD_PHYSMAP is not set 407CONFIG_MTD_PHYSMAP=y
408CONFIG_MTD_PHYSMAP_START=0x0000000
409CONFIG_MTD_PHYSMAP_LEN=0
410CONFIG_MTD_PHYSMAP_BANKWIDTH=0
408# CONFIG_MTD_SOLUTIONENGINE is not set 411# CONFIG_MTD_SOLUTIONENGINE is not set
409CONFIG_MTD_MAGICPANELR2=y
410# CONFIG_MTD_PLATRAM is not set 412# CONFIG_MTD_PLATRAM is not set
411 413
412# 414#