aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/alchemy
diff options
context:
space:
mode:
authorManuel Lauss <manuel.lauss@googlemail.com>2011-11-10 07:06:21 -0500
committerRalf Baechle <ralf@linux-mips.org>2011-12-07 17:02:07 -0500
commita9b71a8f0f42efe1a21154667ca02305c950d30a (patch)
tree0081abc97e9fda1f27f48327b033316a77b35f5a /arch/mips/alchemy
parent7c4b24da07d99b5473de7cc7ba3f67d85b889bc0 (diff)
MIPS: Alchemy: move au1200fb global functions to platform data
au1200fb calls 3 functions which have to be defined in board code. Fix this ugliness with the introduction of platform_data. Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com> Cc: linux-fbdev@vger.kernel.org To: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/2871/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/alchemy')
-rw-r--r--arch/mips/alchemy/devboards/db1200.c51
-rw-r--r--arch/mips/alchemy/devboards/db1300.c52
-rw-r--r--arch/mips/alchemy/devboards/pb1200.c55
3 files changed, 89 insertions, 69 deletions
diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c
index 43f5f1be9d68..e2cc5f921538 100644
--- a/arch/mips/alchemy/devboards/db1200.c
+++ b/arch/mips/alchemy/devboards/db1200.c
@@ -37,6 +37,7 @@
37#include <asm/mach-au1x00/au1000.h> 37#include <asm/mach-au1x00/au1000.h>
38#include <asm/mach-au1x00/au1100_mmc.h> 38#include <asm/mach-au1x00/au1100_mmc.h>
39#include <asm/mach-au1x00/au1xxx_dbdma.h> 39#include <asm/mach-au1x00/au1xxx_dbdma.h>
40#include <asm/mach-au1x00/au1200fb.h>
40#include <asm/mach-au1x00/au1550_spi.h> 41#include <asm/mach-au1x00/au1550_spi.h>
41#include <asm/mach-db1x00/bcsr.h> 42#include <asm/mach-db1x00/bcsr.h>
42#include <asm/mach-db1x00/db1200.h> 43#include <asm/mach-db1x00/db1200.h>
@@ -422,6 +423,33 @@ static struct platform_device db1200_mmc0_dev = {
422 423
423/**********************************************************************/ 424/**********************************************************************/
424 425
426static int db1200fb_panel_index(void)
427{
428 return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f;
429}
430
431static int db1200fb_panel_init(void)
432{
433 /* Apply power */
434 bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
435 BCSR_BOARD_LCDBL);
436 return 0;
437}
438
439static int db1200fb_panel_shutdown(void)
440{
441 /* Remove power */
442 bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
443 BCSR_BOARD_LCDBL, 0);
444 return 0;
445}
446
447static struct au1200fb_platdata db1200fb_pd = {
448 .panel_index = db1200fb_panel_index,
449 .panel_init = db1200fb_panel_init,
450 .panel_shutdown = db1200fb_panel_shutdown,
451};
452
425static struct resource au1200_lcd_res[] = { 453static struct resource au1200_lcd_res[] = {
426 [0] = { 454 [0] = {
427 .start = AU1200_LCD_PHYS_ADDR, 455 .start = AU1200_LCD_PHYS_ADDR,
@@ -443,6 +471,7 @@ static struct platform_device au1200_lcd_dev = {
443 .dev = { 471 .dev = {
444 .dma_mask = &au1200_lcd_dmamask, 472 .dma_mask = &au1200_lcd_dmamask,
445 .coherent_dma_mask = DMA_BIT_MASK(32), 473 .coherent_dma_mask = DMA_BIT_MASK(32),
474 .platform_data = &db1200fb_pd,
446 }, 475 },
447 .num_resources = ARRAY_SIZE(au1200_lcd_res), 476 .num_resources = ARRAY_SIZE(au1200_lcd_res),
448 .resource = au1200_lcd_res, 477 .resource = au1200_lcd_res,
@@ -681,25 +710,3 @@ static int __init db1200_dev_init(void)
681 return platform_add_devices(db1200_devs, ARRAY_SIZE(db1200_devs)); 710 return platform_add_devices(db1200_devs, ARRAY_SIZE(db1200_devs));
682} 711}
683device_initcall(db1200_dev_init); 712device_initcall(db1200_dev_init);
684
685/* au1200fb calls these: STERBT EINEN TRAGISCHEN TOD!!! */
686int board_au1200fb_panel(void)
687{
688 return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f;
689}
690
691int board_au1200fb_panel_init(void)
692{
693 /* Apply power */
694 bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
695 BCSR_BOARD_LCDBL);
696 return 0;
697}
698
699int board_au1200fb_panel_shutdown(void)
700{
701 /* Remove power */
702 bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
703 BCSR_BOARD_LCDBL, 0);
704 return 0;
705}
diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devboards/db1300.c
index c41788c59278..7f3dacb60ea5 100644
--- a/arch/mips/alchemy/devboards/db1300.c
+++ b/arch/mips/alchemy/devboards/db1300.c
@@ -23,6 +23,7 @@
23 23
24#include <asm/mach-au1x00/au1000.h> 24#include <asm/mach-au1x00/au1000.h>
25#include <asm/mach-au1x00/au1100_mmc.h> 25#include <asm/mach-au1x00/au1100_mmc.h>
26#include <asm/mach-au1x00/au1200fb.h>
26#include <asm/mach-au1x00/au1xxx_dbdma.h> 27#include <asm/mach-au1x00/au1xxx_dbdma.h>
27#include <asm/mach-au1x00/au1xxx_psc.h> 28#include <asm/mach-au1x00/au1xxx_psc.h>
28#include <asm/mach-db1x00/db1300.h> 29#include <asm/mach-db1x00/db1300.h>
@@ -636,6 +637,33 @@ static struct platform_device db1300_sndi2s_dev = {
636 637
637/**********************************************************************/ 638/**********************************************************************/
638 639
640static int db1300fb_panel_index(void)
641{
642 return 9; /* DB1300_800x480 */
643}
644
645static int db1300fb_panel_init(void)
646{
647 /* Apply power (Vee/Vdd logic is inverted on Panel DB1300_800x480) */
648 bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD,
649 BCSR_BOARD_LCDBL);
650 return 0;
651}
652
653static int db1300fb_panel_shutdown(void)
654{
655 /* Remove power (Vee/Vdd logic is inverted on Panel DB1300_800x480) */
656 bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDBL,
657 BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD);
658 return 0;
659}
660
661static struct au1200fb_platdata db1300fb_pd = {
662 .panel_index = db1300fb_panel_index,
663 .panel_init = db1300fb_panel_init,
664 .panel_shutdown = db1300fb_panel_shutdown,
665};
666
639static struct resource au1300_lcd_res[] = { 667static struct resource au1300_lcd_res[] = {
640 [0] = { 668 [0] = {
641 .start = AU1200_LCD_PHYS_ADDR, 669 .start = AU1200_LCD_PHYS_ADDR,
@@ -657,6 +685,7 @@ static struct platform_device db1300_lcd_dev = {
657 .dev = { 685 .dev = {
658 .dma_mask = &au1300_lcd_dmamask, 686 .dma_mask = &au1300_lcd_dmamask,
659 .coherent_dma_mask = DMA_BIT_MASK(32), 687 .coherent_dma_mask = DMA_BIT_MASK(32),
688 .platform_data = &db1300fb_pd,
660 }, 689 },
661 .num_resources = ARRAY_SIZE(au1300_lcd_res), 690 .num_resources = ARRAY_SIZE(au1300_lcd_res),
662 .resource = au1300_lcd_res, 691 .resource = au1300_lcd_res,
@@ -762,26 +791,3 @@ void __init board_setup(void)
762 alchemy_uart_enable(AU1300_UART1_PHYS_ADDR); 791 alchemy_uart_enable(AU1300_UART1_PHYS_ADDR);
763 alchemy_uart_enable(AU1300_UART3_PHYS_ADDR); 792 alchemy_uart_enable(AU1300_UART3_PHYS_ADDR);
764} 793}
765
766
767/* au1200fb calls these: STERBT EINEN TRAGISCHEN TOD!!! */
768int board_au1200fb_panel(void)
769{
770 return 9; /* DB1300_800x480 */
771}
772
773int board_au1200fb_panel_init(void)
774{
775 /* Apply power (Vee/Vdd logic is inverted on Panel DB1300_800x480) */
776 bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD,
777 BCSR_BOARD_LCDBL);
778 return 0;
779}
780
781int board_au1200fb_panel_shutdown(void)
782{
783 /* Remove power (Vee/Vdd logic is inverted on Panel DB1300_800x480) */
784 bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDBL,
785 BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD);
786 return 0;
787}
diff --git a/arch/mips/alchemy/devboards/pb1200.c b/arch/mips/alchemy/devboards/pb1200.c
index a1b64977b471..a2676c95053b 100644
--- a/arch/mips/alchemy/devboards/pb1200.c
+++ b/arch/mips/alchemy/devboards/pb1200.c
@@ -26,6 +26,7 @@
26#include <linux/smc91x.h> 26#include <linux/smc91x.h>
27#include <asm/mach-au1x00/au1000.h> 27#include <asm/mach-au1x00/au1000.h>
28#include <asm/mach-au1x00/au1100_mmc.h> 28#include <asm/mach-au1x00/au1100_mmc.h>
29#include <asm/mach-au1x00/au1200fb.h>
29#include <asm/mach-au1x00/au1xxx_dbdma.h> 30#include <asm/mach-au1x00/au1xxx_dbdma.h>
30#include <asm/mach-db1x00/bcsr.h> 31#include <asm/mach-db1x00/bcsr.h>
31#include <asm/mach-pb1x00/pb1200.h> 32#include <asm/mach-pb1x00/pb1200.h>
@@ -351,6 +352,33 @@ static struct platform_device pb1200_i2c_dev = {
351 .resource = au1200_psc0_res, 352 .resource = au1200_psc0_res,
352}; 353};
353 354
355static int pb1200fb_panel_index(void)
356{
357 return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f;
358}
359
360static int pb1200fb_panel_init(void)
361{
362 /* Apply power */
363 bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
364 BCSR_BOARD_LCDBL);
365 return 0;
366}
367
368static int pb1200fb_panel_shutdown(void)
369{
370 /* Remove power */
371 bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
372 BCSR_BOARD_LCDBL, 0);
373 return 0;
374}
375
376static struct au1200fb_platdata pb1200fb_pd = {
377 .panel_index = pb1200fb_panel_index,
378 .panel_init = pb1200fb_panel_init,
379 .panel_shutdown = pb1200fb_panel_shutdown,
380};
381
354static struct resource au1200_lcd_res[] = { 382static struct resource au1200_lcd_res[] = {
355 [0] = { 383 [0] = {
356 .start = AU1200_LCD_PHYS_ADDR, 384 .start = AU1200_LCD_PHYS_ADDR,
@@ -366,12 +394,13 @@ static struct resource au1200_lcd_res[] = {
366 394
367static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32); 395static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32);
368 396
369static struct platform_device au1200_lcd_dev = { 397static struct platform_device pb1200_lcd_dev = {
370 .name = "au1200-lcd", 398 .name = "au1200-lcd",
371 .id = 0, 399 .id = 0,
372 .dev = { 400 .dev = {
373 .dma_mask = &au1200_lcd_dmamask, 401 .dma_mask = &au1200_lcd_dmamask,
374 .coherent_dma_mask = DMA_BIT_MASK(32), 402 .coherent_dma_mask = DMA_BIT_MASK(32),
403 .platform_data = &pb1200fb_pd,
375 }, 404 },
376 .num_resources = ARRAY_SIZE(au1200_lcd_res), 405 .num_resources = ARRAY_SIZE(au1200_lcd_res),
377 .resource = au1200_lcd_res, 406 .resource = au1200_lcd_res,
@@ -383,7 +412,7 @@ static struct platform_device *board_platform_devices[] __initdata = {
383 &pb1200_i2c_dev, 412 &pb1200_i2c_dev,
384 &pb1200_mmc0_dev, 413 &pb1200_mmc0_dev,
385 &pb1200_mmc1_dev, 414 &pb1200_mmc1_dev,
386 &au1200_lcd_dev, 415 &pb1200_lcd_dev,
387}; 416};
388 417
389static int __init board_register_devices(void) 418static int __init board_register_devices(void)
@@ -440,25 +469,3 @@ static int __init board_register_devices(void)
440 ARRAY_SIZE(board_platform_devices)); 469 ARRAY_SIZE(board_platform_devices));
441} 470}
442device_initcall(board_register_devices); 471device_initcall(board_register_devices);
443
444
445int board_au1200fb_panel(void)
446{
447 return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f;
448}
449
450int board_au1200fb_panel_init(void)
451{
452 /* Apply power */
453 bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
454 BCSR_BOARD_LCDBL);
455 return 0;
456}
457
458int board_au1200fb_panel_shutdown(void)
459{
460 /* Remove power */
461 bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
462 BCSR_BOARD_LCDBL, 0);
463 return 0;
464}