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
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>
26 #if IS_ENABLED(CONFIG_DM9000)
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)*/
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
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 */
54 .flags
= IORESOURCE_IRQ
,
58 static struct dm9000_plat_data dm9000_platdata
= {
59 .flags
= DM9000_PLATF_32BITONLY
,
62 static struct platform_device dm9000_device
= {
65 .num_resources
= ARRAY_SIZE(dm9000_resources
),
66 .resource
= dm9000_resources
,
68 .platform_data
= &dm9000_platdata
,
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)",
89 .name
= "Kernel+ROMfs (2994K)",
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
),
106 static struct resource flash_resource
= {
109 .flags
= IORESOURCE_MEM
,
112 static struct platform_device flash_device
= {
113 .name
= "physmap-flash",
115 .resource
= &flash_resource
,
118 .platform_data
= &flash_data
,
122 static struct platform_device rtc_device
= {
123 .name
= "rtc-ds1307",
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)
141 static int __init
init_amcore(void)
143 #if IS_ENABLED(CONFIG_DM9000)
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
));
156 arch_initcall(init_amcore
);