Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
awilliam
GitHub Repository: awilliam/linux-vfio
Path: blob/master/arch/arm/mach-kirkwood/sheevaplug-setup.c
10817 views
1
/*
2
* arch/arm/mach-kirkwood/sheevaplug-setup.c
3
*
4
* Marvell SheevaPlug Reference Board Setup
5
*
6
* This file is licensed under the terms of the GNU General Public
7
* License version 2. This program is licensed "as is" without any
8
* warranty of any kind, whether express or implied.
9
*/
10
11
#include <linux/kernel.h>
12
#include <linux/init.h>
13
#include <linux/platform_device.h>
14
#include <linux/ata_platform.h>
15
#include <linux/mtd/partitions.h>
16
#include <linux/mv643xx_eth.h>
17
#include <linux/gpio.h>
18
#include <linux/leds.h>
19
#include <asm/mach-types.h>
20
#include <asm/mach/arch.h>
21
#include <mach/kirkwood.h>
22
#include <plat/mvsdio.h>
23
#include "common.h"
24
#include "mpp.h"
25
26
static struct mtd_partition sheevaplug_nand_parts[] = {
27
{
28
.name = "u-boot",
29
.offset = 0,
30
.size = SZ_1M
31
}, {
32
.name = "uImage",
33
.offset = MTDPART_OFS_NXTBLK,
34
.size = SZ_4M
35
}, {
36
.name = "root",
37
.offset = MTDPART_OFS_NXTBLK,
38
.size = MTDPART_SIZ_FULL
39
},
40
};
41
42
static struct mv643xx_eth_platform_data sheevaplug_ge00_data = {
43
.phy_addr = MV643XX_ETH_PHY_ADDR(0),
44
};
45
46
static struct mv_sata_platform_data sheeva_esata_sata_data = {
47
.n_ports = 2,
48
};
49
50
static struct mvsdio_platform_data sheevaplug_mvsdio_data = {
51
/* unfortunately the CD signal has not been connected */
52
};
53
54
static struct mvsdio_platform_data sheeva_esata_mvsdio_data = {
55
.gpio_write_protect = 44, /* MPP44 used as SD write protect */
56
.gpio_card_detect = 47, /* MPP47 used as SD card detect */
57
};
58
59
static struct gpio_led sheevaplug_led_pins[] = {
60
{
61
.name = "plug:red:misc",
62
.default_trigger = "none",
63
.gpio = 46,
64
.active_low = 1,
65
},
66
{
67
.name = "plug:green:health",
68
.default_trigger = "default-on",
69
.gpio = 49,
70
.active_low = 1,
71
},
72
};
73
74
static struct gpio_led_platform_data sheevaplug_led_data = {
75
.leds = sheevaplug_led_pins,
76
.num_leds = ARRAY_SIZE(sheevaplug_led_pins),
77
};
78
79
static struct platform_device sheevaplug_leds = {
80
.name = "leds-gpio",
81
.id = -1,
82
.dev = {
83
.platform_data = &sheevaplug_led_data,
84
}
85
};
86
87
static unsigned int sheevaplug_mpp_config[] __initdata = {
88
MPP29_GPIO, /* USB Power Enable */
89
MPP46_GPIO, /* LED Red */
90
MPP49_GPIO, /* LED */
91
0
92
};
93
94
static unsigned int sheeva_esata_mpp_config[] __initdata = {
95
MPP29_GPIO, /* USB Power Enable */
96
MPP44_GPIO, /* SD Write Protect */
97
MPP47_GPIO, /* SD Card Detect */
98
MPP49_GPIO, /* LED Green */
99
0
100
};
101
102
static void __init sheevaplug_init(void)
103
{
104
/*
105
* Basic setup. Needs to be called early.
106
*/
107
kirkwood_init();
108
109
/* setup gpio pin select */
110
if (machine_is_sheeva_esata())
111
kirkwood_mpp_conf(sheeva_esata_mpp_config);
112
else
113
kirkwood_mpp_conf(sheevaplug_mpp_config);
114
115
kirkwood_uart0_init();
116
kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25);
117
118
if (gpio_request(29, "USB Power Enable") != 0 ||
119
gpio_direction_output(29, 1) != 0)
120
printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
121
kirkwood_ehci_init();
122
123
kirkwood_ge00_init(&sheevaplug_ge00_data);
124
125
/* honor lower power consumption for plugs with out eSATA */
126
if (machine_is_sheeva_esata())
127
kirkwood_sata_init(&sheeva_esata_sata_data);
128
129
/* enable sd wp and sd cd on plugs with esata */
130
if (machine_is_sheeva_esata())
131
kirkwood_sdio_init(&sheeva_esata_mvsdio_data);
132
else
133
kirkwood_sdio_init(&sheevaplug_mvsdio_data);
134
135
platform_device_register(&sheevaplug_leds);
136
}
137
138
#ifdef CONFIG_MACH_SHEEVAPLUG
139
MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
140
/* Maintainer: shadi Ammouri <[email protected]> */
141
.boot_params = 0x00000100,
142
.init_machine = sheevaplug_init,
143
.map_io = kirkwood_map_io,
144
.init_early = kirkwood_init_early,
145
.init_irq = kirkwood_init_irq,
146
.timer = &kirkwood_timer,
147
MACHINE_END
148
#endif
149
150
#ifdef CONFIG_MACH_ESATA_SHEEVAPLUG
151
MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board")
152
.boot_params = 0x00000100,
153
.init_machine = sheevaplug_init,
154
.map_io = kirkwood_map_io,
155
.init_early = kirkwood_init_early,
156
.init_irq = kirkwood_init_irq,
157
.timer = &kirkwood_timer,
158
MACHINE_END
159
#endif
160
161