[ARM] pxa/cm-x270: avoid direct access of GPIO/MFP registers

Cc: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
This commit is contained in:
Eric Miao 2010-01-04 13:34:05 +08:00
parent 846c864cac
commit 96f6a13a6d

View File

@ -176,33 +176,57 @@ static struct resource cmx270_2700G_resource[] = {
}, },
}; };
static unsigned long save_lcd_regs[10]; static unsigned long cmx270_marathon_on[] = {
GPIO58_GPIO,
GPIO59_GPIO,
GPIO60_GPIO,
GPIO61_GPIO,
GPIO62_GPIO,
GPIO63_GPIO,
GPIO64_GPIO,
GPIO65_GPIO,
GPIO66_GPIO,
GPIO67_GPIO,
GPIO68_GPIO,
GPIO69_GPIO,
GPIO70_GPIO,
GPIO71_GPIO,
GPIO72_GPIO,
GPIO73_GPIO,
GPIO74_GPIO,
GPIO75_GPIO,
GPIO76_GPIO,
GPIO77_GPIO,
};
static unsigned long cmx270_marathon_off[] = {
GPIOxx_LCD_TFT_16BPP,
};
static int cmx270_marathon_probe(struct fb_info *fb) static int cmx270_marathon_probe(struct fb_info *fb)
{ {
/* save PXA-270 pin settings before enabling 2700G */ int gpio, err;
save_lcd_regs[0] = GPDR1;
save_lcd_regs[1] = GPDR2;
save_lcd_regs[2] = GAFR1_U;
save_lcd_regs[3] = GAFR2_L;
save_lcd_regs[4] = GAFR2_U;
/* Disable PXA-270 on-chip controller driving pins */ for (gpio = 58; gpio <= 77; gpio++) {
GPDR1 &= ~(0xfc000000); err = gpio_request(gpio, "LCD");
GPDR2 &= ~(0x00c03fff); if (err)
GAFR1_U &= ~(0xfff00000); return err;
GAFR2_L &= ~(0x0fffffff); gpio_direction_input(gpio);
GAFR2_U &= ~(0x0000f000); }
pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_marathon_on));
return 0; return 0;
} }
static int cmx270_marathon_remove(struct fb_info *fb) static int cmx270_marathon_remove(struct fb_info *fb)
{ {
GPDR1 = save_lcd_regs[0]; int gpio;
GPDR2 = save_lcd_regs[1];
GAFR1_U = save_lcd_regs[2]; pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_marathon_off));
GAFR2_L = save_lcd_regs[3];
GAFR2_U = save_lcd_regs[4]; for (gpio = 58; gpio <= 77; gpio++)
gpio_free(gpio);
return 0; return 0;
} }