|
@@ -11,6 +11,7 @@
|
|
#include <linux/etherdevice.h>
|
|
#include <linux/etherdevice.h>
|
|
#include <linux/init.h>
|
|
#include <linux/init.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/kernel.h>
|
|
|
|
+#include <linux/leds.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/string.h>
|
|
#include <linux/string.h>
|
|
#include <linux/types.h>
|
|
#include <linux/types.h>
|
|
@@ -120,6 +121,65 @@ static void __init set_hw_addr(struct platform_device *pdev)
|
|
clk_put(pclk);
|
|
clk_put(pclk);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#ifdef CONFIG_BOARD_ATSTK1002_J2_LED
|
|
|
|
+
|
|
|
|
+static struct gpio_led stk_j2_led[] = {
|
|
|
|
+#ifdef CONFIG_BOARD_ATSTK1002_J2_LED8
|
|
|
|
+#define LEDSTRING "J2 jumpered to LED8"
|
|
|
|
+ { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), },
|
|
|
|
+ { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), },
|
|
|
|
+ { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), },
|
|
|
|
+ { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), },
|
|
|
|
+ { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), },
|
|
|
|
+ { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), },
|
|
|
|
+ { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), },
|
|
|
|
+ { .name = "led7:amber", .gpio = GPIO_PIN_PB(30),
|
|
|
|
+ .default_trigger = "heartbeat", },
|
|
|
|
+#else /* RGB */
|
|
|
|
+#define LEDSTRING "J2 jumpered to RGB LEDs"
|
|
|
|
+ { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), },
|
|
|
|
+ { .name = "g1:green", .gpio = GPIO_PIN_PB(10), },
|
|
|
|
+ { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), },
|
|
|
|
+
|
|
|
|
+ { .name = "r2:red", .gpio = GPIO_PIN_PB( 9),
|
|
|
|
+ .default_trigger = "heartbeat", },
|
|
|
|
+ { .name = "g2:green", .gpio = GPIO_PIN_PB(13), },
|
|
|
|
+ { .name = "b2:blue", .gpio = GPIO_PIN_PB(15),
|
|
|
|
+ .default_trigger = "heartbeat", },
|
|
|
|
+ /* PB16, PB30 unused */
|
|
|
|
+#endif
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct gpio_led_platform_data stk_j2_led_data = {
|
|
|
|
+ .num_leds = ARRAY_SIZE(stk_j2_led),
|
|
|
|
+ .leds = stk_j2_led,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct platform_device stk_j2_led_dev = {
|
|
|
|
+ .name = "leds-gpio",
|
|
|
|
+ .id = 2, /* gpio block J2 */
|
|
|
|
+ .dev = {
|
|
|
|
+ .platform_data = &stk_j2_led_data,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static void setup_j2_leds(void)
|
|
|
|
+{
|
|
|
|
+ unsigned i;
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < ARRAY_SIZE(stk_j2_led); i++)
|
|
|
|
+ at32_select_gpio(stk_j2_led[i].gpio, AT32_GPIOF_OUTPUT);
|
|
|
|
+
|
|
|
|
+ printk("STK1002: " LEDSTRING "\n");
|
|
|
|
+ platform_device_register(&stk_j2_led_dev);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#else
|
|
|
|
+static void setup_j2_leds(void)
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
void __init setup_board(void)
|
|
void __init setup_board(void)
|
|
{
|
|
{
|
|
#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
|
|
#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
|
|
@@ -185,6 +245,8 @@ static int __init atstk1002_init(void)
|
|
at32_add_device_ssc(0, ATMEL_SSC_TX);
|
|
at32_add_device_ssc(0, ATMEL_SSC_TX);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+ setup_j2_leds();
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
postcore_initcall(atstk1002_init);
|
|
postcore_initcall(atstk1002_init);
|