2 * Renesas Technology Europe RSK+ 7203 Support.
4 * Copyright (C) 2008 Paul Mundt
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
10 #include <linux/init.h>
11 #include <linux/types.h>
12 #include <linux/platform_device.h>
13 #include <linux/interrupt.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/physmap.h>
17 #include <linux/mtd/map.h>
18 #include <linux/smc911x.h>
19 #include <linux/gpio.h>
20 #include <asm/machvec.h>
22 #include <asm/sh7203.h>
24 static struct smc911x_platdata smc911x_info = {
25 .flags = SMC911X_USE_16BIT,
26 .irq_flags = IRQF_TRIGGER_LOW,
29 static struct resource smc911x_resources[] = {
32 .end = 0x24000000 + 0x100,
33 .flags = IORESOURCE_MEM,
38 .flags = IORESOURCE_IRQ,
42 static struct platform_device smc911x_device = {
45 .num_resources = ARRAY_SIZE(smc911x_resources),
46 .resource = smc911x_resources,
48 .platform_data = &smc911x_info,
52 static const char *probes[] = { "cmdlinepart", NULL };
54 static struct mtd_partition *parsed_partitions;
56 static struct mtd_partition rsk7203_partitions[] = {
61 .mask_flags = MTD_WRITEABLE,
64 .offset = MTDPART_OFS_NXTBLK,
68 .offset = MTDPART_OFS_NXTBLK,
69 .size = MTDPART_SIZ_FULL,
73 static struct physmap_flash_data flash_data = {
77 static struct resource flash_resource = {
80 .flags = IORESOURCE_MEM,
83 static struct platform_device flash_device = {
84 .name = "physmap-flash",
86 .resource = &flash_resource,
89 .platform_data = &flash_data,
93 static struct mtd_info *flash_mtd;
95 static struct map_info rsk7203_flash_map = {
101 static void __init set_mtd_partitions(void)
105 simple_map_init(&rsk7203_flash_map);
106 flash_mtd = do_map_probe("cfi_probe", &rsk7203_flash_map);
107 nr_parts = parse_mtd_partitions(flash_mtd, probes,
108 &parsed_partitions, 0);
109 /* If there is no partition table, used the hard coded table */
111 flash_data.parts = rsk7203_partitions;
112 flash_data.nr_parts = ARRAY_SIZE(rsk7203_partitions);
114 flash_data.nr_parts = nr_parts;
115 flash_data.parts = parsed_partitions;
120 static struct platform_device *rsk7203_devices[] __initdata = {
125 static int __init rsk7203_devices_setup(void)
127 /* Select pins for SCIF0 */
128 gpio_request(GPIO_FN_TXD0, NULL);
129 gpio_request(GPIO_FN_RXD0, NULL);
132 gpio_request(GPIO_PE10, NULL);
133 gpio_direction_output(GPIO_PE10, 0);
134 gpio_export(GPIO_PE10, 0);
136 set_mtd_partitions();
137 return platform_add_devices(rsk7203_devices,
138 ARRAY_SIZE(rsk7203_devices));
140 device_initcall(rsk7203_devices_setup);
145 static struct sh_machine_vector mv_rsk7203 __initmv = {
146 .mv_name = "RSK+7203",