aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2015-04-02 11:07:26 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-04-02 11:07:26 -0400
commit612544fbde1b3cf60eb1c06ce1b6640c5d61bcdd (patch)
treeaeca94a4710d6a809a1dc07071a978120de74d39
parent21c784b93b0a19af4ae7bcce0d22120ba91970cf (diff)
MIPS: SEAD3: Combine all platform device registrations in one file.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/mti-sead3/Makefile7
-rw-r--r--arch/mips/mti-sead3/sead3-ehci.c49
-rw-r--r--arch/mips/mti-sead3/sead3-leds.c89
-rw-r--r--arch/mips/mti-sead3/sead3-mtd.c53
-rw-r--r--arch/mips/mti-sead3/sead3-net.c53
-rw-r--r--arch/mips/mti-sead3/sead3-platform.c179
6 files changed, 179 insertions, 251 deletions
diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
index 37f95f2ac997..ecd71db6258b 100644
--- a/arch/mips/mti-sead3/Makefile
+++ b/arch/mips/mti-sead3/Makefile
@@ -8,12 +8,11 @@
8# Copyright (C) 2012 MIPS Technoligies, Inc. All rights reserved. 8# Copyright (C) 2012 MIPS Technoligies, Inc. All rights reserved.
9# Steven J. Hill <sjhill@mips.com> 9# Steven J. Hill <sjhill@mips.com>
10# 10#
11obj-y := sead3-lcd.o sead3-display.o sead3-ehci.o \ 11obj-y := sead3-lcd.o sead3-display.o sead3-init.o \
12 sead3-init.o sead3-int.o sead3-mtd.o \ 12 sead3-int.o sead3-platform.o sead3-reset.o \
13 sead3-net.o sead3-platform.o sead3-reset.o \
14 sead3-setup.o sead3-time.o 13 sead3-setup.o sead3-time.o
15 14
16obj-y += leds-sead3.o sead3-leds.o 15obj-y += leds-sead3.o
17 16
18obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o 17obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o
19 18
diff --git a/arch/mips/mti-sead3/sead3-ehci.c b/arch/mips/mti-sead3/sead3-ehci.c
deleted file mode 100644
index e2b094a91d5c..000000000000
--- a/arch/mips/mti-sead3/sead3-ehci.c
+++ /dev/null
@@ -1,49 +0,0 @@
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/init.h>
9#include <linux/irq.h>
10#include <linux/dma-mapping.h>
11#include <linux/platform_device.h>
12#include <linux/irqchip/mips-gic.h>
13
14#include <asm/mips-boards/sead3int.h>
15
16static struct resource ehci_resources[] = {
17 {
18 .start = 0x1b200000,
19 .end = 0x1b200fff,
20 .flags = IORESOURCE_MEM
21 },
22 {
23 .flags = IORESOURCE_IRQ
24 }
25};
26
27static u64 sead3_usbdev_dma_mask = DMA_BIT_MASK(32);
28
29static struct platform_device ehci_device = {
30 .name = "sead3-ehci",
31 .id = 0,
32 .dev = {
33 .dma_mask = &sead3_usbdev_dma_mask,
34 .coherent_dma_mask = DMA_BIT_MASK(32)
35 },
36 .num_resources = ARRAY_SIZE(ehci_resources),
37 .resource = ehci_resources
38};
39
40static int __init ehci_init(void)
41{
42 if (gic_present)
43 ehci_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_EHCI;
44 else
45 ehci_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_EHCI;
46 return platform_device_register(&ehci_device);
47}
48
49device_initcall(ehci_init);
diff --git a/arch/mips/mti-sead3/sead3-leds.c b/arch/mips/mti-sead3/sead3-leds.c
deleted file mode 100644
index c6fa3e44cb8a..000000000000
--- a/arch/mips/mti-sead3/sead3-leds.c
+++ /dev/null
@@ -1,89 +0,0 @@
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/init.h>
9#include <linux/leds.h>
10#include <linux/platform_device.h>
11
12#define LEDFLAGS(bits, shift) \
13 ((bits << 8) | (shift << 8))
14
15#define LEDBITS(id, shift, bits) \
16 .name = id #shift, \
17 .flags = LEDFLAGS(bits, shift)
18
19struct led_info led_data_info[] = {
20 { LEDBITS("bit", 0, 1) },
21 { LEDBITS("bit", 1, 1) },
22 { LEDBITS("bit", 2, 1) },
23 { LEDBITS("bit", 3, 1) },
24 { LEDBITS("bit", 4, 1) },
25 { LEDBITS("bit", 5, 1) },
26 { LEDBITS("bit", 6, 1) },
27 { LEDBITS("bit", 7, 1) },
28 { LEDBITS("all", 0, 8) },
29};
30
31static struct led_platform_data led_data = {
32 .num_leds = ARRAY_SIZE(led_data_info),
33 .leds = led_data_info
34};
35
36static struct resource pled_resources[] = {
37 {
38 .start = 0x1f000210,
39 .end = 0x1f000217,
40 .flags = IORESOURCE_MEM
41 }
42};
43
44static struct platform_device pled_device = {
45 .name = "sead3::pled",
46 .id = 0,
47 .dev = {
48 .platform_data = &led_data,
49 },
50 .num_resources = ARRAY_SIZE(pled_resources),
51 .resource = pled_resources
52};
53
54
55static struct resource fled_resources[] = {
56 {
57 .start = 0x1f000218,
58 .end = 0x1f00021f,
59 .flags = IORESOURCE_MEM
60 }
61};
62
63static struct platform_device fled_device = {
64 .name = "sead3::fled",
65 .id = 0,
66 .dev = {
67 .platform_data = &led_data,
68 },
69 .num_resources = ARRAY_SIZE(fled_resources),
70 .resource = fled_resources
71};
72
73static struct platform_device sead3_led_device = {
74 .name = "sead3-led",
75 .id = -1,
76};
77
78struct platform_device *sead3_led_devices[] = {
79 &pled_device,
80 &fled_device,
81 &sead3_led_device,
82};
83
84static int __init sead3_led_init(void)
85{
86 return platform_add_devices(sead3_led_devices, ARRAY_SIZE(sead3_led_devices));
87}
88
89device_initcall(sead3_led_init);
diff --git a/arch/mips/mti-sead3/sead3-mtd.c b/arch/mips/mti-sead3/sead3-mtd.c
deleted file mode 100644
index f9c890d72677..000000000000
--- a/arch/mips/mti-sead3/sead3-mtd.c
+++ /dev/null
@@ -1,53 +0,0 @@
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/init.h>
9#include <linux/platform_device.h>
10#include <linux/mtd/physmap.h>
11
12static struct mtd_partition sead3_mtd_partitions[] = {
13 {
14 .name = "User FS",
15 .offset = 0x00000000,
16 .size = 0x01fc0000,
17 }, {
18 .name = "Board Config",
19 .offset = 0x01fc0000,
20 .size = 0x00040000,
21 .mask_flags = MTD_WRITEABLE
22 },
23};
24
25static struct physmap_flash_data sead3_flash_data = {
26 .width = 4,
27 .nr_parts = ARRAY_SIZE(sead3_mtd_partitions),
28 .parts = sead3_mtd_partitions
29};
30
31static struct resource sead3_flash_resource = {
32 .start = 0x1c000000,
33 .end = 0x1dffffff,
34 .flags = IORESOURCE_MEM
35};
36
37static struct platform_device sead3_flash = {
38 .name = "physmap-flash",
39 .id = 0,
40 .dev = {
41 .platform_data = &sead3_flash_data,
42 },
43 .num_resources = 1,
44 .resource = &sead3_flash_resource,
45};
46
47static int __init sead3_mtd_init(void)
48{
49 platform_device_register(&sead3_flash);
50
51 return 0;
52}
53device_initcall(sead3_mtd_init);
diff --git a/arch/mips/mti-sead3/sead3-net.c b/arch/mips/mti-sead3/sead3-net.c
deleted file mode 100644
index 16895f8eea41..000000000000
--- a/arch/mips/mti-sead3/sead3-net.c
+++ /dev/null
@@ -1,53 +0,0 @@
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/init.h>
9#include <linux/irq.h>
10#include <linux/irqchip/mips-gic.h>
11#include <linux/platform_device.h>
12#include <linux/smsc911x.h>
13
14#include <asm/mips-boards/sead3int.h>
15
16static struct smsc911x_platform_config sead3_smsc911x_data = {
17 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
18 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
19 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
20 .phy_interface = PHY_INTERFACE_MODE_MII,
21};
22
23struct resource sead3_net_resources[] = {
24 {
25 .start = 0x1f010000,
26 .end = 0x1f01ffff,
27 .flags = IORESOURCE_MEM
28 },
29 {
30 .flags = IORESOURCE_IRQ
31 }
32};
33
34static struct platform_device sead3_net_device = {
35 .name = "smsc911x",
36 .id = 0,
37 .dev = {
38 .platform_data = &sead3_smsc911x_data,
39 },
40 .num_resources = ARRAY_SIZE(sead3_net_resources),
41 .resource = sead3_net_resources
42};
43
44static int __init sead3_net_init(void)
45{
46 if (gic_present)
47 sead3_net_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_NET;
48 else
49 sead3_net_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_NET;
50 return platform_device_register(&sead3_net_device);
51}
52
53device_initcall(sead3_net_init);
diff --git a/arch/mips/mti-sead3/sead3-platform.c b/arch/mips/mti-sead3/sead3-platform.c
index a38325474a07..73b73efbfb05 100644
--- a/arch/mips/mti-sead3/sead3-platform.c
+++ b/arch/mips/mti-sead3/sead3-platform.c
@@ -5,9 +5,15 @@
5 * 5 *
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. 6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
7 */ 7 */
8#include <linux/dma-mapping.h>
8#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/irq.h>
9#include <linux/irqchip/mips-gic.h> 11#include <linux/irqchip/mips-gic.h>
12#include <linux/leds.h>
13#include <linux/mtd/physmap.h>
14#include <linux/platform_device.h>
10#include <linux/serial_8250.h> 15#include <linux/serial_8250.h>
16#include <linux/smsc911x.h>
11 17
12#include <asm/mips-boards/sead3int.h> 18#include <asm/mips-boards/sead3int.h>
13 19
@@ -35,16 +41,183 @@ static struct platform_device uart8250_device = {
35 }, 41 },
36}; 42};
37 43
38static int __init uart8250_init(void) 44static struct smsc911x_platform_config sead3_smsc911x_data = {
45 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
46 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
47 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
48 .phy_interface = PHY_INTERFACE_MODE_MII,
49};
50
51static struct resource sead3_net_resources[] = {
52 {
53 .start = 0x1f010000,
54 .end = 0x1f01ffff,
55 .flags = IORESOURCE_MEM
56 }, {
57 .flags = IORESOURCE_IRQ
58 }
59};
60
61static struct platform_device sead3_net_device = {
62 .name = "smsc911x",
63 .id = 0,
64 .dev = {
65 .platform_data = &sead3_smsc911x_data,
66 },
67 .num_resources = ARRAY_SIZE(sead3_net_resources),
68 .resource = sead3_net_resources
69};
70
71static struct mtd_partition sead3_mtd_partitions[] = {
72 {
73 .name = "User FS",
74 .offset = 0x00000000,
75 .size = 0x01fc0000,
76 }, {
77 .name = "Board Config",
78 .offset = 0x01fc0000,
79 .size = 0x00040000,
80 .mask_flags = MTD_WRITEABLE
81 },
82};
83
84static struct physmap_flash_data sead3_flash_data = {
85 .width = 4,
86 .nr_parts = ARRAY_SIZE(sead3_mtd_partitions),
87 .parts = sead3_mtd_partitions
88};
89
90static struct resource sead3_flash_resource = {
91 .start = 0x1c000000,
92 .end = 0x1dffffff,
93 .flags = IORESOURCE_MEM
94};
95
96static struct platform_device sead3_flash = {
97 .name = "physmap-flash",
98 .id = 0,
99 .dev = {
100 .platform_data = &sead3_flash_data,
101 },
102 .num_resources = 1,
103 .resource = &sead3_flash_resource,
104};
105
106#define LEDFLAGS(bits, shift) \
107 ((bits << 8) | (shift << 8))
108
109#define LEDBITS(id, shift, bits) \
110 .name = id #shift, \
111 .flags = LEDFLAGS(bits, shift)
112
113static struct led_info led_data_info[] = {
114 { LEDBITS("bit", 0, 1) },
115 { LEDBITS("bit", 1, 1) },
116 { LEDBITS("bit", 2, 1) },
117 { LEDBITS("bit", 3, 1) },
118 { LEDBITS("bit", 4, 1) },
119 { LEDBITS("bit", 5, 1) },
120 { LEDBITS("bit", 6, 1) },
121 { LEDBITS("bit", 7, 1) },
122 { LEDBITS("all", 0, 8) },
123};
124
125static struct led_platform_data led_data = {
126 .num_leds = ARRAY_SIZE(led_data_info),
127 .leds = led_data_info
128};
129
130static struct resource pled_resources[] = {
131 {
132 .start = 0x1f000210,
133 .end = 0x1f000217,
134 .flags = IORESOURCE_MEM
135 }
136};
137
138static struct platform_device pled_device = {
139 .name = "sead3::pled",
140 .id = 0,
141 .dev = {
142 .platform_data = &led_data,
143 },
144 .num_resources = ARRAY_SIZE(pled_resources),
145 .resource = pled_resources
146};
147
148
149static struct resource fled_resources[] = {
150 {
151 .start = 0x1f000218,
152 .end = 0x1f00021f,
153 .flags = IORESOURCE_MEM
154 }
155};
156
157static struct platform_device fled_device = {
158 .name = "sead3::fled",
159 .id = 0,
160 .dev = {
161 .platform_data = &led_data,
162 },
163 .num_resources = ARRAY_SIZE(fled_resources),
164 .resource = fled_resources
165};
166
167static struct platform_device sead3_led_device = {
168 .name = "sead3-led",
169 .id = -1,
170};
171
172static struct resource ehci_resources[] = {
173 {
174 .start = 0x1b200000,
175 .end = 0x1b200fff,
176 .flags = IORESOURCE_MEM
177 }, {
178 .flags = IORESOURCE_IRQ
179 }
180};
181
182static u64 sead3_usbdev_dma_mask = DMA_BIT_MASK(32);
183
184static struct platform_device ehci_device = {
185 .name = "sead3-ehci",
186 .id = 0,
187 .dev = {
188 .dma_mask = &sead3_usbdev_dma_mask,
189 .coherent_dma_mask = DMA_BIT_MASK(32)
190 },
191 .num_resources = ARRAY_SIZE(ehci_resources),
192 .resource = ehci_resources
193};
194
195static struct platform_device *sead3_platform_devices[] __initdata = {
196 &uart8250_device,
197 &sead3_flash,
198 &pled_device,
199 &fled_device,
200 &sead3_led_device,
201 &ehci_device,
202 &sead3_net_device,
203};
204
205static int __init sead3_platforms_device_init(void)
39{ 206{
40 if (gic_present) { 207 if (gic_present) {
41 uart8250_data[0].irq = MIPS_GIC_IRQ_BASE + GIC_INT_UART0; 208 uart8250_data[0].irq = MIPS_GIC_IRQ_BASE + GIC_INT_UART0;
42 uart8250_data[1].irq = MIPS_GIC_IRQ_BASE + GIC_INT_UART1; 209 uart8250_data[1].irq = MIPS_GIC_IRQ_BASE + GIC_INT_UART1;
210 ehci_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_EHCI;
211 sead3_net_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_NET;
43 } else { 212 } else {
44 uart8250_data[0].irq = MIPS_CPU_IRQ_BASE + CPU_INT_UART0; 213 uart8250_data[0].irq = MIPS_CPU_IRQ_BASE + CPU_INT_UART0;
45 uart8250_data[1].irq = MIPS_CPU_IRQ_BASE + CPU_INT_UART1; 214 uart8250_data[1].irq = MIPS_CPU_IRQ_BASE + CPU_INT_UART1;
215 ehci_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_EHCI;
216 sead3_net_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_NET;
46 } 217 }
47 return platform_device_register(&uart8250_device); 218
219 return platform_add_devices(sead3_platform_devices,
220 ARRAY_SIZE(sead3_platform_devices));
48} 221}
49 222
50device_initcall(uart8250_init); 223device_initcall(sead3_platforms_device_init);