2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
8 #include <linux/dma-mapping.h>
9 #include <linux/init.h>
10 #include <linux/leds.h>
11 #include <linux/mtd/physmap.h>
12 #include <linux/platform_device.h>
14 static struct mtd_partition sead3_mtd_partitions[] = {
20 .name = "Board Config",
23 .mask_flags = MTD_WRITEABLE
27 static struct physmap_flash_data sead3_flash_data = {
29 .nr_parts = ARRAY_SIZE(sead3_mtd_partitions),
30 .parts = sead3_mtd_partitions
33 static struct resource sead3_flash_resource = {
36 .flags = IORESOURCE_MEM
39 static struct platform_device sead3_flash = {
40 .name = "physmap-flash",
43 .platform_data = &sead3_flash_data,
46 .resource = &sead3_flash_resource,
49 #define LEDFLAGS(bits, shift) \
50 ((bits << 8) | (shift << 8))
52 #define LEDBITS(id, shift, bits) \
54 .flags = LEDFLAGS(bits, shift)
56 static struct led_info led_data_info[] = {
57 { LEDBITS("bit", 0, 1) },
58 { LEDBITS("bit", 1, 1) },
59 { LEDBITS("bit", 2, 1) },
60 { LEDBITS("bit", 3, 1) },
61 { LEDBITS("bit", 4, 1) },
62 { LEDBITS("bit", 5, 1) },
63 { LEDBITS("bit", 6, 1) },
64 { LEDBITS("bit", 7, 1) },
65 { LEDBITS("all", 0, 8) },
68 static struct led_platform_data led_data = {
69 .num_leds = ARRAY_SIZE(led_data_info),
73 static struct resource pled_resources[] = {
77 .flags = IORESOURCE_MEM
81 static struct platform_device pled_device = {
82 .name = "sead3::pled",
85 .platform_data = &led_data,
87 .num_resources = ARRAY_SIZE(pled_resources),
88 .resource = pled_resources
92 static struct resource fled_resources[] = {
96 .flags = IORESOURCE_MEM
100 static struct platform_device fled_device = {
101 .name = "sead3::fled",
104 .platform_data = &led_data,
106 .num_resources = ARRAY_SIZE(fled_resources),
107 .resource = fled_resources
110 static struct platform_device sead3_led_device = {
115 static struct platform_device *sead3_platform_devices[] __initdata = {
122 static int __init sead3_platforms_device_init(void)
124 return platform_add_devices(sead3_platform_devices,
125 ARRAY_SIZE(sead3_platform_devices));
128 device_initcall(sead3_platforms_device_init);