Path: blob/master/arch/mn10300/unit-asb2303/flash.c
10817 views
/* Handle mapping of the flash on the ASB2303 board1*2* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public Licence7* as published by the Free Software Foundation; either version8* 2 of the Licence, or (at your option) any later version.9*/10#include <linux/init.h>11#include <linux/platform_device.h>12#include <linux/mtd/partitions.h>13#include <linux/mtd/physmap.h>1415#define ASB2303_PROM_ADDR 0xA0000000 /* Boot PROM */16#define ASB2303_PROM_SIZE (2 * 1024 * 1024)17#define ASB2303_FLASH_ADDR 0xA4000000 /* System Flash */18#define ASB2303_FLASH_SIZE (32 * 1024 * 1024)19#define ASB2303_CONFIG_ADDR 0xA6000000 /* System Config EEPROM */20#define ASB2303_CONFIG_SIZE (8 * 1024)2122/*23* default MTD partition table for both main flash devices, expected to be24* overridden by RedBoot25*/26static struct mtd_partition asb2303_partitions[] = {27{28.name = "Bootloader",29.size = 0x00040000,30.offset = 0,31.mask_flags = MTD_CAP_ROM /* force read-only */32}, {33.name = "Kernel",34.size = 0x00400000,35.offset = 0x00040000,36}, {37.name = "Filesystem",38.size = MTDPART_SIZ_FULL,39.offset = 0x0044000040}41};4243/*44* the ASB2303 Boot PROM definition45*/46static struct physmap_flash_data asb2303_bootprom_data = {47.width = 2,48.nr_parts = 1,49.parts = asb2303_partitions,50};5152static struct resource asb2303_bootprom_resource = {53.start = ASB2303_PROM_ADDR,54.end = ASB2303_PROM_ADDR + ASB2303_PROM_SIZE,55.flags = IORESOURCE_MEM,56};5758static struct platform_device asb2303_bootprom = {59.name = "physmap-flash",60.id = 0,61.dev.platform_data = &asb2303_bootprom_data,62.num_resources = 1,63.resource = &asb2303_bootprom_resource,64};6566/*67* the ASB2303 System Flash definition68*/69static struct physmap_flash_data asb2303_sysflash_data = {70.width = 4,71.nr_parts = 1,72.parts = asb2303_partitions,73};7475static struct resource asb2303_sysflash_resource = {76.start = ASB2303_FLASH_ADDR,77.end = ASB2303_FLASH_ADDR + ASB2303_FLASH_SIZE,78.flags = IORESOURCE_MEM,79};8081static struct platform_device asb2303_sysflash = {82.name = "physmap-flash",83.id = 1,84.dev.platform_data = &asb2303_sysflash_data,85.num_resources = 1,86.resource = &asb2303_sysflash_resource,87};8889/*90* register the ASB2303 flashes91*/92static int __init asb2303_mtd_init(void)93{94platform_device_register(&asb2303_bootprom);95platform_device_register(&asb2303_sysflash);96return 0;97}9899module_init(asb2303_mtd_init);100101102