1
2
3
4
5
6
7
8
9
10
11
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/pci.h>
17#include <linux/irq.h>
18#include <linux/leds.h>
19#include <linux/gpio.h>
20#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
22#include <asm/mach/pci.h>
23#include <plat/orion-gpio.h>
24#include "common.h"
25#include "orion5x.h"
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#define D2NET_GPIO_RED_LED 6
54#define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16
55#define D2NET_GPIO_BLUE_LED_OFF 23
56
57static struct gpio_led d2net_leds[] = {
58 {
59 .name = "d2net:blue:sata",
60 .default_trigger = "default-on",
61 .gpio = D2NET_GPIO_BLUE_LED_OFF,
62 .active_low = 1,
63 },
64 {
65 .name = "d2net:red:fail",
66 .gpio = D2NET_GPIO_RED_LED,
67 },
68};
69
70static struct gpio_led_platform_data d2net_led_data = {
71 .num_leds = ARRAY_SIZE(d2net_leds),
72 .leds = d2net_leds,
73};
74
75static struct platform_device d2net_gpio_leds = {
76 .name = "leds-gpio",
77 .id = -1,
78 .dev = {
79 .platform_data = &d2net_led_data,
80 },
81};
82
83static void __init d2net_gpio_leds_init(void)
84{
85 int err;
86
87
88 err = gpio_request(D2NET_GPIO_BLUE_LED_BLINK_CTRL, "blue LED blink");
89 if (err == 0) {
90 err = gpio_direction_output(D2NET_GPIO_BLUE_LED_BLINK_CTRL, 1);
91 if (err)
92 gpio_free(D2NET_GPIO_BLUE_LED_BLINK_CTRL);
93 }
94 if (err)
95 pr_err("d2net: failed to configure blue LED blink GPIO\n");
96
97 platform_device_register(&d2net_gpio_leds);
98}
99
100
101
102
103
104void __init d2net_init(void)
105{
106 d2net_gpio_leds_init();
107
108 pr_notice("d2net: Flash write are not yet supported.\n");
109}
110