1 // SPDX-License-Identifier: GPL-2.0
3 // Copyright (c) 2008 Simtec Electronics
4 // http://armlinux.simtec.co.uk/
5 // Ben Dooks <ben@simtec.co.uk>
9 #include <linux/module.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/kernel.h>
13 #include <linux/platform_device.h>
15 #include <linux/mtd/mtd.h>
16 #include <linux/mtd/map.h>
17 #include <linux/mtd/physmap.h>
18 #include <linux/mtd/partitions.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach/map.h>
22 #include <asm/mach/irq.h>
29 static void simtec_nor_vpp(struct platform_device
*pdev
, int vpp
)
33 val
= __raw_readb(BAST_VA_CTRL3
);
35 printk(KERN_DEBUG
"%s(%d)\n", __func__
, vpp
);
38 val
|= BAST_CPLD_CTRL3_ROMWEN
;
40 val
&= ~BAST_CPLD_CTRL3_ROMWEN
;
42 __raw_writeb(val
, BAST_VA_CTRL3
);
45 static struct physmap_flash_data simtec_nor_pdata
= {
47 .set_vpp
= simtec_nor_vpp
,
51 static struct resource simtec_nor_resource
[] = {
52 [0] = DEFINE_RES_MEM(S3C2410_CS1
+ 0x4000000, SZ_8M
),
55 static struct platform_device simtec_device_nor
= {
56 .name
= "physmap-flash",
58 .num_resources
= ARRAY_SIZE(simtec_nor_resource
),
59 .resource
= simtec_nor_resource
,
61 .platform_data
= &simtec_nor_pdata
,
65 void __init
nor_simtec_init(void)
69 ret
= platform_device_register(&simtec_device_nor
);
71 printk(KERN_ERR
"failed to register physmap-flash device\n");
73 simtec_nor_vpp(NULL
, 1);