diff options
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone')
22 files changed, 2990 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0001-f_rndis-HACK-around-undefined-variables.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0001-f_rndis-HACK-around-undefined-variables.patch new file mode 100644 index 00000000..99ab48f7 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0001-f_rndis-HACK-around-undefined-variables.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From d325c3f83e6f42536678dbf317f1bbf0e3f8efc7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Fri, 7 Oct 2011 15:29:28 +0200 | ||
4 | Subject: [PATCH 01/22] f_rndis: HACK around undefined variables | ||
5 | |||
6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
7 | --- | ||
8 | drivers/usb/gadget/f_rndis.c | 4 ++-- | ||
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
10 | |||
11 | diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c | ||
12 | index 6614490..d2f1b6f 100644 | ||
13 | --- a/drivers/usb/gadget/f_rndis.c | ||
14 | +++ b/drivers/usb/gadget/f_rndis.c | ||
15 | @@ -767,11 +767,11 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | ||
16 | |||
17 | rndis_set_param_medium(rndis->config, NDIS_MEDIUM_802_3, 0); | ||
18 | rndis_set_host_mac(rndis->config, rndis->ethaddr); | ||
19 | - | ||
20 | +/* | ||
21 | if (rndis_set_param_vendor(rndis->config, vendorID, | ||
22 | manufacturer)) | ||
23 | goto fail; | ||
24 | - | ||
25 | +*/ | ||
26 | /* NOTE: all that is done without knowing or caring about | ||
27 | * the network link ... which is unavailable to this code | ||
28 | * until we're activated via set_alt(). | ||
29 | -- | ||
30 | 1.7.9.4 | ||
31 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0002-da8xx-fb-add-DVI-support-for-beaglebone.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0002-da8xx-fb-add-DVI-support-for-beaglebone.patch new file mode 100644 index 00000000..1cc88e44 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0002-da8xx-fb-add-DVI-support-for-beaglebone.patch | |||
@@ -0,0 +1,38 @@ | |||
1 | From 94e7b8b9535e83ad46a523bb5020bd9fdb352f54 Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Thu, 3 Nov 2011 17:35:50 +0100 | ||
4 | Subject: [PATCH 02/22] da8xx-fb: add DVI support for beaglebone | ||
5 | |||
6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
7 | --- | ||
8 | drivers/video/da8xx-fb.c | 14 ++++++++++++++ | ||
9 | 1 file changed, 14 insertions(+) | ||
10 | |||
11 | diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c | ||
12 | index 85eda33..dea8936 100644 | ||
13 | --- a/drivers/video/da8xx-fb.c | ||
14 | +++ b/drivers/video/da8xx-fb.c | ||
15 | @@ -271,6 +271,20 @@ static struct da8xx_panel known_lcd_panels[] = { | ||
16 | .pxl_clk = 30000000, | ||
17 | .invert_pxl_clk = 0, | ||
18 | }, | ||
19 | + [3] = { | ||
20 | + /* 1024 x 768 @ 60 Hz Reduced blanking VESA CVT 0.79M3-R */ | ||
21 | + .name = "1024x768@60", | ||
22 | + .width = 1024, | ||
23 | + .height = 768, | ||
24 | + .hfp = 48, | ||
25 | + .hbp = 80, | ||
26 | + .hsw = 32, | ||
27 | + .vfp = 3, | ||
28 | + .vbp = 15, | ||
29 | + .vsw = 4, | ||
30 | + .pxl_clk = 56000000, | ||
31 | + .invert_pxl_clk = 0, | ||
32 | + }, | ||
33 | }; | ||
34 | |||
35 | /* Enable the Raster Engine of the LCD Controller */ | ||
36 | -- | ||
37 | 1.7.9.4 | ||
38 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0003-beaglebone-rebase-everything-onto-3.2-WARNING-MEGAPA.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0003-beaglebone-rebase-everything-onto-3.2-WARNING-MEGAPA.patch new file mode 100644 index 00000000..c5b1ce0d --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0003-beaglebone-rebase-everything-onto-3.2-WARNING-MEGAPA.patch | |||
@@ -0,0 +1,552 @@ | |||
1 | From 839c23bffe07e2c955904ce3e9e3c776c1b2f88b Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Mon, 30 Jan 2012 21:30:09 +0100 | ||
4 | Subject: [PATCH 03/22] beaglebone: rebase everything onto 3.2 - WARNING | ||
5 | MEGAPATCH | ||
6 | |||
7 | --- | ||
8 | arch/arm/mach-omap2/board-am335xevm.c | 425 ++++++++++++++++++++++++++++++++- | ||
9 | 1 file changed, 414 insertions(+), 11 deletions(-) | ||
10 | |||
11 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
12 | index 8aa7e10..e0c20c5 100644 | ||
13 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
14 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
15 | @@ -19,6 +19,7 @@ | ||
16 | #include <linux/i2c/at24.h> | ||
17 | #include <linux/phy.h> | ||
18 | #include <linux/gpio.h> | ||
19 | +#include <linux/leds.h> | ||
20 | #include <linux/spi/spi.h> | ||
21 | #include <linux/spi/flash.h> | ||
22 | #include <linux/gpio_keys.h> | ||
23 | @@ -167,6 +168,66 @@ struct da8xx_lcdc_platform_data TFC_S9700RTWV35TR_01B_pdata = { | ||
24 | |||
25 | #include "common.h" | ||
26 | |||
27 | +static const struct display_panel bbtoys7_panel = { | ||
28 | + WVGA, | ||
29 | + 16, | ||
30 | + 16, | ||
31 | + COLOR_ACTIVE, | ||
32 | +}; | ||
33 | + | ||
34 | +static struct lcd_ctrl_config bbtoys7_cfg = { | ||
35 | + &bbtoys7_panel, | ||
36 | + .ac_bias = 255, | ||
37 | + .ac_bias_intrpt = 0, | ||
38 | + .dma_burst_sz = 16, | ||
39 | + .bpp = 16, | ||
40 | + .fdd = 0x80, | ||
41 | + .tft_alt_mode = 0, | ||
42 | + .stn_565_mode = 0, | ||
43 | + .mono_8bit_mode = 0, | ||
44 | + .invert_line_clock = 1, | ||
45 | + .invert_frm_clock = 1, | ||
46 | + .sync_edge = 0, | ||
47 | + .sync_ctrl = 1, | ||
48 | + .raster_order = 0, | ||
49 | +}; | ||
50 | + | ||
51 | +struct da8xx_lcdc_platform_data bbtoys7_pdata = { | ||
52 | + .manu_name = "ThreeFive", | ||
53 | + .controller_data = &bbtoys7_cfg, | ||
54 | + .type = "TFC_S9700RTWV35TR_01B", | ||
55 | +}; | ||
56 | + | ||
57 | +static const struct display_panel dvi_panel = { | ||
58 | + WVGA, | ||
59 | + 16, | ||
60 | + 16, | ||
61 | + COLOR_ACTIVE, | ||
62 | +}; | ||
63 | + | ||
64 | +static struct lcd_ctrl_config dvi_cfg = { | ||
65 | + &dvi_panel, | ||
66 | + .ac_bias = 255, | ||
67 | + .ac_bias_intrpt = 0, | ||
68 | + .dma_burst_sz = 16, | ||
69 | + .bpp = 16, | ||
70 | + .fdd = 0x80, | ||
71 | + .tft_alt_mode = 0, | ||
72 | + .stn_565_mode = 0, | ||
73 | + .mono_8bit_mode = 0, | ||
74 | + .invert_line_clock = 1, | ||
75 | + .invert_frm_clock = 1, | ||
76 | + .sync_edge = 0, | ||
77 | + .sync_ctrl = 1, | ||
78 | + .raster_order = 0, | ||
79 | +}; | ||
80 | + | ||
81 | +struct da8xx_lcdc_platform_data dvi_pdata = { | ||
82 | + .manu_name = "BBToys", | ||
83 | + .controller_data = &dvi_cfg, | ||
84 | + .type = "1024x768@60", | ||
85 | +}; | ||
86 | + | ||
87 | /* TSc controller */ | ||
88 | #include <linux/input/ti_tscadc.h> | ||
89 | #include <linux/lis3lv02d.h> | ||
90 | @@ -320,9 +381,34 @@ struct am335x_evm_eeprom_config { | ||
91 | static struct am335x_evm_eeprom_config config; | ||
92 | static bool daughter_brd_detected; | ||
93 | |||
94 | -#define GP_EVM_REV_IS_1_0 0x1 | ||
95 | +struct beaglebone_cape_eeprom_config { | ||
96 | + u32 header; | ||
97 | + char format_revision[2]; | ||
98 | + char name[32]; | ||
99 | + char version[4]; | ||
100 | + char manufacturer[16]; | ||
101 | + char partnumber[16]; | ||
102 | + u16 numpins; | ||
103 | + char serial[12]; | ||
104 | + u8 muxdata[170]; | ||
105 | + u16 current_3v3; | ||
106 | + u16 current_vdd5v; | ||
107 | + u16 current_sys5v; | ||
108 | + u16 dc; | ||
109 | +}; | ||
110 | + | ||
111 | +static struct beaglebone_cape_eeprom_config cape_config; | ||
112 | +static bool beaglebone_cape_detected; | ||
113 | + | ||
114 | +/* keep track of ADC pin usage */ | ||
115 | +static int capecount = 0; | ||
116 | +static bool beaglebone_tsadcpins_free = 1; | ||
117 | + | ||
118 | + | ||
119 | +#define GP_EVM_REV_IS_1_0A 0x1 | ||
120 | #define GP_EVM_REV_IS_1_1A 0x2 | ||
121 | #define GP_EVM_REV_IS_UNKNOWN 0xFF | ||
122 | +#define GP_EVM_ACTUALLY_BEAGLEBONE 0xBB | ||
123 | static unsigned int gp_evm_revision = GP_EVM_REV_IS_UNKNOWN; | ||
124 | unsigned int gigabit_enable = 1; | ||
125 | |||
126 | @@ -404,11 +490,102 @@ static struct pinmux_config lcdc_pin_mux[] = { | ||
127 | {NULL, 0}, | ||
128 | }; | ||
129 | |||
130 | +/* Module pin mux for Beagleboardtoys DVI cape */ | ||
131 | +static struct pinmux_config dvi_pin_mux[] = { | ||
132 | + {"lcd_data0.lcd_data0", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
133 | + | AM33XX_PULL_DISA}, | ||
134 | + {"lcd_data1.lcd_data1", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
135 | + | AM33XX_PULL_DISA}, | ||
136 | + {"lcd_data2.lcd_data2", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
137 | + | AM33XX_PULL_DISA}, | ||
138 | + {"lcd_data3.lcd_data3", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
139 | + | AM33XX_PULL_DISA}, | ||
140 | + {"lcd_data4.lcd_data4", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
141 | + | AM33XX_PULL_DISA}, | ||
142 | + {"lcd_data5.lcd_data5", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
143 | + | AM33XX_PULL_DISA}, | ||
144 | + {"lcd_data6.lcd_data6", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
145 | + | AM33XX_PULL_DISA}, | ||
146 | + {"lcd_data7.lcd_data7", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
147 | + | AM33XX_PULL_DISA}, | ||
148 | + {"lcd_data8.lcd_data8", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
149 | + | AM33XX_PULL_DISA}, | ||
150 | + {"lcd_data9.lcd_data9", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
151 | + | AM33XX_PULL_DISA}, | ||
152 | + {"lcd_data10.lcd_data10", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
153 | + | AM33XX_PULL_DISA}, | ||
154 | + {"lcd_data11.lcd_data11", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
155 | + | AM33XX_PULL_DISA}, | ||
156 | + {"lcd_data12.lcd_data12", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
157 | + | AM33XX_PULL_DISA}, | ||
158 | + {"lcd_data13.lcd_data13", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
159 | + | AM33XX_PULL_DISA}, | ||
160 | + {"lcd_data14.lcd_data14", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
161 | + | AM33XX_PULL_DISA}, | ||
162 | + {"lcd_data15.lcd_data15", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
163 | + | AM33XX_PULL_DISA}, | ||
164 | + {"lcd_vsync.lcd_vsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
165 | + {"lcd_hsync.lcd_hsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
166 | + {"lcd_pclk.lcd_pclk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
167 | + {"lcd_ac_bias_en.lcd_ac_bias_en", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
168 | + {"gpmc_a2.rgmii2_td3", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // USR0 LED | ||
169 | + {"gpmc_a3.rgmii2_td2", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // USR1 LED | ||
170 | + {"gpmc_ad7.gpmc_ad7", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // DVI PDn | ||
171 | + {NULL, 0}, | ||
172 | +}; | ||
173 | + | ||
174 | +/* Module pin mux for Beagleboardtoys 7" LCD cape */ | ||
175 | +static struct pinmux_config bbtoys7_pin_mux[] = { | ||
176 | + {"lcd_data0.lcd_data0", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
177 | + | AM33XX_PULL_DISA}, | ||
178 | + {"lcd_data1.lcd_data1", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
179 | + | AM33XX_PULL_DISA}, | ||
180 | + {"lcd_data2.lcd_data2", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
181 | + | AM33XX_PULL_DISA}, | ||
182 | + {"lcd_data3.lcd_data3", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
183 | + | AM33XX_PULL_DISA}, | ||
184 | + {"lcd_data4.lcd_data4", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
185 | + | AM33XX_PULL_DISA}, | ||
186 | + {"lcd_data5.lcd_data5", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
187 | + | AM33XX_PULL_DISA}, | ||
188 | + {"lcd_data6.lcd_data6", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
189 | + | AM33XX_PULL_DISA}, | ||
190 | + {"lcd_data7.lcd_data7", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
191 | + | AM33XX_PULL_DISA}, | ||
192 | + {"lcd_data8.lcd_data8", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
193 | + | AM33XX_PULL_DISA}, | ||
194 | + {"lcd_data9.lcd_data9", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
195 | + | AM33XX_PULL_DISA}, | ||
196 | + {"lcd_data10.lcd_data10", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
197 | + | AM33XX_PULL_DISA}, | ||
198 | + {"lcd_data11.lcd_data11", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
199 | + | AM33XX_PULL_DISA}, | ||
200 | + {"lcd_data12.lcd_data12", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
201 | + | AM33XX_PULL_DISA}, | ||
202 | + {"lcd_data13.lcd_data13", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
203 | + | AM33XX_PULL_DISA}, | ||
204 | + {"lcd_data14.lcd_data14", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
205 | + | AM33XX_PULL_DISA}, | ||
206 | + {"lcd_data15.lcd_data15", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | ||
207 | + | AM33XX_PULL_DISA}, | ||
208 | + {"lcd_vsync.lcd_vsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
209 | + {"lcd_hsync.lcd_hsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
210 | + {"lcd_pclk.lcd_pclk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
211 | + {"lcd_ac_bias_en.lcd_ac_bias_en", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
212 | + {"gpmc_a2.gpio1_18", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // Backlight | ||
213 | + {"ecap0_in_pwm0_out.gpio0_7", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // AVDD_EN | ||
214 | + {NULL, 0}, | ||
215 | +}; | ||
216 | + | ||
217 | static struct pinmux_config tsc_pin_mux[] = { | ||
218 | {"ain0.ain0", OMAP_MUX_MODE0 | AM33XX_INPUT_EN}, | ||
219 | {"ain1.ain1", OMAP_MUX_MODE0 | AM33XX_INPUT_EN}, | ||
220 | {"ain2.ain2", OMAP_MUX_MODE0 | AM33XX_INPUT_EN}, | ||
221 | {"ain3.ain3", OMAP_MUX_MODE0 | AM33XX_INPUT_EN}, | ||
222 | + {"ain4.ain4", OMAP_MUX_MODE0 | AM33XX_INPUT_EN}, | ||
223 | + {"ain5.ain5", OMAP_MUX_MODE0 | AM33XX_INPUT_EN}, | ||
224 | + {"ain6.ain6", OMAP_MUX_MODE0 | AM33XX_INPUT_EN}, | ||
225 | + {"ain7.ain7", OMAP_MUX_MODE0 | AM33XX_INPUT_EN}, | ||
226 | {"vrefp.vrefp", OMAP_MUX_MODE0 | AM33XX_INPUT_EN}, | ||
227 | {"vrefn.vrefn", OMAP_MUX_MODE0 | AM33XX_INPUT_EN}, | ||
228 | {NULL, 0}, | ||
229 | @@ -543,9 +720,9 @@ static struct pinmux_config i2c1_pin_mux[] = { | ||
230 | |||
231 | static struct pinmux_config i2c2_pin_mux[] = { | ||
232 | {"uart1_ctsn.i2c2_sda", OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW | | ||
233 | - AM33XX_PULL_UP | AM33XX_INPUT_EN}, | ||
234 | + AM33XX_PIN_INPUT_PULLUP}, | ||
235 | {"uart1_rtsn.i2c2_scl", OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW | | ||
236 | - AM33XX_PULL_UP | AM33XX_INPUT_EN}, | ||
237 | + AM33XX_PIN_INPUT_PULLUP}, | ||
238 | {NULL, 0}, | ||
239 | }; | ||
240 | |||
241 | @@ -823,6 +1000,64 @@ static struct pinmux_config profibus_pin_mux[] = { | ||
242 | {NULL, 0}, | ||
243 | }; | ||
244 | |||
245 | + | ||
246 | +#define BEAGLEBONEDVI_USR0_LED GPIO_TO_PIN(1, 18) | ||
247 | +#define BEAGLEBONEDVI_USR1_LED GPIO_TO_PIN(1, 19) | ||
248 | + | ||
249 | +static struct gpio_led dvi_gpio_leds[] = { | ||
250 | + { | ||
251 | + .name = "beaglebone::usr0", | ||
252 | + .default_trigger = "heartbeat", | ||
253 | + .gpio = BEAGLEBONE_USR1_LED, | ||
254 | + }, | ||
255 | + { | ||
256 | + .name = "beaglebone::usr1", | ||
257 | + .default_trigger = "mmc0", | ||
258 | + .gpio = BEAGLEBONE_USR2_LED, | ||
259 | + }, | ||
260 | + { | ||
261 | + .name = "beaglebone::usr2", | ||
262 | + .gpio = BEAGLEBONE_USR3_LED, | ||
263 | + }, | ||
264 | + { | ||
265 | + .name = "beaglebone::usr3", | ||
266 | + .gpio = BEAGLEBONE_USR4_LED, | ||
267 | + }, | ||
268 | + { | ||
269 | + .name = "dvi::usr0", | ||
270 | + .default_trigger = "heartbeat", | ||
271 | + .gpio = BEAGLEBONEDVI_USR0_LED, | ||
272 | + }, | ||
273 | + { | ||
274 | + .name = "dvi::usr1", | ||
275 | + .default_trigger = "mmc0", | ||
276 | + .gpio = BEAGLEBONEDVI_USR1_LED, | ||
277 | + }, | ||
278 | +}; | ||
279 | + | ||
280 | +static struct gpio_led_platform_data dvi_gpio_led_info = { | ||
281 | + .leds = dvi_gpio_leds, | ||
282 | + .num_leds = ARRAY_SIZE(dvi_gpio_leds), | ||
283 | +}; | ||
284 | + | ||
285 | +static struct platform_device dvi_leds_gpio = { | ||
286 | + .name = "leds-gpio", | ||
287 | + .id = -1, | ||
288 | + .dev = { | ||
289 | + .platform_data = &dvi_gpio_led_info, | ||
290 | + }, | ||
291 | +}; | ||
292 | + | ||
293 | +static struct pinmux_config bone_pin_mux[] = { | ||
294 | + /* User LED gpios (gpio1_21 to gpio1_24) */ | ||
295 | + {"gpmc_a5.rgmii2_td0", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, | ||
296 | + {"gpmc_a6.rgmii2_tclk", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, | ||
297 | + {"gpmc_a7.rgmii2_rclk", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, | ||
298 | + {"gpmc_a8.rgmii2_rd3", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, | ||
299 | + /* Grounding gpio1_6 (pin 3 Conn A) signals bone tester to start diag tests */ | ||
300 | + {"gpmc_ad6.gpio1_6", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP}, | ||
301 | +}; | ||
302 | + | ||
303 | /* Module pin mux for eCAP0 */ | ||
304 | static struct pinmux_config ecap0_pin_mux[] = { | ||
305 | {"ecap0_in_pwm0_out.ecap0_in_pwm0_out", | ||
306 | @@ -932,6 +1167,51 @@ static void lcdc_init(int evm_id, int profile) | ||
307 | return; | ||
308 | } | ||
309 | |||
310 | +#define BEAGLEBONE_LCD_AVDD_EN GPIO_TO_PIN(0, 7) | ||
311 | +#define BEAGLEBONE_LCD_BL GPIO_TO_PIN(1, 18) | ||
312 | + | ||
313 | +static void bbtoys7lcd_init(int evm_id, int profile) | ||
314 | +{ | ||
315 | + setup_pin_mux(bbtoys7_pin_mux); | ||
316 | + | ||
317 | + // we are being stupid and setting pixclock from here instead of da8xx-fb.c | ||
318 | + if (conf_disp_pll(300000000)) { | ||
319 | + pr_info("Failed to set pixclock to 300000000, not attempting to" | ||
320 | + "register LCD cape\n"); | ||
321 | + return; | ||
322 | + } | ||
323 | + | ||
324 | + if (am33xx_register_lcdc(&bbtoys7_pdata)) | ||
325 | + pr_info("Failed to register Beagleboardtoys 7\" LCD cape device\n"); | ||
326 | + | ||
327 | + gpio_request(BEAGLEBONE_LCD_BL, "BONE_LCD_BL"); | ||
328 | + gpio_direction_output(BEAGLEBONE_LCD_BL, 1); | ||
329 | + gpio_request(BEAGLEBONE_LCD_AVDD_EN, "BONE_LCD_AVDD_EN"); | ||
330 | + gpio_direction_output(BEAGLEBONE_LCD_AVDD_EN, 1); | ||
331 | + | ||
332 | + return; | ||
333 | +} | ||
334 | + | ||
335 | +#define BEAGLEBONEDVI_PDn GPIO_TO_PIN(1, 7) | ||
336 | + | ||
337 | +static void dvi_init(int evm_id, int profile) | ||
338 | +{ | ||
339 | + setup_pin_mux(dvi_pin_mux); | ||
340 | + gpio_request(BEAGLEBONEDVI_PDn, "DVI_PDn"); | ||
341 | + gpio_direction_output(BEAGLEBONEDVI_PDn, 1); | ||
342 | + | ||
343 | + // we are being stupid and setting pixclock from here instead of da8xx-fb.c | ||
344 | + if (conf_disp_pll(560000000)) { | ||
345 | + pr_info("Failed to set pixclock to 56000000, not attempting to" | ||
346 | + "register DVI adapter\n"); | ||
347 | + return; | ||
348 | + } | ||
349 | + | ||
350 | + if (am33xx_register_lcdc(&dvi_pdata)) | ||
351 | + pr_info("Failed to register BeagleBoardToys DVI cape\n"); | ||
352 | + return; | ||
353 | +} | ||
354 | + | ||
355 | static void tsc_init(int evm_id, int profile) | ||
356 | { | ||
357 | int err; | ||
358 | @@ -939,16 +1219,48 @@ static void tsc_init(int evm_id, int profile) | ||
359 | if (gp_evm_revision == GP_EVM_REV_IS_1_1A) { | ||
360 | am335x_touchscreen_data.analog_input = 1; | ||
361 | pr_info("TSC connected to beta GP EVM\n"); | ||
362 | - } else { | ||
363 | + } | ||
364 | + if (gp_evm_revision == GP_EVM_REV_IS_1_1A) { | ||
365 | am335x_touchscreen_data.analog_input = 0; | ||
366 | pr_info("TSC connected to alpha GP EVM\n"); | ||
367 | } | ||
368 | + if( gp_evm_revision == GP_EVM_ACTUALLY_BEAGLEBONE) { | ||
369 | + am335x_touchscreen_data.analog_input = 1; | ||
370 | + pr_info("TSC connected to BeagleBone\n");; | ||
371 | + } | ||
372 | setup_pin_mux(tsc_pin_mux); | ||
373 | err = platform_device_register(&tsc_device); | ||
374 | if (err) | ||
375 | pr_err("failed to register touchscreen device\n"); | ||
376 | } | ||
377 | |||
378 | +static void bone_tsc_init(int evm_id, int profile) | ||
379 | +{ | ||
380 | + int err; | ||
381 | + setup_pin_mux(tsc_pin_mux); | ||
382 | + err = platform_device_register(&bone_tsc_device); | ||
383 | + if (err) | ||
384 | + pr_err("failed to register touchscreen device\n"); | ||
385 | +} | ||
386 | + | ||
387 | + | ||
388 | +static void boneleds_init(int evm_id, int profile ) | ||
389 | +{ | ||
390 | + int err; | ||
391 | + setup_pin_mux(bone_pin_mux); | ||
392 | + err = platform_device_register(&bone_leds_gpio); | ||
393 | + if (err) | ||
394 | + pr_err("failed to register BeagleBone LEDS\n"); | ||
395 | +} | ||
396 | + | ||
397 | +static void dvileds_init(int evm_id, int profile ) | ||
398 | +{ | ||
399 | + int err; | ||
400 | + err = platform_device_register(&dvi_leds_gpio); | ||
401 | + if (err) | ||
402 | + pr_err("failed to register BeagleBone DVI cape LEDS\n"); | ||
403 | +} | ||
404 | + | ||
405 | static void rgmii1_init(int evm_id, int profile) | ||
406 | { | ||
407 | setup_pin_mux(rgmii1_pin_mux); | ||
408 | @@ -1358,18 +1670,106 @@ static void i2c1_init(int evm_id, int profile) | ||
409 | return; | ||
410 | } | ||
411 | |||
412 | +static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context) | ||
413 | +{ | ||
414 | + capecount++; | ||
415 | + int ret; | ||
416 | + char tmp[32]; | ||
417 | + char name[32]; | ||
418 | + char manufacturer[32]; | ||
419 | + | ||
420 | + /* get cape specific data */ | ||
421 | + ret = mem_acc->read(mem_acc, (char *)&cape_config, 0, sizeof(cape_config)); | ||
422 | + if (ret != sizeof(cape_config)) { | ||
423 | + pr_warning("BeagleBone cape EEPROM: could not read eeprom at address 0x%x\n", capecount + 0x53); | ||
424 | + if ((capecount > 3) && (beaglebone_tsadcpins_free == 1)) { | ||
425 | + pr_info("BeagleBone cape: exporting ADC pins to sysfs\n"); | ||
426 | + bone_tsc_init(0,0); | ||
427 | + beaglebone_tsadcpins_free = 0; | ||
428 | + } | ||
429 | + return; | ||
430 | + } | ||
431 | + | ||
432 | + if (cape_config.header != AM335X_EEPROM_HEADER) { | ||
433 | + pr_warning("BeagleBone Cape EEPROM: wrong header 0x%x, expected 0x%x\n", | ||
434 | + cape_config.header, AM335X_EEPROM_HEADER); | ||
435 | + goto out; | ||
436 | + } | ||
437 | + | ||
438 | + pr_info("BeagleBone cape EEPROM: found eeprom at address 0x%x\n", capecount + 0x53); | ||
439 | + snprintf(name, sizeof(cape_config.name) + 1, "%s", cape_config.name); | ||
440 | + snprintf(manufacturer, sizeof(cape_config.manufacturer) + 1, "%s", cape_config.manufacturer); | ||
441 | + pr_info("BeagleBone cape: %s %s\n", manufacturer, name); | ||
442 | + snprintf(tmp, sizeof(cape_config.partnumber) + 1, "%s", cape_config.partnumber); | ||
443 | + pr_info("BeagleBone cape partnumber: %s\n", tmp); | ||
444 | |||
445 | -static struct i2c_board_info am335x_i2c_boardinfo2[] = { | ||
446 | + if (!strncmp("BB-BONE-DVID-01", cape_config.partnumber, 5)) { | ||
447 | + pr_info("BeagleBone cape: initializing DVI cape\n"); | ||
448 | + dvi_init(0,0); | ||
449 | + } | ||
450 | + if (!strncmp("LCD01", cape_config.partnumber, 5)) { | ||
451 | + pr_info("BeagleBone cape: initializing LCD cape\n"); | ||
452 | + bbtoys7lcd_init(0,0); | ||
453 | + pr_info("BeagleBone cape: initializing LCD cape touchscreen\n"); | ||
454 | + tsc_init(0,0); | ||
455 | + beaglebone_tsadcpins_free = 0; | ||
456 | + } | ||
457 | + | ||
458 | + | ||
459 | + if ((capecount > 3) && (beaglebone_tsadcpins_free == 1)) { | ||
460 | + pr_info("BeagleBone cape: exporting ADC pins to sysfs\n"); | ||
461 | + bone_tsc_init(0,0); | ||
462 | + beaglebone_tsadcpins_free = 0; | ||
463 | + } | ||
464 | + | ||
465 | + return; | ||
466 | +out: | ||
467 | + /* | ||
468 | + * If the EEPROM hasn't been programed or an incorrect header | ||
469 | + * or board name are read, assume this is an old beaglebone board | ||
470 | + * (< Rev A3) | ||
471 | + */ | ||
472 | + pr_err("Could not detect BeagleBone cape properly\n"); | ||
473 | + beaglebone_cape_detected = false; | ||
474 | + | ||
475 | +} | ||
476 | + | ||
477 | +static struct at24_platform_data cape_eeprom_info = { | ||
478 | + .byte_len = (256*1024) / 8, | ||
479 | + .page_size = 64, | ||
480 | + .flags = AT24_FLAG_ADDR16, | ||
481 | + .context = (void *)NULL, | ||
482 | + .setup = beaglebone_cape_setup, | ||
483 | +}; | ||
484 | + | ||
485 | +static struct i2c_board_info __initdata cape_i2c_boardinfo[] = { | ||
486 | + { | ||
487 | + I2C_BOARD_INFO("24c256", 0x54), | ||
488 | + .platform_data = &cape_eeprom_info, | ||
489 | + }, | ||
490 | + { | ||
491 | + I2C_BOARD_INFO("24c256", 0x55), | ||
492 | + .platform_data = &cape_eeprom_info, | ||
493 | + }, | ||
494 | + { | ||
495 | + I2C_BOARD_INFO("24c256", 0x56), | ||
496 | + .platform_data = &cape_eeprom_info, | ||
497 | + }, | ||
498 | + { | ||
499 | + I2C_BOARD_INFO("24c256", 0x57), | ||
500 | + .platform_data = &cape_eeprom_info, | ||
501 | + }, | ||
502 | }; | ||
503 | |||
504 | static void i2c2_init(int evm_id, int profile) | ||
505 | { | ||
506 | - setup_pin_mux(i2c2_pin_mux); | ||
507 | - omap_register_i2c_bus(3, 100, am335x_i2c_boardinfo2, | ||
508 | - ARRAY_SIZE(am335x_i2c_boardinfo2)); | ||
509 | - return; | ||
510 | + setup_pin_mux(i2c2_pin_mux); | ||
511 | + omap_register_i2c_bus(3, 100, cape_i2c_boardinfo, | ||
512 | + ARRAY_SIZE(cape_i2c_boardinfo)); | ||
513 | + return; | ||
514 | } | ||
515 | |||
516 | + | ||
517 | /* Setup McASP 1 */ | ||
518 | static void mcasp1_init(int evm_id, int profile) | ||
519 | { | ||
520 | @@ -1723,8 +2123,9 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = { | ||
521 | {rmii1_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
522 | {usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
523 | {usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
524 | - {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
525 | {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
526 | + {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
527 | + {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
528 | {NULL, 0, 0}, | ||
529 | }; | ||
530 | |||
531 | @@ -1734,8 +2135,9 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = { | ||
532 | {mii1_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
533 | {usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
534 | {usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
535 | - {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
536 | {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
537 | + {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
538 | + {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
539 | {NULL, 0, 0}, | ||
540 | }; | ||
541 | |||
542 | @@ -1822,6 +2224,7 @@ static void setup_beaglebone_old(void) | ||
543 | static void setup_beaglebone(void) | ||
544 | { | ||
545 | pr_info("The board is a AM335x Beaglebone.\n"); | ||
546 | + gp_evm_revision = GP_EVM_ACTUALLY_BEAGLEBONE; | ||
547 | |||
548 | /* Beagle Bone has Micro-SD slot which doesn't have Write Protect pin */ | ||
549 | am335x_mmc[0].gpio_wp = -EINVAL; | ||
550 | -- | ||
551 | 1.7.9.4 | ||
552 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0004-more-beaglebone-merges.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0004-more-beaglebone-merges.patch new file mode 100644 index 00000000..eb79ebb9 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0004-more-beaglebone-merges.patch | |||
@@ -0,0 +1,125 @@ | |||
1 | From e32e80d4258b45a8b59306c3cf2ab35e6ec19ac2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Tue, 31 Jan 2012 10:04:03 +0100 | ||
4 | Subject: [PATCH 04/22] more beaglebone merges | ||
5 | |||
6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
7 | --- | ||
8 | arch/arm/mach-omap2/board-am335xevm.c | 63 +++++++++++++++++++++++++++++++-- | ||
9 | 1 file changed, 60 insertions(+), 3 deletions(-) | ||
10 | |||
11 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
12 | index e0c20c5..177ab9e 100644 | ||
13 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
14 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
15 | @@ -248,6 +248,11 @@ static struct resource tsc_resources[] = { | ||
16 | static struct tsc_data am335x_touchscreen_data = { | ||
17 | .wires = 4, | ||
18 | .x_plate_resistance = 200, | ||
19 | + .mode = TI_TSCADC_TSCMODE, | ||
20 | +}; | ||
21 | + | ||
22 | +static struct tsc_data bone_touchscreen_data = { | ||
23 | + .mode = TI_TSCADC_GENMODE, | ||
24 | }; | ||
25 | |||
26 | static struct platform_device tsc_device = { | ||
27 | @@ -260,6 +265,16 @@ static struct platform_device tsc_device = { | ||
28 | .resource = tsc_resources, | ||
29 | }; | ||
30 | |||
31 | +static struct platform_device bone_tsc_device = { | ||
32 | + .name = "tsc", | ||
33 | + .id = -1, | ||
34 | + .dev = { | ||
35 | + .platform_data = &bone_touchscreen_data, | ||
36 | + }, | ||
37 | + .num_resources = ARRAY_SIZE(tsc_resources), | ||
38 | + .resource = tsc_resources, | ||
39 | +}; | ||
40 | + | ||
41 | static u8 am335x_iis_serializer_direction1[] = { | ||
42 | INACTIVE_MODE, INACTIVE_MODE, TX_MODE, RX_MODE, | ||
43 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, | ||
44 | @@ -404,7 +419,7 @@ static bool beaglebone_cape_detected; | ||
45 | static int capecount = 0; | ||
46 | static bool beaglebone_tsadcpins_free = 1; | ||
47 | |||
48 | - | ||
49 | +#define GP_EVM_REV_IS_1_0 0x1 | ||
50 | #define GP_EVM_REV_IS_1_0A 0x1 | ||
51 | #define GP_EVM_REV_IS_1_1A 0x2 | ||
52 | #define GP_EVM_REV_IS_UNKNOWN 0xFF | ||
53 | @@ -1000,6 +1015,47 @@ static struct pinmux_config profibus_pin_mux[] = { | ||
54 | {NULL, 0}, | ||
55 | }; | ||
56 | |||
57 | +/* LEDS - gpio1_21 -> gpio1_24 */ | ||
58 | + | ||
59 | +#define BEAGLEBONE_USR1_LED GPIO_TO_PIN(1, 21) | ||
60 | +#define BEAGLEBONE_USR2_LED GPIO_TO_PIN(1, 22) | ||
61 | +#define BEAGLEBONE_USR3_LED GPIO_TO_PIN(1, 23) | ||
62 | +#define BEAGLEBONE_USR4_LED GPIO_TO_PIN(1, 24) | ||
63 | + | ||
64 | +static struct gpio_led bone_gpio_leds[] = { | ||
65 | + { | ||
66 | + .name = "beaglebone::usr0", | ||
67 | + .default_trigger = "heartbeat", | ||
68 | + .gpio = BEAGLEBONE_USR1_LED, | ||
69 | + }, | ||
70 | + { | ||
71 | + .name = "beaglebone::usr1", | ||
72 | + .default_trigger = "mmc0", | ||
73 | + .gpio = BEAGLEBONE_USR2_LED, | ||
74 | + }, | ||
75 | + { | ||
76 | + .name = "beaglebone::usr2", | ||
77 | + .gpio = BEAGLEBONE_USR3_LED, | ||
78 | + }, | ||
79 | + { | ||
80 | + .name = "beaglebone::usr3", | ||
81 | + .gpio = BEAGLEBONE_USR4_LED, | ||
82 | + }, | ||
83 | +}; | ||
84 | + | ||
85 | +static struct gpio_led_platform_data bone_gpio_led_info = { | ||
86 | + .leds = bone_gpio_leds, | ||
87 | + .num_leds = ARRAY_SIZE(bone_gpio_leds), | ||
88 | +}; | ||
89 | + | ||
90 | +static struct platform_device bone_leds_gpio = { | ||
91 | + .name = "leds-gpio", | ||
92 | + .id = -1, | ||
93 | + .dev = { | ||
94 | + .platform_data = &bone_gpio_led_info, | ||
95 | + }, | ||
96 | +}; | ||
97 | + | ||
98 | |||
99 | #define BEAGLEBONEDVI_USR0_LED GPIO_TO_PIN(1, 18) | ||
100 | #define BEAGLEBONEDVI_USR1_LED GPIO_TO_PIN(1, 19) | ||
101 | @@ -1703,11 +1759,11 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context | ||
102 | snprintf(tmp, sizeof(cape_config.partnumber) + 1, "%s", cape_config.partnumber); | ||
103 | pr_info("BeagleBone cape partnumber: %s\n", tmp); | ||
104 | |||
105 | - if (!strncmp("BB-BONE-DVID-01", cape_config.partnumber, 5)) { | ||
106 | + if (!strncmp("BB-BONE-DVID-01", cape_config.partnumber, 15)) { | ||
107 | pr_info("BeagleBone cape: initializing DVI cape\n"); | ||
108 | dvi_init(0,0); | ||
109 | } | ||
110 | - if (!strncmp("LCD01", cape_config.partnumber, 5)) { | ||
111 | + if (!strncmp("BB-BONE-LCD7-01", cape_config.partnumber, 15)) { | ||
112 | pr_info("BeagleBone cape: initializing LCD cape\n"); | ||
113 | bbtoys7lcd_init(0,0); | ||
114 | pr_info("BeagleBone cape: initializing LCD cape touchscreen\n"); | ||
115 | @@ -2154,6 +2210,7 @@ static void setup_general_purpose_evm(void) | ||
116 | pr_info("The board is general purpose EVM in profile %d\n", prof_sel); | ||
117 | |||
118 | if (!strncmp("1.1A", config.version, 4)) { | ||
119 | + pr_info("EVM version is %s\n", config.version); | ||
120 | gp_evm_revision = GP_EVM_REV_IS_1_1A; | ||
121 | } else if (!strncmp("1.0", config.version, 3)) { | ||
122 | gp_evm_revision = GP_EVM_REV_IS_1_0; | ||
123 | -- | ||
124 | 1.7.9.4 | ||
125 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0005-beaglebone-disable-tsadc.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0005-beaglebone-disable-tsadc.patch new file mode 100644 index 00000000..5b60b4c7 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0005-beaglebone-disable-tsadc.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From 622a15ae235de585d3223384828d68ed6faa7730 Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Tue, 31 Jan 2012 10:09:06 +0100 | ||
4 | Subject: [PATCH 05/22] beaglebone: disable tsadc | ||
5 | |||
6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
7 | --- | ||
8 | arch/arm/mach-omap2/board-am335xevm.c | 4 ++-- | ||
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
10 | |||
11 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
12 | index 177ab9e..87ccf14 100644 | ||
13 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
14 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
15 | @@ -248,11 +248,11 @@ static struct resource tsc_resources[] = { | ||
16 | static struct tsc_data am335x_touchscreen_data = { | ||
17 | .wires = 4, | ||
18 | .x_plate_resistance = 200, | ||
19 | - .mode = TI_TSCADC_TSCMODE, | ||
20 | +// .mode = TI_TSCADC_TSCMODE, | ||
21 | }; | ||
22 | |||
23 | static struct tsc_data bone_touchscreen_data = { | ||
24 | - .mode = TI_TSCADC_GENMODE, | ||
25 | +// .mode = TI_TSCADC_GENMODE, | ||
26 | }; | ||
27 | |||
28 | static struct platform_device tsc_device = { | ||
29 | -- | ||
30 | 1.7.9.4 | ||
31 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0006-tscadc-Add-general-purpose-mode-untested-with-touchs.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0006-tscadc-Add-general-purpose-mode-untested-with-touchs.patch new file mode 100644 index 00000000..69f2e4e0 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0006-tscadc-Add-general-purpose-mode-untested-with-touchs.patch | |||
@@ -0,0 +1,411 @@ | |||
1 | From cd5378a9341cb6c5ea511a95ec8ebbfeb2aae44d Mon Sep 17 00:00:00 2001 | ||
2 | From: Joel A Fernandes <joelagnel@ti.com> | ||
3 | Date: Wed, 30 Nov 2011 15:00:40 +0100 | ||
4 | Subject: [PATCH 06/22] tscadc: Add general purpose mode, untested with | ||
5 | touchscreen functionality | ||
6 | |||
7 | Signed-off-by: Joel A Fernandes <joelagnel@ti.com> | ||
8 | |||
9 | Conflicts: | ||
10 | |||
11 | drivers/input/touchscreen/ti_tscadc.c | ||
12 | [Fixed by Koen - needs review] | ||
13 | --- | ||
14 | arch/arm/mach-omap2/board-am335xevm.c | 2 + | ||
15 | arch/arm/mach-omap2/mux33xx.c | 12 ++ | ||
16 | arch/arm/mach-omap2/mux33xx.h | 4 + | ||
17 | drivers/input/touchscreen/ti_tscadc.c | 209 +++++++++++++++++++++++++-------- | ||
18 | include/linux/input/ti_tscadc.h | 4 + | ||
19 | 5 files changed, 180 insertions(+), 51 deletions(-) | ||
20 | |||
21 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
22 | index 87ccf14..c7bb091 100644 | ||
23 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
24 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
25 | @@ -2182,6 +2182,7 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = { | ||
26 | {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
27 | {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
28 | {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
29 | + {tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
30 | {NULL, 0, 0}, | ||
31 | }; | ||
32 | |||
33 | @@ -2194,6 +2195,7 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = { | ||
34 | {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
35 | {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
36 | {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
37 | + {tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
38 | {NULL, 0, 0}, | ||
39 | }; | ||
40 | |||
41 | diff --git a/arch/arm/mach-omap2/mux33xx.c b/arch/arm/mach-omap2/mux33xx.c | ||
42 | index 8df8fa9..14ef129 100644 | ||
43 | --- a/arch/arm/mach-omap2/mux33xx.c | ||
44 | +++ b/arch/arm/mach-omap2/mux33xx.c | ||
45 | @@ -584,6 +584,18 @@ static struct omap_mux __initdata am33xx_muxmodes[] = { | ||
46 | _AM33XX_MUXENTRY(AIN3, 0, | ||
47 | "ain3", NULL, NULL, NULL, | ||
48 | NULL, NULL, NULL, NULL), | ||
49 | + _AM33XX_MUXENTRY(AIN4, 0, | ||
50 | + "ain4", NULL, NULL, NULL, | ||
51 | + NULL, NULL, NULL, NULL), | ||
52 | + _AM33XX_MUXENTRY(AIN5, 0, | ||
53 | + "ain5", NULL, NULL, NULL, | ||
54 | + NULL, NULL, NULL, NULL), | ||
55 | + _AM33XX_MUXENTRY(AIN6, 0, | ||
56 | + "ain6", NULL, NULL, NULL, | ||
57 | + NULL, NULL, NULL, NULL), | ||
58 | + _AM33XX_MUXENTRY(AIN7, 0, | ||
59 | + "ain7", NULL, NULL, NULL, | ||
60 | + NULL, NULL, NULL, NULL), | ||
61 | _AM33XX_MUXENTRY(VREFP, 0, | ||
62 | "vrefp", NULL, NULL, NULL, | ||
63 | NULL, NULL, NULL, NULL), | ||
64 | diff --git a/arch/arm/mach-omap2/mux33xx.h b/arch/arm/mach-omap2/mux33xx.h | ||
65 | index 70a3012..348c8e5 100644 | ||
66 | --- a/arch/arm/mach-omap2/mux33xx.h | ||
67 | +++ b/arch/arm/mach-omap2/mux33xx.h | ||
68 | @@ -228,6 +228,10 @@ | ||
69 | #define AM33XX_CONTROL_PADCONF_DDR_DQSN1_OFFSET 0x0AFC | ||
70 | #define AM33XX_CONTROL_PADCONF_DDR_VREF_OFFSET 0x0B00 | ||
71 | #define AM33XX_CONTROL_PADCONF_DDR_VTP_OFFSET 0x0B04 | ||
72 | +#define AM33XX_CONTROL_PADCONF_AIN7_OFFSET 0x0B10 | ||
73 | +#define AM33XX_CONTROL_PADCONF_AIN6_OFFSET 0x0B14 | ||
74 | +#define AM33XX_CONTROL_PADCONF_AIN5_OFFSET 0x0B18 | ||
75 | +#define AM33XX_CONTROL_PADCONF_AIN4_OFFSET 0x0B1C | ||
76 | #define AM33XX_CONTROL_PADCONF_AIN3_OFFSET 0x0B20 | ||
77 | #define AM33XX_CONTROL_PADCONF_AIN2_OFFSET 0x0B24 | ||
78 | #define AM33XX_CONTROL_PADCONF_AIN1_OFFSET 0x0B28 | ||
79 | diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c | ||
80 | index e3b5775..699503d 100644 | ||
81 | --- a/drivers/input/touchscreen/ti_tscadc.c | ||
82 | +++ b/drivers/input/touchscreen/ti_tscadc.c | ||
83 | @@ -27,6 +27,8 @@ | ||
84 | #include <linux/input/ti_tscadc.h> | ||
85 | #include <linux/delay.h> | ||
86 | |||
87 | +/* Memory mapped registers here have incorrect offsets! | ||
88 | + * Correct after referring TRM */ | ||
89 | #define TSCADC_REG_IRQEOI 0x020 | ||
90 | #define TSCADC_REG_RAWIRQSTATUS 0x024 | ||
91 | #define TSCADC_REG_IRQSTATUS 0x028 | ||
92 | @@ -54,12 +56,18 @@ | ||
93 | |||
94 | /* Register Bitfields */ | ||
95 | #define TSCADC_IRQWKUP_ENB BIT(0) | ||
96 | -#define TSCADC_STPENB_STEPENB 0x7FFF | ||
97 | +#define TSCADC_STPENB_STEPENB_TOUCHSCREEN 0x7FFF | ||
98 | +#define TSCADC_STPENB_STEPENB_GENERAL 0x0400 | ||
99 | #define TSCADC_IRQENB_FIFO0THRES BIT(2) | ||
100 | +#define TSCADC_IRQENB_FIFO0OVERRUN BIT(3) | ||
101 | #define TSCADC_IRQENB_FIFO1THRES BIT(5) | ||
102 | +#define TSCADC_IRQENB_EOS BIT(1) | ||
103 | #define TSCADC_IRQENB_PENUP BIT(9) | ||
104 | -#define TSCADC_STEPCONFIG_MODE_HWSYNC 0x2 | ||
105 | +#define TSCADC_STEPCONFIG_MODE_HWSYNC 0x2 | ||
106 | +#define TSCADC_STEPCONFIG_MODE_SWCONT 0x1 | ||
107 | +#define TSCADC_STEPCONFIG_MODE_SWONESHOT 0x0 | ||
108 | #define TSCADC_STEPCONFIG_2SAMPLES_AVG (1 << 4) | ||
109 | +#define TSCADC_STEPCONFIG_NO_AVG 0 | ||
110 | #define TSCADC_STEPCONFIG_XPP BIT(5) | ||
111 | #define TSCADC_STEPCONFIG_XNN BIT(6) | ||
112 | #define TSCADC_STEPCONFIG_YPP BIT(7) | ||
113 | @@ -105,6 +113,7 @@ struct tscadc { | ||
114 | int analog_input; | ||
115 | int x_plate_resistance; | ||
116 | struct clk *tsc_ick; | ||
117 | + int mode; | ||
118 | int irq; | ||
119 | void __iomem *tsc_base; | ||
120 | }; | ||
121 | @@ -120,6 +129,86 @@ static void tscadc_writel(struct tscadc *tsc, unsigned int reg, | ||
122 | writel(val, tsc->tsc_base + reg); | ||
123 | } | ||
124 | |||
125 | +static void tsc_adc_step_config(struct tscadc *ts_dev) | ||
126 | +{ | ||
127 | + unsigned int stepconfig = 0, delay = 0, chargeconfig = 0; | ||
128 | + | ||
129 | + /* | ||
130 | + * Step Configuration | ||
131 | + * software-enabled continous mode | ||
132 | + * 2 sample averaging | ||
133 | + * sample channel 1 (SEL_INP mux bits = 0) | ||
134 | + */ | ||
135 | + stepconfig = TSCADC_STEPCONFIG_MODE_SWONESHOT | | ||
136 | + TSCADC_STEPCONFIG_2SAMPLES_AVG | | ||
137 | + (0x7 << 19); | ||
138 | + | ||
139 | + delay = TSCADC_STEPCONFIG_SAMPLEDLY | TSCADC_STEPCONFIG_OPENDLY; | ||
140 | + | ||
141 | + tscadc_writel(ts_dev, TSCADC_REG_STEPCONFIG(10), stepconfig); | ||
142 | + tscadc_writel(ts_dev, TSCADC_REG_STEPDELAY(10), delay); | ||
143 | + | ||
144 | + /* Get the ball rolling, this will trigger the FSM to step through | ||
145 | + * as soon as TSC_ADC_SS is turned on */ | ||
146 | + tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_GENERAL); | ||
147 | +} | ||
148 | + | ||
149 | +static irqreturn_t tsc_adc_interrupt(int irq, void *dev) | ||
150 | +{ | ||
151 | + struct tscadc *ts_dev = (struct tscadc *)dev; | ||
152 | + struct input_dev *input_dev = ts_dev->input; | ||
153 | + unsigned int status, irqclr = 0; | ||
154 | + int i; | ||
155 | + int fsm = 0, fifo0count = 0, fifo1count = 0; | ||
156 | + unsigned int read_sample = 0, ready1 = 0; | ||
157 | + unsigned int prev_val_x = ~0, prev_val_y = ~0; | ||
158 | + unsigned int prev_diff_x = ~0, prev_diff_y = ~0; | ||
159 | + unsigned int cur_diff_x = 0, cur_diff_y = 0; | ||
160 | + unsigned int val_x = 0, val_y = 0, diffx = 0, diffy = 0; | ||
161 | + | ||
162 | + status = tscadc_readl(ts_dev, TSCADC_REG_IRQSTATUS); | ||
163 | + | ||
164 | + printk("interrupt! status=%x\n", status); | ||
165 | + // if (status & TSCADC_IRQENB_EOS) { | ||
166 | + // irqclr |= TSCADC_IRQENB_EOS; | ||
167 | + // } | ||
168 | + | ||
169 | + if (status & TSCADC_IRQENB_FIFO0THRES) { | ||
170 | + fifo1count = tscadc_readl(ts_dev, TSCADC_REG_FIFO0CNT); | ||
171 | + printk("fifo 0 count = %d\n", fifo1count); | ||
172 | + | ||
173 | + for (i = 0; i < fifo1count; i++) { | ||
174 | + read_sample = tscadc_readl(ts_dev, TSCADC_REG_FIFO0); | ||
175 | + printk("sample: %d: %x\n", i, read_sample); | ||
176 | + } | ||
177 | + irqclr |= TSCADC_IRQENB_FIFO0THRES; | ||
178 | + } | ||
179 | + | ||
180 | + | ||
181 | + if (status & TSCADC_IRQENB_FIFO1THRES) { | ||
182 | + fifo1count = tscadc_readl(ts_dev, TSCADC_REG_FIFO1CNT); | ||
183 | + | ||
184 | + for (i = 0; i < fifo1count; i++) { | ||
185 | + read_sample = tscadc_readl(ts_dev, TSCADC_REG_FIFO1); | ||
186 | + // read_sample = read_sample & 0xfff; | ||
187 | + printk("sample: %d: %d\n", i, read_sample); | ||
188 | + panic("sample read from fifo1!"); | ||
189 | + } | ||
190 | + irqclr |= TSCADC_IRQENB_FIFO1THRES; | ||
191 | + } | ||
192 | + | ||
193 | + mdelay(500); | ||
194 | + | ||
195 | + tscadc_writel(ts_dev, TSCADC_REG_IRQSTATUS, irqclr); | ||
196 | + | ||
197 | + /* check pending interrupts */ | ||
198 | + tscadc_writel(ts_dev, TSCADC_REG_IRQEOI, 0x0); | ||
199 | + | ||
200 | + /* Turn on Step 1 again */ | ||
201 | + tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_GENERAL); | ||
202 | + return IRQ_HANDLED; | ||
203 | +} | ||
204 | + | ||
205 | static void tsc_step_config(struct tscadc *ts_dev) | ||
206 | { | ||
207 | unsigned int stepconfigx = 0, stepconfigy = 0; | ||
208 | @@ -224,7 +313,7 @@ static void tsc_step_config(struct tscadc *ts_dev) | ||
209 | tscadc_writel(ts_dev, TSCADC_REG_STEPCONFIG14, stepconfigz2); | ||
210 | tscadc_writel(ts_dev, TSCADC_REG_STEPDELAY14, delay); | ||
211 | |||
212 | - tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB); | ||
213 | + tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_TOUCHSCREEN); | ||
214 | } | ||
215 | |||
216 | static void tsc_idle_config(struct tscadc *ts_config) | ||
217 | @@ -242,7 +331,7 @@ static void tsc_idle_config(struct tscadc *ts_config) | ||
218 | tscadc_writel(ts_config, TSCADC_REG_IDLECONFIG, idleconfig); | ||
219 | } | ||
220 | |||
221 | -static irqreturn_t tscadc_interrupt(int irq, void *dev) | ||
222 | +static irqreturn_t tsc_interrupt(int irq, void *dev) | ||
223 | { | ||
224 | struct tscadc *ts_dev = (struct tscadc *)dev; | ||
225 | struct input_dev *input_dev = ts_dev->input; | ||
226 | @@ -362,7 +451,7 @@ static irqreturn_t tscadc_interrupt(int irq, void *dev) | ||
227 | /* check pending interrupts */ | ||
228 | tscadc_writel(ts_dev, TSCADC_REG_IRQEOI, 0x0); | ||
229 | |||
230 | - tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB); | ||
231 | + tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_TOUCHSCREEN); | ||
232 | return IRQ_HANDLED; | ||
233 | } | ||
234 | |||
235 | @@ -400,13 +489,15 @@ static int __devinit tscadc_probe(struct platform_device *pdev) | ||
236 | return -ENODEV; | ||
237 | } | ||
238 | |||
239 | - input_dev = input_allocate_device(); | ||
240 | - if (!input_dev) { | ||
241 | - dev_err(&pdev->dev, "failed to allocate input device.\n"); | ||
242 | - err = -ENOMEM; | ||
243 | - goto err_free_mem; | ||
244 | + if(pdata->mode == TI_TSCADC_TSCMODE) { | ||
245 | + input_dev = input_allocate_device(); | ||
246 | + if (!input_dev) { | ||
247 | + dev_err(&pdev->dev, "failed to allocate input device.\n"); | ||
248 | + err = -ENOMEM; | ||
249 | + goto err_free_mem; | ||
250 | + } | ||
251 | + ts_dev->input = input_dev; | ||
252 | } | ||
253 | - ts_dev->input = input_dev; | ||
254 | |||
255 | res = request_mem_region(res->start, resource_size(res), pdev->name); | ||
256 | if (!res) { | ||
257 | @@ -422,8 +513,15 @@ static int __devinit tscadc_probe(struct platform_device *pdev) | ||
258 | goto err_release_mem; | ||
259 | } | ||
260 | |||
261 | - err = request_irq(ts_dev->irq, tscadc_interrupt, IRQF_DISABLED, | ||
262 | - pdev->dev.driver->name, ts_dev); | ||
263 | + if(pdata->mode == TI_TSCADC_TSCMODE) { | ||
264 | + err = request_irq(ts_dev->irq, tsc_interrupt, IRQF_DISABLED, | ||
265 | + pdev->dev.driver->name, ts_dev); | ||
266 | + } | ||
267 | + else { | ||
268 | + err = request_irq(ts_dev->irq, tsc_adc_interrupt, IRQF_DISABLED, | ||
269 | + pdev->dev.driver->name, ts_dev); | ||
270 | + } | ||
271 | + | ||
272 | if (err) { | ||
273 | dev_err(&pdev->dev, "failed to allocate irq.\n"); | ||
274 | goto err_unmap_regs; | ||
275 | @@ -443,11 +541,17 @@ static int __devinit tscadc_probe(struct platform_device *pdev) | ||
276 | goto err_free_irq; | ||
277 | } | ||
278 | clock_rate = clk_get_rate(clk); | ||
279 | + | ||
280 | + /* clk_value of atleast 21MHz required | ||
281 | + * Clock verified on BeagleBone to be 24MHz */ | ||
282 | + | ||
283 | + | ||
284 | clk_value = clock_rate / ADC_CLK; | ||
285 | if (clk_value < 7) { | ||
286 | dev_err(&pdev->dev, "clock input less than min clock requirement\n"); | ||
287 | goto err_fail; | ||
288 | } | ||
289 | + | ||
290 | /* TSCADC_CLKDIV needs to be configured to the value minus 1 */ | ||
291 | clk_value = clk_value - 1; | ||
292 | tscadc_writel(ts_dev, TSCADC_REG_CLKDIV, clk_value); | ||
293 | @@ -458,57 +562,60 @@ static int __devinit tscadc_probe(struct platform_device *pdev) | ||
294 | ts_dev->wires = pdata->wires; | ||
295 | ts_dev->analog_input = pdata->analog_input; | ||
296 | ts_dev->x_plate_resistance = pdata->x_plate_resistance; | ||
297 | + ts_dev->mode = pdata->mode; | ||
298 | |||
299 | - /* Set the control register bits */ | ||
300 | + /* Set the control register bits - 12.5.44 TRM */ | ||
301 | ctrl = TSCADC_CNTRLREG_STEPCONFIGWRT | | ||
302 | - TSCADC_CNTRLREG_TSCENB | | ||
303 | - TSCADC_CNTRLREG_STEPID; | ||
304 | - switch (ts_dev->wires) { | ||
305 | - case 4: | ||
306 | - ctrl |= TSCADC_CNTRLREG_4WIRE; | ||
307 | - break; | ||
308 | - case 5: | ||
309 | - ctrl |= TSCADC_CNTRLREG_5WIRE; | ||
310 | - break; | ||
311 | - case 8: | ||
312 | - ctrl |= TSCADC_CNTRLREG_8WIRE; | ||
313 | - break; | ||
314 | + TSCADC_CNTRLREG_STEPID; | ||
315 | + if(pdata->mode == TI_TSCADC_TSCMODE) { | ||
316 | + ctrl |= TSCADC_CNTRLREG_TSCENB; | ||
317 | + switch (ts_dev->wires) { | ||
318 | + case 4: | ||
319 | + ctrl |= TSCADC_CNTRLREG_4WIRE; | ||
320 | + break; | ||
321 | + case 5: | ||
322 | + ctrl |= TSCADC_CNTRLREG_5WIRE; | ||
323 | + break; | ||
324 | + case 8: | ||
325 | + ctrl |= TSCADC_CNTRLREG_8WIRE; | ||
326 | + break; | ||
327 | + } | ||
328 | } | ||
329 | tscadc_writel(ts_dev, TSCADC_REG_CTRL, ctrl); | ||
330 | |||
331 | - /* Set register bits for Idel Config Mode */ | ||
332 | - tsc_idle_config(ts_dev); | ||
333 | - | ||
334 | - /* IRQ Enable */ | ||
335 | - irqenable = TSCADC_IRQENB_FIFO1THRES; | ||
336 | + /* Touch screen / ADC configuration */ | ||
337 | + if(pdata->mode == TI_TSCADC_TSCMODE) { | ||
338 | + tsc_idle_config(ts_dev); | ||
339 | + tsc_step_config(ts_dev); | ||
340 | + tscadc_writel(ts_dev, TSCADC_REG_FIFO1THR, 6); | ||
341 | + irqenable = TSCADC_IRQENB_FIFO1THRES; | ||
342 | + /* Touch screen also needs an input_dev */ | ||
343 | + input_dev->name = "ti-tsc-adcc"; | ||
344 | + input_dev->dev.parent = &pdev->dev; | ||
345 | + input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | ||
346 | + input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | ||
347 | + input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0); | ||
348 | + input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0); | ||
349 | + /* register to the input system */ | ||
350 | + err = input_register_device(input_dev); | ||
351 | + if (err) | ||
352 | + goto err_fail; | ||
353 | + } | ||
354 | + else { | ||
355 | + tsc_adc_step_config(ts_dev); | ||
356 | + tscadc_writel(ts_dev, TSCADC_REG_FIFO0THR, 0); | ||
357 | + irqenable = TSCADC_IRQENB_FIFO0THRES; | ||
358 | + } | ||
359 | tscadc_writel(ts_dev, TSCADC_REG_IRQENABLE, irqenable); | ||
360 | |||
361 | - tsc_step_config(ts_dev); | ||
362 | - | ||
363 | - tscadc_writel(ts_dev, TSCADC_REG_FIFO1THR, 6); | ||
364 | - | ||
365 | ctrl |= TSCADC_CNTRLREG_TSCSSENB; | ||
366 | - tscadc_writel(ts_dev, TSCADC_REG_CTRL, ctrl); | ||
367 | - | ||
368 | - input_dev->name = "ti-tsc-adcc"; | ||
369 | - input_dev->dev.parent = &pdev->dev; | ||
370 | - | ||
371 | - input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | ||
372 | - input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | ||
373 | - | ||
374 | - input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, 0, 0); | ||
375 | - input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, 0, 0); | ||
376 | - input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT, 0, 0); | ||
377 | - | ||
378 | - /* register to the input system */ | ||
379 | - err = input_register_device(input_dev); | ||
380 | - if (err) | ||
381 | - goto err_fail; | ||
382 | + tscadc_writel(ts_dev, TSCADC_REG_CTRL, ctrl); /* Turn on TSC_ADC */ | ||
383 | |||
384 | platform_set_drvdata(pdev, ts_dev); | ||
385 | return 0; | ||
386 | |||
387 | err_fail: | ||
388 | + printk(KERN_ERR "Fatal error, shutting down TSC_ADC\n"); | ||
389 | clk_disable(ts_dev->tsc_ick); | ||
390 | clk_put(ts_dev->tsc_ick); | ||
391 | err_free_irq: | ||
392 | diff --git a/include/linux/input/ti_tscadc.h b/include/linux/input/ti_tscadc.h | ||
393 | index 2c547bb..850cd4b 100644 | ||
394 | --- a/include/linux/input/ti_tscadc.h | ||
395 | +++ b/include/linux/input/ti_tscadc.h | ||
396 | @@ -14,8 +14,12 @@ | ||
397 | * @x_plate_resistance: X plate resistance. | ||
398 | */ | ||
399 | |||
400 | +#define TI_TSCADC_TSCMODE 0 | ||
401 | +#define TI_TSCADC_GENMODE 1 | ||
402 | + | ||
403 | struct tsc_data { | ||
404 | int wires; | ||
405 | int analog_input; | ||
406 | int x_plate_resistance; | ||
407 | + int mode; | ||
408 | }; | ||
409 | -- | ||
410 | 1.7.9.4 | ||
411 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0007-tscadc-Add-board-file-mfd-support-fix-warning.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0007-tscadc-Add-board-file-mfd-support-fix-warning.patch new file mode 100644 index 00000000..6f37ba61 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0007-tscadc-Add-board-file-mfd-support-fix-warning.patch | |||
@@ -0,0 +1,44 @@ | |||
1 | From f6e6f6bf5e460f5294b4f0f05af14506db631b55 Mon Sep 17 00:00:00 2001 | ||
2 | From: Joel A Fernandes <joelagnel@ti.com> | ||
3 | Date: Wed, 30 Nov 2011 15:02:17 +0100 | ||
4 | Subject: [PATCH 07/22] tscadc: Add board file mfd support, fix warning | ||
5 | |||
6 | Signed-off-by: Joel A Fernandes <joelagnel@ti.com> | ||
7 | |||
8 | Conflicts: | ||
9 | |||
10 | arch/arm/mach-omap2/board-am335xevm.c | ||
11 | --- | ||
12 | arch/arm/mach-omap2/board-am335xevm.c | 2 +- | ||
13 | drivers/input/touchscreen/ti_tscadc.c | 2 +- | ||
14 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
17 | index c7bb091..17705b3 100644 | ||
18 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
19 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
20 | @@ -2182,7 +2182,7 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = { | ||
21 | {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
22 | {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
23 | {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
24 | - {tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
25 | + {bone_tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
26 | {NULL, 0, 0}, | ||
27 | }; | ||
28 | |||
29 | diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c | ||
30 | index 699503d..f813564 100644 | ||
31 | --- a/drivers/input/touchscreen/ti_tscadc.c | ||
32 | +++ b/drivers/input/touchscreen/ti_tscadc.c | ||
33 | @@ -462,7 +462,7 @@ static irqreturn_t tsc_interrupt(int irq, void *dev) | ||
34 | static int __devinit tscadc_probe(struct platform_device *pdev) | ||
35 | { | ||
36 | struct tscadc *ts_dev; | ||
37 | - struct input_dev *input_dev; | ||
38 | + struct input_dev *input_dev = NULL; | ||
39 | int err; | ||
40 | int clk_value; | ||
41 | int clock_rate, irqenable, ctrl; | ||
42 | -- | ||
43 | 1.7.9.4 | ||
44 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0008-AM335X-init-tsc-bone-style-for-new-boards.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0008-AM335X-init-tsc-bone-style-for-new-boards.patch new file mode 100644 index 00000000..6f499185 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0008-AM335X-init-tsc-bone-style-for-new-boards.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | From d27f8ff05d04b9191f70eb8a7cb4d901d3ab50f7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Joel A Fernandes <joelagnel@ti.com> | ||
3 | Date: Wed, 30 Nov 2011 15:03:59 +0100 | ||
4 | Subject: [PATCH 08/22] AM335X: init tsc bone style for new boards | ||
5 | |||
6 | Signed-off-by: Joel A Fernandes <joelagnel@ti.com> | ||
7 | --- | ||
8 | arch/arm/mach-omap2/board-am335xevm.c | 2 +- | ||
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
12 | index 17705b3..ac4f78f 100644 | ||
13 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
14 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
15 | @@ -2195,7 +2195,7 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = { | ||
16 | {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
17 | {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
18 | {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
19 | - {tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
20 | + {bone_tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
21 | {NULL, 0, 0}, | ||
22 | }; | ||
23 | |||
24 | -- | ||
25 | 1.7.9.4 | ||
26 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0009-tscadc-make-stepconfig-channel-configurable.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0009-tscadc-make-stepconfig-channel-configurable.patch new file mode 100644 index 00000000..47d9b248 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0009-tscadc-make-stepconfig-channel-configurable.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | From 750ca3e9b053119b867d3630bf5c891b845144b3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Joel A Fernandes <joelagnel@ti.com> | ||
3 | Date: Mon, 28 Nov 2011 18:18:04 -0600 | ||
4 | Subject: [PATCH 09/22] tscadc: make stepconfig channel-configurable | ||
5 | |||
6 | Signed-off-by: Joel A Fernandes <joelagnel@ti.com> | ||
7 | --- | ||
8 | drivers/input/touchscreen/ti_tscadc.c | 8 +++++--- | ||
9 | 1 file changed, 5 insertions(+), 3 deletions(-) | ||
10 | |||
11 | diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c | ||
12 | index f813564..0b91bdc 100644 | ||
13 | --- a/drivers/input/touchscreen/ti_tscadc.c | ||
14 | +++ b/drivers/input/touchscreen/ti_tscadc.c | ||
15 | @@ -129,7 +129,9 @@ static void tscadc_writel(struct tscadc *tsc, unsigned int reg, | ||
16 | writel(val, tsc->tsc_base + reg); | ||
17 | } | ||
18 | |||
19 | -static void tsc_adc_step_config(struct tscadc *ts_dev) | ||
20 | +/* Configure ADC to sample on channel (1-8) */ | ||
21 | + | ||
22 | +static void tsc_adc_step_config(struct tscadc *ts_dev, int channel) | ||
23 | { | ||
24 | unsigned int stepconfig = 0, delay = 0, chargeconfig = 0; | ||
25 | |||
26 | @@ -141,7 +143,7 @@ static void tsc_adc_step_config(struct tscadc *ts_dev) | ||
27 | */ | ||
28 | stepconfig = TSCADC_STEPCONFIG_MODE_SWONESHOT | | ||
29 | TSCADC_STEPCONFIG_2SAMPLES_AVG | | ||
30 | - (0x7 << 19); | ||
31 | + ((channel-1) << 19); | ||
32 | |||
33 | delay = TSCADC_STEPCONFIG_SAMPLEDLY | TSCADC_STEPCONFIG_OPENDLY; | ||
34 | |||
35 | @@ -602,7 +604,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev) | ||
36 | goto err_fail; | ||
37 | } | ||
38 | else { | ||
39 | - tsc_adc_step_config(ts_dev); | ||
40 | + tsc_adc_step_config(ts_dev, 8); | ||
41 | tscadc_writel(ts_dev, TSCADC_REG_FIFO0THR, 0); | ||
42 | irqenable = TSCADC_IRQENB_FIFO0THRES; | ||
43 | } | ||
44 | -- | ||
45 | 1.7.9.4 | ||
46 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0010-tscadc-Trigger-through-sysfs.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0010-tscadc-Trigger-through-sysfs.patch new file mode 100644 index 00000000..a008eb56 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0010-tscadc-Trigger-through-sysfs.patch | |||
@@ -0,0 +1,147 @@ | |||
1 | From fb718df2afa6f3876c22d830c55de70943d95812 Mon Sep 17 00:00:00 2001 | ||
2 | From: Joel A Fernandes <joelagnel@ti.com> | ||
3 | Date: Mon, 28 Nov 2011 20:55:25 -0600 | ||
4 | Subject: [PATCH 10/22] tscadc: Trigger through sysfs | ||
5 | |||
6 | Signed-off-by: Joel A Fernandes <joelagnel@ti.com> | ||
7 | |||
8 | Conflicts: | ||
9 | |||
10 | drivers/input/touchscreen/ti_tscadc.c | ||
11 | --- | ||
12 | drivers/input/touchscreen/ti_tscadc.c | 60 ++++++++++++++++++++++++++++++--- | ||
13 | include/linux/input/ti_tscadc.h | 1 + | ||
14 | 2 files changed, 56 insertions(+), 5 deletions(-) | ||
15 | |||
16 | diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c | ||
17 | index 0b91bdc..a74d9ba 100644 | ||
18 | --- a/drivers/input/touchscreen/ti_tscadc.c | ||
19 | +++ b/drivers/input/touchscreen/ti_tscadc.c | ||
20 | @@ -26,6 +26,17 @@ | ||
21 | #include <linux/io.h> | ||
22 | #include <linux/input/ti_tscadc.h> | ||
23 | #include <linux/delay.h> | ||
24 | +#include <linux/device.h> | ||
25 | + | ||
26 | +size_t do_adc_sample(struct kobject *, struct attribute *, char *); | ||
27 | +static DEVICE_ATTR(ain1, S_IRUGO, do_adc_sample, NULL); | ||
28 | +static DEVICE_ATTR(ain2, S_IRUGO, do_adc_sample, NULL); | ||
29 | +static DEVICE_ATTR(ain3, S_IRUGO, do_adc_sample, NULL); | ||
30 | +static DEVICE_ATTR(ain4, S_IRUGO, do_adc_sample, NULL); | ||
31 | +static DEVICE_ATTR(ain5, S_IRUGO, do_adc_sample, NULL); | ||
32 | +static DEVICE_ATTR(ain6, S_IRUGO, do_adc_sample, NULL); | ||
33 | +static DEVICE_ATTR(ain7, S_IRUGO, do_adc_sample, NULL); | ||
34 | +static DEVICE_ATTR(ain8, S_IRUGO, do_adc_sample, NULL); | ||
35 | |||
36 | /* Memory mapped registers here have incorrect offsets! | ||
37 | * Correct after referring TRM */ | ||
38 | @@ -144,12 +155,12 @@ static void tsc_adc_step_config(struct tscadc *ts_dev, int channel) | ||
39 | stepconfig = TSCADC_STEPCONFIG_MODE_SWONESHOT | | ||
40 | TSCADC_STEPCONFIG_2SAMPLES_AVG | | ||
41 | ((channel-1) << 19); | ||
42 | - | ||
43 | + | ||
44 | delay = TSCADC_STEPCONFIG_SAMPLEDLY | TSCADC_STEPCONFIG_OPENDLY; | ||
45 | |||
46 | tscadc_writel(ts_dev, TSCADC_REG_STEPCONFIG(10), stepconfig); | ||
47 | tscadc_writel(ts_dev, TSCADC_REG_STEPDELAY(10), delay); | ||
48 | - | ||
49 | + | ||
50 | /* Get the ball rolling, this will trigger the FSM to step through | ||
51 | * as soon as TSC_ADC_SS is turned on */ | ||
52 | tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_GENERAL); | ||
53 | @@ -199,7 +210,7 @@ static irqreturn_t tsc_adc_interrupt(int irq, void *dev) | ||
54 | irqclr |= TSCADC_IRQENB_FIFO1THRES; | ||
55 | } | ||
56 | |||
57 | - mdelay(500); | ||
58 | + // mdelay(500); | ||
59 | |||
60 | tscadc_writel(ts_dev, TSCADC_REG_IRQSTATUS, irqclr); | ||
61 | |||
62 | @@ -207,7 +218,7 @@ static irqreturn_t tsc_adc_interrupt(int irq, void *dev) | ||
63 | tscadc_writel(ts_dev, TSCADC_REG_IRQEOI, 0x0); | ||
64 | |||
65 | /* Turn on Step 1 again */ | ||
66 | - tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_GENERAL); | ||
67 | + // tscadc_writel(ts_dev, TSCADC_REG_SE, TSCADC_STPENB_STEPENB_GENERAL); | ||
68 | return IRQ_HANDLED; | ||
69 | } | ||
70 | |||
71 | @@ -461,6 +472,34 @@ static irqreturn_t tsc_interrupt(int irq, void *dev) | ||
72 | * The functions for inserting/removing driver as a module. | ||
73 | */ | ||
74 | |||
75 | +size_t do_adc_sample(struct kobject *kobj, struct attribute *attr, char *buf) { | ||
76 | + struct platform_device *pdev; | ||
77 | + struct device *dev; | ||
78 | + struct tscadc *ts_dev; | ||
79 | + int channel_num; | ||
80 | + | ||
81 | + pdev = (struct platform_device *)container_of(kobj, struct device, kobj); | ||
82 | + dev = &pdev->dev; | ||
83 | + | ||
84 | + ts_dev = dev_get_drvdata(dev); | ||
85 | + | ||
86 | + if(strncmp(attr->name, "ain", 3)) { | ||
87 | + printk("Invalid ain num\n"); | ||
88 | + return -EINVAL; | ||
89 | + } | ||
90 | + | ||
91 | + channel_num = attr->name[3] - 0x30; | ||
92 | + if(channel_num > 8 || channel_num < 1) { | ||
93 | + printk("Invalid channel_num=%d\n", channel_num); | ||
94 | + return -EINVAL; | ||
95 | + } | ||
96 | + | ||
97 | + tsc_adc_step_config(ts_dev, channel_num); | ||
98 | + | ||
99 | + memcpy(buf, attr->name, strlen(attr->name)+1); | ||
100 | + return strlen(attr->name); | ||
101 | +} | ||
102 | + | ||
103 | static int __devinit tscadc_probe(struct platform_device *pdev) | ||
104 | { | ||
105 | struct tscadc *ts_dev; | ||
106 | @@ -472,6 +511,18 @@ static int __devinit tscadc_probe(struct platform_device *pdev) | ||
107 | struct resource *res; | ||
108 | struct clk *clk; | ||
109 | |||
110 | + printk("dev addr = %p\n", &pdev->dev); | ||
111 | + printk("pdev addr = %p\n", pdev); | ||
112 | + | ||
113 | + device_create_file(&pdev->dev, &dev_attr_ain1); | ||
114 | + device_create_file(&pdev->dev, &dev_attr_ain2); | ||
115 | + device_create_file(&pdev->dev, &dev_attr_ain3); | ||
116 | + device_create_file(&pdev->dev, &dev_attr_ain4); | ||
117 | + device_create_file(&pdev->dev, &dev_attr_ain5); | ||
118 | + device_create_file(&pdev->dev, &dev_attr_ain6); | ||
119 | + device_create_file(&pdev->dev, &dev_attr_ain7); | ||
120 | + device_create_file(&pdev->dev, &dev_attr_ain8); | ||
121 | + | ||
122 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
123 | if (!res) { | ||
124 | dev_err(&pdev->dev, "no memory resource defined.\n"); | ||
125 | @@ -604,7 +655,6 @@ static int __devinit tscadc_probe(struct platform_device *pdev) | ||
126 | goto err_fail; | ||
127 | } | ||
128 | else { | ||
129 | - tsc_adc_step_config(ts_dev, 8); | ||
130 | tscadc_writel(ts_dev, TSCADC_REG_FIFO0THR, 0); | ||
131 | irqenable = TSCADC_IRQENB_FIFO0THRES; | ||
132 | } | ||
133 | diff --git a/include/linux/input/ti_tscadc.h b/include/linux/input/ti_tscadc.h | ||
134 | index 850cd4b..fc239c6 100644 | ||
135 | --- a/include/linux/input/ti_tscadc.h | ||
136 | +++ b/include/linux/input/ti_tscadc.h | ||
137 | @@ -13,6 +13,7 @@ | ||
138 | * 0. | ||
139 | * @x_plate_resistance: X plate resistance. | ||
140 | */ | ||
141 | +#include <linux/device.h> | ||
142 | |||
143 | #define TI_TSCADC_TSCMODE 0 | ||
144 | #define TI_TSCADC_GENMODE 1 | ||
145 | -- | ||
146 | 1.7.9.4 | ||
147 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0011-meta-ti-Remove-debug-messages-for-meta-ti.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0011-meta-ti-Remove-debug-messages-for-meta-ti.patch new file mode 100644 index 00000000..9470d398 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0011-meta-ti-Remove-debug-messages-for-meta-ti.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From f3e413faef836c5f9357f091d7149a8924ffabdd Mon Sep 17 00:00:00 2001 | ||
2 | From: Joel A Fernandes <joelagnel@ti.com> | ||
3 | Date: Mon, 28 Nov 2011 20:56:48 -0600 | ||
4 | Subject: [PATCH 11/22] meta-ti: Remove debug messages for meta-ti | ||
5 | |||
6 | Signed-off-by: Joel A Fernandes <joelagnel@ti.com> | ||
7 | --- | ||
8 | drivers/input/touchscreen/ti_tscadc.c | 4 ++-- | ||
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
10 | |||
11 | diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c | ||
12 | index a74d9ba..1f9cbf5 100644 | ||
13 | --- a/drivers/input/touchscreen/ti_tscadc.c | ||
14 | +++ b/drivers/input/touchscreen/ti_tscadc.c | ||
15 | @@ -181,14 +181,14 @@ static irqreturn_t tsc_adc_interrupt(int irq, void *dev) | ||
16 | |||
17 | status = tscadc_readl(ts_dev, TSCADC_REG_IRQSTATUS); | ||
18 | |||
19 | - printk("interrupt! status=%x\n", status); | ||
20 | + // printk("interrupt! status=%x\n", status); | ||
21 | // if (status & TSCADC_IRQENB_EOS) { | ||
22 | // irqclr |= TSCADC_IRQENB_EOS; | ||
23 | // } | ||
24 | |||
25 | if (status & TSCADC_IRQENB_FIFO0THRES) { | ||
26 | fifo1count = tscadc_readl(ts_dev, TSCADC_REG_FIFO0CNT); | ||
27 | - printk("fifo 0 count = %d\n", fifo1count); | ||
28 | + // printk("fifo 0 count = %d\n", fifo1count); | ||
29 | |||
30 | for (i = 0; i < fifo1count; i++) { | ||
31 | read_sample = tscadc_readl(ts_dev, TSCADC_REG_FIFO0); | ||
32 | -- | ||
33 | 1.7.9.4 | ||
34 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0012-tscadc-switch-to-polling-instead-of-interrupts.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0012-tscadc-switch-to-polling-instead-of-interrupts.patch new file mode 100644 index 00000000..d1456ada --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0012-tscadc-switch-to-polling-instead-of-interrupts.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From 994bbaf10e91e859c54ba238e72e8f6f496c14e0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Joel A Fernandes <joelagnel@ti.com> | ||
3 | Date: Tue, 29 Nov 2011 09:44:22 -0600 | ||
4 | Subject: [PATCH 12/22] tscadc: switch to polling instead of interrupts | ||
5 | |||
6 | Signed-off-by: Joel A Fernandes <joelagnel@ti.com> | ||
7 | --- | ||
8 | drivers/input/touchscreen/ti_tscadc.c | 16 ++++++++++++++-- | ||
9 | 1 file changed, 14 insertions(+), 2 deletions(-) | ||
10 | |||
11 | diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c | ||
12 | index 1f9cbf5..8e2a994 100644 | ||
13 | --- a/drivers/input/touchscreen/ti_tscadc.c | ||
14 | +++ b/drivers/input/touchscreen/ti_tscadc.c | ||
15 | @@ -477,6 +477,8 @@ size_t do_adc_sample(struct kobject *kobj, struct attribute *attr, char *buf) { | ||
16 | struct device *dev; | ||
17 | struct tscadc *ts_dev; | ||
18 | int channel_num; | ||
19 | + int fifo0count = 0; | ||
20 | + int read_sample = 0; | ||
21 | |||
22 | pdev = (struct platform_device *)container_of(kobj, struct device, kobj); | ||
23 | dev = &pdev->dev; | ||
24 | @@ -496,7 +498,17 @@ size_t do_adc_sample(struct kobject *kobj, struct attribute *attr, char *buf) { | ||
25 | |||
26 | tsc_adc_step_config(ts_dev, channel_num); | ||
27 | |||
28 | - memcpy(buf, attr->name, strlen(attr->name)+1); | ||
29 | + do { | ||
30 | + fifo0count = tscadc_readl(ts_dev, TSCADC_REG_FIFO0CNT); | ||
31 | + } | ||
32 | + while (!fifo0count); | ||
33 | + | ||
34 | + while (fifo0count--) { | ||
35 | + read_sample = tscadc_readl(ts_dev, TSCADC_REG_FIFO0) & 0xfff; | ||
36 | + // printk("polling sample: %d: %x\n", fifo0count, read_sample); | ||
37 | + } | ||
38 | + sprintf(buf, "%d", read_sample); | ||
39 | + | ||
40 | return strlen(attr->name); | ||
41 | } | ||
42 | |||
43 | @@ -656,7 +668,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev) | ||
44 | } | ||
45 | else { | ||
46 | tscadc_writel(ts_dev, TSCADC_REG_FIFO0THR, 0); | ||
47 | - irqenable = TSCADC_IRQENB_FIFO0THRES; | ||
48 | + irqenable = 0; // TSCADC_IRQENB_FIFO0THRES; | ||
49 | } | ||
50 | tscadc_writel(ts_dev, TSCADC_REG_IRQENABLE, irqenable); | ||
51 | |||
52 | -- | ||
53 | 1.7.9.4 | ||
54 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0013-beaglebone-fix-ADC-init.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0013-beaglebone-fix-ADC-init.patch new file mode 100644 index 00000000..97367382 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0013-beaglebone-fix-ADC-init.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | From 045193b61f57d4244e569800b252fff5e6e91a4b Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Tue, 31 Jan 2012 14:50:55 +0100 | ||
4 | Subject: [PATCH 13/22] beaglebone: fix ADC init | ||
5 | |||
6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
7 | --- | ||
8 | arch/arm/mach-omap2/board-am335xevm.c | 6 ++---- | ||
9 | 1 file changed, 2 insertions(+), 4 deletions(-) | ||
10 | |||
11 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
12 | index ac4f78f..177ab9e 100644 | ||
13 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
14 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
15 | @@ -248,11 +248,11 @@ static struct resource tsc_resources[] = { | ||
16 | static struct tsc_data am335x_touchscreen_data = { | ||
17 | .wires = 4, | ||
18 | .x_plate_resistance = 200, | ||
19 | -// .mode = TI_TSCADC_TSCMODE, | ||
20 | + .mode = TI_TSCADC_TSCMODE, | ||
21 | }; | ||
22 | |||
23 | static struct tsc_data bone_touchscreen_data = { | ||
24 | -// .mode = TI_TSCADC_GENMODE, | ||
25 | + .mode = TI_TSCADC_GENMODE, | ||
26 | }; | ||
27 | |||
28 | static struct platform_device tsc_device = { | ||
29 | @@ -2182,7 +2182,6 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = { | ||
30 | {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
31 | {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
32 | {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
33 | - {bone_tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
34 | {NULL, 0, 0}, | ||
35 | }; | ||
36 | |||
37 | @@ -2195,7 +2194,6 @@ static struct evm_dev_cfg beaglebone_dev_cfg[] = { | ||
38 | {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
39 | {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
40 | {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
41 | - {bone_tsc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | ||
42 | {NULL, 0, 0}, | ||
43 | }; | ||
44 | |||
45 | -- | ||
46 | 1.7.9.4 | ||
47 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0014-AM335x-MUX-add-ehrpwm1A.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0014-AM335x-MUX-add-ehrpwm1A.patch new file mode 100644 index 00000000..15aebe50 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0014-AM335x-MUX-add-ehrpwm1A.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | From bc405fc66657f9275bcdfe82c46e78ab71195f93 Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Tue, 31 Jan 2012 16:49:52 +0100 | ||
4 | Subject: [PATCH 14/22] AM335x: MUX: add ehrpwm1A | ||
5 | |||
6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
7 | --- | ||
8 | arch/arm/mach-omap2/mux33xx.c | 2 +- | ||
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/arch/arm/mach-omap2/mux33xx.c b/arch/arm/mach-omap2/mux33xx.c | ||
12 | index 14ef129..fcb81ec 100644 | ||
13 | --- a/arch/arm/mach-omap2/mux33xx.c | ||
14 | +++ b/arch/arm/mach-omap2/mux33xx.c | ||
15 | @@ -85,7 +85,7 @@ static struct omap_mux __initdata am33xx_muxmodes[] = { | ||
16 | NULL, NULL, NULL, "gpio1_17"), | ||
17 | _AM33XX_MUXENTRY(GPMC_A2, 0, | ||
18 | "gpmc_a2", "mii2_txd3", "rgmii2_td3", "mmc2_dat1", | ||
19 | - NULL, NULL, NULL, "gpio1_18"), | ||
20 | + NULL, NULL, "ehrpwm1A", "gpio1_18"), | ||
21 | _AM33XX_MUXENTRY(GPMC_A3, 0, | ||
22 | "gpmc_a3", "mii2_txd2", "rgmii2_td2", "mmc2_dat2", | ||
23 | NULL, NULL, NULL, "gpio1_19"), | ||
24 | -- | ||
25 | 1.7.9.4 | ||
26 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0015-beaglebone-enable-PWM-for-lcd-backlight-backlight-is.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0015-beaglebone-enable-PWM-for-lcd-backlight-backlight-is.patch new file mode 100644 index 00000000..b98a95cf --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0015-beaglebone-enable-PWM-for-lcd-backlight-backlight-is.patch | |||
@@ -0,0 +1,177 @@ | |||
1 | From b1340250f872964ced2298fc4e0ae4d39469cf12 Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Tue, 31 Jan 2012 17:02:10 +0100 | ||
4 | Subject: [PATCH 15/22] beaglebone: enable PWM for lcd backlight <- backlight | ||
5 | is inverted | ||
6 | |||
7 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
8 | --- | ||
9 | arch/arm/mach-omap2/board-am335xevm.c | 54 +++++++++++++++++++++++++++------ | ||
10 | arch/arm/mach-omap2/devices.c | 13 ++++++++ | ||
11 | arch/arm/mach-omap2/devices.h | 1 + | ||
12 | 3 files changed, 58 insertions(+), 10 deletions(-) | ||
13 | |||
14 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
15 | index 177ab9e..6a77194 100644 | ||
16 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
17 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
18 | @@ -36,6 +36,7 @@ | ||
19 | #include <linux/mfd/tps65910.h> | ||
20 | #include <linux/mfd/tps65217.h> | ||
21 | #include <linux/pwm_backlight.h> | ||
22 | +#include <linux/pwm/pwm.h> | ||
23 | |||
24 | /* LCD controller is similar to DA850 */ | ||
25 | #include <video/da8xx-fb.h> | ||
26 | @@ -131,7 +132,7 @@ static const struct display_panel disp_panel = { | ||
27 | /* LCD backlight platform Data */ | ||
28 | #define AM335X_BACKLIGHT_MAX_BRIGHTNESS 100 | ||
29 | #define AM335X_BACKLIGHT_DEFAULT_BRIGHTNESS 100 | ||
30 | -#define AM335X_PWM_PERIOD_NANO_SECONDS (1000000 * 10) | ||
31 | +#define AM335X_PWM_PERIOD_NANO_SECONDS (1000000 * 5) | ||
32 | |||
33 | #define PWM_DEVICE_ID "ecap.0" | ||
34 | |||
35 | @@ -175,6 +176,16 @@ static const struct display_panel bbtoys7_panel = { | ||
36 | COLOR_ACTIVE, | ||
37 | }; | ||
38 | |||
39 | +#define BBTOYS7LCD_PWM_DEVICE_ID "ehrpwm.1:0" | ||
40 | + | ||
41 | +static struct platform_pwm_backlight_data bbtoys7lcd_backlight_data = { | ||
42 | + .pwm_id = BBTOYS7LCD_PWM_DEVICE_ID, | ||
43 | + .ch = -1, | ||
44 | + .max_brightness = AM335X_BACKLIGHT_MAX_BRIGHTNESS, | ||
45 | + .dft_brightness = AM335X_BACKLIGHT_DEFAULT_BRIGHTNESS, | ||
46 | + .pwm_period_ns = AM335X_PWM_PERIOD_NANO_SECONDS, | ||
47 | +}; | ||
48 | + | ||
49 | static struct lcd_ctrl_config bbtoys7_cfg = { | ||
50 | &bbtoys7_panel, | ||
51 | .ac_bias = 255, | ||
52 | @@ -586,9 +597,9 @@ static struct pinmux_config bbtoys7_pin_mux[] = { | ||
53 | {"lcd_vsync.lcd_vsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
54 | {"lcd_hsync.lcd_hsync", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
55 | {"lcd_pclk.lcd_pclk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
56 | - {"lcd_ac_bias_en.lcd_ac_bias_en", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
57 | - {"gpmc_a2.gpio1_18", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // Backlight | ||
58 | + {"lcd_ac_bias_en.lcd_ac_bias_en", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | ||
59 | {"ecap0_in_pwm0_out.gpio0_7", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // AVDD_EN | ||
60 | + {"gpmc_a2.ehrpwm1A", OMAP_MUX_MODE6 | AM33XX_PIN_OUTPUT}, // Backlight | ||
61 | {NULL, 0}, | ||
62 | }; | ||
63 | |||
64 | @@ -1121,6 +1132,7 @@ static struct pinmux_config ecap0_pin_mux[] = { | ||
65 | {NULL, 0}, | ||
66 | }; | ||
67 | |||
68 | +static int ehrpwm_backlight_enable; | ||
69 | static int backlight_enable; | ||
70 | |||
71 | #define AM335XEVM_WLAN_PMENA_GPIO GPIO_TO_PIN(1, 30) | ||
72 | @@ -1190,6 +1202,30 @@ static int __init ecap0_init(void) | ||
73 | } | ||
74 | late_initcall(ecap0_init); | ||
75 | |||
76 | +static void enable_ehrpwm1(int evm_id, int profile) | ||
77 | +{ | ||
78 | + ehrpwm_backlight_enable = true; | ||
79 | +} | ||
80 | + | ||
81 | +/* Setup pwm-backlight for bbtoys7lcd */ | ||
82 | +static struct platform_device bbtoys7lcd_backlight = { | ||
83 | + .name = "pwm-backlight", | ||
84 | + .id = -1, | ||
85 | + .dev = { | ||
86 | + .platform_data = &bbtoys7lcd_backlight_data, | ||
87 | + } | ||
88 | +}; | ||
89 | + | ||
90 | +static int __init ehrpwm1_init(void) | ||
91 | +{ | ||
92 | + int status = 0; | ||
93 | + if (ehrpwm_backlight_enable) { | ||
94 | + platform_device_register(&bbtoys7lcd_backlight); | ||
95 | + } | ||
96 | + return status; | ||
97 | +} | ||
98 | +late_initcall(ehrpwm1_init); | ||
99 | + | ||
100 | static int __init conf_disp_pll(int rate) | ||
101 | { | ||
102 | struct clk *disp_pll; | ||
103 | @@ -1224,11 +1260,12 @@ static void lcdc_init(int evm_id, int profile) | ||
104 | } | ||
105 | |||
106 | #define BEAGLEBONE_LCD_AVDD_EN GPIO_TO_PIN(0, 7) | ||
107 | -#define BEAGLEBONE_LCD_BL GPIO_TO_PIN(1, 18) | ||
108 | |||
109 | static void bbtoys7lcd_init(int evm_id, int profile) | ||
110 | { | ||
111 | setup_pin_mux(bbtoys7_pin_mux); | ||
112 | + gpio_request(BEAGLEBONE_LCD_AVDD_EN, "BONE_LCD_AVDD_EN"); | ||
113 | + gpio_direction_output(BEAGLEBONE_LCD_AVDD_EN, 1); | ||
114 | |||
115 | // we are being stupid and setting pixclock from here instead of da8xx-fb.c | ||
116 | if (conf_disp_pll(300000000)) { | ||
117 | @@ -1239,12 +1276,7 @@ static void bbtoys7lcd_init(int evm_id, int profile) | ||
118 | |||
119 | if (am33xx_register_lcdc(&bbtoys7_pdata)) | ||
120 | pr_info("Failed to register Beagleboardtoys 7\" LCD cape device\n"); | ||
121 | - | ||
122 | - gpio_request(BEAGLEBONE_LCD_BL, "BONE_LCD_BL"); | ||
123 | - gpio_direction_output(BEAGLEBONE_LCD_BL, 1); | ||
124 | - gpio_request(BEAGLEBONE_LCD_AVDD_EN, "BONE_LCD_AVDD_EN"); | ||
125 | - gpio_direction_output(BEAGLEBONE_LCD_AVDD_EN, 1); | ||
126 | - | ||
127 | + | ||
128 | return; | ||
129 | } | ||
130 | |||
131 | @@ -1768,6 +1800,8 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context | ||
132 | bbtoys7lcd_init(0,0); | ||
133 | pr_info("BeagleBone cape: initializing LCD cape touchscreen\n"); | ||
134 | tsc_init(0,0); | ||
135 | + pr_info("BeagleBone cape: Registering PWM backlight for LCD cape\n"); | ||
136 | + enable_ehrpwm1(0,0); | ||
137 | beaglebone_tsadcpins_free = 0; | ||
138 | } | ||
139 | |||
140 | diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c | ||
141 | index 198df7b..8cd2523 100644 | ||
142 | --- a/arch/arm/mach-omap2/devices.c | ||
143 | +++ b/arch/arm/mach-omap2/devices.c | ||
144 | @@ -1278,6 +1278,19 @@ void register_ehrpwm(int max_freq) | ||
145 | platform_device_register(&am335x_epwm2_device); | ||
146 | } | ||
147 | |||
148 | +void register_ehrpwm1(int max_freq) | ||
149 | +{ | ||
150 | + int val; | ||
151 | + | ||
152 | + val = __raw_readw(AM33XX_CTRL_REGADDR(AM33XX_PWMSS_CTRL)); | ||
153 | + val |= PWMSS1_TBCLKEN; | ||
154 | + __raw_writew(val, AM33XX_CTRL_REGADDR(AM33XX_PWMSS_CTRL)); | ||
155 | + am335x_pwmss_config1.chan_attrib[1].max_freq = max_freq; | ||
156 | + sema_init(&am335x_pwmss_config1.config_semaphore, 1); | ||
157 | + am335x_pwmss_config1.version = PWM_VERSION_1; | ||
158 | + platform_device_register(&am335x_epwm1_device); | ||
159 | +} | ||
160 | + | ||
161 | static struct resource am335x_ecap0_resurce[] = { | ||
162 | { | ||
163 | .start = AM33XX_EPWMSS0_BASE , | ||
164 | diff --git a/arch/arm/mach-omap2/devices.h b/arch/arm/mach-omap2/devices.h | ||
165 | index e086839..5161eb4 100644 | ||
166 | --- a/arch/arm/mach-omap2/devices.h | ||
167 | +++ b/arch/arm/mach-omap2/devices.h | ||
168 | @@ -18,5 +18,6 @@ int omap3_init_camera(struct isp_platform_data *pdata); | ||
169 | |||
170 | void __init am335x_register_mcasp1(struct snd_platform_data *pdata); | ||
171 | extern void register_ehrpwm(int max_freq); | ||
172 | +extern void register_ehrpwm1(int max_freq); | ||
173 | |||
174 | #endif | ||
175 | -- | ||
176 | 1.7.9.4 | ||
177 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0016-omap_hsmmc-Set-dto-to-max-value-of-14-to-avoid-SD-Ca.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0016-omap_hsmmc-Set-dto-to-max-value-of-14-to-avoid-SD-Ca.patch new file mode 100644 index 00000000..fb61077c --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0016-omap_hsmmc-Set-dto-to-max-value-of-14-to-avoid-SD-Ca.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From 0cc4e8a341f58683ee26bceb27e43cbb7bb3dc30 Mon Sep 17 00:00:00 2001 | ||
2 | From: Steve Sakoman <steve@sakoman.com> | ||
3 | Date: Mon, 18 Jul 2011 23:13:41 -0500 | ||
4 | Subject: [PATCH 16/22] omap_hsmmc: Set dto to max value of 14 to avoid SD | ||
5 | Card timeouts | ||
6 | |||
7 | This fixes MMC errors due to timeouts on certain SD Cards following suggestions | ||
8 | to set dto to 14 by Jason Kridner and Steven Kipisz | ||
9 | |||
10 | Details of the issue: | ||
11 | http://talk.maemo.org/showthread.php?p=1000707#post1000707 | ||
12 | |||
13 | This fix was originally proposed by Sukumar Ghoral of TI. | ||
14 | --- | ||
15 | drivers/mmc/host/omap_hsmmc.c | 3 +++ | ||
16 | 1 file changed, 3 insertions(+) | ||
17 | |||
18 | diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c | ||
19 | index 703013c..554237f 100644 | ||
20 | --- a/drivers/mmc/host/omap_hsmmc.c | ||
21 | +++ b/drivers/mmc/host/omap_hsmmc.c | ||
22 | @@ -1562,6 +1562,9 @@ static void set_data_timeout(struct omap_hsmmc_host *host, | ||
23 | dto = 14; | ||
24 | } | ||
25 | |||
26 | + /* Set dto to max value of 14 to avoid SD Card timeouts */ | ||
27 | + dto = 14; | ||
28 | + | ||
29 | reg &= ~DTO_MASK; | ||
30 | reg |= dto << DTO_SHIFT; | ||
31 | OMAP_HSMMC_WRITE(host->base, SYSCTL, reg); | ||
32 | -- | ||
33 | 1.7.9.4 | ||
34 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0017-beaglebone-set-default-brightness-to-50-for-pwm-back.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0017-beaglebone-set-default-brightness-to-50-for-pwm-back.patch new file mode 100644 index 00000000..d170569f --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0017-beaglebone-set-default-brightness-to-50-for-pwm-back.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | From f4574c67479c3c86f5eb78a1806f627740c91483 Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Wed, 1 Feb 2012 14:10:38 +0100 | ||
4 | Subject: [PATCH 17/22] beaglebone: set default brightness to 50% for pwm | ||
5 | backlights | ||
6 | |||
7 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
8 | --- | ||
9 | arch/arm/mach-omap2/board-am335xevm.c | 2 +- | ||
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
11 | |||
12 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
13 | index 6a77194..c31c0aa 100644 | ||
14 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
15 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
16 | @@ -131,7 +131,7 @@ static const struct display_panel disp_panel = { | ||
17 | |||
18 | /* LCD backlight platform Data */ | ||
19 | #define AM335X_BACKLIGHT_MAX_BRIGHTNESS 100 | ||
20 | -#define AM335X_BACKLIGHT_DEFAULT_BRIGHTNESS 100 | ||
21 | +#define AM335X_BACKLIGHT_DEFAULT_BRIGHTNESS 50 | ||
22 | #define AM335X_PWM_PERIOD_NANO_SECONDS (1000000 * 5) | ||
23 | |||
24 | #define PWM_DEVICE_ID "ecap.0" | ||
25 | -- | ||
26 | 1.7.9.4 | ||
27 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0018-st7735fb-WIP-framebuffer-driver-supporting-Adafruit-.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0018-st7735fb-WIP-framebuffer-driver-supporting-Adafruit-.patch new file mode 100644 index 00000000..fbd442c8 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0018-st7735fb-WIP-framebuffer-driver-supporting-Adafruit-.patch | |||
@@ -0,0 +1,668 @@ | |||
1 | From dd3b1a497531a579e80656f298bf8adf7a789f43 Mon Sep 17 00:00:00 2001 | ||
2 | From: Matt Porter <mporter@ti.com> | ||
3 | Date: Mon, 21 Nov 2011 12:55:23 -0500 | ||
4 | Subject: [PATCH 18/22] st7735fb: WIP framebuffer driver supporting Adafruit | ||
5 | 1.8" SPI LCD | ||
6 | |||
7 | Signed-off-by: Matt Porter <mporter@ti.com> | ||
8 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
9 | --- | ||
10 | drivers/video/Kconfig | 11 + | ||
11 | drivers/video/Makefile | 1 + | ||
12 | drivers/video/st7735fb.c | 516 ++++++++++++++++++++++++++++++++++++++++++++++ | ||
13 | include/video/st7735fb.h | 86 ++++++++ | ||
14 | 4 files changed, 614 insertions(+) | ||
15 | create mode 100644 drivers/video/st7735fb.c | ||
16 | create mode 100644 include/video/st7735fb.h | ||
17 | |||
18 | diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig | ||
19 | index f66bf0e..64754de 100644 | ||
20 | --- a/drivers/video/Kconfig | ||
21 | +++ b/drivers/video/Kconfig | ||
22 | @@ -2420,6 +2420,17 @@ config FB_PUV3_UNIGFX | ||
23 | Choose this option if you want to use the Unigfx device as a | ||
24 | framebuffer device. Without the support of PCI & AGP. | ||
25 | |||
26 | +config FB_ST7735 | ||
27 | + tristate "ST7735 framebuffer support" | ||
28 | + depends on FB && SPI | ||
29 | + select FB_SYS_FILLRECT | ||
30 | + select FB_SYS_COPYAREA | ||
31 | + select FB_SYS_IMAGEBLIT | ||
32 | + select FB_SYS_FOPS | ||
33 | + select FB_DEFERRED_IO | ||
34 | + help | ||
35 | + Framebuffer support for the ST7735 display controller in SPI mode. | ||
36 | + | ||
37 | source "drivers/video/omap/Kconfig" | ||
38 | source "drivers/video/omap2/Kconfig" | ||
39 | |||
40 | diff --git a/drivers/video/Makefile b/drivers/video/Makefile | ||
41 | index 9b9d8ff..c6d9851 100644 | ||
42 | --- a/drivers/video/Makefile | ||
43 | +++ b/drivers/video/Makefile | ||
44 | @@ -143,6 +143,7 @@ obj-$(CONFIG_FB_MSM) += msm/ | ||
45 | obj-$(CONFIG_FB_NUC900) += nuc900fb.o | ||
46 | obj-$(CONFIG_FB_JZ4740) += jz4740_fb.o | ||
47 | obj-$(CONFIG_FB_PUV3_UNIGFX) += fb-puv3.o | ||
48 | +obj-$(CONFIG_FB_ST7735) += st7735fb.o | ||
49 | |||
50 | # Platform or fallback drivers go here | ||
51 | obj-$(CONFIG_FB_UVESA) += uvesafb.o | ||
52 | diff --git a/drivers/video/st7735fb.c b/drivers/video/st7735fb.c | ||
53 | new file mode 100644 | ||
54 | index 0000000..500cc88 | ||
55 | --- /dev/null | ||
56 | +++ b/drivers/video/st7735fb.c | ||
57 | @@ -0,0 +1,516 @@ | ||
58 | +/* | ||
59 | + * linux/drivers/video/st7735fb.c -- FB driver for ST7735 LCD controller | ||
60 | + * Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven. | ||
61 | + * | ||
62 | + * Copyright (C) 2011, Matt Porter | ||
63 | + * | ||
64 | + * This file is subject to the terms and conditions of the GNU General Public | ||
65 | + * License. See the file COPYING in the main directory of this archive for | ||
66 | + * more details. | ||
67 | + */ | ||
68 | + | ||
69 | +#include <linux/module.h> | ||
70 | +#include <linux/kernel.h> | ||
71 | +#include <linux/errno.h> | ||
72 | +#include <linux/string.h> | ||
73 | +#include <linux/mm.h> | ||
74 | +#include <linux/vmalloc.h> | ||
75 | +#include <linux/slab.h> | ||
76 | +#include <linux/init.h> | ||
77 | +#include <linux/fb.h> | ||
78 | +#include <linux/gpio.h> | ||
79 | +#include <linux/spi/spi.h> | ||
80 | +#include <linux/delay.h> | ||
81 | +#include <linux/uaccess.h> | ||
82 | + | ||
83 | +#include <video/st7735fb.h> | ||
84 | + | ||
85 | +static struct st7735_function st7735_cfg_script[] = { | ||
86 | + { ST7735_START, ST7735_START}, | ||
87 | + { ST7735_CMD, ST7735_SWRESET}, | ||
88 | + { ST7735_DELAY, 150}, | ||
89 | + { ST7735_CMD, ST7735_SLPOUT}, | ||
90 | + { ST7735_DELAY, 500}, | ||
91 | + { ST7735_CMD, ST7735_FRMCTR1}, | ||
92 | + { ST7735_DATA, 0x01}, | ||
93 | + { ST7735_DATA, 0x2c}, | ||
94 | + { ST7735_DATA, 0x2d}, | ||
95 | + { ST7735_CMD, ST7735_FRMCTR2}, | ||
96 | + { ST7735_DATA, 0x01}, | ||
97 | + { ST7735_DATA, 0x2c}, | ||
98 | + { ST7735_DATA, 0x2d}, | ||
99 | + { ST7735_CMD, ST7735_FRMCTR3}, | ||
100 | + { ST7735_DATA, 0x01}, | ||
101 | + { ST7735_DATA, 0x2c}, | ||
102 | + { ST7735_DATA, 0x2d}, | ||
103 | + { ST7735_DATA, 0x01}, | ||
104 | + { ST7735_DATA, 0x2c}, | ||
105 | + { ST7735_DATA, 0x2d}, | ||
106 | + { ST7735_CMD, ST7735_INVCTR}, | ||
107 | + { ST7735_DATA, 0x07}, | ||
108 | + { ST7735_CMD, ST7735_PWCTR1}, | ||
109 | + { ST7735_DATA, 0xa2}, | ||
110 | + { ST7735_DATA, 0x02}, | ||
111 | + { ST7735_DATA, 0x84}, | ||
112 | + { ST7735_CMD, ST7735_PWCTR2}, | ||
113 | + { ST7735_DATA, 0xc5}, | ||
114 | + { ST7735_CMD, ST7735_PWCTR3}, | ||
115 | + { ST7735_DATA, 0x0a}, | ||
116 | + { ST7735_DATA, 0x00}, | ||
117 | + { ST7735_CMD, ST7735_PWCTR4}, | ||
118 | + { ST7735_DATA, 0x8a}, | ||
119 | + { ST7735_DATA, 0x2a}, | ||
120 | + { ST7735_CMD, ST7735_PWCTR5}, | ||
121 | + { ST7735_DATA, 0x8a}, | ||
122 | + { ST7735_DATA, 0xee}, | ||
123 | + { ST7735_CMD, ST7735_VMCTR1}, | ||
124 | + { ST7735_DATA, 0x0e}, | ||
125 | + { ST7735_CMD, ST7735_INVOFF}, | ||
126 | + { ST7735_CMD, ST7735_MADCTL}, | ||
127 | + { ST7735_DATA, 0xc8}, | ||
128 | + { ST7735_CMD, ST7735_COLMOD}, | ||
129 | + { ST7735_DATA, 0x05}, | ||
130 | + { ST7735_CMD, ST7735_CASET}, | ||
131 | + { ST7735_DATA, 0x00}, | ||
132 | + { ST7735_DATA, 0x00}, | ||
133 | + { ST7735_DATA, 0x00}, | ||
134 | + { ST7735_DATA, 0x00}, | ||
135 | + { ST7735_DATA, 0x7f}, | ||
136 | + { ST7735_CMD, ST7735_RASET}, | ||
137 | + { ST7735_DATA, 0x00}, | ||
138 | + { ST7735_DATA, 0x00}, | ||
139 | + { ST7735_DATA, 0x00}, | ||
140 | + { ST7735_DATA, 0x00}, | ||
141 | + { ST7735_DATA, 0x9f}, | ||
142 | + { ST7735_CMD, ST7735_GMCTRP1}, | ||
143 | + { ST7735_DATA, 0x02}, | ||
144 | + { ST7735_DATA, 0x1c}, | ||
145 | + { ST7735_DATA, 0x07}, | ||
146 | + { ST7735_DATA, 0x12}, | ||
147 | + { ST7735_DATA, 0x37}, | ||
148 | + { ST7735_DATA, 0x32}, | ||
149 | + { ST7735_DATA, 0x29}, | ||
150 | + { ST7735_DATA, 0x2d}, | ||
151 | + { ST7735_DATA, 0x29}, | ||
152 | + { ST7735_DATA, 0x25}, | ||
153 | + { ST7735_DATA, 0x2b}, | ||
154 | + { ST7735_DATA, 0x39}, | ||
155 | + { ST7735_DATA, 0x00}, | ||
156 | + { ST7735_DATA, 0x01}, | ||
157 | + { ST7735_DATA, 0x03}, | ||
158 | + { ST7735_DATA, 0x10}, | ||
159 | + { ST7735_CMD, ST7735_GMCTRN1}, | ||
160 | + { ST7735_DATA, 0x03}, | ||
161 | + { ST7735_DATA, 0x1d}, | ||
162 | + { ST7735_DATA, 0x07}, | ||
163 | + { ST7735_DATA, 0x06}, | ||
164 | + { ST7735_DATA, 0x2e}, | ||
165 | + { ST7735_DATA, 0x2c}, | ||
166 | + { ST7735_DATA, 0x29}, | ||
167 | + { ST7735_DATA, 0x2d}, | ||
168 | + { ST7735_DATA, 0x2e}, | ||
169 | + { ST7735_DATA, 0x2e}, | ||
170 | + { ST7735_DATA, 0x37}, | ||
171 | + { ST7735_DATA, 0x3f}, | ||
172 | + { ST7735_DATA, 0x00}, | ||
173 | + { ST7735_DATA, 0x00}, | ||
174 | + { ST7735_DATA, 0x02}, | ||
175 | + { ST7735_DATA, 0x10}, | ||
176 | + { ST7735_CMD, ST7735_DISPON}, | ||
177 | + { ST7735_DELAY, 100}, | ||
178 | + { ST7735_CMD, ST7735_NORON}, | ||
179 | + { ST7735_DELAY, 10}, | ||
180 | + { ST7735_END, ST7735_END}, | ||
181 | +}; | ||
182 | + | ||
183 | +static struct fb_fix_screeninfo st7735fb_fix __devinitdata = { | ||
184 | + .id = "ST7735", | ||
185 | + .type = FB_TYPE_PACKED_PIXELS, | ||
186 | + .visual = FB_VISUAL_PSEUDOCOLOR, | ||
187 | + .xpanstep = 0, | ||
188 | + .ypanstep = 0, | ||
189 | + .ywrapstep = 0, | ||
190 | + .line_length = WIDTH*BPP/8, | ||
191 | + .accel = FB_ACCEL_NONE, | ||
192 | +}; | ||
193 | + | ||
194 | +static struct fb_var_screeninfo st7735fb_var __devinitdata = { | ||
195 | + .xres = WIDTH, | ||
196 | + .yres = HEIGHT, | ||
197 | + .xres_virtual = WIDTH, | ||
198 | + .yres_virtual = HEIGHT, | ||
199 | + .bits_per_pixel = BPP, | ||
200 | + .nonstd = 1, | ||
201 | +}; | ||
202 | + | ||
203 | +static int st7735_write(struct st7735fb_par *par, u8 data) | ||
204 | +{ | ||
205 | + u8 txbuf[2]; /* allocation from stack must go */ | ||
206 | + | ||
207 | + txbuf[0] = data; | ||
208 | + | ||
209 | + return spi_write(par->spi, &txbuf[0], 1); | ||
210 | +} | ||
211 | + | ||
212 | +static void st7735_write_data(struct st7735fb_par *par, u8 data) | ||
213 | +{ | ||
214 | + int ret = 0; | ||
215 | + | ||
216 | + /* Set data mode */ | ||
217 | + gpio_set_value(par->dc, 1); | ||
218 | + | ||
219 | + ret = st7735_write(par, data); | ||
220 | + if (ret < 0) | ||
221 | + pr_err("%s: write data %02x failed with status %d\n", | ||
222 | + par->info->fix.id, data, ret); | ||
223 | +} | ||
224 | + | ||
225 | +static int st7735_write_data_buf(struct st7735fb_par *par, | ||
226 | + u8 *txbuf, int size) | ||
227 | +{ | ||
228 | + /* Set data mode */ | ||
229 | + gpio_set_value(par->dc, 1); | ||
230 | + | ||
231 | + /* Write entire buffer */ | ||
232 | + return spi_write(par->spi, txbuf, size); | ||
233 | +} | ||
234 | + | ||
235 | +static void st7735_write_cmd(struct st7735fb_par *par, u8 data) | ||
236 | +{ | ||
237 | + int ret = 0; | ||
238 | + | ||
239 | + /* Set command mode */ | ||
240 | + gpio_set_value(par->dc, 0); | ||
241 | + | ||
242 | + ret = st7735_write(par, data); | ||
243 | + if (ret < 0) | ||
244 | + pr_err("%s: write command %02x failed with status %d\n", | ||
245 | + par->info->fix.id, data, ret); | ||
246 | +} | ||
247 | + | ||
248 | +static void st7735_run_cfg_script(struct st7735fb_par *par) | ||
249 | +{ | ||
250 | + int i = 0; | ||
251 | + int end_script = 0; | ||
252 | + | ||
253 | + do { | ||
254 | + switch (st7735_cfg_script[i].cmd) | ||
255 | + { | ||
256 | + case ST7735_START: | ||
257 | + break; | ||
258 | + case ST7735_CMD: | ||
259 | + st7735_write_cmd(par, | ||
260 | + st7735_cfg_script[i].data & 0xff); | ||
261 | + break; | ||
262 | + case ST7735_DATA: | ||
263 | + st7735_write_data(par, | ||
264 | + st7735_cfg_script[i].data & 0xff); | ||
265 | + break; | ||
266 | + case ST7735_DELAY: | ||
267 | + mdelay(st7735_cfg_script[i].data); | ||
268 | + break; | ||
269 | + case ST7735_END: | ||
270 | + end_script = 1; | ||
271 | + } | ||
272 | + i++; | ||
273 | + } while (!end_script); | ||
274 | +} | ||
275 | + | ||
276 | +static void st7735_set_addr_win(struct st7735fb_par *par, | ||
277 | + int xs, int ys, int xe, int ye) | ||
278 | +{ | ||
279 | + st7735_write_cmd(par, ST7735_CASET); | ||
280 | + st7735_write_data(par, 0x00); | ||
281 | + st7735_write_data(par, xs+2); | ||
282 | + st7735_write_data(par, 0x00); | ||
283 | + st7735_write_data(par, xe+2); | ||
284 | + st7735_write_cmd(par, ST7735_RASET); | ||
285 | + st7735_write_data(par, 0x00); | ||
286 | + st7735_write_data(par, ys+1); | ||
287 | + st7735_write_data(par, 0x00); | ||
288 | + st7735_write_data(par, ye+1); | ||
289 | +} | ||
290 | + | ||
291 | +static void st7735_reset(struct st7735fb_par *par) | ||
292 | +{ | ||
293 | + /* Reset controller */ | ||
294 | + gpio_set_value(par->rst, 0); | ||
295 | + udelay(10); | ||
296 | + gpio_set_value(par->rst, 1); | ||
297 | + mdelay(120); | ||
298 | +} | ||
299 | + | ||
300 | +static void st7735fb_update_display(struct st7735fb_par *par) | ||
301 | +{ | ||
302 | + int ret = 0; | ||
303 | + u8 *vmem = par->info->screen_base; | ||
304 | + | ||
305 | + /* | ||
306 | + TODO: | ||
307 | + Allow a subset of pages to be passed in | ||
308 | + (for deferred I/O). Check pages against | ||
309 | + pan display settings to see if they | ||
310 | + should be updated. | ||
311 | + */ | ||
312 | + /* For now, just write the full 40KiB on each update */ | ||
313 | + | ||
314 | + /* Set row/column data window */ | ||
315 | + st7735_set_addr_win(par, 0, 0, WIDTH-1, HEIGHT-1); | ||
316 | + | ||
317 | + /* Internal RAM write command */ | ||
318 | + st7735_write_cmd(par, ST7735_RAMWR); | ||
319 | + | ||
320 | + /* Blast framebuffer to ST7735 internal display RAM */ | ||
321 | + ret = st7735_write_data_buf(par, vmem, WIDTH*HEIGHT*BPP/8); | ||
322 | + if (ret < 0) | ||
323 | + pr_err("%s: spi_write failed to update display buffer\n", | ||
324 | + par->info->fix.id); | ||
325 | +} | ||
326 | + | ||
327 | +static void st7735fb_deferred_io(struct fb_info *info, | ||
328 | + struct list_head *pagelist) | ||
329 | +{ | ||
330 | + st7735fb_update_display(info->par); | ||
331 | +} | ||
332 | + | ||
333 | +static int st7735fb_init_display(struct st7735fb_par *par) | ||
334 | +{ | ||
335 | + /* TODO: Need some error checking on gpios */ | ||
336 | + | ||
337 | + /* Request GPIOs and initialize to default values */ | ||
338 | + gpio_request_one(par->rst, GPIOF_OUT_INIT_HIGH, | ||
339 | + "ST7735 Reset Pin"); | ||
340 | + gpio_request_one(par->dc, GPIOF_OUT_INIT_LOW, | ||
341 | + "ST7735 Data/Command Pin"); | ||
342 | + | ||
343 | + st7735_reset(par); | ||
344 | + | ||
345 | + st7735_run_cfg_script(par); | ||
346 | + | ||
347 | + return 0; | ||
348 | +} | ||
349 | + | ||
350 | +void st7735fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | ||
351 | +{ | ||
352 | + struct st7735fb_par *par = info->par; | ||
353 | + | ||
354 | + sys_fillrect(info, rect); | ||
355 | + | ||
356 | + st7735fb_update_display(par); | ||
357 | +} | ||
358 | + | ||
359 | +void st7735fb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | ||
360 | +{ | ||
361 | + struct st7735fb_par *par = info->par; | ||
362 | + | ||
363 | + sys_copyarea(info, area); | ||
364 | + | ||
365 | + st7735fb_update_display(par); | ||
366 | +} | ||
367 | + | ||
368 | +void st7735fb_imageblit(struct fb_info *info, const struct fb_image *image) | ||
369 | +{ | ||
370 | + struct st7735fb_par *par = info->par; | ||
371 | + | ||
372 | + sys_imageblit(info, image); | ||
373 | + | ||
374 | + st7735fb_update_display(par); | ||
375 | +} | ||
376 | + | ||
377 | +static ssize_t st7735fb_write(struct fb_info *info, const char __user *buf, | ||
378 | + size_t count, loff_t *ppos) | ||
379 | +{ | ||
380 | + struct st7735fb_par *par = info->par; | ||
381 | + unsigned long p = *ppos; | ||
382 | + void *dst; | ||
383 | + int err = 0; | ||
384 | + unsigned long total_size; | ||
385 | + | ||
386 | + if (info->state != FBINFO_STATE_RUNNING) | ||
387 | + return -EPERM; | ||
388 | + | ||
389 | + total_size = info->fix.smem_len; | ||
390 | + | ||
391 | + if (p > total_size) | ||
392 | + return -EFBIG; | ||
393 | + | ||
394 | + if (count > total_size) { | ||
395 | + err = -EFBIG; | ||
396 | + count = total_size; | ||
397 | + } | ||
398 | + | ||
399 | + if (count + p > total_size) { | ||
400 | + if (!err) | ||
401 | + err = -ENOSPC; | ||
402 | + | ||
403 | + count = total_size - p; | ||
404 | + } | ||
405 | + | ||
406 | + dst = (void __force *) (info->screen_base + p); | ||
407 | + | ||
408 | + if (copy_from_user(dst, buf, count)) | ||
409 | + err = -EFAULT; | ||
410 | + | ||
411 | + if (!err) | ||
412 | + *ppos += count; | ||
413 | + | ||
414 | + st7735fb_update_display(par); | ||
415 | + | ||
416 | + return (err) ? err : count; | ||
417 | +} | ||
418 | + | ||
419 | +static struct fb_ops st7735fb_ops = { | ||
420 | + .owner = THIS_MODULE, | ||
421 | + .fb_read = fb_sys_read, | ||
422 | + .fb_write = st7735fb_write, | ||
423 | + .fb_fillrect = st7735fb_fillrect, | ||
424 | + .fb_copyarea = st7735fb_copyarea, | ||
425 | + .fb_imageblit = st7735fb_imageblit, | ||
426 | +}; | ||
427 | + | ||
428 | +static struct fb_deferred_io st7735fb_defio = { | ||
429 | + .delay = HZ, | ||
430 | + .deferred_io = st7735fb_deferred_io, | ||
431 | +}; | ||
432 | + | ||
433 | +static int __devinit st7735fb_probe (struct spi_device *spi) | ||
434 | +{ | ||
435 | + int chip = spi_get_device_id(spi)->driver_data; | ||
436 | + struct st7735fb_platform_data *pdata = spi->dev.platform_data; | ||
437 | + int vmem_size = WIDTH*HEIGHT*BPP/8; | ||
438 | + u8 *vmem; | ||
439 | + struct fb_info *info; | ||
440 | + struct st7735fb_par *par; | ||
441 | + int retval = -ENOMEM; | ||
442 | + | ||
443 | + if (chip != ST7735_DISPLAY_AF_TFT18) { | ||
444 | + pr_err("%s: only the %s device is supported\n", DRVNAME, | ||
445 | + to_spi_driver(spi->dev.driver)->id_table->name); | ||
446 | + return -EINVAL; | ||
447 | + } | ||
448 | + | ||
449 | + if (!pdata) { | ||
450 | + pr_err("%s: platform data required for rst and dc info\n", | ||
451 | + DRVNAME); | ||
452 | + return -EINVAL; | ||
453 | + } | ||
454 | + | ||
455 | + vmem = vzalloc(vmem_size); | ||
456 | + if (!vmem) | ||
457 | + return retval; | ||
458 | + | ||
459 | + info = framebuffer_alloc(sizeof(struct st7735fb_par), &spi->dev); | ||
460 | + if (!info) | ||
461 | + goto fballoc_fail; | ||
462 | + | ||
463 | + info->screen_base = (u8 __force __iomem *)vmem; | ||
464 | + info->fbops = &st7735fb_ops; | ||
465 | + info->fix = st7735fb_fix; | ||
466 | + info->fix.smem_len = vmem_size; | ||
467 | + info->var = st7735fb_var; | ||
468 | + /* Choose any packed pixel format as long as it's RGB565 */ | ||
469 | + info->var.red.offset = 11; | ||
470 | + info->var.red.length = 5; | ||
471 | + info->var.green.offset = 5; | ||
472 | + info->var.green.length = 6; | ||
473 | + info->var.blue.offset = 0; | ||
474 | + info->var.blue.length = 5; | ||
475 | + info->var.transp.offset = 0; | ||
476 | + info->var.transp.length = 0; | ||
477 | + info->flags = FBINFO_FLAG_DEFAULT | | ||
478 | +#ifdef __LITTLE_ENDIAN | ||
479 | + FBINFO_FOREIGN_ENDIAN | | ||
480 | +#endif | ||
481 | + FBINFO_VIRTFB; | ||
482 | + | ||
483 | + info->fbdefio = &st7735fb_defio; | ||
484 | + fb_deferred_io_init(info); | ||
485 | + | ||
486 | + par = info->par; | ||
487 | + par->info = info; | ||
488 | + par->spi = spi; | ||
489 | + par->rst = pdata->rst_gpio; | ||
490 | + par->dc = pdata->dc_gpio; | ||
491 | + | ||
492 | + retval = register_framebuffer(info); | ||
493 | + if (retval < 0) | ||
494 | + goto fbreg_fail; | ||
495 | + | ||
496 | + spi_set_drvdata(spi, info); | ||
497 | + | ||
498 | + retval = st7735fb_init_display(par); | ||
499 | + if (retval < 0) | ||
500 | + goto init_fail; | ||
501 | + | ||
502 | + printk(KERN_INFO | ||
503 | + "fb%d: %s frame buffer device,\n\tusing %d KiB of video memory\n", | ||
504 | + info->node, info->fix.id, vmem_size); | ||
505 | + | ||
506 | + return 0; | ||
507 | + | ||
508 | + | ||
509 | + /* TODO: release gpios on fail */ | ||
510 | +init_fail: | ||
511 | + spi_set_drvdata(spi, NULL); | ||
512 | + | ||
513 | +fbreg_fail: | ||
514 | + framebuffer_release(info); | ||
515 | + | ||
516 | +fballoc_fail: | ||
517 | + vfree(vmem); | ||
518 | + | ||
519 | + return retval; | ||
520 | +} | ||
521 | + | ||
522 | +static int __devexit st7735fb_remove(struct spi_device *spi) | ||
523 | +{ | ||
524 | + struct fb_info *info = spi_get_drvdata(spi); | ||
525 | + | ||
526 | + spi_set_drvdata(spi, NULL); | ||
527 | + | ||
528 | + if (info) { | ||
529 | + unregister_framebuffer(info); | ||
530 | + vfree(info->screen_base); | ||
531 | + framebuffer_release(info); | ||
532 | + } | ||
533 | + | ||
534 | + /* TODO: release gpios */ | ||
535 | + | ||
536 | + return 0; | ||
537 | +} | ||
538 | + | ||
539 | +static const struct spi_device_id st7735fb_ids[] = { | ||
540 | + { "adafruit_tft18", ST7735_DISPLAY_AF_TFT18 }, | ||
541 | + { }, | ||
542 | +}; | ||
543 | + | ||
544 | +MODULE_DEVICE_TABLE(spi, st7735fb_ids); | ||
545 | + | ||
546 | +static struct spi_driver st7735fb_driver = { | ||
547 | + .driver = { | ||
548 | + .name = "st7735fb", | ||
549 | + .owner = THIS_MODULE, | ||
550 | + }, | ||
551 | + .id_table = st7735fb_ids, | ||
552 | + .probe = st7735fb_probe, | ||
553 | + .remove = __devexit_p(st7735fb_remove), | ||
554 | +}; | ||
555 | + | ||
556 | +static int __init st7735fb_init(void) | ||
557 | +{ | ||
558 | + return spi_register_driver(&st7735fb_driver); | ||
559 | +} | ||
560 | + | ||
561 | +static void __exit st7735fb_exit(void) | ||
562 | +{ | ||
563 | + spi_unregister_driver(&st7735fb_driver); | ||
564 | +} | ||
565 | + | ||
566 | +/* ------------------------------------------------------------------------- */ | ||
567 | + | ||
568 | +module_init(st7735fb_init); | ||
569 | +module_exit(st7735fb_exit); | ||
570 | + | ||
571 | +MODULE_DESCRIPTION("FB driver for ST7735 display controller"); | ||
572 | +MODULE_AUTHOR("Matt Porter"); | ||
573 | +MODULE_LICENSE("GPL"); | ||
574 | diff --git a/include/video/st7735fb.h b/include/video/st7735fb.h | ||
575 | new file mode 100644 | ||
576 | index 0000000..250f036 | ||
577 | --- /dev/null | ||
578 | +++ b/include/video/st7735fb.h | ||
579 | @@ -0,0 +1,86 @@ | ||
580 | +/* | ||
581 | + * linux/include/video/st7735fb.h -- FB driver for ST7735 LCD controller | ||
582 | + * | ||
583 | + * Copyright (C) 2011, Matt Porter | ||
584 | + * | ||
585 | + * This file is subject to the terms and conditions of the GNU General Public | ||
586 | + * License. See the file COPYING in the main directory of this archive for | ||
587 | + * more details. | ||
588 | + */ | ||
589 | + | ||
590 | +#define DRVNAME "st7735fb" | ||
591 | +#define WIDTH 128 | ||
592 | +#define HEIGHT 160 | ||
593 | +#define BPP 16 | ||
594 | + | ||
595 | +/* Supported display modules */ | ||
596 | +#define ST7735_DISPLAY_AF_TFT18 0 /* Adafruit SPI TFT 1.8" */ | ||
597 | + | ||
598 | +/* Init script function */ | ||
599 | +struct st7735_function { | ||
600 | + u16 cmd; | ||
601 | + u16 data; | ||
602 | +}; | ||
603 | + | ||
604 | +/* Init script commands */ | ||
605 | +enum st7735_cmd { | ||
606 | + ST7735_START, | ||
607 | + ST7735_END, | ||
608 | + ST7735_CMD, | ||
609 | + ST7735_DATA, | ||
610 | + ST7735_DELAY | ||
611 | +}; | ||
612 | + | ||
613 | +struct st7735fb_par { | ||
614 | + struct spi_device *spi; | ||
615 | + struct fb_info *info; | ||
616 | + int rst; | ||
617 | + int dc; | ||
618 | +}; | ||
619 | + | ||
620 | +struct st7735fb_platform_data { | ||
621 | + int rst_gpio; | ||
622 | + int dc_gpio; | ||
623 | +}; | ||
624 | + | ||
625 | +/* ST7735 Commands */ | ||
626 | +#define ST7735_NOP 0x0 | ||
627 | +#define ST7735_SWRESET 0x01 | ||
628 | +#define ST7735_RDDID 0x04 | ||
629 | +#define ST7735_RDDST 0x09 | ||
630 | +#define ST7735_SLPIN 0x10 | ||
631 | +#define ST7735_SLPOUT 0x11 | ||
632 | +#define ST7735_PTLON 0x12 | ||
633 | +#define ST7735_NORON 0x13 | ||
634 | +#define ST7735_INVOFF 0x20 | ||
635 | +#define ST7735_INVON 0x21 | ||
636 | +#define ST7735_DISPOFF 0x28 | ||
637 | +#define ST7735_DISPON 0x29 | ||
638 | +#define ST7735_CASET 0x2A | ||
639 | +#define ST7735_RASET 0x2B | ||
640 | +#define ST7735_RAMWR 0x2C | ||
641 | +#define ST7735_RAMRD 0x2E | ||
642 | +#define ST7735_COLMOD 0x3A | ||
643 | +#define ST7735_MADCTL 0x36 | ||
644 | +#define ST7735_FRMCTR1 0xB1 | ||
645 | +#define ST7735_FRMCTR2 0xB2 | ||
646 | +#define ST7735_FRMCTR3 0xB3 | ||
647 | +#define ST7735_INVCTR 0xB4 | ||
648 | +#define ST7735_DISSET5 0xB6 | ||
649 | +#define ST7735_PWCTR1 0xC0 | ||
650 | +#define ST7735_PWCTR2 0xC1 | ||
651 | +#define ST7735_PWCTR3 0xC2 | ||
652 | +#define ST7735_PWCTR4 0xC3 | ||
653 | +#define ST7735_PWCTR5 0xC4 | ||
654 | +#define ST7735_VMCTR1 0xC5 | ||
655 | +#define ST7735_RDID1 0xDA | ||
656 | +#define ST7735_RDID2 0xDB | ||
657 | +#define ST7735_RDID3 0xDC | ||
658 | +#define ST7735_RDID4 0xDD | ||
659 | +#define ST7735_GMCTRP1 0xE0 | ||
660 | +#define ST7735_GMCTRN1 0xE1 | ||
661 | +#define ST7735_PWCTR6 0xFC | ||
662 | + | ||
663 | + | ||
664 | + | ||
665 | + | ||
666 | -- | ||
667 | 1.7.9.4 | ||
668 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0019-beaglebone-use-P8_6-gpio1_3-as-w1-bus.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0019-beaglebone-use-P8_6-gpio1_3-as-w1-bus.patch new file mode 100644 index 00000000..8986fd8c --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0019-beaglebone-use-P8_6-gpio1_3-as-w1-bus.patch | |||
@@ -0,0 +1,83 @@ | |||
1 | From a2282555e35f8f3278d0d4b2fd67348152dde883 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/22] beaglebone: use P8_6 (gpio1_3) as w1 bus | ||
5 | |||
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(+) | ||
10 | |||
11 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
12 | index c31c0aa..538466d 100644 | ||
13 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
14 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
15 | @@ -37,6 +37,7 @@ | ||
16 | #include <linux/mfd/tps65217.h> | ||
17 | #include <linux/pwm_backlight.h> | ||
18 | #include <linux/pwm/pwm.h> | ||
19 | +#include <linux/w1-gpio.h> | ||
20 | |||
21 | /* LCD controller is similar to DA850 */ | ||
22 | #include <video/da8xx-fb.h> | ||
23 | @@ -603,6 +604,11 @@ static struct pinmux_config bbtoys7_pin_mux[] = { | ||
24 | {NULL, 0}, | ||
25 | }; | ||
26 | |||
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 | @@ -1026,6 +1032,19 @@ static struct pinmux_config profibus_pin_mux[] = { | ||
36 | {NULL, 0}, | ||
37 | }; | ||
38 | |||
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 */ | ||
53 | |||
54 | #define BEAGLEBONE_USR1_LED GPIO_TO_PIN(1, 21) | ||
55 | @@ -1349,6 +1368,17 @@ static void dvileds_init(int evm_id, int profile ) | ||
56 | pr_err("failed to register BeagleBone DVI cape LEDS\n"); | ||
57 | } | ||
58 | |||
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 | @@ -2228,6 +2258,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 | }; | ||
80 | |||
81 | -- | ||
82 | 1.7.9.4 | ||
83 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0020-beaglebone-add-support-for-Towertech-TT3201-CAN-cape.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0020-beaglebone-add-support-for-Towertech-TT3201-CAN-cape.patch new file mode 100644 index 00000000..9baf0c0d --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0020-beaglebone-add-support-for-Towertech-TT3201-CAN-cape.patch | |||
@@ -0,0 +1,320 @@ | |||
1 | From 9d67d32b9f1132157cd96a2e126a5b667b3640f1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alessandro Zummo <a.zummo@towertech.it> | ||
3 | Date: Thu, 9 Feb 2012 12:46:52 +0100 | ||
4 | Subject: [PATCH 20/22] beaglebone: add support for Towertech TT3201 CAN cape | ||
5 | |||
6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
7 | --- | ||
8 | arch/arm/mach-omap2/board-am335xevm.c | 54 ++++++++++++++++++++++++++++++++- | ||
9 | arch/arm/mach-omap2/mux33xx.c | 8 ++--- | ||
10 | drivers/net/can/dev.c | 8 ++--- | ||
11 | drivers/net/can/mcp251x.c | 47 ++++++++++++++++++++++------ | ||
12 | 4 files changed, 98 insertions(+), 19 deletions(-) | ||
13 | |||
14 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
15 | index 538466d..36efca1 100644 | ||
16 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
17 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
18 | @@ -38,6 +38,7 @@ | ||
19 | #include <linux/pwm_backlight.h> | ||
20 | #include <linux/pwm/pwm.h> | ||
21 | #include <linux/w1-gpio.h> | ||
22 | +#include <linux/can/platform/mcp251x.h> | ||
23 | |||
24 | /* LCD controller is similar to DA850 */ | ||
25 | #include <video/da8xx-fb.h> | ||
26 | @@ -829,6 +830,15 @@ static struct pinmux_config d_can_ia_pin_mux[] = { | ||
27 | {NULL, 0}, | ||
28 | }; | ||
29 | |||
30 | +static struct pinmux_config tt3201_pin_mux[] = { | ||
31 | + {"uart1_rxd.d_can1_tx", OMAP_MUX_MODE2 | AM33XX_PIN_OUTPUT }, | ||
32 | + {"uart1_txd.d_can1_rx", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP }, | ||
33 | + {"mcasp0_fsr.gpio3_19", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP }, | ||
34 | + {"mcasp0_ahclkx.gpio3_21", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP }, | ||
35 | + {"ecap0_in_pwm0_out.spi1_cs1", OMAP_MUX_MODE2 | AM33XX_PIN_OUTPUT_PULLUP }, | ||
36 | + {NULL, 0}, | ||
37 | +}; | ||
38 | + | ||
39 | /* Module pin mux for uart2 */ | ||
40 | static struct pinmux_config uart2_pin_mux[] = { | ||
41 | {"spi0_sclk.uart2_rxd", OMAP_MUX_MODE1 | AM33XX_SLEWCTRL_SLOW | | ||
42 | @@ -1788,6 +1798,44 @@ static void i2c1_init(int evm_id, int profile) | ||
43 | return; | ||
44 | } | ||
45 | |||
46 | +static struct mcp251x_platform_data mcp251x_info = { | ||
47 | + .oscillator_frequency = 16000000, | ||
48 | +}; | ||
49 | + | ||
50 | +static struct spi_board_info tt3201_spi_info[] = { | ||
51 | + { | ||
52 | + .modalias = "mcp2515", | ||
53 | + .max_speed_hz = 10000000, | ||
54 | + .bus_num = 2, | ||
55 | + .chip_select = 0, | ||
56 | + .mode = SPI_MODE_0, | ||
57 | + .platform_data = &mcp251x_info, | ||
58 | + }, | ||
59 | + { | ||
60 | + .modalias = "mcp2515", | ||
61 | + .max_speed_hz = 10000000, | ||
62 | + .bus_num = 2, | ||
63 | + .chip_select = 1, | ||
64 | + .mode = SPI_MODE_0, | ||
65 | + .platform_data = &mcp251x_info, | ||
66 | + }, | ||
67 | +}; | ||
68 | + | ||
69 | +static void tt3201_init(int evm_id, int profile) | ||
70 | +{ | ||
71 | + pr_info("TowerTech TT3201 CAN Cape\n"); | ||
72 | + | ||
73 | + setup_pin_mux(spi1_pin_mux); | ||
74 | + setup_pin_mux(tt3201_pin_mux); | ||
75 | + | ||
76 | + tt3201_spi_info[0].irq = gpio_to_irq(GPIO_TO_PIN(3, 19)); | ||
77 | + tt3201_spi_info[1].irq = gpio_to_irq(GPIO_TO_PIN(3, 21)); | ||
78 | + | ||
79 | + spi_register_board_info(tt3201_spi_info, | ||
80 | + ARRAY_SIZE(tt3201_spi_info)); | ||
81 | + | ||
82 | + am33xx_d_can_init(1); | ||
83 | +} | ||
84 | static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context) | ||
85 | { | ||
86 | capecount++; | ||
87 | @@ -1835,7 +1883,11 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context | ||
88 | beaglebone_tsadcpins_free = 0; | ||
89 | } | ||
90 | |||
91 | - | ||
92 | + if (!strncmp("TT3201-001", cape_config.partnumber, 10)) { | ||
93 | + pr_info("BeagleBone cape: initializing CAN cape\n"); | ||
94 | + tt3201_init(0,0); | ||
95 | + } | ||
96 | + | ||
97 | if ((capecount > 3) && (beaglebone_tsadcpins_free == 1)) { | ||
98 | pr_info("BeagleBone cape: exporting ADC pins to sysfs\n"); | ||
99 | bone_tsc_init(0,0); | ||
100 | diff --git a/arch/arm/mach-omap2/mux33xx.c b/arch/arm/mach-omap2/mux33xx.c | ||
101 | index fcb81ec..2de76e3 100644 | ||
102 | --- a/arch/arm/mach-omap2/mux33xx.c | ||
103 | +++ b/arch/arm/mach-omap2/mux33xx.c | ||
104 | @@ -312,16 +312,16 @@ static struct omap_mux __initdata am33xx_muxmodes[] = { | ||
105 | "uart0_txd", "spi1_cs1", "d_can0_rx", "i2c2_scl", | ||
106 | NULL, NULL, NULL, "gpio1_11"), | ||
107 | _AM33XX_MUXENTRY(UART1_CTSN, 0, | ||
108 | - "uart1_ctsn", NULL, NULL, "i2c2_sda", | ||
109 | + "uart1_ctsn", NULL, "d_can0_tx", "i2c2_sda", | ||
110 | "spi1_cs0", NULL, NULL, "gpio0_12"), | ||
111 | _AM33XX_MUXENTRY(UART1_RTSN, 0, | ||
112 | - "uart1_rtsn", NULL, NULL, "i2c2_scl", | ||
113 | + "uart1_rtsn", NULL, "d_can0_rx", "i2c2_scl", | ||
114 | "spi1_cs1", NULL, NULL, "gpio0_13"), | ||
115 | _AM33XX_MUXENTRY(UART1_RXD, 0, | ||
116 | - "uart1_rxd", "mmc1_sdwp", NULL, "i2c1_sda", | ||
117 | + "uart1_rxd", "mmc1_sdwp", "d_can1_tx", "i2c1_sda", | ||
118 | NULL, "pr1_uart0_rxd_mux1", NULL, "gpio0_14"), | ||
119 | _AM33XX_MUXENTRY(UART1_TXD, 0, | ||
120 | - "uart1_txd", "mmc2_sdwp", NULL, "i2c1_scl", | ||
121 | + "uart1_txd", "mmc2_sdwp", "d_can1_rx", "i2c1_scl", | ||
122 | NULL, "pr1_uart0_txd_mux1", NULL, "gpio0_15"), | ||
123 | _AM33XX_MUXENTRY(I2C0_SDA, 0, | ||
124 | "i2c0_sda", NULL, NULL, NULL, | ||
125 | diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c | ||
126 | index 25695bd..bc1e87e 100644 | ||
127 | --- a/drivers/net/can/dev.c | ||
128 | +++ b/drivers/net/can/dev.c | ||
129 | @@ -392,7 +392,7 @@ void can_restart(unsigned long data) | ||
130 | stats->rx_bytes += cf->can_dlc; | ||
131 | |||
132 | restart: | ||
133 | - dev_dbg(dev->dev.parent, "restarted\n"); | ||
134 | + netdev_dbg(dev, "restarted\n"); | ||
135 | priv->can_stats.restarts++; | ||
136 | |||
137 | /* Now restart the device */ | ||
138 | @@ -400,7 +400,7 @@ restart: | ||
139 | |||
140 | netif_carrier_on(dev); | ||
141 | if (err) | ||
142 | - dev_err(dev->dev.parent, "Error %d during restart", err); | ||
143 | + netdev_err(dev, "error %d during restart", err); | ||
144 | } | ||
145 | |||
146 | int can_restart_now(struct net_device *dev) | ||
147 | @@ -433,7 +433,7 @@ void can_bus_off(struct net_device *dev) | ||
148 | { | ||
149 | struct can_priv *priv = netdev_priv(dev); | ||
150 | |||
151 | - dev_dbg(dev->dev.parent, "bus-off\n"); | ||
152 | + netdev_dbg(dev, "bus-off\n"); | ||
153 | |||
154 | netif_carrier_off(dev); | ||
155 | priv->can_stats.bus_off++; | ||
156 | @@ -545,7 +545,7 @@ int open_candev(struct net_device *dev) | ||
157 | struct can_priv *priv = netdev_priv(dev); | ||
158 | |||
159 | if (!priv->bittiming.tq && !priv->bittiming.bitrate) { | ||
160 | - dev_err(dev->dev.parent, "bit-timing not yet defined\n"); | ||
161 | + netdev_err(dev, "bit-timing not yet defined\n"); | ||
162 | return -EINVAL; | ||
163 | } | ||
164 | |||
165 | diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c | ||
166 | index 330140e..b3e231c 100644 | ||
167 | --- a/drivers/net/can/mcp251x.c | ||
168 | +++ b/drivers/net/can/mcp251x.c | ||
169 | @@ -93,8 +93,9 @@ | ||
170 | # define CANCTRL_REQOP_LOOPBACK 0x40 | ||
171 | # define CANCTRL_REQOP_SLEEP 0x20 | ||
172 | # define CANCTRL_REQOP_NORMAL 0x00 | ||
173 | -# define CANCTRL_OSM 0x08 | ||
174 | # define CANCTRL_ABAT 0x10 | ||
175 | +# define CANCTRL_OSM 0x08 | ||
176 | +# define CANCTRL_CLKEN 0x04 | ||
177 | #define TEC 0x1c | ||
178 | #define REC 0x1d | ||
179 | #define CNF1 0x2a | ||
180 | @@ -287,7 +288,7 @@ static void mcp251x_clean(struct net_device *net) | ||
181 | /* | ||
182 | * Note about handling of error return of mcp251x_spi_trans: accessing | ||
183 | * registers via SPI is not really different conceptually than using | ||
184 | - * normal I/O assembler instructions, although it's much more | ||
185 | + * normal I/O assembly instructions, although it's much more | ||
186 | * complicated from a practical POV. So it's not advisable to always | ||
187 | * check the return value of this function. Imagine that every | ||
188 | * read{b,l}, write{b,l} and friends would be bracketed in "if ( < 0) | ||
189 | @@ -490,7 +491,7 @@ static void mcp251x_hw_rx(struct spi_device *spi, int buf_idx) | ||
190 | |||
191 | static void mcp251x_hw_sleep(struct spi_device *spi) | ||
192 | { | ||
193 | - mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_SLEEP); | ||
194 | +// mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_SLEEP); | ||
195 | } | ||
196 | |||
197 | static netdev_tx_t mcp251x_hard_start_xmit(struct sk_buff *skb, | ||
198 | @@ -547,13 +548,16 @@ static int mcp251x_set_normal_mode(struct spi_device *spi) | ||
199 | |||
200 | if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK) { | ||
201 | /* Put device into loopback mode */ | ||
202 | - mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_LOOPBACK); | ||
203 | + mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_LOOPBACK | CANCTRL_CLKEN); | ||
204 | } else if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) { | ||
205 | /* Put device into listen-only mode */ | ||
206 | - mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_LISTEN_ONLY); | ||
207 | + mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_LISTEN_ONLY | CANCTRL_CLKEN); | ||
208 | } else { | ||
209 | /* Put device into normal mode */ | ||
210 | - mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_NORMAL); | ||
211 | + mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_NORMAL | CANCTRL_CLKEN); | ||
212 | + | ||
213 | + netdev_info(priv->net, "CANCTRL: 0x%02x\n", | ||
214 | + mcp251x_read_reg(spi, CANCTRL)); | ||
215 | |||
216 | /* Wait for the device to enter normal mode */ | ||
217 | timeout = jiffies + HZ; | ||
218 | @@ -585,11 +589,15 @@ static int mcp251x_do_set_bittiming(struct net_device *net) | ||
219 | (bt->prop_seg - 1)); | ||
220 | mcp251x_write_bits(spi, CNF3, CNF3_PHSEG2_MASK, | ||
221 | (bt->phase_seg2 - 1)); | ||
222 | - dev_info(&spi->dev, "CNF: 0x%02x 0x%02x 0x%02x\n", | ||
223 | + | ||
224 | + netdev_info(net, "CNF: 0x%02x 0x%02x 0x%02x\n", | ||
225 | mcp251x_read_reg(spi, CNF1), | ||
226 | mcp251x_read_reg(spi, CNF2), | ||
227 | mcp251x_read_reg(spi, CNF3)); | ||
228 | |||
229 | + netdev_info(net, "CANCTRL: 0x%02x\n", | ||
230 | + mcp251x_read_reg(spi, CANCTRL)); | ||
231 | + | ||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | @@ -600,6 +608,7 @@ static int mcp251x_setup(struct net_device *net, struct mcp251x_priv *priv, | ||
236 | |||
237 | mcp251x_write_reg(spi, RXBCTRL(0), | ||
238 | RXBCTRL_BUKT | RXBCTRL_RXM0 | RXBCTRL_RXM1); | ||
239 | + | ||
240 | mcp251x_write_reg(spi, RXBCTRL(1), | ||
241 | RXBCTRL_RXM0 | RXBCTRL_RXM1); | ||
242 | return 0; | ||
243 | @@ -728,7 +737,9 @@ static void mcp251x_tx_work_handler(struct work_struct *ws) | ||
244 | mutex_lock(&priv->mcp_lock); | ||
245 | if (priv->tx_skb) { | ||
246 | if (priv->can.state == CAN_STATE_BUS_OFF) { | ||
247 | + | ||
248 | mcp251x_clean(net); | ||
249 | + | ||
250 | } else { | ||
251 | frame = (struct can_frame *)priv->tx_skb->data; | ||
252 | |||
253 | @@ -827,21 +838,37 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id) | ||
254 | |||
255 | /* Update can state */ | ||
256 | if (eflag & EFLG_TXBO) { | ||
257 | + | ||
258 | + netdev_err(net, "err: bus off\n"); | ||
259 | + | ||
260 | new_state = CAN_STATE_BUS_OFF; | ||
261 | can_id |= CAN_ERR_BUSOFF; | ||
262 | } else if (eflag & EFLG_TXEP) { | ||
263 | + | ||
264 | + netdev_err(net, "err: txep\n"); | ||
265 | + | ||
266 | new_state = CAN_STATE_ERROR_PASSIVE; | ||
267 | can_id |= CAN_ERR_CRTL; | ||
268 | data1 |= CAN_ERR_CRTL_TX_PASSIVE; | ||
269 | + | ||
270 | } else if (eflag & EFLG_RXEP) { | ||
271 | + | ||
272 | + netdev_err(net, "err: rxep\n"); | ||
273 | + | ||
274 | new_state = CAN_STATE_ERROR_PASSIVE; | ||
275 | can_id |= CAN_ERR_CRTL; | ||
276 | data1 |= CAN_ERR_CRTL_RX_PASSIVE; | ||
277 | } else if (eflag & EFLG_TXWAR) { | ||
278 | + | ||
279 | + netdev_err(net, "err: txwar\n"); | ||
280 | + | ||
281 | new_state = CAN_STATE_ERROR_WARNING; | ||
282 | can_id |= CAN_ERR_CRTL; | ||
283 | data1 |= CAN_ERR_CRTL_TX_WARNING; | ||
284 | } else if (eflag & EFLG_RXWAR) { | ||
285 | + | ||
286 | + netdev_err(net, "err: rxwar\n"); | ||
287 | + | ||
288 | new_state = CAN_STATE_ERROR_WARNING; | ||
289 | can_id |= CAN_ERR_CRTL; | ||
290 | data1 |= CAN_ERR_CRTL_RX_WARNING; | ||
291 | @@ -918,7 +945,7 @@ static int mcp251x_open(struct net_device *net) | ||
292 | |||
293 | ret = open_candev(net); | ||
294 | if (ret) { | ||
295 | - dev_err(&spi->dev, "unable to set initial baudrate!\n"); | ||
296 | + netdev_err(net, "failed to open can device\n"); | ||
297 | return ret; | ||
298 | } | ||
299 | |||
300 | @@ -934,7 +961,7 @@ static int mcp251x_open(struct net_device *net) | ||
301 | pdata->irq_flags ? pdata->irq_flags : IRQF_TRIGGER_FALLING, | ||
302 | DEVICE_NAME, priv); | ||
303 | if (ret) { | ||
304 | - dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); | ||
305 | + netdev_err(net, "failed to acquire irq %d\n", spi->irq); | ||
306 | if (pdata->transceiver_enable) | ||
307 | pdata->transceiver_enable(0); | ||
308 | close_candev(net); | ||
309 | @@ -1071,7 +1098,7 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi) | ||
310 | |||
311 | ret = register_candev(net); | ||
312 | if (!ret) { | ||
313 | - dev_info(&spi->dev, "probed\n"); | ||
314 | + netdev_info(priv->net, "probed\n"); | ||
315 | return ret; | ||
316 | } | ||
317 | error_probe: | ||
318 | -- | ||
319 | 1.7.9.4 | ||
320 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0021-ARM-OMAP2-am33xx-fix-serial-mux-warnings-for-am33xx.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0021-ARM-OMAP2-am33xx-fix-serial-mux-warnings-for-am33xx.patch new file mode 100644 index 00000000..2d37f2c2 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0021-ARM-OMAP2-am33xx-fix-serial-mux-warnings-for-am33xx.patch | |||
@@ -0,0 +1,40 @@ | |||
1 | From 6a1eef2a91f39da5bcca2e6b11f60298a9f15831 Mon Sep 17 00:00:00 2001 | ||
2 | From: "Hebbar, Gururaja" <gururaja.hebbar@ti.com> | ||
3 | Date: Tue, 24 Jan 2012 19:45:12 +0530 | ||
4 | Subject: [PATCH 21/22] ARM: OMAP2+: am33xx: fix serial mux warnings for | ||
5 | am33xx | ||
6 | |||
7 | The patch removes below warning in serial mux setup on AM335x platform | ||
8 | |||
9 | [ 0.162052] _omap_mux_get_by_name: Could not find signal | ||
10 | uart1_cts.uart1_cts | ||
11 | [ 0.169437] omap_hwmod_mux_init: Could not allocate device mux entry | ||
12 | [ 0.176384] _omap_mux_get_by_name: Could not find signal | ||
13 | uart2_cts.uart2_cts | ||
14 | [ 0.183735] omap_hwmod_mux_init: Could not allocate device mux entry | ||
15 | [ 0.190663] _omap_mux_get_by_name: Could not find signal | ||
16 | uart3_cts_rctx.uart3_cts_rctx | ||
17 | [ 0.198926] omap_hwmod_mux_init: Could not allocate device mux entry | ||
18 | |||
19 | Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> | ||
20 | --- | ||
21 | arch/arm/mach-omap2/serial.c | 3 ++- | ||
22 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
23 | |||
24 | diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c | ||
25 | index ad5bed3..bfa8ae3 100644 | ||
26 | --- a/arch/arm/mach-omap2/serial.c | ||
27 | +++ b/arch/arm/mach-omap2/serial.c | ||
28 | @@ -409,7 +409,8 @@ void __init omap_serial_board_init(struct omap_uart_port_info *info) | ||
29 | bdata.pads = NULL; | ||
30 | bdata.pads_cnt = 0; | ||
31 | |||
32 | - if (cpu_is_omap44xx() || cpu_is_omap34xx()) | ||
33 | + if (cpu_is_omap44xx() || (cpu_is_omap34xx() && | ||
34 | + !cpu_is_am33xx())) | ||
35 | omap_serial_fill_default_pads(&bdata); | ||
36 | |||
37 | if (!info) | ||
38 | -- | ||
39 | 1.7.9.4 | ||
40 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0022-ARM-OMAP2-am335x-correct-McASP0-pin-mux-detail.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0022-ARM-OMAP2-am335x-correct-McASP0-pin-mux-detail.patch new file mode 100644 index 00000000..7615d69b --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0022-ARM-OMAP2-am335x-correct-McASP0-pin-mux-detail.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | From d03a78bdff2f490d20510d0a90214a0b75f81639 Mon Sep 17 00:00:00 2001 | ||
2 | From: "Hebbar, Gururaja" <gururaja.hebbar@ti.com> | ||
3 | Date: Mon, 27 Feb 2012 11:56:39 +0530 | ||
4 | Subject: [PATCH 22/22] ARM: OMAP2+: am335x: correct McASP0 pin mux detail | ||
5 | |||
6 | McASP0 AXR3 pin mux-mode was incorrect specified in mux file. This | ||
7 | patch corrects the same. | ||
8 | |||
9 | Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> | ||
10 | --- | ||
11 | arch/arm/mach-omap2/mux33xx.c | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/arch/arm/mach-omap2/mux33xx.c b/arch/arm/mach-omap2/mux33xx.c | ||
15 | index 2de76e3..25dcedb 100644 | ||
16 | --- a/arch/arm/mach-omap2/mux33xx.c | ||
17 | +++ b/arch/arm/mach-omap2/mux33xx.c | ||
18 | @@ -351,7 +351,7 @@ static struct omap_mux __initdata am33xx_muxmodes[] = { | ||
19 | "mcasp0_axr1", NULL, NULL, "mcasp1_axr0", | ||
20 | NULL, NULL, NULL, "gpio3_20"), | ||
21 | _AM33XX_MUXENTRY(MCASP0_AHCLKX, 0, | ||
22 | - "mcasp0_ahclkx", "mcasp0_axr3", NULL, "mcasp1_axr1", | ||
23 | + "mcasp0_ahclkx", NULL, "mcasp0_axr3", "mcasp1_axr1", | ||
24 | NULL, NULL, NULL, "gpio3_21"), | ||
25 | _AM33XX_MUXENTRY(XDMA_EVENT_INTR0, 0, | ||
26 | "xdma_event_intr0", NULL, NULL, NULL, | ||
27 | -- | ||
28 | 1.7.9.4 | ||
29 | |||