summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ks8695/board-sg.c
blob: d5ec85a56375536fd7a46e805938911c870a69f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// SPDX-License-Identifier: GPL-2.0-only
/*
 * board-sg.c -- support for the SnapGear KS8695 based boards
 */

#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/physmap.h>
#include <linux/mtd/partitions.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include "devices.h"
#include "generic.h"

/*
 * The SG310 machine type is fitted with a conventional 8MB Strataflash
 * device. Define its partitioning.
 */
#define	FL_BASE		0x02000000
#define	FL_SIZE		SZ_8M

static struct mtd_partition sg_mtd_partitions[] = {
	[0] = {
		.name	= "SnapGear Boot Loader",
		.size	= SZ_128K,
	},
	[1] = {
		.name	= "SnapGear non-volatile configuration",
		.size	= SZ_512K,
		.offset	= SZ_256K,
	},
	[2] = {
		.name	= "SnapGear image",
		.offset	= SZ_512K + SZ_256K,
	},
	[3] = {
		.name	= "SnapGear StrataFlash",
	},
	[4] = {
		.name	= "SnapGear Boot Tags",
		.size	= SZ_128K,
		.offset	= SZ_128K,
	},
};

static struct physmap_flash_data sg_mtd_pdata = {
	.width		= 1,
	.nr_parts	= ARRAY_SIZE(sg_mtd_partitions),
	.parts		= sg_mtd_partitions,
};


static struct resource sg_mtd_resource[] = {
	[0] = {
		.start = FL_BASE,
		.end   = FL_BASE + FL_SIZE - 1,
		.flags = IORESOURCE_MEM,
	},
};

static struct platform_device sg_mtd_device = {
	.name		= "physmap-flash",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(sg_mtd_resource),
	.resource	= sg_mtd_resource,
	.dev		= {
		.platform_data = &sg_mtd_pdata,
	},
};

static void __init sg_init(void)
{
	ks8695_add_device_lan();
	ks8695_add_device_wan();

	if (machine_is_sg310())
		platform_device_register(&sg_mtd_device);
}

#ifdef CONFIG_MACH_LITE300
MACHINE_START(LITE300, "SecureComputing/SG300")
	/* SnapGear */
	.atag_offset	= 0x100,
	.map_io		= ks8695_map_io,
	.init_irq	= ks8695_init_irq,
	.init_machine	= sg_init,
	.init_time	= ks8695_timer_init,
	.restart	= ks8695_restart,
MACHINE_END
#endif

#ifdef CONFIG_MACH_SG310
MACHINE_START(SG310, "McAfee/SG310")
	/* SnapGear */
	.atag_offset	= 0x100,
	.map_io		= ks8695_map_io,
	.init_irq	= ks8695_init_irq,
	.init_machine	= sg_init,
	.init_time	= ks8695_timer_init,
	.restart	= ks8695_restart,
MACHINE_END
#endif

#ifdef CONFIG_MACH_SE4200
MACHINE_START(SE4200, "SecureComputing/SE4200")
	/* SnapGear */
	.atag_offset	= 0x100,
	.map_io		= ks8695_map_io,
	.init_irq	= ks8695_init_irq,
	.init_machine	= sg_init,
	.init_time	= ks8695_timer_init,
	.restart	= ks8695_restart,
MACHINE_END
#endif