aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2009-07-17 06:50:43 -0400
committerEric Miao <eric.y.miao@gmail.com>2009-09-10 06:49:39 -0400
commitc4bd01727380ce666aba987b3d7c0e838cb99bbe (patch)
tree5ee425da3645c1371b154bc47d1ae7ab3c81041b
parent2a23ec3679d84ac243add761fa3d3872cf6dcb11 (diff)
[ARM] pxa: add gpio_pwdown(_inverted) into pxaficp_ir.c
and convert PXA-based devices to gpio_pwdown where possible. Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
-rw-r--r--arch/arm/mach-pxa/corgi.c27
-rw-r--r--arch/arm/mach-pxa/e740.c1
-rw-r--r--arch/arm/mach-pxa/e750.c1
-rw-r--r--arch/arm/mach-pxa/eseries.c39
-rw-r--r--arch/arm/mach-pxa/hx4700.c9
-rw-r--r--arch/arm/mach-pxa/include/mach/irda.h2
-rw-r--r--arch/arm/mach-pxa/lubbock.c5
-rw-r--r--arch/arm/mach-pxa/magician.c10
-rw-r--r--arch/arm/mach-pxa/mainstone.c5
-rw-r--r--arch/arm/mach-pxa/palmld.c30
-rw-r--r--arch/arm/mach-pxa/palmt5.c30
-rw-r--r--arch/arm/mach-pxa/palmtc.c30
-rw-r--r--arch/arm/mach-pxa/palmte2.c30
-rw-r--r--arch/arm/mach-pxa/palmtx.c30
-rw-r--r--arch/arm/mach-pxa/palmz72.c28
-rw-r--r--arch/arm/mach-pxa/poodle.c27
-rw-r--r--arch/arm/mach-pxa/pxa2xx.c1
-rw-r--r--arch/arm/mach-pxa/spitz.c46
-rw-r--r--arch/arm/mach-pxa/tosa.c9
-rw-r--r--arch/arm/mach-pxa/treo680.c39
-rw-r--r--arch/arm/mach-pxa/trizeps4.c1
-rw-r--r--drivers/net/irda/pxaficp_ir.c47
22 files changed, 81 insertions, 366 deletions
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 0ff5ed80936f..b536b5a5a10d 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -447,34 +447,9 @@ static struct pxamci_platform_data corgi_mci_platform_data = {
447/* 447/*
448 * Irda 448 * Irda
449 */ 449 */
450static void corgi_irda_transceiver_mode(struct device *dev, int mode)
451{
452 gpio_set_value(CORGI_GPIO_IR_ON, mode & IR_OFF);
453 pxa2xx_transceiver_mode(dev, mode);
454}
455
456static int corgi_irda_startup(struct device *dev)
457{
458 int err;
459
460 err = gpio_request(CORGI_GPIO_IR_ON, "IR_ON");
461 if (err)
462 return err;
463
464 gpio_direction_output(CORGI_GPIO_IR_ON, 1);
465 return 0;
466}
467
468static void corgi_irda_shutdown(struct device *dev)
469{
470 gpio_free(CORGI_GPIO_IR_ON);
471}
472
473static struct pxaficp_platform_data corgi_ficp_platform_data = { 450static struct pxaficp_platform_data corgi_ficp_platform_data = {
451 .gpio_pwdown = CORGI_GPIO_IR_ON,
474 .transceiver_cap = IR_SIRMODE | IR_OFF, 452 .transceiver_cap = IR_SIRMODE | IR_OFF,
475 .transceiver_mode = corgi_irda_transceiver_mode,
476 .startup = corgi_irda_startup,
477 .shutdown = corgi_irda_shutdown,
478}; 453};
479 454
480 455
diff --git a/arch/arm/mach-pxa/e740.c b/arch/arm/mach-pxa/e740.c
index a36fc17f671d..49acdfa6650d 100644
--- a/arch/arm/mach-pxa/e740.c
+++ b/arch/arm/mach-pxa/e740.c
@@ -199,7 +199,6 @@ static void __init e740_init(void)
199 platform_add_devices(devices, ARRAY_SIZE(devices)); 199 platform_add_devices(devices, ARRAY_SIZE(devices));
200 pxa_set_udc_info(&e7xx_udc_mach_info); 200 pxa_set_udc_info(&e7xx_udc_mach_info);
201 pxa_set_ac97_info(NULL); 201 pxa_set_ac97_info(NULL);
202 e7xx_irda_init();
203 pxa_set_ficp_info(&e7xx_ficp_platform_data); 202 pxa_set_ficp_info(&e7xx_ficp_platform_data);
204} 203}
205 204
diff --git a/arch/arm/mach-pxa/e750.c b/arch/arm/mach-pxa/e750.c
index 1d00110590e5..4052ece3ef49 100644
--- a/arch/arm/mach-pxa/e750.c
+++ b/arch/arm/mach-pxa/e750.c
@@ -200,7 +200,6 @@ static void __init e750_init(void)
200 platform_add_devices(devices, ARRAY_SIZE(devices)); 200 platform_add_devices(devices, ARRAY_SIZE(devices));
201 pxa_set_udc_info(&e7xx_udc_mach_info); 201 pxa_set_udc_info(&e7xx_udc_mach_info);
202 pxa_set_ac97_info(NULL); 202 pxa_set_ac97_info(NULL);
203 e7xx_irda_init();
204 pxa_set_ficp_info(&e7xx_ficp_platform_data); 203 pxa_set_ficp_info(&e7xx_ficp_platform_data);
205} 204}
206 205
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index c60dadf847a6..91417f035069 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -47,44 +47,9 @@ struct pxa2xx_udc_mach_info e7xx_udc_mach_info = {
47 .gpio_pullup_inverted = 1 47 .gpio_pullup_inverted = 1
48}; 48};
49 49
50static void e7xx_irda_transceiver_mode(struct device *dev, int mode)
51{
52 if (mode & IR_OFF) {
53 gpio_set_value(GPIO_E7XX_IR_OFF, 1);
54 pxa2xx_transceiver_mode(dev, mode);
55 } else {
56 pxa2xx_transceiver_mode(dev, mode);
57 gpio_set_value(GPIO_E7XX_IR_OFF, 0);
58 }
59}
60
61int e7xx_irda_init(void)
62{
63 int ret;
64
65 ret = gpio_request(GPIO_E7XX_IR_OFF, "IrDA power");
66 if (ret)
67 goto out;
68
69 ret = gpio_direction_output(GPIO_E7XX_IR_OFF, 0);
70 if (ret)
71 goto out;
72
73 e7xx_irda_transceiver_mode(NULL, IR_SIRMODE | IR_OFF);
74out:
75 return ret;
76}
77
78static void e7xx_irda_shutdown(struct device *dev)
79{
80 e7xx_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
81 gpio_free(GPIO_E7XX_IR_OFF);
82}
83
84struct pxaficp_platform_data e7xx_ficp_platform_data = { 50struct pxaficp_platform_data e7xx_ficp_platform_data = {
85 .transceiver_cap = IR_SIRMODE | IR_OFF, 51 .gpio_pwdown = GPIO_E7XX_IR_OFF,
86 .transceiver_mode = e7xx_irda_transceiver_mode, 52 .transceiver_cap = IR_SIRMODE | IR_OFF,
87 .shutdown = e7xx_irda_shutdown,
88}; 53};
89 54
90int eseries_tmio_enable(struct platform_device *dev) 55int eseries_tmio_enable(struct platform_device *dev)
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index f2058721254b..abff9e132749 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -175,14 +175,9 @@ static int hx4700_gpio_request(struct gpio_ress *gpios, int size)
175 * IRDA 175 * IRDA
176 */ 176 */
177 177
178static void irda_transceiver_mode(struct device *dev, int mode)
179{
180 gpio_set_value(GPIO105_HX4700_nIR_ON, mode & IR_OFF);
181}
182
183static struct pxaficp_platform_data ficp_info = { 178static struct pxaficp_platform_data ficp_info = {
184 .transceiver_cap = IR_SIRMODE | IR_OFF, 179 .gpio_pwdown = GPIO105_HX4700_nIR_ON,
185 .transceiver_mode = irda_transceiver_mode, 180 .transceiver_cap = IR_SIRMODE | IR_OFF,
186}; 181};
187 182
188/* 183/*
diff --git a/arch/arm/mach-pxa/include/mach/irda.h b/arch/arm/mach-pxa/include/mach/irda.h
index 0a50c3c763df..3cd41f77dda4 100644
--- a/arch/arm/mach-pxa/include/mach/irda.h
+++ b/arch/arm/mach-pxa/include/mach/irda.h
@@ -12,6 +12,8 @@ struct pxaficp_platform_data {
12 void (*transceiver_mode)(struct device *dev, int mode); 12 void (*transceiver_mode)(struct device *dev, int mode);
13 int (*startup)(struct device *dev); 13 int (*startup)(struct device *dev);
14 void (*shutdown)(struct device *dev); 14 void (*shutdown)(struct device *dev);
15 int gpio_pwdown; /* powerdown GPIO for the IrDA chip */
16 bool gpio_pwdown_inverted; /* gpio_pwdown is inverted */
15}; 17};
16 18
17extern void pxa_set_ficp_info(struct pxaficp_platform_data *info); 19extern void pxa_set_ficp_info(struct pxaficp_platform_data *info);
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 1785cc9494d9..c6a94d3fdd61 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -507,8 +507,9 @@ static void lubbock_irda_transceiver_mode(struct device *dev, int mode)
507} 507}
508 508
509static struct pxaficp_platform_data lubbock_ficp_platform_data = { 509static struct pxaficp_platform_data lubbock_ficp_platform_data = {
510 .transceiver_cap = IR_SIRMODE | IR_FIRMODE, 510 .gpio_pwdown = -1,
511 .transceiver_mode = lubbock_irda_transceiver_mode, 511 .transceiver_cap = IR_SIRMODE | IR_FIRMODE,
512 .transceiver_mode = lubbock_irda_transceiver_mode,
512}; 513};
513 514
514static void __init lubbock_init(void) 515static void __init lubbock_init(void)
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 0daba43d7ca1..5360c07f5138 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -140,15 +140,9 @@ static unsigned long magician_pin_config[] __initdata = {
140 * IRDA 140 * IRDA
141 */ 141 */
142 142
143static void magician_irda_transceiver_mode(struct device *dev, int mode)
144{
145 gpio_set_value(GPIO83_MAGICIAN_nIR_EN, mode & IR_OFF);
146 pxa2xx_transceiver_mode(dev, mode);
147}
148
149static struct pxaficp_platform_data magician_ficp_info = { 143static struct pxaficp_platform_data magician_ficp_info = {
150 .transceiver_cap = IR_SIRMODE | IR_OFF, 144 .gpio_pwdown = GPIO83_MAGICIAN_nIR_EN,
151 .transceiver_mode = magician_irda_transceiver_mode, 145 .transceiver_cap = IR_SIRMODE | IR_OFF,
152}; 146};
153 147
154/* 148/*
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index f7dc23078ce3..a4eeae345e64 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -479,8 +479,9 @@ static void mainstone_irda_transceiver_mode(struct device *dev, int mode)
479} 479}
480 480
481static struct pxaficp_platform_data mainstone_ficp_platform_data = { 481static struct pxaficp_platform_data mainstone_ficp_platform_data = {
482 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, 482 .gpio_pwdown = -1,
483 .transceiver_mode = mainstone_irda_transceiver_mode, 483 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
484 .transceiver_mode = mainstone_irda_transceiver_mode,
484}; 485};
485 486
486static struct gpio_keys_button gpio_keys_button[] = { 487static struct gpio_keys_button gpio_keys_button[] = {
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index b3ae8b958ad6..1ad029dd4438 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -304,35 +304,9 @@ static struct platform_device palmld_backlight = {
304/****************************************************************************** 304/******************************************************************************
305 * IrDA 305 * IrDA
306 ******************************************************************************/ 306 ******************************************************************************/
307static int palmld_irda_startup(struct device *dev)
308{
309 int err;
310 err = gpio_request(GPIO_NR_PALMLD_IR_DISABLE, "IR DISABLE");
311 if (err)
312 goto err;
313 err = gpio_direction_output(GPIO_NR_PALMLD_IR_DISABLE, 1);
314 if (err)
315 gpio_free(GPIO_NR_PALMLD_IR_DISABLE);
316err:
317 return err;
318}
319
320static void palmld_irda_shutdown(struct device *dev)
321{
322 gpio_free(GPIO_NR_PALMLD_IR_DISABLE);
323}
324
325static void palmld_irda_transceiver_mode(struct device *dev, int mode)
326{
327 gpio_set_value(GPIO_NR_PALMLD_IR_DISABLE, mode & IR_OFF);
328 pxa2xx_transceiver_mode(dev, mode);
329}
330
331static struct pxaficp_platform_data palmld_ficp_platform_data = { 307static struct pxaficp_platform_data palmld_ficp_platform_data = {
332 .startup = palmld_irda_startup, 308 .gpio_pwdown = GPIO_NR_PALMLD_IR_DISABLE,
333 .shutdown = palmld_irda_shutdown, 309 .transceiver_cap = IR_SIRMODE | IR_OFF,
334 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
335 .transceiver_mode = palmld_irda_transceiver_mode,
336}; 310};
337 311
338/****************************************************************************** 312/******************************************************************************
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 88dcaac358a2..2dd7ce28556b 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -243,35 +243,9 @@ static struct platform_device palmt5_backlight = {
243/****************************************************************************** 243/******************************************************************************
244 * IrDA 244 * IrDA
245 ******************************************************************************/ 245 ******************************************************************************/
246static int palmt5_irda_startup(struct device *dev)
247{
248 int err;
249 err = gpio_request(GPIO_NR_PALMT5_IR_DISABLE, "IR DISABLE");
250 if (err)
251 goto err;
252 err = gpio_direction_output(GPIO_NR_PALMT5_IR_DISABLE, 1);
253 if (err)
254 gpio_free(GPIO_NR_PALMT5_IR_DISABLE);
255err:
256 return err;
257}
258
259static void palmt5_irda_shutdown(struct device *dev)
260{
261 gpio_free(GPIO_NR_PALMT5_IR_DISABLE);
262}
263
264static void palmt5_irda_transceiver_mode(struct device *dev, int mode)
265{
266 gpio_set_value(GPIO_NR_PALMT5_IR_DISABLE, mode & IR_OFF);
267 pxa2xx_transceiver_mode(dev, mode);
268}
269
270static struct pxaficp_platform_data palmt5_ficp_platform_data = { 246static struct pxaficp_platform_data palmt5_ficp_platform_data = {
271 .startup = palmt5_irda_startup, 247 .gpio_pwdown = GPIO_NR_PALMT5_IR_DISABLE,
272 .shutdown = palmt5_irda_shutdown, 248 .transceiver_cap = IR_SIRMODE | IR_OFF,
273 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
274 .transceiver_mode = palmt5_irda_transceiver_mode,
275}; 249};
276 250
277/****************************************************************************** 251/******************************************************************************
diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c
index f70f1f820eed..bb2cc0dd44ec 100644
--- a/arch/arm/mach-pxa/palmtc.c
+++ b/arch/arm/mach-pxa/palmtc.c
@@ -218,35 +218,9 @@ static struct platform_device palmtc_backlight = {
218/****************************************************************************** 218/******************************************************************************
219 * IrDA 219 * IrDA
220 ******************************************************************************/ 220 ******************************************************************************/
221static int palmtc_irda_startup(struct device *dev)
222{
223 int err;
224 err = gpio_request(GPIO_NR_PALMTC_IR_DISABLE, "IR DISABLE");
225 if (err)
226 goto err;
227 err = gpio_direction_output(GPIO_NR_PALMTC_IR_DISABLE, 1);
228 if (err)
229 gpio_free(GPIO_NR_PALMTC_IR_DISABLE);
230err:
231 return err;
232}
233
234static void palmtc_irda_shutdown(struct device *dev)
235{
236 gpio_free(GPIO_NR_PALMTC_IR_DISABLE);
237}
238
239static void palmtc_irda_transceiver_mode(struct device *dev, int mode)
240{
241 gpio_set_value(GPIO_NR_PALMTC_IR_DISABLE, mode & IR_OFF);
242 pxa2xx_transceiver_mode(dev, mode);
243}
244
245static struct pxaficp_platform_data palmtc_ficp_platform_data = { 221static struct pxaficp_platform_data palmtc_ficp_platform_data = {
246 .startup = palmtc_irda_startup, 222 .gpio_pwdown = GPIO_NR_PALMTC_IR_DISABLE,
247 .shutdown = palmtc_irda_shutdown, 223 .transceiver_cap = IR_SIRMODE | IR_OFF,
248 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
249 .transceiver_mode = palmtc_irda_transceiver_mode,
250}; 224};
251 225
252/****************************************************************************** 226/******************************************************************************
diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c
index d9ef76c9278f..277c4062e3c6 100644
--- a/arch/arm/mach-pxa/palmte2.c
+++ b/arch/arm/mach-pxa/palmte2.c
@@ -215,35 +215,9 @@ static struct platform_device palmte2_backlight = {
215/****************************************************************************** 215/******************************************************************************
216 * IrDA 216 * IrDA
217 ******************************************************************************/ 217 ******************************************************************************/
218static int palmte2_irda_startup(struct device *dev)
219{
220 int err;
221 err = gpio_request(GPIO_NR_PALMTE2_IR_DISABLE, "IR DISABLE");
222 if (err)
223 goto err;
224 err = gpio_direction_output(GPIO_NR_PALMTE2_IR_DISABLE, 1);
225 if (err)
226 gpio_free(GPIO_NR_PALMTE2_IR_DISABLE);
227err:
228 return err;
229}
230
231static void palmte2_irda_shutdown(struct device *dev)
232{
233 gpio_free(GPIO_NR_PALMTE2_IR_DISABLE);
234}
235
236static void palmte2_irda_transceiver_mode(struct device *dev, int mode)
237{
238 gpio_set_value(GPIO_NR_PALMTE2_IR_DISABLE, mode & IR_OFF);
239 pxa2xx_transceiver_mode(dev, mode);
240}
241
242static struct pxaficp_platform_data palmte2_ficp_platform_data = { 218static struct pxaficp_platform_data palmte2_ficp_platform_data = {
243 .startup = palmte2_irda_startup, 219 .gpio_pwdown = GPIO_NR_PALMTE2_IR_DISABLE,
244 .shutdown = palmte2_irda_shutdown, 220 .transceiver_cap = IR_SIRMODE | IR_OFF,
245 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
246 .transceiver_mode = palmte2_irda_transceiver_mode,
247}; 221};
248 222
249/****************************************************************************** 223/******************************************************************************
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index c0aca18b71bb..76a2b37eaf30 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -303,35 +303,9 @@ static struct platform_device palmtx_backlight = {
303/****************************************************************************** 303/******************************************************************************
304 * IrDA 304 * IrDA
305 ******************************************************************************/ 305 ******************************************************************************/
306static int palmtx_irda_startup(struct device *dev)
307{
308 int err;
309 err = gpio_request(GPIO_NR_PALMTX_IR_DISABLE, "IR DISABLE");
310 if (err)
311 goto err;
312 err = gpio_direction_output(GPIO_NR_PALMTX_IR_DISABLE, 1);
313 if (err)
314 gpio_free(GPIO_NR_PALMTX_IR_DISABLE);
315err:
316 return err;
317}
318
319static void palmtx_irda_shutdown(struct device *dev)
320{
321 gpio_free(GPIO_NR_PALMTX_IR_DISABLE);
322}
323
324static void palmtx_irda_transceiver_mode(struct device *dev, int mode)
325{
326 gpio_set_value(GPIO_NR_PALMTX_IR_DISABLE, mode & IR_OFF);
327 pxa2xx_transceiver_mode(dev, mode);
328}
329
330static struct pxaficp_platform_data palmtx_ficp_platform_data = { 306static struct pxaficp_platform_data palmtx_ficp_platform_data = {
331 .startup = palmtx_irda_startup, 307 .gpio_pwdown = GPIO_NR_PALMTX_IR_DISABLE,
332 .shutdown = palmtx_irda_shutdown, 308 .transceiver_cap = IR_SIRMODE | IR_OFF,
333 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
334 .transceiver_mode = palmtx_irda_transceiver_mode,
335}; 309};
336 310
337/****************************************************************************** 311/******************************************************************************
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index d8fa53c19178..c2bf493c5f53 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -230,35 +230,9 @@ static struct platform_device palmz72_backlight = {
230/****************************************************************************** 230/******************************************************************************
231 * IrDA 231 * IrDA
232 ******************************************************************************/ 232 ******************************************************************************/
233static int palmz72_irda_startup(struct device *dev)
234{
235 int err;
236 err = gpio_request(GPIO_NR_PALMZ72_IR_DISABLE, "IR DISABLE");
237 if (err)
238 goto err;
239 err = gpio_direction_output(GPIO_NR_PALMZ72_IR_DISABLE, 1);
240 if (err)
241 gpio_free(GPIO_NR_PALMZ72_IR_DISABLE);
242err:
243 return err;
244}
245
246static void palmz72_irda_shutdown(struct device *dev)
247{
248 gpio_free(GPIO_NR_PALMZ72_IR_DISABLE);
249}
250
251static void palmz72_irda_transceiver_mode(struct device *dev, int mode)
252{
253 gpio_set_value(GPIO_NR_PALMZ72_IR_DISABLE, mode & IR_OFF);
254 pxa2xx_transceiver_mode(dev, mode);
255}
256
257static struct pxaficp_platform_data palmz72_ficp_platform_data = { 233static struct pxaficp_platform_data palmz72_ficp_platform_data = {
258 .startup = palmz72_irda_startup, 234 .gpio_pwdown = GPIO_NR_PALMZ72_IR_DISABLE,
259 .shutdown = palmz72_irda_shutdown,
260 .transceiver_cap = IR_SIRMODE | IR_OFF, 235 .transceiver_cap = IR_SIRMODE | IR_OFF,
261 .transceiver_mode = palmz72_irda_transceiver_mode,
262}; 236};
263 237
264/****************************************************************************** 238/******************************************************************************
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 333b1dc2dd3e..a186994f77fb 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -302,34 +302,9 @@ static struct pxamci_platform_data poodle_mci_platform_data = {
302/* 302/*
303 * Irda 303 * Irda
304 */ 304 */
305static void poodle_irda_transceiver_mode(struct device *dev, int mode)
306{
307 gpio_set_value(POODLE_GPIO_IR_ON, mode & IR_OFF);
308 pxa2xx_transceiver_mode(dev, mode);
309}
310
311static int poodle_irda_startup(struct device *dev)
312{
313 int err;
314
315 err = gpio_request(POODLE_GPIO_IR_ON, "IR_ON");
316 if (err)
317 return err;
318
319 gpio_direction_output(POODLE_GPIO_IR_ON, 1);
320 return 0;
321}
322
323static void poodle_irda_shutdown(struct device *dev)
324{
325 gpio_free(POODLE_GPIO_IR_ON);
326}
327
328static struct pxaficp_platform_data poodle_ficp_platform_data = { 305static struct pxaficp_platform_data poodle_ficp_platform_data = {
306 .gpio_pwdown = POODLE_GPIO_IR_ON,
329 .transceiver_cap = IR_SIRMODE | IR_OFF, 307 .transceiver_cap = IR_SIRMODE | IR_OFF,
330 .transceiver_mode = poodle_irda_transceiver_mode,
331 .startup = poodle_irda_startup,
332 .shutdown = poodle_irda_shutdown,
333}; 308};
334 309
335 310
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c
index 2f3394f85917..868270421b8c 100644
--- a/arch/arm/mach-pxa/pxa2xx.c
+++ b/arch/arm/mach-pxa/pxa2xx.c
@@ -52,3 +52,4 @@ void pxa2xx_transceiver_mode(struct device *dev, int mode)
52 } else 52 } else
53 BUG(); 53 BUG();
54} 54}
55EXPORT_SYMBOL_GPL(pxa2xx_transceiver_mode);
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index c4b8305b66a4..f9dc59c054b3 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -560,50 +560,10 @@ static struct pxaohci_platform_data spitz_ohci_platform_data = {
560/* 560/*
561 * Irda 561 * Irda
562 */ 562 */
563static int spitz_irda_startup(struct device *dev)
564{
565 int rc;
566
567 rc = gpio_request(SPITZ_GPIO_IR_ON, "IrDA on");
568 if (rc)
569 goto err;
570
571 rc = gpio_direction_output(SPITZ_GPIO_IR_ON, 1);
572 if (rc)
573 goto err_dir;
574
575 return 0;
576
577err_dir:
578 gpio_free(SPITZ_GPIO_IR_ON);
579err:
580 return rc;
581}
582
583static void spitz_irda_shutdown(struct device *dev)
584{
585 gpio_free(SPITZ_GPIO_IR_ON);
586}
587
588static void spitz_irda_transceiver_mode(struct device *dev, int mode)
589{
590 gpio_set_value(SPITZ_GPIO_IR_ON, mode & IR_OFF);
591 pxa2xx_transceiver_mode(dev, mode);
592}
593
594#ifdef CONFIG_MACH_AKITA
595static void akita_irda_transceiver_mode(struct device *dev, int mode)
596{
597 gpio_set_value(AKITA_GPIO_IR_ON, mode & IR_OFF);
598 pxa2xx_transceiver_mode(dev, mode);
599}
600#endif
601 563
602static struct pxaficp_platform_data spitz_ficp_platform_data = { 564static struct pxaficp_platform_data spitz_ficp_platform_data = {
565/* .gpio_pwdown is set in spitz_init() and akita_init() accordingly */
603 .transceiver_cap = IR_SIRMODE | IR_OFF, 566 .transceiver_cap = IR_SIRMODE | IR_OFF,
604 .transceiver_mode = spitz_irda_transceiver_mode,
605 .startup = spitz_irda_startup,
606 .shutdown = spitz_irda_shutdown,
607}; 567};
608 568
609 569
@@ -782,6 +742,8 @@ static void __init common_init(void)
782#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI) 742#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
783static void __init spitz_init(void) 743static void __init spitz_init(void)
784{ 744{
745 spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON;
746
785 platform_scoop_config = &spitz_pcmcia_config; 747 platform_scoop_config = &spitz_pcmcia_config;
786 748
787 common_init(); 749 common_init();
@@ -824,7 +786,7 @@ static struct nand_ecclayout akita_oobinfo = {
824 786
825static void __init akita_init(void) 787static void __init akita_init(void)
826{ 788{
827 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; 789 spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON;
828 790
829 sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt; 791 sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
830 sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo; 792 sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index b56cc5667bb4..e81a52673d49 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -337,10 +337,11 @@ static void tosa_irda_shutdown(struct device *dev)
337} 337}
338 338
339static struct pxaficp_platform_data tosa_ficp_platform_data = { 339static struct pxaficp_platform_data tosa_ficp_platform_data = {
340 .transceiver_cap = IR_SIRMODE | IR_OFF, 340 .gpio_pwdown = -1,
341 .transceiver_mode = tosa_irda_transceiver_mode, 341 .transceiver_cap = IR_SIRMODE | IR_OFF,
342 .startup = tosa_irda_startup, 342 .transceiver_mode = tosa_irda_transceiver_mode,
343 .shutdown = tosa_irda_shutdown, 343 .startup = tosa_irda_startup,
344 .shutdown = tosa_irda_shutdown,
344}; 345};
345 346
346/* 347/*
diff --git a/arch/arm/mach-pxa/treo680.c b/arch/arm/mach-pxa/treo680.c
index 9a2df64c6599..fe085076fbf2 100644
--- a/arch/arm/mach-pxa/treo680.c
+++ b/arch/arm/mach-pxa/treo680.c
@@ -295,44 +295,9 @@ static struct platform_device treo680_backlight = {
295/****************************************************************************** 295/******************************************************************************
296 * IrDA 296 * IrDA
297 ******************************************************************************/ 297 ******************************************************************************/
298static void treo680_transceiver_mode(struct device *dev, int mode)
299{
300 gpio_set_value(GPIO_NR_TREO680_IR_EN, mode & IR_OFF);
301 pxa2xx_transceiver_mode(dev, mode);
302}
303
304static int treo680_irda_startup(struct device *dev)
305{
306 int err;
307
308 err = gpio_request(GPIO_NR_TREO680_IR_EN, "Ir port disable");
309 if (err)
310 goto err1;
311
312 err = gpio_direction_output(GPIO_NR_TREO680_IR_EN, 1);
313 if (err)
314 goto err2;
315
316 return 0;
317
318err2:
319 dev_err(dev, "treo680_irda: cannot change IR gpio direction\n");
320 gpio_free(GPIO_NR_TREO680_IR_EN);
321err1:
322 dev_err(dev, "treo680_irda: cannot allocate IR gpio\n");
323 return err;
324}
325
326static void treo680_irda_shutdown(struct device *dev)
327{
328 gpio_free(GPIO_NR_TREO680_IR_EN);
329}
330
331static struct pxaficp_platform_data treo680_ficp_info = { 298static struct pxaficp_platform_data treo680_ficp_info = {
332 .transceiver_cap = IR_FIRMODE | IR_SIRMODE | IR_OFF, 299 .gpio_pwdown = GPIO_NR_TREO680_IR_EN,
333 .startup = treo680_irda_startup, 300 .transceiver_cap = IR_SIRMODE | IR_OFF,
334 .shutdown = treo680_irda_shutdown,
335 .transceiver_mode = treo680_transceiver_mode,
336}; 301};
337 302
338/****************************************************************************** 303/******************************************************************************
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index 32299869b352..3981e0356d12 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -415,6 +415,7 @@ static void trizeps4_irda_transceiver_mode(struct device *dev, int mode)
415} 415}
416 416
417static struct pxaficp_platform_data trizeps4_ficp_platform_data = { 417static struct pxaficp_platform_data trizeps4_ficp_platform_data = {
418 .gpio_pwdown = -1,
418 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, 419 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
419 .transceiver_mode = trizeps4_irda_transceiver_mode, 420 .transceiver_mode = trizeps4_irda_transceiver_mode,
420 .startup = trizeps4_irda_startup, 421 .startup = trizeps4_irda_startup,
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 77d10edefd25..f5b7d8320787 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -17,6 +17,7 @@
17#include <linux/etherdevice.h> 17#include <linux/etherdevice.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/gpio.h>
20 21
21#include <net/irda/irda.h> 22#include <net/irda/irda.h>
22#include <net/irda/irmod.h> 23#include <net/irda/irmod.h>
@@ -163,6 +164,22 @@ inline static void pxa_irda_fir_dma_tx_start(struct pxa_irda *si)
163} 164}
164 165
165/* 166/*
167 * Set the IrDA communications mode.
168 */
169static void pxa_irda_set_mode(struct pxa_irda *si, int mode)
170{
171 if (si->pdata->transceiver_mode)
172 si->pdata->transceiver_mode(si->dev, mode);
173 else {
174 if (gpio_is_valid(si->pdata->gpio_pwdown))
175 gpio_set_value(si->pdata->gpio_pwdown,
176 !(mode & IR_OFF) ^
177 !si->pdata->gpio_pwdown_inverted);
178 pxa2xx_transceiver_mode(si->dev, mode);
179 }
180}
181
182/*
166 * Set the IrDA communications speed. 183 * Set the IrDA communications speed.
167 */ 184 */
168static int pxa_irda_set_speed(struct pxa_irda *si, int speed) 185static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
@@ -188,7 +205,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
188 pxa_irda_disable_clk(si); 205 pxa_irda_disable_clk(si);
189 206
190 /* set board transceiver to SIR mode */ 207 /* set board transceiver to SIR mode */
191 si->pdata->transceiver_mode(si->dev, IR_SIRMODE); 208 pxa_irda_set_mode(si, IR_SIRMODE);
192 209
193 /* enable the STUART clock */ 210 /* enable the STUART clock */
194 pxa_irda_enable_sirclk(si); 211 pxa_irda_enable_sirclk(si);
@@ -222,7 +239,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
222 ICCR0 = 0; 239 ICCR0 = 0;
223 240
224 /* set board transceiver to FIR mode */ 241 /* set board transceiver to FIR mode */
225 si->pdata->transceiver_mode(si->dev, IR_FIRMODE); 242 pxa_irda_set_mode(si, IR_FIRMODE);
226 243
227 /* enable the FICP clock */ 244 /* enable the FICP clock */
228 pxa_irda_enable_firclk(si); 245 pxa_irda_enable_firclk(si);
@@ -641,7 +658,7 @@ static void pxa_irda_shutdown(struct pxa_irda *si)
641 local_irq_restore(flags); 658 local_irq_restore(flags);
642 659
643 /* power off board transceiver */ 660 /* power off board transceiver */
644 si->pdata->transceiver_mode(si->dev, IR_OFF); 661 pxa_irda_set_mode(si, IR_OFF);
645 662
646 printk(KERN_DEBUG "pxa_ir: irda shutdown\n"); 663 printk(KERN_DEBUG "pxa_ir: irda shutdown\n");
647} 664}
@@ -849,10 +866,26 @@ static int pxa_irda_probe(struct platform_device *pdev)
849 if (err) 866 if (err)
850 goto err_mem_5; 867 goto err_mem_5;
851 868
852 if (si->pdata->startup) 869 if (gpio_is_valid(si->pdata->gpio_pwdown)) {
870 err = gpio_request(si->pdata->gpio_pwdown, "IrDA switch");
871 if (err)
872 goto err_startup;
873 err = gpio_direction_output(si->pdata->gpio_pwdown,
874 !si->pdata->gpio_pwdown_inverted);
875 if (err) {
876 gpio_free(si->pdata->gpio_pwdown);
877 goto err_startup;
878 }
879 }
880
881 if (si->pdata->startup) {
853 err = si->pdata->startup(si->dev); 882 err = si->pdata->startup(si->dev);
854 if (err) 883 if (err)
855 goto err_startup; 884 goto err_startup;
885 }
886
887 if (gpio_is_valid(si->pdata->gpio_pwdown) && si->pdata->startup)
888 dev_warn(si->dev, "gpio_pwdown and startup() both defined!\n");
856 889
857 dev->netdev_ops = &pxa_irda_netdev_ops; 890 dev->netdev_ops = &pxa_irda_netdev_ops;
858 891
@@ -903,6 +936,8 @@ static int pxa_irda_remove(struct platform_device *_dev)
903 if (dev) { 936 if (dev) {
904 struct pxa_irda *si = netdev_priv(dev); 937 struct pxa_irda *si = netdev_priv(dev);
905 unregister_netdev(dev); 938 unregister_netdev(dev);
939 if (gpio_is_valid(si->pdata->gpio_pwdown))
940 gpio_free(si->pdata->gpio_pwdown);
906 if (si->pdata->shutdown) 941 if (si->pdata->shutdown)
907 si->pdata->shutdown(si->dev); 942 si->pdata->shutdown(si->dev);
908 kfree(si->tx_buff.head); 943 kfree(si->tx_buff.head);