xref: /openbmc/linux/arch/sh/boards/mach-rsk/setup.c (revision 99a3b155)
1 /*
2  * Renesas Technology Europe RSK+ Support.
3  *
4  * Copyright (C) 2008 Paul Mundt
5  * Copyright (C) 2008 Peter Griffin <pgriffin@mpc-data.co.uk>
6  *
7  * This file is subject to the terms and conditions of the GNU General Public
8  * License.  See the file "COPYING" in the main directory of this archive
9  * for more details.
10  */
11 #include <linux/init.h>
12 #include <linux/types.h>
13 #include <linux/platform_device.h>
14 #include <linux/interrupt.h>
15 #include <linux/mtd/mtd.h>
16 #include <linux/mtd/partitions.h>
17 #include <linux/mtd/physmap.h>
18 #include <linux/mtd/map.h>
19 #include <linux/regulator/fixed.h>
20 #include <linux/regulator/machine.h>
21 #include <asm/machvec.h>
22 #include <asm/io.h>
23 
24 /* Dummy supplies, where voltage doesn't matter */
25 static struct regulator_consumer_supply dummy_supplies[] = {
26 	REGULATOR_SUPPLY("vddvario", "smsc911x"),
27 	REGULATOR_SUPPLY("vdd33a", "smsc911x"),
28 };
29 
30 static struct mtd_partition rsk_partitions[] = {
31 	{
32 		.name		= "Bootloader",
33 		.offset		= 0x00000000,
34 		.size		= 0x00040000,
35 		.mask_flags	= MTD_WRITEABLE,
36 	}, {
37 		.name		= "Kernel",
38 		.offset		= MTDPART_OFS_NXTBLK,
39 		.size		= 0x001c0000,
40 	}, {
41 		.name		= "Flash_FS",
42 		.offset		= MTDPART_OFS_NXTBLK,
43 		.size		= MTDPART_SIZ_FULL,
44 	}
45 };
46 
47 static struct physmap_flash_data flash_data = {
48 	.parts			= rsk_partitions,
49 	.nr_parts		= ARRAY_SIZE(rsk_partitions),
50 	.width			= 2,
51 };
52 
53 static struct resource flash_resource = {
54 	.start		= 0x20000000,
55 	.end		= 0x20400000,
56 	.flags		= IORESOURCE_MEM,
57 };
58 
59 static struct platform_device flash_device = {
60 	.name		= "physmap-flash",
61 	.id		= -1,
62 	.resource	= &flash_resource,
63 	.num_resources	= 1,
64 	.dev		= {
65 		.platform_data = &flash_data,
66 	},
67 };
68 
69 static struct platform_device *rsk_devices[] __initdata = {
70 	&flash_device,
71 };
72 
73 static int __init rsk_devices_setup(void)
74 {
75 	regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
76 
77 	return platform_add_devices(rsk_devices,
78 				    ARRAY_SIZE(rsk_devices));
79 }
80 device_initcall(rsk_devices_setup);
81 
82 /*
83  * The Machine Vector
84  */
85 static struct sh_machine_vector mv_rsk __initmv = {
86 	.mv_name        = "RSK+",
87 };
88