1 // SPDX-License-Identifier: GPL-2.0-only
3 * board-sg.c -- support for the SnapGear KS8695 based boards
6 #include <linux/kernel.h>
7 #include <linux/types.h>
8 #include <linux/init.h>
9 #include <linux/platform_device.h>
10 #include <linux/mtd/mtd.h>
11 #include <linux/mtd/map.h>
12 #include <linux/mtd/physmap.h>
13 #include <linux/mtd/partitions.h>
14 #include <asm/mach-types.h>
15 #include <asm/mach/arch.h>
20 * The SG310 machine type is fitted with a conventional 8MB Strataflash
21 * device. Define its partitioning.
23 #define FL_BASE 0x02000000
26 static struct mtd_partition sg_mtd_partitions
[] = {
28 .name
= "SnapGear Boot Loader",
32 .name
= "SnapGear non-volatile configuration",
37 .name
= "SnapGear image",
38 .offset
= SZ_512K
+ SZ_256K
,
41 .name
= "SnapGear StrataFlash",
44 .name
= "SnapGear Boot Tags",
50 static struct physmap_flash_data sg_mtd_pdata
= {
52 .nr_parts
= ARRAY_SIZE(sg_mtd_partitions
),
53 .parts
= sg_mtd_partitions
,
57 static struct resource sg_mtd_resource
[] = {
60 .end
= FL_BASE
+ FL_SIZE
- 1,
61 .flags
= IORESOURCE_MEM
,
65 static struct platform_device sg_mtd_device
= {
66 .name
= "physmap-flash",
68 .num_resources
= ARRAY_SIZE(sg_mtd_resource
),
69 .resource
= sg_mtd_resource
,
71 .platform_data
= &sg_mtd_pdata
,
75 static void __init
sg_init(void)
77 ks8695_add_device_lan();
78 ks8695_add_device_wan();
80 if (machine_is_sg310())
81 platform_device_register(&sg_mtd_device
);
84 #ifdef CONFIG_MACH_LITE300
85 MACHINE_START(LITE300
, "SecureComputing/SG300")
88 .map_io
= ks8695_map_io
,
89 .init_irq
= ks8695_init_irq
,
90 .init_machine
= sg_init
,
91 .init_time
= ks8695_timer_init
,
92 .restart
= ks8695_restart
,
96 #ifdef CONFIG_MACH_SG310
97 MACHINE_START(SG310
, "McAfee/SG310")
100 .map_io
= ks8695_map_io
,
101 .init_irq
= ks8695_init_irq
,
102 .init_machine
= sg_init
,
103 .init_time
= ks8695_timer_init
,
104 .restart
= ks8695_restart
,
108 #ifdef CONFIG_MACH_SE4200
109 MACHINE_START(SE4200
, "SecureComputing/SE4200")
111 .atag_offset
= 0x100,
112 .map_io
= ks8695_map_io
,
113 .init_irq
= ks8695_init_irq
,
114 .init_machine
= sg_init
,
115 .init_time
= ks8695_timer_init
,
116 .restart
= ks8695_restart
,