Linux 4.13.16
[linux/fpc-iii.git] / arch / m68k / coldfire / amcore.c
blobc6cb1a5cc1a5e2d442ddbf57bb074c83672e3ad4
1 /*
2 * amcore.c -- Support for Sysam AMCORE open board
4 * (C) Copyright 2016, Angelo Dureghello <angelo@sysam.it>
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
11 #include <linux/device.h>
12 #include <linux/platform_device.h>
13 #include <linux/dm9000.h>
14 #include <linux/irq.h>
15 #include <linux/interrupt.h>
16 #include <linux/mtd/mtd.h>
17 #include <linux/mtd/map.h>
18 #include <linux/mtd/partitions.h>
19 #include <linux/mtd/physmap.h>
20 #include <linux/i2c.h>
22 #include <asm/coldfire.h>
23 #include <asm/mcfsim.h>
24 #include <asm/io.h>
26 #if IS_ENABLED(CONFIG_DM9000)
28 #define DM9000_IRQ 25
29 #define DM9000_ADDR 0x30000000
32 * DEVICES and related device RESOURCES
34 static struct resource dm9000_resources[] = {
35 /* physical address of the address register (CMD [A2] to 0)*/
36 [0] = {
37 .start = DM9000_ADDR,
38 .end = DM9000_ADDR,
39 .flags = IORESOURCE_MEM,
42 * physical address of the data register (CMD [A2] to 1),
43 * driver wants a range >=4 to assume a 32bit data bus
45 [1] = {
46 .start = DM9000_ADDR + 4,
47 .end = DM9000_ADDR + 7,
48 .flags = IORESOURCE_MEM,
50 /* IRQ line the device's interrupt pin is connected to */
51 [2] = {
52 .start = DM9000_IRQ,
53 .end = DM9000_IRQ,
54 .flags = IORESOURCE_IRQ,
58 static struct dm9000_plat_data dm9000_platdata = {
59 .flags = DM9000_PLATF_32BITONLY,
62 static struct platform_device dm9000_device = {
63 .name = "dm9000",
64 .id = 0,
65 .num_resources = ARRAY_SIZE(dm9000_resources),
66 .resource = dm9000_resources,
67 .dev = {
68 .platform_data = &dm9000_platdata,
71 #endif
73 static void __init dm9000_pre_init(void)
75 /* Set the dm9000 interrupt to be auto-vectored */
76 mcf_autovector(DM9000_IRQ);
80 * Partitioning of parallel NOR flash (39VF3201B)
82 static struct mtd_partition amcore_partitions[] = {
84 .name = "U-Boot (128K)",
85 .size = 0x20000,
86 .offset = 0x0
89 .name = "Kernel+ROMfs (2994K)",
90 .size = 0x2E0000,
91 .offset = MTDPART_OFS_APPEND
94 .name = "Flash Free Space (1024K)",
95 .size = MTDPART_SIZ_FULL,
96 .offset = MTDPART_OFS_APPEND
100 static struct physmap_flash_data flash_data = {
101 .parts = amcore_partitions,
102 .nr_parts = ARRAY_SIZE(amcore_partitions),
103 .width = 2,
106 static struct resource flash_resource = {
107 .start = 0xffc00000,
108 .end = 0xffffffff,
109 .flags = IORESOURCE_MEM,
112 static struct platform_device flash_device = {
113 .name = "physmap-flash",
114 .id = -1,
115 .resource = &flash_resource,
116 .num_resources = 1,
117 .dev = {
118 .platform_data = &flash_data,
122 static struct platform_device rtc_device = {
123 .name = "rtc-ds1307",
124 .id = -1,
127 static struct i2c_board_info amcore_i2c_info[] __initdata = {
129 I2C_BOARD_INFO("ds1338", 0x68),
133 static struct platform_device *amcore_devices[] __initdata = {
134 #if IS_ENABLED(CONFIG_DM9000)
135 &dm9000_device,
136 #endif
137 &flash_device,
138 &rtc_device,
141 static int __init init_amcore(void)
143 #if IS_ENABLED(CONFIG_DM9000)
144 dm9000_pre_init();
145 #endif
147 /* Add i2c RTC Dallas chip supprt */
148 i2c_register_board_info(0, amcore_i2c_info,
149 ARRAY_SIZE(amcore_i2c_info));
151 platform_add_devices(amcore_devices, ARRAY_SIZE(amcore_devices));
153 return 0;
156 arch_initcall(init_amcore);