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