1 // SPDX-License-Identifier: GPL-2.0-only
3 * arch/arm/mach-orion5x/board-d2net.c
5 * LaCie d2Network and Big Disk Network NAS setup
7 * Copyright (C) 2009 Simon Guinot <sguinot@lacie.com>
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/pci.h>
14 #include <linux/irq.h>
15 #include <linux/leds.h>
16 #include <linux/gpio.h>
17 #include <asm/mach-types.h>
18 #include <asm/mach/arch.h>
19 #include <asm/mach/pci.h>
20 #include <plat/orion-gpio.h>
24 /*****************************************************************************
25 * LaCie d2 Network Info
26 ****************************************************************************/
28 /*****************************************************************************
30 ****************************************************************************/
33 * The blue front LED is wired to the CPLD and can blink in relation with the
36 * The following array detail the different LED registers and the combination
37 * of their possible values:
39 * led_off | blink_ctrl | SATA active | LED state
43 * 0 | 1 | 0 | blink (rate 300ms)
46 * Notes: The blue and the red front LED's can't be on at the same time.
47 * Red LED have priority.
50 #define D2NET_GPIO_RED_LED 6
51 #define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16
52 #define D2NET_GPIO_BLUE_LED_OFF 23
54 static struct gpio_led d2net_leds[] = {
56 .name = "d2net:blue:sata",
57 .default_trigger = "default-on",
58 .gpio = D2NET_GPIO_BLUE_LED_OFF,
62 .name = "d2net:red:fail",
63 .gpio = D2NET_GPIO_RED_LED,
67 static struct gpio_led_platform_data d2net_led_data = {
68 .num_leds = ARRAY_SIZE(d2net_leds),
72 static struct platform_device d2net_gpio_leds = {
76 .platform_data = &d2net_led_data,
80 static void __init d2net_gpio_leds_init(void)
84 /* Configure register blink_ctrl to allow SATA activity LED blinking. */
85 err = gpio_request(D2NET_GPIO_BLUE_LED_BLINK_CTRL, "blue LED blink");
87 err = gpio_direction_output(D2NET_GPIO_BLUE_LED_BLINK_CTRL, 1);
89 gpio_free(D2NET_GPIO_BLUE_LED_BLINK_CTRL);
92 pr_err("d2net: failed to configure blue LED blink GPIO\n");
94 platform_device_register(&d2net_gpio_leds);
97 /*****************************************************************************
99 ****************************************************************************/
101 void __init d2net_init(void)
103 d2net_gpio_leds_init();
105 pr_notice("d2net: Flash write are not yet supported.\n");