Merge tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux/fpc-iii.git] / arch / arm / mach-s3c / simtec-nor.c
bloba6fba056a7475a3dd43a5fd15f814e131b6674e0
1 // SPDX-License-Identifier: GPL-2.0
2 //
3 // Copyright (c) 2008 Simtec Electronics
4 // http://armlinux.simtec.co.uk/
5 // Ben Dooks <ben@simtec.co.uk>
6 //
7 // Simtec NOR mapping
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>
24 #include "map.h"
26 #include "bast.h"
27 #include "simtec.h"
29 static void simtec_nor_vpp(struct platform_device *pdev, int vpp)
31 unsigned int val;
33 val = __raw_readb(BAST_VA_CTRL3);
35 printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
37 if (vpp)
38 val |= BAST_CPLD_CTRL3_ROMWEN;
39 else
40 val &= ~BAST_CPLD_CTRL3_ROMWEN;
42 __raw_writeb(val, BAST_VA_CTRL3);
45 static struct physmap_flash_data simtec_nor_pdata = {
46 .width = 2,
47 .set_vpp = simtec_nor_vpp,
48 .nr_parts = 0,
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",
57 .id = -1,
58 .num_resources = ARRAY_SIZE(simtec_nor_resource),
59 .resource = simtec_nor_resource,
60 .dev = {
61 .platform_data = &simtec_nor_pdata,
65 void __init nor_simtec_init(void)
67 int ret;
69 ret = platform_device_register(&simtec_device_nor);
70 if (ret < 0)
71 printk(KERN_ERR "failed to register physmap-flash device\n");
72 else
73 simtec_nor_vpp(NULL, 1);