]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/mips/mti-sead3/sead3-platform.c
MIPS: SEAD3: Probe EHCI controller using DT
[karo-tx-linux.git] / arch / mips / mti-sead3 / sead3-platform.c
1 /*
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
4  * for more details.
5  *
6  * Copyright (C) 2012 MIPS Technologies, Inc.  All rights reserved.
7  */
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>
13
14 static struct mtd_partition sead3_mtd_partitions[] = {
15         {
16                 .name =         "User FS",
17                 .offset =       0x00000000,
18                 .size =         0x01fc0000,
19         }, {
20                 .name =         "Board Config",
21                 .offset =       0x01fc0000,
22                 .size =         0x00040000,
23                 .mask_flags =   MTD_WRITEABLE
24         },
25 };
26
27 static struct physmap_flash_data sead3_flash_data = {
28         .width          = 4,
29         .nr_parts       = ARRAY_SIZE(sead3_mtd_partitions),
30         .parts          = sead3_mtd_partitions
31 };
32
33 static struct resource sead3_flash_resource = {
34         .start          = 0x1c000000,
35         .end            = 0x1dffffff,
36         .flags          = IORESOURCE_MEM
37 };
38
39 static struct platform_device sead3_flash = {
40         .name           = "physmap-flash",
41         .id             = 0,
42         .dev            = {
43                 .platform_data  = &sead3_flash_data,
44         },
45         .num_resources  = 1,
46         .resource       = &sead3_flash_resource,
47 };
48
49 #define LEDFLAGS(bits, shift)           \
50         ((bits << 8) | (shift << 8))
51
52 #define LEDBITS(id, shift, bits)        \
53         .name = id #shift,              \
54         .flags = LEDFLAGS(bits, shift)
55
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) },
66 };
67
68 static struct led_platform_data led_data = {
69         .num_leds       = ARRAY_SIZE(led_data_info),
70         .leds           = led_data_info
71 };
72
73 static struct resource pled_resources[] = {
74         {
75                 .start  = 0x1f000210,
76                 .end    = 0x1f000217,
77                 .flags  = IORESOURCE_MEM
78         }
79 };
80
81 static struct platform_device pled_device = {
82         .name                   = "sead3::pled",
83         .id                     = 0,
84         .dev                    = {
85                 .platform_data  = &led_data,
86         },
87         .num_resources          = ARRAY_SIZE(pled_resources),
88         .resource               = pled_resources
89 };
90
91
92 static struct resource fled_resources[] = {
93         {
94                 .start                  = 0x1f000218,
95                 .end                    = 0x1f00021f,
96                 .flags                  = IORESOURCE_MEM
97         }
98 };
99
100 static struct platform_device fled_device = {
101         .name                   = "sead3::fled",
102         .id                     = 0,
103         .dev                    = {
104                 .platform_data  = &led_data,
105         },
106         .num_resources          = ARRAY_SIZE(fled_resources),
107         .resource               = fled_resources
108 };
109
110 static struct platform_device sead3_led_device = {
111         .name   = "sead3-led",
112         .id     = -1,
113 };
114
115 static struct platform_device *sead3_platform_devices[] __initdata = {
116         &sead3_flash,
117         &pled_device,
118         &fled_device,
119         &sead3_led_device,
120 };
121
122 static int __init sead3_platforms_device_init(void)
123 {
124         return platform_add_devices(sead3_platform_devices,
125                                     ARRAY_SIZE(sead3_platform_devices));
126 }
127
128 device_initcall(sead3_platforms_device_init);