Root/target/linux/kirkwood/files/arch/arm/mach-kirkwood/goflexnet-setup.c

1/*
2 * arch/arm/mach-kirkwood/goflexnet-setup.c
3 *
4 * Seagate GoFlex Net 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 "common.h"
23#include "mpp.h"
24
25static struct mtd_partition goflexnet_nand_parts[] = {
26    {
27        .name = "u-boot",
28        .offset = 0,
29        .size = SZ_1M
30    }, {
31        .name = "uImage",
32        .offset = MTDPART_OFS_NXTBLK,
33        .size = SZ_4M
34    }, {
35        .name = "rootfs",
36        .offset = MTDPART_OFS_NXTBLK,
37        .size = SZ_32M
38    }, {
39        .name = "data",
40        .offset = MTDPART_OFS_NXTBLK,
41        .size = MTDPART_SIZ_FULL
42    },
43};
44
45static struct mv643xx_eth_platform_data goflexnet_ge00_data = {
46    .phy_addr = MV643XX_ETH_PHY_ADDR(0),
47};
48
49static struct mv_sata_platform_data goflexnet_sata_data = {
50    .n_ports = 2,
51};
52
53static struct gpio_led goflexnet_led_pins[] = {
54    {
55        .name = "status:green:health",
56        .default_trigger = "default-on",
57        .gpio = 46, // 0x4000
58        .active_low = 1,
59    },
60    {
61        .name = "status:orange:fault",
62        .default_trigger = "none",
63        .gpio = 47, // 0x8000
64        .active_low = 1,
65    },
66    {
67        .name = "status:white:left0",
68        .default_trigger = "none",
69        .gpio = 42, // 0x0400
70        .active_low = 0,
71    },
72    {
73        .name = "status:white:left1",
74        .default_trigger = "none",
75        .gpio = 43, // 0x0800
76        .active_low = 0,
77    },
78    {
79        .name = "status:white:left2",
80        .default_trigger = "none",
81        .gpio = 44, // 0x1000
82        .active_low = 0,
83    },
84    {
85        .name = "status:white:left3",
86        .default_trigger = "none",
87        .gpio = 45, // 0x2000
88        .active_low = 0,
89    },
90    {
91        .name = "status:white:right0",
92        .default_trigger = "none",
93        .gpio = 38, // 0x0040
94        .active_low = 0,
95    },
96    {
97        .name = "status:white:right1",
98        .default_trigger = "none",
99        .gpio = 39, // 0x0080
100        .active_low = 0,
101    },
102    {
103        .name = "status:white:right2",
104        .default_trigger = "none",
105        .gpio = 40, // 0x0100
106        .active_low = 0,
107    },
108    {
109        .name = "status:white:right3",
110        .default_trigger = "none",
111        .gpio = 41, // 0x0200
112        .active_low = 0,
113    }
114};
115
116static struct gpio_led_platform_data goflexnet_led_data = {
117    .leds = goflexnet_led_pins,
118    .num_leds = ARRAY_SIZE(goflexnet_led_pins),
119};
120
121static struct platform_device goflexnet_leds = {
122    .name = "leds-gpio",
123    .id = -1,
124    .dev = {
125        .platform_data = &goflexnet_led_data,
126    }
127};
128
129static unsigned int goflexnet_mpp_config[] __initdata = {
130    MPP29_GPIO, /* USB Power Enable */
131    MPP47_GPIO, /* LED Orange */
132    MPP46_GPIO, /* LED Green */
133    MPP45_GPIO, /* LED Left Capacity 3 */
134    MPP44_GPIO, /* LED Left Capacity 2 */
135    MPP43_GPIO, /* LED Left Capacity 1 */
136    MPP42_GPIO, /* LED Left Capacity 0 */
137    MPP41_GPIO, /* LED Right Capacity 3 */
138    MPP40_GPIO, /* LED Right Capacity 2 */
139    MPP39_GPIO, /* LED Right Capacity 1 */
140    MPP38_GPIO, /* LED Right Capacity 0 */
141    0
142};
143
144static void __init goflexnet_init(void)
145{
146    /*
147     * Basic setup. Needs to be called early.
148     */
149    kirkwood_init();
150
151    /* setup gpio pin select */
152    kirkwood_mpp_conf(goflexnet_mpp_config);
153
154    kirkwood_uart0_init();
155    kirkwood_nand_init(ARRAY_AND_SIZE(goflexnet_nand_parts), 40);
156
157    if (gpio_request(29, "USB Power Enable") != 0 ||
158        gpio_direction_output(29, 1) != 0)
159        printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
160    kirkwood_ehci_init();
161    kirkwood_ge00_init(&goflexnet_ge00_data);
162    kirkwood_sata_init(&goflexnet_sata_data);
163
164    platform_device_register(&goflexnet_leds);
165}
166
167MACHINE_START(GOFLEXNET, "Seagate GoFlex Net")
168    /* Maintainer: Peter Carmichael <peterjncarm@ovi.com> */
169    .atag_offset = 0x100,
170    .init_machine = goflexnet_init,
171    .map_io = kirkwood_map_io,
172    .init_early = kirkwood_init_early,
173    .init_irq = kirkwood_init_irq,
174    .timer = &kirkwood_timer,
175    .restart = kirkwood_restart,
176MACHINE_END
177

Archive Download this file



interactive