1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright(C) MontaVista Software Inc, 2006
5 * Author: dmitry pervushin <dpervushin@ru.mvista.com>
7 #include <linux/init.h>
8 #include <linux/kernel.h>
9 #include <linux/types.h>
10 #include <linux/ioport.h>
11 #include <linux/serial_8250.h>
12 #include <linux/mtd/physmap.h>
15 #include <asm/bootinfo.h>
16 #include <asm/addrspace.h>
18 #include <asm/bcache.h>
20 #include <asm/reboot.h>
21 #include <asm/traps.h>
23 #include <asm/emma/emma2rh.h>
26 #define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */
28 static struct resource i2c_emma_resources_0
[] = {
31 .start
= EMMA2RH_IRQ_PIIC0
,
32 .end
= EMMA2RH_IRQ_PIIC0
,
33 .flags
= IORESOURCE_IRQ
36 .start
= EMMA2RH_PIIC0_BASE
,
37 .end
= EMMA2RH_PIIC0_BASE
+ 0x1000,
42 struct resource i2c_emma_resources_1
[] = {
45 .start
= EMMA2RH_IRQ_PIIC1
,
46 .end
= EMMA2RH_IRQ_PIIC1
,
47 .flags
= IORESOURCE_IRQ
50 .start
= EMMA2RH_PIIC1_BASE
,
51 .end
= EMMA2RH_PIIC1_BASE
+ 0x1000,
56 struct resource i2c_emma_resources_2
[] = {
59 .start
= EMMA2RH_IRQ_PIIC2
,
60 .end
= EMMA2RH_IRQ_PIIC2
,
61 .flags
= IORESOURCE_IRQ
64 .start
= EMMA2RH_PIIC2_BASE
,
65 .end
= EMMA2RH_PIIC2_BASE
+ 0x1000,
70 struct platform_device i2c_emma_devices
[] = {
74 .resource
= i2c_emma_resources_0
,
75 .num_resources
= ARRAY_SIZE(i2c_emma_resources_0
),
80 .resource
= i2c_emma_resources_1
,
81 .num_resources
= ARRAY_SIZE(i2c_emma_resources_1
),
86 .resource
= i2c_emma_resources_2
,
87 .num_resources
= ARRAY_SIZE(i2c_emma_resources_2
),
91 #define EMMA2RH_SERIAL_CLOCK 18544000
92 #define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST
94 static struct plat_serial8250_port platform_serial_ports
[] = {
96 .membase
= (void __iomem
*)KSEG1ADDR(EMMA2RH_PFUR0_BASE
+ 3),
97 .mapbase
= EMMA2RH_PFUR0_BASE
+ 3,
98 .irq
= EMMA2RH_IRQ_PFUR0
,
99 .uartclk
= EMMA2RH_SERIAL_CLOCK
,
102 .flags
= EMMA2RH_SERIAL_FLAGS
,
104 .membase
= (void __iomem
*)KSEG1ADDR(EMMA2RH_PFUR1_BASE
+ 3),
105 .mapbase
= EMMA2RH_PFUR1_BASE
+ 3,
106 .irq
= EMMA2RH_IRQ_PFUR1
,
107 .uartclk
= EMMA2RH_SERIAL_CLOCK
,
110 .flags
= EMMA2RH_SERIAL_FLAGS
,
112 .membase
= (void __iomem
*)KSEG1ADDR(EMMA2RH_PFUR2_BASE
+ 3),
113 .mapbase
= EMMA2RH_PFUR2_BASE
+ 3,
114 .irq
= EMMA2RH_IRQ_PFUR2
,
115 .uartclk
= EMMA2RH_SERIAL_CLOCK
,
118 .flags
= EMMA2RH_SERIAL_FLAGS
,
124 static struct platform_device serial_emma
= {
125 .name
= "serial8250",
127 .platform_data
= &platform_serial_ports
,
131 static struct mtd_partition markeins_parts
[] = {
134 .offset
= 0x00000000,
138 .name
= "boot code area",
139 .offset
= MTDPART_OFS_APPEND
,
143 .name
= "kernel image",
144 .offset
= MTDPART_OFS_APPEND
,
149 .offset
= MTDPART_OFS_APPEND
,
153 .name
= "boot code area2",
154 .offset
= MTDPART_OFS_APPEND
,
158 .name
= "kernel image2",
159 .offset
= MTDPART_OFS_APPEND
,
160 .size
= MTDPART_SIZ_FULL
,
164 static struct physmap_flash_data markeins_flash_data
= {
166 .nr_parts
= ARRAY_SIZE(markeins_parts
),
167 .parts
= markeins_parts
170 static struct resource markeins_flash_resource
= {
173 .flags
= IORESOURCE_MEM
176 static struct platform_device markeins_flash_device
= {
177 .name
= "physmap-flash",
180 .platform_data
= &markeins_flash_data
,
183 .resource
= &markeins_flash_resource
,
186 static struct platform_device
*devices
[] = {
188 i2c_emma_devices
+ 1,
189 i2c_emma_devices
+ 2,
191 &markeins_flash_device
,
194 static int __init
platform_devices_setup(void)
196 return platform_add_devices(devices
, ARRAY_SIZE(devices
));
199 arch_initcall(platform_devices_setup
);