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/irq.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>
15 #include <linux/serial_8250.h>
16 #include <linux/smsc911x.h>
18 #include <asm/mips-boards/sead3int.h>
24 .uartclk = 14745600, \
25 .iotype = UPIO_MEM32, \
26 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, \
30 static struct plat_serial8250_port uart8250_data[] = {
31 UART(0x1f000900), /* ttyS0 = USB */
32 UART(0x1f000800), /* ttyS1 = RS232 */
36 static struct platform_device uart8250_device = {
38 .id = PLAT8250_DEV_PLATFORM2,
40 .platform_data = uart8250_data,
44 static 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,
51 static struct resource sead3_net_resources[] = {
55 .flags = IORESOURCE_MEM
57 .flags = IORESOURCE_IRQ
61 static struct platform_device sead3_net_device = {
65 .platform_data = &sead3_smsc911x_data,
67 .num_resources = ARRAY_SIZE(sead3_net_resources),
68 .resource = sead3_net_resources
71 static struct mtd_partition sead3_mtd_partitions[] = {
77 .name = "Board Config",
80 .mask_flags = MTD_WRITEABLE
84 static struct physmap_flash_data sead3_flash_data = {
86 .nr_parts = ARRAY_SIZE(sead3_mtd_partitions),
87 .parts = sead3_mtd_partitions
90 static struct resource sead3_flash_resource = {
93 .flags = IORESOURCE_MEM
96 static struct platform_device sead3_flash = {
97 .name = "physmap-flash",
100 .platform_data = &sead3_flash_data,
103 .resource = &sead3_flash_resource,
106 #define LEDFLAGS(bits, shift) \
107 ((bits << 8) | (shift << 8))
109 #define LEDBITS(id, shift, bits) \
111 .flags = LEDFLAGS(bits, shift)
113 static 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) },
125 static struct led_platform_data led_data = {
126 .num_leds = ARRAY_SIZE(led_data_info),
127 .leds = led_data_info
130 static struct resource pled_resources[] = {
134 .flags = IORESOURCE_MEM
138 static struct platform_device pled_device = {
139 .name = "sead3::pled",
142 .platform_data = &led_data,
144 .num_resources = ARRAY_SIZE(pled_resources),
145 .resource = pled_resources
149 static struct resource fled_resources[] = {
153 .flags = IORESOURCE_MEM
157 static struct platform_device fled_device = {
158 .name = "sead3::fled",
161 .platform_data = &led_data,
163 .num_resources = ARRAY_SIZE(fled_resources),
164 .resource = fled_resources
167 static struct platform_device sead3_led_device = {
172 static struct resource ehci_resources[] = {
176 .flags = IORESOURCE_MEM
178 .flags = IORESOURCE_IRQ
182 static u64 sead3_usbdev_dma_mask = DMA_BIT_MASK(32);
184 static struct platform_device ehci_device = {
185 .name = "sead3-ehci",
188 .dma_mask = &sead3_usbdev_dma_mask,
189 .coherent_dma_mask = DMA_BIT_MASK(32)
191 .num_resources = ARRAY_SIZE(ehci_resources),
192 .resource = ehci_resources
195 static struct platform_device *sead3_platform_devices[] __initdata = {
205 static int __init sead3_platforms_device_init(void)
208 uart8250_data[0].irq = MIPS_GIC_IRQ_BASE + GIC_INT_UART0;
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;
213 uart8250_data[0].irq = MIPS_CPU_IRQ_BASE + CPU_INT_UART0;
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;
219 return platform_add_devices(sead3_platform_devices,
220 ARRAY_SIZE(sead3_platform_devices));
223 device_initcall(sead3_platforms_device_init);