0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/kernel.h>
0011 #include <linux/init.h>
0012 #include <linux/platform_device.h>
0013 #include <linux/pci.h>
0014 #include <linux/irq.h>
0015 #include <linux/leds.h>
0016 #include <linux/gpio.h>
0017 #include <asm/mach-types.h>
0018 #include <asm/mach/arch.h>
0019 #include <asm/mach/pci.h>
0020 #include <plat/orion-gpio.h>
0021 #include "common.h"
0022 #include "orion5x.h"
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 #define D2NET_GPIO_RED_LED 6
0051 #define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16
0052 #define D2NET_GPIO_BLUE_LED_OFF 23
0053
0054 static struct gpio_led d2net_leds[] = {
0055 {
0056 .name = "d2net:blue:sata",
0057 .default_trigger = "default-on",
0058 .gpio = D2NET_GPIO_BLUE_LED_OFF,
0059 .active_low = 1,
0060 },
0061 {
0062 .name = "d2net:red:fail",
0063 .gpio = D2NET_GPIO_RED_LED,
0064 },
0065 };
0066
0067 static struct gpio_led_platform_data d2net_led_data = {
0068 .num_leds = ARRAY_SIZE(d2net_leds),
0069 .leds = d2net_leds,
0070 };
0071
0072 static struct platform_device d2net_gpio_leds = {
0073 .name = "leds-gpio",
0074 .id = -1,
0075 .dev = {
0076 .platform_data = &d2net_led_data,
0077 },
0078 };
0079
0080 static void __init d2net_gpio_leds_init(void)
0081 {
0082 int err;
0083
0084
0085 err = gpio_request(D2NET_GPIO_BLUE_LED_BLINK_CTRL, "blue LED blink");
0086 if (err == 0) {
0087 err = gpio_direction_output(D2NET_GPIO_BLUE_LED_BLINK_CTRL, 1);
0088 if (err)
0089 gpio_free(D2NET_GPIO_BLUE_LED_BLINK_CTRL);
0090 }
0091 if (err)
0092 pr_err("d2net: failed to configure blue LED blink GPIO\n");
0093
0094 platform_device_register(&d2net_gpio_leds);
0095 }
0096
0097
0098
0099
0100
0101 void __init d2net_init(void)
0102 {
0103 d2net_gpio_leds_init();
0104
0105 pr_notice("d2net: Flash write are not yet supported.\n");
0106 }