]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-am335x-joel-3.1/0001-am335x-evm-hack-in-LED-support-for-beaglebone.patch
a13af3c7d33d43f689e9fe4188ca5350801d2ef2
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-am335x-joel-3.1 / 0001-am335x-evm-hack-in-LED-support-for-beaglebone.patch
1 From ed2b4469ce07a6e3aec681a26010753c1e20551f Mon Sep 17 00:00:00 2001
2 From: Koen Kooi <koen@dominion.thruhere.net>
3 Date: Fri, 7 Oct 2011 14:39:31 +0200
4 Subject: [PATCH] am335x-evm: hack in LED support for beaglebone
6 Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
7 ---
8  arch/arm/mach-omap2/board-am335xevm.c |   63 +++++++++++++++++++++++++++++++++
9  1 files changed, 63 insertions(+), 0 deletions(-)
11 diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
12 index 0f47b65..82804a9 100644
13 --- a/arch/arm/mach-omap2/board-am335xevm.c
14 +++ b/arch/arm/mach-omap2/board-am335xevm.c
15 @@ -17,6 +17,7 @@
16  #include <linux/i2c.h>
17  #include <linux/i2c/at24.h>
18  #include <linux/gpio.h>
19 +#include <linux/leds.h>
20  #include <linux/mtd/mtd.h>
21  #include <linux/mtd/nand.h>
22  #include <linux/mtd/partitions.h>
23 @@ -559,6 +560,58 @@ static struct pinmux_config usb1_pin_mux[] = {
24         {NULL, 0},
25  };
26  
27 +/* LEDS - gpio1_21 -> gpio1_24 */
28 +
29 +#define BEAGLEBONE_USR1_LED  GPIO_TO_PIN(1, 21)
30 +#define BEAGLEBONE_USR2_LED  GPIO_TO_PIN(1, 22)
31 +#define BEAGLEBONE_USR3_LED  GPIO_TO_PIN(1, 23)
32 +#define BEAGLEBONE_USR4_LED  GPIO_TO_PIN(1, 24)
33 +
34 +static struct gpio_led gpio_leds[] = {
35 +       {
36 +               .name                   = "beaglebone::usr0",
37 +               .default_trigger        = "heartbeat",
38 +               .gpio                   = BEAGLEBONE_USR1_LED,
39 +       },
40 +       {
41 +               .name                   = "beaglebone::usr1",
42 +               .default_trigger        = "mmc0",
43 +               .gpio                   = BEAGLEBONE_USR2_LED,
44 +       },
45 +       {
46 +               .name                   = "beaglebone::usr2",
47 +               .gpio                   = BEAGLEBONE_USR3_LED,
48 +       },
49 +       {
50 +               .name           = "beaglebone::usr3",
51 +               .gpio           = BEAGLEBONE_USR4_LED,
52 +       },
53 +};
54 +
55 +static struct gpio_led_platform_data gpio_led_info = {
56 +       .leds           = gpio_leds,
57 +       .num_leds       = ARRAY_SIZE(gpio_leds),
58 +};
59 +
60 +static struct platform_device leds_gpio = {
61 +       .name   = "leds-gpio",
62 +       .id     = -1,
63 +       .dev    = {
64 +               .platform_data  = &gpio_led_info,
65 +       },
66 +};
67 +
68 +static struct platform_device *bone_devices[] __initdata = {
69 +                   &leds_gpio,
70 +};
71 +
72 +static struct pinmux_config boneled_pin_mux[] = {
73 +    {"gpmc_a5.rgmii2_td0", OMAP_MUX_MODE7 | AM335X_PIN_OUTPUT}, // gpio 21
74 +    {"gpmc_a6.rgmii2_tclk", OMAP_MUX_MODE7 | AM335X_PIN_OUTPUT}, // gpio22
75 +    {"gpmc_a7.rgmii2_rclk", OMAP_MUX_MODE7 | AM335X_PIN_OUTPUT}, // gpio23
76 +    {"gpmc_a8.rgmii2_rd3", OMAP_MUX_MODE7 | AM335X_PIN_OUTPUT}, // gpio 24
77 +};
78 +
79  /* Module pin mux for eCAP0 */
80  static struct pinmux_config ecap0_pin_mux[] = {
81         {"ecap0_in_pwm0_out.gpio0_7", AM335X_PIN_OUTPUT},
82 @@ -631,6 +684,15 @@ static void tsc_init(int evm_id, int profile)
83                 pr_err("failed to register touchscreen device\n");
84  }
85  
86 +static void bone_leds_init(int evm_id, int profil )
87 +{
88 +       int err;
89 +       setup_pin_mux(boneled_pin_mux);
90 +       err = platform_add_devices(bone_devices, ARRAY_SIZE(bone_devices));
91 +       if (err)
92 +               pr_err("failed to register LEDS\n");
93 +}
94 +
95  static void rgmii1_init(int evm_id, int profile)
96  {
97         setup_pin_mux(rgmii1_pin_mux);
98 @@ -844,6 +906,7 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = {
99         {usb1_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
100         {mmc0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
101         {i2c1_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
102 +       {bone_leds_init,  DEV_ON_BASEBOARD, PROFILE_ALL},
103         {NULL, 0, 0},
104  };
105  
106 -- 
107 1.6.6.1