aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreric miao <eric.miao@marvell.com>2008-02-04 04:15:50 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-04-19 06:29:05 -0400
commitfef06d274feb9b0e5a2d20c29b2979634514243f (patch)
treeb85fa0ac5f5f2d4d99da51e74c7a650a6ca07db7
parent3d3934c357103504d0f0a5e9ab808bb57e356f6a (diff)
[ARM] pxa: use new pin configuration mechanism for mainstone
1. the following code to configure PGSRx is no way portable and intuitive: - PGSR0 = 0x00008800; - PGSR1 = 0x00000002; - PGSR2 = 0x0001FC00; - PGSR3 = 0x00001F81; this is removed as low power state has already been encoded in the pin configuration definitions. Note: there is no specific reason for some of the GPIOs to drive high in low power mode as indicated by the above setting, those bits are ignored, and the result is validated to work. 2. the following code to configure GPIO wakeup is removed as this is now totally handled by pxa2xx_mfp_config(): - PWER = 0xC0000002; - PRER = 0x00000002; - PFER = 0x00000002; Signed-off-by: eric miao <eric.miao@marvell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-pxa/mainstone.c138
1 files changed, 81 insertions, 57 deletions
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 75be0c74a640..7fa5a3779e0d 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -40,7 +40,7 @@
40 40
41#include <asm/arch/pxa-regs.h> 41#include <asm/arch/pxa-regs.h>
42#include <asm/arch/pxa2xx-regs.h> 42#include <asm/arch/pxa2xx-regs.h>
43#include <asm/arch/pxa2xx-gpio.h> 43#include <asm/arch/mfp-pxa27x.h>
44#include <asm/arch/mainstone.h> 44#include <asm/arch/mainstone.h>
45#include <asm/arch/audio.h> 45#include <asm/arch/audio.h>
46#include <asm/arch/pxafb.h> 46#include <asm/arch/pxafb.h>
@@ -51,6 +51,81 @@
51#include "generic.h" 51#include "generic.h"
52#include "devices.h" 52#include "devices.h"
53 53
54static unsigned long mainstone_pin_config[] = {
55 /* Chip Select */
56 GPIO15_nCS_1,
57
58 /* LCD - 16bpp Active TFT */
59 GPIO58_LCD_LDD_0,
60 GPIO59_LCD_LDD_1,
61 GPIO60_LCD_LDD_2,
62 GPIO61_LCD_LDD_3,
63 GPIO62_LCD_LDD_4,
64 GPIO63_LCD_LDD_5,
65 GPIO64_LCD_LDD_6,
66 GPIO65_LCD_LDD_7,
67 GPIO66_LCD_LDD_8,
68 GPIO67_LCD_LDD_9,
69 GPIO68_LCD_LDD_10,
70 GPIO69_LCD_LDD_11,
71 GPIO70_LCD_LDD_12,
72 GPIO71_LCD_LDD_13,
73 GPIO72_LCD_LDD_14,
74 GPIO73_LCD_LDD_15,
75 GPIO74_LCD_FCLK,
76 GPIO75_LCD_LCLK,
77 GPIO76_LCD_PCLK,
78 GPIO77_LCD_BIAS,
79 GPIO16_PWM0_OUT, /* Backlight */
80
81 /* MMC */
82 GPIO32_MMC_CLK,
83 GPIO112_MMC_CMD,
84 GPIO92_MMC_DAT_0,
85 GPIO109_MMC_DAT_1,
86 GPIO110_MMC_DAT_2,
87 GPIO111_MMC_DAT_3,
88
89 /* USB Host Port 1 */
90 GPIO88_USBH1_PWR,
91 GPIO89_USBH1_PEN,
92
93 /* PC Card */
94 GPIO48_nPOE,
95 GPIO49_nPWE,
96 GPIO50_nPIOR,
97 GPIO51_nPIOW,
98 GPIO85_nPCE_1,
99 GPIO54_nPCE_2,
100 GPIO79_PSKTSEL,
101 GPIO55_nPREG,
102 GPIO56_nPWAIT,
103 GPIO57_nIOIS16,
104
105 /* AC97 */
106 GPIO45_AC97_SYSCLK,
107
108 /* Keypad */
109 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
110 GPIO94_KP_DKIN_1 | WAKEUP_ON_LEVEL_HIGH,
111 GPIO95_KP_DKIN_2 | WAKEUP_ON_LEVEL_HIGH,
112 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
113 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
114 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
115 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
116 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
117 GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
118 GPIO103_KP_MKOUT_0,
119 GPIO104_KP_MKOUT_1,
120 GPIO105_KP_MKOUT_2,
121 GPIO106_KP_MKOUT_3,
122 GPIO107_KP_MKOUT_4,
123 GPIO108_KP_MKOUT_5,
124 GPIO96_KP_MKOUT_6,
125
126 /* GPIO */
127 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
128};
54 129
55static unsigned long mainstone_irq_enabled; 130static unsigned long mainstone_irq_enabled;
56 131
@@ -279,13 +354,13 @@ static int mainstone_backlight_update_status(struct backlight_device *bl)
279 bl->props.fb_blank != FB_BLANK_UNBLANK) 354 bl->props.fb_blank != FB_BLANK_UNBLANK)
280 brightness = 0; 355 brightness = 0;
281 356
282 if (brightness != 0) { 357 if (brightness != 0)
283 pxa_gpio_mode(GPIO16_PWM0_MD);
284 pxa_set_cken(CKEN_PWM0, 1); 358 pxa_set_cken(CKEN_PWM0, 1);
285 } 359
286 PWM_CTRL0 = 0; 360 PWM_CTRL0 = 0;
287 PWM_PWDUTY0 = brightness; 361 PWM_PWDUTY0 = brightness;
288 PWM_PERVAL0 = bl->props.max_brightness; 362 PWM_PERVAL0 = bl->props.max_brightness;
363
289 if (brightness == 0) 364 if (brightness == 0)
290 pxa_set_cken(CKEN_PWM0, 0); 365 pxa_set_cken(CKEN_PWM0, 0);
291 return 0; /* pointless return value */ 366 return 0; /* pointless return value */
@@ -363,16 +438,6 @@ static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_in
363{ 438{
364 int err; 439 int err;
365 440
366 /*
367 * setup GPIO for PXA27x MMC controller
368 */
369 pxa_gpio_mode(GPIO32_MMCCLK_MD);
370 pxa_gpio_mode(GPIO112_MMCCMD_MD);
371 pxa_gpio_mode(GPIO92_MMCDAT0_MD);
372 pxa_gpio_mode(GPIO109_MMCDAT1_MD);
373 pxa_gpio_mode(GPIO110_MMCDAT2_MD);
374 pxa_gpio_mode(GPIO111_MMCDAT3_MD);
375
376 /* make sure SD/Memory Stick multiplexer's signals 441 /* make sure SD/Memory Stick multiplexer's signals
377 * are routed to MMC controller 442 * are routed to MMC controller
378 */ 443 */
@@ -444,10 +509,6 @@ static struct platform_device *platform_devices[] __initdata = {
444 509
445static int mainstone_ohci_init(struct device *dev) 510static int mainstone_ohci_init(struct device *dev)
446{ 511{
447 /* setup Port1 GPIO pin. */
448 pxa_gpio_mode( 88 | GPIO_ALT_FN_1_IN); /* USBHPWR1 */
449 pxa_gpio_mode( 89 | GPIO_ALT_FN_2_OUT); /* USBHPEN1 */
450
451 /* Set the Power Control Polarity Low and Power Sense 512 /* Set the Power Control Polarity Low and Power Sense
452 Polarity Low to active low. */ 513 Polarity Low to active low. */
453 UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) & 514 UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) &
@@ -465,6 +526,8 @@ static void __init mainstone_init(void)
465{ 526{
466 int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */ 527 int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */
467 528
529 pxa2xx_mfp_config(ARRAY_AND_SIZE(mainstone_pin_config));
530
468 mst_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4; 531 mst_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4;
469 mst_flash_data[1].width = 4; 532 mst_flash_data[1].width = 4;
470 533
@@ -481,31 +544,6 @@ static void __init mainstone_init(void)
481 */ 544 */
482 ARB_CNTRL = ARB_CORE_PARK | 0x234; 545 ARB_CNTRL = ARB_CORE_PARK | 0x234;
483 546
484 /*
485 * On Mainstone, we route AC97_SYSCLK via GPIO45 to
486 * the audio daughter card
487 */
488 pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD);
489
490 GPSR(GPIO48_nPOE) =
491 GPIO_bit(GPIO48_nPOE) |
492 GPIO_bit(GPIO49_nPWE) |
493 GPIO_bit(GPIO50_nPIOR) |
494 GPIO_bit(GPIO51_nPIOW) |
495 GPIO_bit(GPIO85_nPCE_1) |
496 GPIO_bit(GPIO54_nPCE_2);
497
498 pxa_gpio_mode(GPIO48_nPOE_MD);
499 pxa_gpio_mode(GPIO49_nPWE_MD);
500 pxa_gpio_mode(GPIO50_nPIOR_MD);
501 pxa_gpio_mode(GPIO51_nPIOW_MD);
502 pxa_gpio_mode(GPIO85_nPCE_1_MD);
503 pxa_gpio_mode(GPIO54_nPCE_2_MD);
504 pxa_gpio_mode(GPIO79_pSKTSEL_MD);
505 pxa_gpio_mode(GPIO55_nPREG_MD);
506 pxa_gpio_mode(GPIO56_nPWAIT_MD);
507 pxa_gpio_mode(GPIO57_nIOIS16_MD);
508
509 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 547 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
510 548
511 /* reading Mainstone's "Virtual Configuration Register" 549 /* reading Mainstone's "Virtual Configuration Register"
@@ -538,23 +576,9 @@ static void __init mainstone_map_io(void)
538 pxa_map_io(); 576 pxa_map_io();
539 iotable_init(mainstone_io_desc, ARRAY_SIZE(mainstone_io_desc)); 577 iotable_init(mainstone_io_desc, ARRAY_SIZE(mainstone_io_desc));
540 578
541 /* initialize sleep mode regs (wake-up sources, etc) */
542 PGSR0 = 0x00008800;
543 PGSR1 = 0x00000002;
544 PGSR2 = 0x0001FC00;
545 PGSR3 = 0x00001F81;
546 PWER = 0xC0000002;
547 PRER = 0x00000002;
548 PFER = 0x00000002;
549 /* for use I SRAM as framebuffer. */ 579 /* for use I SRAM as framebuffer. */
550 PSLR |= 0xF04; 580 PSLR |= 0xF04;
551 PCFR = 0x66; 581 PCFR = 0x66;
552 /* For Keypad wakeup. */
553 KPC &=~KPC_ASACT;
554 KPC |=KPC_AS;
555 PKWR = 0x000FD000;
556 /* Need read PKWR back after set it. */
557 PKWR;
558} 582}
559 583
560MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") 584MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")