blob: fdf2352d2cf8c207622119341da80f08ea14afef [file] [log] [blame]
Greg Ungerer02c5f162012-09-07 15:24:09 +10001/*
2 * board-sg.c -- support for the SnapGear KS8695 based boards
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/init.h>
12#include <linux/platform_device.h>
13#include <linux/mtd/mtd.h>
14#include <linux/mtd/map.h>
15#include <linux/mtd/physmap.h>
16#include <linux/mtd/partitions.h>
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include <mach/devices.h>
20#include "generic.h"
21
22/*
23 * The SG310 machine type is fitted with a conventional 8MB Strataflash
24 * device. Define its partitioning.
25 */
26#define FL_BASE 0x02000000
27#define FL_SIZE SZ_8M
28
29static struct mtd_partition sg_mtd_partitions[] = {
30 [0] = {
31 .name = "SnapGear Boot Loader",
32 .size = SZ_128K,
33 },
34 [1] = {
35 .name = "SnapGear non-volatile configuration",
36 .size = SZ_512K,
37 .offset = SZ_256K,
38 },
39 [2] = {
40 .name = "SnapGear image",
41 .offset = SZ_512K + SZ_256K,
42 },
43 [3] = {
44 .name = "SnapGear StrataFlash",
45 },
46 [4] = {
47 .name = "SnapGear Boot Tags",
48 .size = SZ_128K,
49 .offset = SZ_128K,
50 },
51};
52
53static struct physmap_flash_data sg_mtd_pdata = {
54 .width = 1,
55 .nr_parts = ARRAY_SIZE(sg_mtd_partitions),
56 .parts = sg_mtd_partitions,
57};
58
59
60static struct resource sg_mtd_resource[] = {
61 [0] = {
62 .start = FL_BASE,
63 .end = FL_BASE + FL_SIZE - 1,
64 .flags = IORESOURCE_MEM,
65 },
66};
67
68static struct platform_device sg_mtd_device = {
69 .name = "physmap-flash",
70 .id = 0,
71 .num_resources = ARRAY_SIZE(sg_mtd_resource),
72 .resource = sg_mtd_resource,
73 .dev = {
74 .platform_data = &sg_mtd_pdata,
75 },
76};
77
78static void __init sg_init(void)
79{
80 ks8695_add_device_lan();
81 ks8695_add_device_wan();
82
83 if (machine_is_sg310())
84 platform_device_register(&sg_mtd_device);
85}
86
87#ifdef CONFIG_MACH_LITE300
88MACHINE_START(LITE300, "SecureComputing/SG300")
89 /* SnapGear */
90 .atag_offset = 0x100,
91 .map_io = ks8695_map_io,
92 .init_irq = ks8695_init_irq,
93 .init_machine = sg_init,
Stephen Warren6bb27d72012-11-08 12:40:59 -070094 .init_time = ks8695_timer_init,
Greg Ungerer02c5f162012-09-07 15:24:09 +100095 .restart = ks8695_restart,
96MACHINE_END
97#endif
98
99#ifdef CONFIG_MACH_SG310
100MACHINE_START(SG310, "McAfee/SG310")
101 /* SnapGear */
102 .atag_offset = 0x100,
103 .map_io = ks8695_map_io,
104 .init_irq = ks8695_init_irq,
105 .init_machine = sg_init,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700106 .init_time = ks8695_timer_init,
Greg Ungerer02c5f162012-09-07 15:24:09 +1000107 .restart = ks8695_restart,
108MACHINE_END
109#endif
110
111#ifdef CONFIG_MACH_SE4200
112MACHINE_START(SE4200, "SecureComputing/SE4200")
113 /* SnapGear */
114 .atag_offset = 0x100,
115 .map_io = ks8695_map_io,
116 .init_irq = ks8695_init_irq,
117 .init_machine = sg_init,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700118 .init_time = ks8695_timer_init,
Greg Ungerer02c5f162012-09-07 15:24:09 +1000119 .restart = ks8695_restart,
120MACHINE_END
121#endif