diff options
author | Mike Rapoport <mike@compulab.co.il> | 2009-04-14 01:33:49 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2009-06-04 22:32:06 -0400 |
commit | 46580c03062da8c047238a6b3d2b2b13af1700b5 (patch) | |
tree | 5e047813eb34ca78c7287262c0fb9917a79f5691 | |
parent | a27ba768a11ac7a1d56688d4224cef3a802d1f89 (diff) |
[ARM] pxa: update pxa2xx_spi_chip initialization to use .gpio_cs field
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
-rw-r--r-- | arch/arm/mach-pxa/corgi.c | 45 | ||||
-rw-r--r-- | arch/arm/mach-pxa/imote2.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-pxa/littleton.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-pxa/poodle.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-pxa/spitz.c | 53 |
5 files changed, 10 insertions, 139 deletions
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index f04e50583289..962dda2e154a 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -445,13 +445,8 @@ static struct ads7846_platform_data corgi_ads7846_info = { | |||
445 | .wait_for_sync = corgi_wait_for_hsync, | 445 | .wait_for_sync = corgi_wait_for_hsync, |
446 | }; | 446 | }; |
447 | 447 | ||
448 | static void corgi_ads7846_cs(u32 command) | ||
449 | { | ||
450 | gpio_set_value(CORGI_GPIO_ADS7846_CS, !(command == PXA2XX_CS_ASSERT)); | ||
451 | } | ||
452 | |||
453 | static struct pxa2xx_spi_chip corgi_ads7846_chip = { | 448 | static struct pxa2xx_spi_chip corgi_ads7846_chip = { |
454 | .cs_control = corgi_ads7846_cs, | 449 | .gpio_cs = CORGI_GPIO_ADS7846_CS, |
455 | }; | 450 | }; |
456 | 451 | ||
457 | static void corgi_bl_kick_battery(void) | 452 | static void corgi_bl_kick_battery(void) |
@@ -475,22 +470,12 @@ static struct corgi_lcd_platform_data corgi_lcdcon_info = { | |||
475 | .kick_battery = corgi_bl_kick_battery, | 470 | .kick_battery = corgi_bl_kick_battery, |
476 | }; | 471 | }; |
477 | 472 | ||
478 | static void corgi_lcdcon_cs(u32 command) | ||
479 | { | ||
480 | gpio_set_value(CORGI_GPIO_LCDCON_CS, !(command == PXA2XX_CS_ASSERT)); | ||
481 | } | ||
482 | |||
483 | static struct pxa2xx_spi_chip corgi_lcdcon_chip = { | 473 | static struct pxa2xx_spi_chip corgi_lcdcon_chip = { |
484 | .cs_control = corgi_lcdcon_cs, | 474 | .gpio_cs = CORGI_GPIO_LCDCON_CS, |
485 | }; | 475 | }; |
486 | 476 | ||
487 | static void corgi_max1111_cs(u32 command) | ||
488 | { | ||
489 | gpio_set_value(CORGI_GPIO_MAX1111_CS, !(command == PXA2XX_CS_ASSERT)); | ||
490 | } | ||
491 | |||
492 | static struct pxa2xx_spi_chip corgi_max1111_chip = { | 477 | static struct pxa2xx_spi_chip corgi_max1111_chip = { |
493 | .cs_control = corgi_max1111_cs, | 478 | .gpio_cs = CORGI_GPIO_MAX1111_CS, |
494 | }; | 479 | }; |
495 | 480 | ||
496 | static struct spi_board_info corgi_spi_devices[] = { | 481 | static struct spi_board_info corgi_spi_devices[] = { |
@@ -520,32 +505,8 @@ static struct spi_board_info corgi_spi_devices[] = { | |||
520 | 505 | ||
521 | static void __init corgi_init_spi(void) | 506 | static void __init corgi_init_spi(void) |
522 | { | 507 | { |
523 | int err; | ||
524 | |||
525 | err = gpio_request(CORGI_GPIO_ADS7846_CS, "ADS7846_CS"); | ||
526 | if (err) | ||
527 | return; | ||
528 | |||
529 | err = gpio_request(CORGI_GPIO_LCDCON_CS, "LCDCON_CS"); | ||
530 | if (err) | ||
531 | goto err_free_1; | ||
532 | |||
533 | err = gpio_request(CORGI_GPIO_MAX1111_CS, "MAX1111_CS"); | ||
534 | if (err) | ||
535 | goto err_free_2; | ||
536 | |||
537 | gpio_direction_output(CORGI_GPIO_ADS7846_CS, 1); | ||
538 | gpio_direction_output(CORGI_GPIO_LCDCON_CS, 1); | ||
539 | gpio_direction_output(CORGI_GPIO_MAX1111_CS, 1); | ||
540 | |||
541 | pxa2xx_set_spi_info(1, &corgi_spi_info); | 508 | pxa2xx_set_spi_info(1, &corgi_spi_info); |
542 | spi_register_board_info(ARRAY_AND_SIZE(corgi_spi_devices)); | 509 | spi_register_board_info(ARRAY_AND_SIZE(corgi_spi_devices)); |
543 | return; | ||
544 | |||
545 | err_free_2: | ||
546 | gpio_free(CORGI_GPIO_LCDCON_CS); | ||
547 | err_free_1: | ||
548 | gpio_free(CORGI_GPIO_ADS7846_CS); | ||
549 | } | 510 | } |
550 | #else | 511 | #else |
551 | static inline void corgi_init_spi(void) {} | 512 | static inline void corgi_init_spi(void) {} |
diff --git a/arch/arm/mach-pxa/imote2.c b/arch/arm/mach-pxa/imote2.c index 821e65a4097e..3ef98d43d303 100644 --- a/arch/arm/mach-pxa/imote2.c +++ b/arch/arm/mach-pxa/imote2.c | |||
@@ -456,25 +456,12 @@ static struct pxa2xx_spi_master pxa_ssp_master_2_info = { | |||
456 | .num_chipselect = 1, | 456 | .num_chipselect = 1, |
457 | }; | 457 | }; |
458 | 458 | ||
459 | /* Patch posted by Eric Miao <eric.miao@marvell.com> will remove | ||
460 | * the need for these functions. | ||
461 | */ | ||
462 | static void spi1control(u32 command) | ||
463 | { | ||
464 | gpio_set_value(24, command & PXA2XX_CS_ASSERT ? 0 : 1); | ||
465 | }; | ||
466 | |||
467 | static void spi3control(u32 command) | ||
468 | { | ||
469 | gpio_set_value(39, command & PXA2XX_CS_ASSERT ? 0 : 1); | ||
470 | }; | ||
471 | |||
472 | static struct pxa2xx_spi_chip staccel_chip_info = { | 459 | static struct pxa2xx_spi_chip staccel_chip_info = { |
473 | .tx_threshold = 8, | 460 | .tx_threshold = 8, |
474 | .rx_threshold = 8, | 461 | .rx_threshold = 8, |
475 | .dma_burst_size = 8, | 462 | .dma_burst_size = 8, |
476 | .timeout = 235, | 463 | .timeout = 235, |
477 | .cs_control = spi1control, | 464 | .gpio_cs = 24, |
478 | }; | 465 | }; |
479 | 466 | ||
480 | static struct pxa2xx_spi_chip cc2420_info = { | 467 | static struct pxa2xx_spi_chip cc2420_info = { |
@@ -482,7 +469,7 @@ static struct pxa2xx_spi_chip cc2420_info = { | |||
482 | .rx_threshold = 8, | 469 | .rx_threshold = 8, |
483 | .dma_burst_size = 8, | 470 | .dma_burst_size = 8, |
484 | .timeout = 235, | 471 | .timeout = 235, |
485 | .cs_control = spi3control, | 472 | .gpio_cs = 39, |
486 | }; | 473 | }; |
487 | 474 | ||
488 | static struct spi_board_info spi_board_info[] __initdata = { | 475 | static struct spi_board_info spi_board_info[] __initdata = { |
@@ -538,8 +525,6 @@ static void __init imote2_init(void) | |||
538 | /* SPI chip select directions - all other directions should | 525 | /* SPI chip select directions - all other directions should |
539 | * be handled by drivers.*/ | 526 | * be handled by drivers.*/ |
540 | gpio_direction_output(37, 0); | 527 | gpio_direction_output(37, 0); |
541 | gpio_direction_output(24, 0); | ||
542 | gpio_direction_output(39, 0); | ||
543 | 528 | ||
544 | platform_add_devices(imote2_devices, ARRAY_SIZE(imote2_devices)); | 529 | platform_add_devices(imote2_devices, ARRAY_SIZE(imote2_devices)); |
545 | 530 | ||
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c index ad5378b1af94..94a32321ad43 100644 --- a/arch/arm/mach-pxa/littleton.c +++ b/arch/arm/mach-pxa/littleton.c | |||
@@ -179,15 +179,10 @@ static struct pxa2xx_spi_master littleton_spi_info = { | |||
179 | .num_chipselect = 1, | 179 | .num_chipselect = 1, |
180 | }; | 180 | }; |
181 | 181 | ||
182 | static void littleton_tdo24m_cs(u32 cmd) | ||
183 | { | ||
184 | gpio_set_value(LITTLETON_GPIO_LCD_CS, !(cmd == PXA2XX_CS_ASSERT)); | ||
185 | } | ||
186 | |||
187 | static struct pxa2xx_spi_chip littleton_tdo24m_chip = { | 182 | static struct pxa2xx_spi_chip littleton_tdo24m_chip = { |
188 | .rx_threshold = 1, | 183 | .rx_threshold = 1, |
189 | .tx_threshold = 1, | 184 | .tx_threshold = 1, |
190 | .cs_control = littleton_tdo24m_cs, | 185 | .gpio_cs = LITTLETON_GPIO_LCD_CS, |
191 | }; | 186 | }; |
192 | 187 | ||
193 | static struct spi_board_info littleton_spi_devices[] __initdata = { | 188 | static struct spi_board_info littleton_spi_devices[] __initdata = { |
@@ -202,16 +197,6 @@ static struct spi_board_info littleton_spi_devices[] __initdata = { | |||
202 | 197 | ||
203 | static void __init littleton_init_spi(void) | 198 | static void __init littleton_init_spi(void) |
204 | { | 199 | { |
205 | int err; | ||
206 | |||
207 | err = gpio_request(LITTLETON_GPIO_LCD_CS, "LCD_CS"); | ||
208 | if (err) { | ||
209 | pr_warning("failed to request GPIO for LCS CS\n"); | ||
210 | return; | ||
211 | } | ||
212 | |||
213 | gpio_direction_output(LITTLETON_GPIO_LCD_CS, 1); | ||
214 | |||
215 | pxa2xx_set_spi_info(2, &littleton_spi_info); | 200 | pxa2xx_set_spi_info(2, &littleton_spi_info); |
216 | spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices)); | 201 | spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices)); |
217 | } | 202 | } |
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 74f4ce600ca4..ac431ed10399 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -214,13 +214,8 @@ static struct ads7846_platform_data poodle_ads7846_info = { | |||
214 | .gpio_pendown = POODLE_GPIO_TP_INT, | 214 | .gpio_pendown = POODLE_GPIO_TP_INT, |
215 | }; | 215 | }; |
216 | 216 | ||
217 | static void ads7846_cs(u32 command) | ||
218 | { | ||
219 | gpio_set_value(POODLE_GPIO_TP_CS, !(command == PXA2XX_CS_ASSERT)); | ||
220 | } | ||
221 | |||
222 | static struct pxa2xx_spi_chip poodle_ads7846_chip = { | 217 | static struct pxa2xx_spi_chip poodle_ads7846_chip = { |
223 | .cs_control = ads7846_cs, | 218 | .gpio_cs = POODLE_GPIO_TP_CS, |
224 | }; | 219 | }; |
225 | 220 | ||
226 | static struct spi_board_info poodle_spi_devices[] = { | 221 | static struct spi_board_info poodle_spi_devices[] = { |
@@ -236,14 +231,6 @@ static struct spi_board_info poodle_spi_devices[] = { | |||
236 | 231 | ||
237 | static void __init poodle_init_spi(void) | 232 | static void __init poodle_init_spi(void) |
238 | { | 233 | { |
239 | int err; | ||
240 | |||
241 | err = gpio_request(POODLE_GPIO_TP_CS, "ADS7846_CS"); | ||
242 | if (err) | ||
243 | return; | ||
244 | |||
245 | gpio_direction_output(POODLE_GPIO_TP_CS, 1); | ||
246 | |||
247 | pxa2xx_set_spi_info(1, &poodle_spi_info); | 234 | pxa2xx_set_spi_info(1, &poodle_spi_info); |
248 | spi_register_board_info(ARRAY_AND_SIZE(poodle_spi_devices)); | 235 | spi_register_board_info(ARRAY_AND_SIZE(poodle_spi_devices)); |
249 | } | 236 | } |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 229f48577d5e..1182b7988230 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -317,13 +317,8 @@ static struct ads7846_platform_data spitz_ads7846_info = { | |||
317 | .wait_for_sync = spitz_wait_for_hsync, | 317 | .wait_for_sync = spitz_wait_for_hsync, |
318 | }; | 318 | }; |
319 | 319 | ||
320 | static void spitz_ads7846_cs(u32 command) | ||
321 | { | ||
322 | gpio_set_value(SPITZ_GPIO_ADS7846_CS, !(command == PXA2XX_CS_ASSERT)); | ||
323 | } | ||
324 | |||
325 | static struct pxa2xx_spi_chip spitz_ads7846_chip = { | 320 | static struct pxa2xx_spi_chip spitz_ads7846_chip = { |
326 | .cs_control = spitz_ads7846_cs, | 321 | .gpio_cs = SPITZ_GPIO_ADS7846_CS, |
327 | }; | 322 | }; |
328 | 323 | ||
329 | static void spitz_bl_kick_battery(void) | 324 | static void spitz_bl_kick_battery(void) |
@@ -347,22 +342,12 @@ static struct corgi_lcd_platform_data spitz_lcdcon_info = { | |||
347 | .kick_battery = spitz_bl_kick_battery, | 342 | .kick_battery = spitz_bl_kick_battery, |
348 | }; | 343 | }; |
349 | 344 | ||
350 | static void spitz_lcdcon_cs(u32 command) | ||
351 | { | ||
352 | gpio_set_value(SPITZ_GPIO_LCDCON_CS, !(command == PXA2XX_CS_ASSERT)); | ||
353 | } | ||
354 | |||
355 | static struct pxa2xx_spi_chip spitz_lcdcon_chip = { | 345 | static struct pxa2xx_spi_chip spitz_lcdcon_chip = { |
356 | .cs_control = spitz_lcdcon_cs, | 346 | .gpio_cs = SPITZ_GPIO_LCDCON_CS, |
357 | }; | 347 | }; |
358 | 348 | ||
359 | static void spitz_max1111_cs(u32 command) | ||
360 | { | ||
361 | gpio_set_value(SPITZ_GPIO_MAX1111_CS, !(command == PXA2XX_CS_ASSERT)); | ||
362 | } | ||
363 | |||
364 | static struct pxa2xx_spi_chip spitz_max1111_chip = { | 349 | static struct pxa2xx_spi_chip spitz_max1111_chip = { |
365 | .cs_control = spitz_max1111_cs, | 350 | .gpio_cs = SPITZ_GPIO_MAX1111_CS, |
366 | }; | 351 | }; |
367 | 352 | ||
368 | static struct spi_board_info spitz_spi_devices[] = { | 353 | static struct spi_board_info spitz_spi_devices[] = { |
@@ -392,30 +377,6 @@ static struct spi_board_info spitz_spi_devices[] = { | |||
392 | 377 | ||
393 | static void __init spitz_init_spi(void) | 378 | static void __init spitz_init_spi(void) |
394 | { | 379 | { |
395 | int err; | ||
396 | |||
397 | err = gpio_request(SPITZ_GPIO_ADS7846_CS, "ADS7846_CS"); | ||
398 | if (err) | ||
399 | return; | ||
400 | |||
401 | err = gpio_request(SPITZ_GPIO_LCDCON_CS, "LCDCON_CS"); | ||
402 | if (err) | ||
403 | goto err_free_1; | ||
404 | |||
405 | err = gpio_request(SPITZ_GPIO_MAX1111_CS, "MAX1111_CS"); | ||
406 | if (err) | ||
407 | goto err_free_2; | ||
408 | |||
409 | err = gpio_direction_output(SPITZ_GPIO_ADS7846_CS, 1); | ||
410 | if (err) | ||
411 | goto err_free_3; | ||
412 | err = gpio_direction_output(SPITZ_GPIO_LCDCON_CS, 1); | ||
413 | if (err) | ||
414 | goto err_free_3; | ||
415 | err = gpio_direction_output(SPITZ_GPIO_MAX1111_CS, 1); | ||
416 | if (err) | ||
417 | goto err_free_3; | ||
418 | |||
419 | if (machine_is_akita()) { | 380 | if (machine_is_akita()) { |
420 | spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; | 381 | spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; |
421 | spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; | 382 | spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; |
@@ -423,14 +384,6 @@ static void __init spitz_init_spi(void) | |||
423 | 384 | ||
424 | pxa2xx_set_spi_info(2, &spitz_spi_info); | 385 | pxa2xx_set_spi_info(2, &spitz_spi_info); |
425 | spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); | 386 | spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); |
426 | return; | ||
427 | |||
428 | err_free_3: | ||
429 | gpio_free(SPITZ_GPIO_MAX1111_CS); | ||
430 | err_free_2: | ||
431 | gpio_free(SPITZ_GPIO_LCDCON_CS); | ||
432 | err_free_1: | ||
433 | gpio_free(SPITZ_GPIO_ADS7846_CS); | ||
434 | } | 387 | } |
435 | #else | 388 | #else |
436 | static inline void spitz_init_spi(void) {} | 389 | static inline void spitz_init_spi(void) {} |