ti-hw-bringup-image: ship musb workaround
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.0+3.1rc / 0001-am335x-Add-pin-mux-and-init-for-beaglebone-specific-.patch
1 From 5be793dc9de7e694d9256396aecfdc136c8e2cf6 Mon Sep 17 00:00:00 2001
2 From: Joel A Fernandes <joelagnel@ti.com>
3 Date: Mon, 17 Oct 2011 02:00:39 -0400
4 Subject: [PATCH] am335x: Add pin mux and init for beaglebone specific devices
6 Currently added for following:
7   * User LEDs (added by Koen Kooi <k-kooi@ti.com>)
8   * BeagleBone tester
10 Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
11 ---
12  arch/arm/mach-omap2/board-am335xevm.c |   69 +++++++++++++++++++++++++++++++++
13  arch/arm/mach-omap2/mux33xx.c         |    2 +-
14  2 files changed, 70 insertions(+), 1 deletions(-)
16 diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
17 index f625510..6beaa23 100644
18 --- a/arch/arm/mach-omap2/board-am335xevm.c
19 +++ b/arch/arm/mach-omap2/board-am335xevm.c
20 @@ -17,6 +17,7 @@
21  #include <linux/i2c.h>
22  #include <linux/i2c/at24.h>
23  #include <linux/gpio.h>
24 +#include <linux/leds.h>
25  #include <linux/spi/spi.h>
26  #include <linux/spi/flash.h>
27  #include <linux/mtd/mtd.h>
28 @@ -590,6 +591,61 @@ static struct pinmux_config usb1_pin_mux[] = {
29         {NULL, 0},
30  };
31  
32 +/* LEDS - gpio1_21 -> gpio1_24 */
33 +
34 +#define BEAGLEBONE_USR1_LED  GPIO_TO_PIN(1, 21)
35 +#define BEAGLEBONE_USR2_LED  GPIO_TO_PIN(1, 22)
36 +#define BEAGLEBONE_USR3_LED  GPIO_TO_PIN(1, 23)
37 +#define BEAGLEBONE_USR4_LED  GPIO_TO_PIN(1, 24)
38 +
39 +static struct gpio_led gpio_leds[] = {
40 +       {
41 +               .name                   = "beaglebone::usr0",
42 +               .default_trigger        = "heartbeat",
43 +               .gpio                   = BEAGLEBONE_USR1_LED,
44 +       },
45 +       {
46 +               .name                   = "beaglebone::usr1",
47 +               .default_trigger        = "mmc0",
48 +               .gpio                   = BEAGLEBONE_USR2_LED,
49 +       },
50 +       {
51 +               .name                   = "beaglebone::usr2",
52 +               .gpio                   = BEAGLEBONE_USR3_LED,
53 +       },
54 +       {
55 +               .name           = "beaglebone::usr3",
56 +               .gpio           = BEAGLEBONE_USR4_LED,
57 +       },
58 +};
59 +
60 +static struct gpio_led_platform_data gpio_led_info = {
61 +       .leds           = gpio_leds,
62 +       .num_leds       = ARRAY_SIZE(gpio_leds),
63 +};
64 +
65 +static struct platform_device leds_gpio = {
66 +       .name   = "leds-gpio",
67 +       .id     = -1,
68 +       .dev    = {
69 +               .platform_data  = &gpio_led_info,
70 +       },
71 +};
72 +
73 +static struct platform_device *bone_devices[] __initdata = {
74 +                   &leds_gpio,
75 +};
76 +
77 +static struct pinmux_config bone_pin_mux[] = {
78 +       /* User LED gpios (gpio1_21 to gpio1_24) */
79 +    {"gpmc_a5.rgmii2_td0", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
80 +    {"gpmc_a6.rgmii2_tclk", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
81 +    {"gpmc_a7.rgmii2_rclk", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
82 +    {"gpmc_a8.rgmii2_rd3", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
83 +    /* Grounding gpio1_6 (pin 3 Conn A) signals bone tester to start diag tests */
84 +    {"gpmc_ad6.gpio1_6", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
85 +};
86 +
87  /* Module pin mux for eCAP0 */
88  static struct pinmux_config ecap0_pin_mux[] = {
89         {"ecap0_in_pwm0_out.gpio0_7", AM33XX_PIN_OUTPUT},
90 @@ -698,6 +754,18 @@ static void tsc_init(int evm_id, int profile)
91                 pr_err("failed to register touchscreen device\n");
92  }
93  
94 +/*
95 + * Initialization of BeagleBone specific devices
96 + */
97 +static void bone_init(int evm_id, int profil )
98 +{
99 +       int err;
100 +       setup_pin_mux(bone_pin_mux);
101 +       err = platform_add_devices(bone_devices, ARRAY_SIZE(bone_devices));
102 +       if (err)
103 +               pr_err("failed to register LEDS\n");
104 +}
106  static void rgmii1_init(int evm_id, int profile)
107  {
108         setup_pin_mux(rgmii1_pin_mux);
109 @@ -1103,6 +1171,7 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = {
110         {usb0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
111         {usb1_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
112         {mmc0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
113 +       {bone_init,     DEV_ON_BASEBOARD, PROFILE_ALL},
114         {NULL, 0, 0},
115  };
116  
117 diff --git a/arch/arm/mach-omap2/mux33xx.c b/arch/arm/mach-omap2/mux33xx.c
118 index 0286c4f..f09e827 100644
119 --- a/arch/arm/mach-omap2/mux33xx.c
120 +++ b/arch/arm/mach-omap2/mux33xx.c
121 @@ -49,7 +49,7 @@ static struct omap_mux __initdata am33xx_muxmodes[] = {
122                 NULL, NULL, NULL, NULL),
123         _AM33XX_MUXENTRY(GPMC_AD6, 0,
124                 "gpmc_ad6", "mmc1_dat6", NULL, NULL,
125 -               NULL, NULL, NULL, NULL),
126 +               NULL, NULL, NULL, "gpio1_6"),
127         _AM33XX_MUXENTRY(GPMC_AD7, 0,
128                 "gpmc_ad7", "mmc1_dat7", NULL, NULL,
129                 NULL, NULL, NULL, NULL),
130 -- 
131 1.7.1