aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Miao <eric.y.miao@gmail.com>2010-01-04 00:34:05 -0500
committerEric Miao <eric.y.miao@gmail.com>2010-03-01 18:40:48 -0500
commit96f6a13a6d8a6370fb9a8c828d549f3ddea8d0c5 (patch)
tree3c2c588aaf20863eb129169ee43b87ef230ad293
parent846c864cac520eaa10e845f585f05af643aa848a (diff)
[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>
-rw-r--r--arch/arm/mach-pxa/cm-x270.c62
1 files changed, 43 insertions, 19 deletions
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index 425efbc94d8e..a9926bb75922 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -176,33 +176,57 @@ static struct resource cmx270_2700G_resource[] = {
176 }, 176 },
177}; 177};
178 178
179static unsigned long save_lcd_regs[10]; 179static unsigned long cmx270_marathon_on[] = {
180 GPIO58_GPIO,
181 GPIO59_GPIO,
182 GPIO60_GPIO,
183 GPIO61_GPIO,
184 GPIO62_GPIO,
185 GPIO63_GPIO,
186 GPIO64_GPIO,
187 GPIO65_GPIO,
188 GPIO66_GPIO,
189 GPIO67_GPIO,
190 GPIO68_GPIO,
191 GPIO69_GPIO,
192 GPIO70_GPIO,
193 GPIO71_GPIO,
194 GPIO72_GPIO,
195 GPIO73_GPIO,
196 GPIO74_GPIO,
197 GPIO75_GPIO,
198 GPIO76_GPIO,
199 GPIO77_GPIO,
200};
201
202static unsigned long cmx270_marathon_off[] = {
203 GPIOxx_LCD_TFT_16BPP,
204};
180 205
181static int cmx270_marathon_probe(struct fb_info *fb) 206static int cmx270_marathon_probe(struct fb_info *fb)
182{ 207{
183 /* save PXA-270 pin settings before enabling 2700G */ 208 int gpio, err;
184 save_lcd_regs[0] = GPDR1; 209
185 save_lcd_regs[1] = GPDR2; 210 for (gpio = 58; gpio <= 77; gpio++) {
186 save_lcd_regs[2] = GAFR1_U; 211 err = gpio_request(gpio, "LCD");
187 save_lcd_regs[3] = GAFR2_L; 212 if (err)
188 save_lcd_regs[4] = GAFR2_U; 213 return err;
189 214 gpio_direction_input(gpio);
190 /* Disable PXA-270 on-chip controller driving pins */ 215 }
191 GPDR1 &= ~(0xfc000000); 216
192 GPDR2 &= ~(0x00c03fff); 217 pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_marathon_on));
193 GAFR1_U &= ~(0xfff00000);
194 GAFR2_L &= ~(0x0fffffff);
195 GAFR2_U &= ~(0x0000f000);
196 return 0; 218 return 0;
197} 219}
198 220
199static int cmx270_marathon_remove(struct fb_info *fb) 221static int cmx270_marathon_remove(struct fb_info *fb)
200{ 222{
201 GPDR1 = save_lcd_regs[0]; 223 int gpio;
202 GPDR2 = save_lcd_regs[1]; 224
203 GAFR1_U = save_lcd_regs[2]; 225 pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_marathon_off));
204 GAFR2_L = save_lcd_regs[3]; 226
205 GAFR2_U = save_lcd_regs[4]; 227 for (gpio = 58; gpio <= 77; gpio++)
228 gpio_free(gpio);
229
206 return 0; 230 return 0;
207} 231}
208 232