[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / beaglebone / 0019-beaglebone-use-P8_6-gpio1_3-as-w1-bus.patch
1 From 4f40b3e2d3fa97add575cfd398fc76595d2c2141 Mon Sep 17 00:00:00 2001
2 From: Koen Kooi <koen@dominion.thruhere.net>
3 Date: Tue, 7 Feb 2012 11:01:13 +0100
4 Subject: [PATCH 19/26] beaglebone: use P8_6 (gpio1_3) as w1 bus
6 Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
7 ---
8 arch/arm/mach-omap2/board-am335xevm.c | 31 +++++++++++++++++++++++++++++++
9 1 file changed, 31 insertions(+)
11 diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
12 index 9294af5..88f07e3 100644
13 --- a/arch/arm/mach-omap2/board-am335xevm.c
14 +++ b/arch/arm/mach-omap2/board-am335xevm.c
15 @@ -38,6 +38,7 @@
16 #include <linux/pwm_backlight.h>
17 #include <linux/reboot.h>
18 #include <linux/pwm/pwm.h>
19 +#include <linux/w1-gpio.h>
21 /* LCD controller is similar to DA850 */
22 #include <video/da8xx-fb.h>
23 @@ -615,6 +616,11 @@ static struct pinmux_config bbtoys7_pin_mux[] = {
24 {NULL, 0},
25 };
27 +static struct pinmux_config w1_gpio_pin_mux[] = {
28 + {"gpmc_ad3.gpio1_3", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
29 + {NULL, 0},
30 +};
31 +
32 static struct pinmux_config tsc_pin_mux[] = {
33 {"ain0.ain0", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
34 {"ain1.ain1", OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
35 @@ -1038,6 +1044,19 @@ static struct pinmux_config profibus_pin_mux[] = {
36 {NULL, 0},
37 };
39 +#define BEAGLEBONE_W1_GPIO GPIO_TO_PIN(1, 3)
40 +
41 +static struct w1_gpio_platform_data bone_w1_gpio_pdata = {
42 + .pin = BEAGLEBONE_W1_GPIO,
43 + .is_open_drain = 0,
44 +};
45 +
46 +static struct platform_device bone_w1_device = {
47 + .name = "w1-gpio",
48 + .id = -1,
49 + .dev.platform_data = &bone_w1_gpio_pdata,
50 +};
51 +
52 /* LEDS - gpio1_21 -> gpio1_24 */
54 #define BEAGLEBONE_USR1_LED GPIO_TO_PIN(1, 21)
55 @@ -1375,6 +1394,17 @@ static void dvileds_init(int evm_id, int profile )
56 pr_err("failed to register BeagleBone DVI cape LEDS\n");
57 }
59 +static void bonew1_gpio_init(int evm_id, int profile )
60 +{
61 + int err;
62 + setup_pin_mux(w1_gpio_pin_mux);
63 + err = platform_device_register(&bone_w1_device);
64 + if (err)
65 + pr_err("failed to register w1-gpio\n");
66 + else
67 + pr_info("w1-gpio connected to P8_6\n");
68 +}
69 +
70 static void rgmii1_init(int evm_id, int profile)
71 {
72 setup_pin_mux(rgmii1_pin_mux);
73 @@ -2290,6 +2320,7 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = {
74 {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
75 {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
76 {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
77 + {bonew1_gpio_init, DEV_ON_BASEBOARD, PROFILE_ALL},
78 {NULL, 0, 0},
79 };
81 --
82 1.7.9.5