diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-12-08 00:32:03 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-12-22 04:44:02 -0500 |
commit | ea0aac1e1327476d2f6a38f08145281237cf1b03 (patch) | |
tree | e4bc1b726cd4d17145a69edca84fe9b5db6c6d5c /arch/sh/boards/mach-rsk | |
parent | b5cfeac990cc164a3d3422aab88ac5b138fa822d (diff) |
sh: Consolidate rsk7203/7201 in to a new mach-rsk.
RSK+ platforms have quite a few characteristics in common, so roll them
together in to a shiny new RSK mach-type.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/mach-rsk')
-rw-r--r-- | arch/sh/boards/mach-rsk/Kconfig | 18 | ||||
-rw-r--r-- | arch/sh/boards/mach-rsk/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/boards/mach-rsk/devices-rsk7203.c | 103 | ||||
-rw-r--r-- | arch/sh/boards/mach-rsk/setup.c | 106 |
4 files changed, 229 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-rsk/Kconfig b/arch/sh/boards/mach-rsk/Kconfig new file mode 100644 index 000000000000..bff095dffc02 --- /dev/null +++ b/arch/sh/boards/mach-rsk/Kconfig | |||
@@ -0,0 +1,18 @@ | |||
1 | if SH_RSK | ||
2 | |||
3 | choice | ||
4 | prompt "RSK+ options" | ||
5 | default SH_RSK7203 | ||
6 | |||
7 | config SH_RSK7201 | ||
8 | bool "RSK7201" | ||
9 | depends on CPU_SUBTYPE_SH7201 | ||
10 | |||
11 | config SH_RSK7203 | ||
12 | bool "RSK7203" | ||
13 | select GENERIC_GPIO | ||
14 | depends on CPU_SUBTYPE_SH7203 | ||
15 | |||
16 | endchoice | ||
17 | |||
18 | endif | ||
diff --git a/arch/sh/boards/mach-rsk/Makefile b/arch/sh/boards/mach-rsk/Makefile new file mode 100644 index 000000000000..498da75ce38b --- /dev/null +++ b/arch/sh/boards/mach-rsk/Makefile | |||
@@ -0,0 +1,2 @@ | |||
1 | obj-y := setup.o | ||
2 | obj-$(CONFIG_SH_RSK7203) += devices-rsk7203.o | ||
diff --git a/arch/sh/boards/mach-rsk/devices-rsk7203.c b/arch/sh/boards/mach-rsk/devices-rsk7203.c new file mode 100644 index 000000000000..73f743b9be8d --- /dev/null +++ b/arch/sh/boards/mach-rsk/devices-rsk7203.c | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | * Renesas Technology Europe RSK+ 7203 Support. | ||
3 | * | ||
4 | * Copyright (C) 2008 Paul Mundt | ||
5 | * | ||
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 | ||
8 | * for more details. | ||
9 | */ | ||
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 <linux/leds.h> | ||
21 | #include <asm/machvec.h> | ||
22 | #include <asm/io.h> | ||
23 | #include <cpu/sh7203.h> | ||
24 | |||
25 | static struct smc911x_platdata smc911x_info = { | ||
26 | .flags = SMC911X_USE_16BIT, | ||
27 | .irq_flags = IRQF_TRIGGER_LOW, | ||
28 | }; | ||
29 | |||
30 | static struct resource smc911x_resources[] = { | ||
31 | [0] = { | ||
32 | .start = 0x24000000, | ||
33 | .end = 0x24000000 + 0x100, | ||
34 | .flags = IORESOURCE_MEM, | ||
35 | }, | ||
36 | [1] = { | ||
37 | .start = 64, | ||
38 | .end = 64, | ||
39 | .flags = IORESOURCE_IRQ, | ||
40 | }, | ||
41 | }; | ||
42 | |||
43 | static struct platform_device smc911x_device = { | ||
44 | .name = "smc911x", | ||
45 | .id = -1, | ||
46 | .num_resources = ARRAY_SIZE(smc911x_resources), | ||
47 | .resource = smc911x_resources, | ||
48 | .dev = { | ||
49 | .platform_data = &smc911x_info, | ||
50 | }, | ||
51 | }; | ||
52 | |||
53 | static struct gpio_led rsk7203_gpio_leds[] = { | ||
54 | { | ||
55 | .name = "green", | ||
56 | .gpio = GPIO_PE10, | ||
57 | .active_low = 1, | ||
58 | }, { | ||
59 | .name = "orange", | ||
60 | .default_trigger = "nand-disk", | ||
61 | .gpio = GPIO_PE12, | ||
62 | .active_low = 1, | ||
63 | }, { | ||
64 | .name = "red:timer", | ||
65 | .default_trigger = "timer", | ||
66 | .gpio = GPIO_PC14, | ||
67 | .active_low = 1, | ||
68 | }, { | ||
69 | .name = "red:heartbeat", | ||
70 | .default_trigger = "heartbeat", | ||
71 | .gpio = GPIO_PE11, | ||
72 | .active_low = 1, | ||
73 | }, | ||
74 | }; | ||
75 | |||
76 | static struct gpio_led_platform_data rsk7203_gpio_leds_info = { | ||
77 | .leds = rsk7203_gpio_leds, | ||
78 | .num_leds = ARRAY_SIZE(rsk7203_gpio_leds), | ||
79 | }; | ||
80 | |||
81 | static struct platform_device led_device = { | ||
82 | .name = "leds-gpio", | ||
83 | .id = -1, | ||
84 | .dev = { | ||
85 | .platform_data = &rsk7203_gpio_leds_info, | ||
86 | }, | ||
87 | }; | ||
88 | |||
89 | static struct platform_device *rsk7203_devices[] __initdata = { | ||
90 | &smc911x_device, | ||
91 | &led_device, | ||
92 | }; | ||
93 | |||
94 | static int __init rsk7203_devices_setup(void) | ||
95 | { | ||
96 | /* Select pins for SCIF0 */ | ||
97 | gpio_request(GPIO_FN_TXD0, NULL); | ||
98 | gpio_request(GPIO_FN_RXD0, NULL); | ||
99 | |||
100 | return platform_add_devices(rsk7203_devices, | ||
101 | ARRAY_SIZE(rsk7203_devices)); | ||
102 | } | ||
103 | device_initcall(rsk7203_devices_setup); | ||
diff --git a/arch/sh/boards/mach-rsk/setup.c b/arch/sh/boards/mach-rsk/setup.c new file mode 100644 index 000000000000..af64d030a5c7 --- /dev/null +++ b/arch/sh/boards/mach-rsk/setup.c | |||
@@ -0,0 +1,106 @@ | |||
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 <asm/machvec.h> | ||
20 | #include <asm/io.h> | ||
21 | |||
22 | static const char *probes[] = { "cmdlinepart", NULL }; | ||
23 | |||
24 | static struct mtd_partition *parsed_partitions; | ||
25 | |||
26 | static struct mtd_partition rsk_partitions[] = { | ||
27 | { | ||
28 | .name = "Bootloader", | ||
29 | .offset = 0x00000000, | ||
30 | .size = 0x00040000, | ||
31 | .mask_flags = MTD_WRITEABLE, | ||
32 | }, { | ||
33 | .name = "Kernel", | ||
34 | .offset = MTDPART_OFS_NXTBLK, | ||
35 | .size = 0x001c0000, | ||
36 | }, { | ||
37 | .name = "Flash_FS", | ||
38 | .offset = MTDPART_OFS_NXTBLK, | ||
39 | .size = MTDPART_SIZ_FULL, | ||
40 | } | ||
41 | }; | ||
42 | |||
43 | static struct physmap_flash_data flash_data = { | ||
44 | .width = 2, | ||
45 | }; | ||
46 | |||
47 | static struct resource flash_resource = { | ||
48 | .start = 0x20000000, | ||
49 | .end = 0x20400000, | ||
50 | .flags = IORESOURCE_MEM, | ||
51 | }; | ||
52 | |||
53 | static struct platform_device flash_device = { | ||
54 | .name = "physmap-flash", | ||
55 | .id = -1, | ||
56 | .resource = &flash_resource, | ||
57 | .num_resources = 1, | ||
58 | .dev = { | ||
59 | .platform_data = &flash_data, | ||
60 | }, | ||
61 | }; | ||
62 | |||
63 | static struct mtd_info *flash_mtd; | ||
64 | |||
65 | static struct map_info rsk_flash_map = { | ||
66 | .name = "RSK+ Flash", | ||
67 | .size = 0x400000, | ||
68 | .bankwidth = 2, | ||
69 | }; | ||
70 | |||
71 | static void __init set_mtd_partitions(void) | ||
72 | { | ||
73 | int nr_parts = 0; | ||
74 | |||
75 | simple_map_init(&rsk_flash_map); | ||
76 | flash_mtd = do_map_probe("cfi_probe", &rsk_flash_map); | ||
77 | nr_parts = parse_mtd_partitions(flash_mtd, probes, | ||
78 | &parsed_partitions, 0); | ||
79 | /* If there is no partition table, used the hard coded table */ | ||
80 | if (nr_parts <= 0) { | ||
81 | flash_data.parts = rsk_partitions; | ||
82 | flash_data.nr_parts = ARRAY_SIZE(rsk_partitions); | ||
83 | } else { | ||
84 | flash_data.nr_parts = nr_parts; | ||
85 | flash_data.parts = parsed_partitions; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | static struct platform_device *rsk_devices[] __initdata = { | ||
90 | &flash_device, | ||
91 | }; | ||
92 | |||
93 | static int __init rsk_devices_setup(void) | ||
94 | { | ||
95 | set_mtd_partitions(); | ||
96 | return platform_add_devices(rsk_devices, | ||
97 | ARRAY_SIZE(rsk_devices)); | ||
98 | } | ||
99 | device_initcall(rsk_devices_setup); | ||
100 | |||
101 | /* | ||
102 | * The Machine Vector | ||
103 | */ | ||
104 | static struct sh_machine_vector mv_rsk __initmv = { | ||
105 | .mv_name = "RSK+", | ||
106 | }; | ||