2008-07-03 18:24:39 +08:00
|
|
|
/* linux/arch/arm/mach-s3c2410/nor-simtec.c
|
|
|
|
*
|
|
|
|
* Copyright (c) 2008 Simtec Electronics
|
|
|
|
* http://armlinux.simtec.co.uk/
|
|
|
|
* Ben Dooks <ben@simtec.co.uk>
|
|
|
|
*
|
|
|
|
* Simtec NOR mapping
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
|
|
|
|
#include <linux/mtd/mtd.h>
|
|
|
|
#include <linux/mtd/map.h>
|
|
|
|
#include <linux/mtd/physmap.h>
|
|
|
|
#include <linux/mtd/partitions.h>
|
|
|
|
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
#include <asm/mach/irq.h>
|
|
|
|
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/map.h>
|
2008-07-03 18:24:39 +08:00
|
|
|
|
2013-01-02 11:56:20 +08:00
|
|
|
#include "bast.h"
|
2012-03-07 17:47:11 +08:00
|
|
|
#include "simtec.h"
|
2008-07-03 18:24:39 +08:00
|
|
|
|
2011-05-18 17:51:55 +08:00
|
|
|
static void simtec_nor_vpp(struct platform_device *pdev, int vpp)
|
2008-07-03 18:24:39 +08:00
|
|
|
{
|
|
|
|
unsigned int val;
|
|
|
|
|
|
|
|
val = __raw_readb(BAST_VA_CTRL3);
|
|
|
|
|
|
|
|
printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
|
|
|
|
|
|
|
|
if (vpp)
|
|
|
|
val |= BAST_CPLD_CTRL3_ROMWEN;
|
|
|
|
else
|
|
|
|
val &= ~BAST_CPLD_CTRL3_ROMWEN;
|
|
|
|
|
|
|
|
__raw_writeb(val, BAST_VA_CTRL3);
|
|
|
|
}
|
|
|
|
|
2008-08-27 05:54:02 +08:00
|
|
|
static struct physmap_flash_data simtec_nor_pdata = {
|
2008-07-03 18:24:39 +08:00
|
|
|
.width = 2,
|
|
|
|
.set_vpp = simtec_nor_vpp,
|
|
|
|
.nr_parts = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource simtec_nor_resource[] = {
|
2012-05-12 15:12:25 +08:00
|
|
|
[0] = DEFINE_RES_MEM(S3C2410_CS1 + 0x4000000, SZ_8M),
|
2008-07-03 18:24:39 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device simtec_device_nor = {
|
|
|
|
.name = "physmap-flash",
|
|
|
|
.id = -1,
|
|
|
|
.num_resources = ARRAY_SIZE(simtec_nor_resource),
|
|
|
|
.resource = simtec_nor_resource,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &simtec_nor_pdata,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
void __init nor_simtec_init(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = platform_device_register(&simtec_device_nor);
|
|
|
|
if (ret < 0)
|
|
|
|
printk(KERN_ERR "failed to register physmap-flash device\n");
|
|
|
|
else
|
|
|
|
simtec_nor_vpp(NULL, 1);
|
|
|
|
}
|