Commit e7a05fe5 authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] fbdev: Fix io access in neofb

  - Fix IO access in neofb
  - Use readl/writel
  - add __iomem annotations
Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8d82d438
...@@ -493,7 +493,7 @@ static inline int neo2200_sync(struct fb_info *info) ...@@ -493,7 +493,7 @@ static inline int neo2200_sync(struct fb_info *info)
struct neofb_par *par = (struct neofb_par *) info->par; struct neofb_par *par = (struct neofb_par *) info->par;
int waitcycles; int waitcycles;
while (par->neo2200->bltStat & 1) while (readl(&par->neo2200->bltStat) & 1)
waitcycles++; waitcycles++;
return 0; return 0;
} }
...@@ -531,7 +531,7 @@ static inline void neo2200_accel_init(struct fb_info *info, ...@@ -531,7 +531,7 @@ static inline void neo2200_accel_init(struct fb_info *info,
struct fb_var_screeninfo *var) struct fb_var_screeninfo *var)
{ {
struct neofb_par *par = (struct neofb_par *) info->par; struct neofb_par *par = (struct neofb_par *) info->par;
Neo2200 *neo2200 = par->neo2200; Neo2200 __iomem *neo2200 = par->neo2200;
u32 bltMod, pitch; u32 bltMod, pitch;
neo2200_sync(info); neo2200_sync(info);
...@@ -556,8 +556,8 @@ static inline void neo2200_accel_init(struct fb_info *info, ...@@ -556,8 +556,8 @@ static inline void neo2200_accel_init(struct fb_info *info,
return; return;
} }
neo2200->bltStat = bltMod << 16; writel(bltMod << 16, &neo2200->bltStat);
neo2200->pitch = (pitch << 16) | pitch; writel((pitch << 16) | pitch, &neo2200->pitch);
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
...@@ -1418,27 +1418,27 @@ neo2200_fillrect(struct fb_info *info, const struct fb_fillrect *rect) ...@@ -1418,27 +1418,27 @@ neo2200_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
neo2200_wait_fifo(info, 4); neo2200_wait_fifo(info, 4);
/* set blt control */ /* set blt control */
par->neo2200->bltCntl = NEO_BC3_FIFO_EN | writel(NEO_BC3_FIFO_EN |
NEO_BC0_SRC_IS_FG | NEO_BC3_SKIP_MAPPING | NEO_BC0_SRC_IS_FG | NEO_BC3_SKIP_MAPPING |
// NEO_BC3_DST_XY_ADDR | // NEO_BC3_DST_XY_ADDR |
// NEO_BC3_SRC_XY_ADDR | // NEO_BC3_SRC_XY_ADDR |
rop; rop, &par->neo2200->bltCntl);
switch (info->var.bits_per_pixel) { switch (info->var.bits_per_pixel) {
case 8: case 8:
par->neo2200->fgColor = rect->color; writel(rect->color, &par->neo2200->fgColor);
break; break;
case 16: case 16:
case 24: case 24:
par->neo2200->fgColor = writel(((u32 *) (info->pseudo_palette))[rect->color],
((u32 *) (info->pseudo_palette))[rect->color]; &par->neo2200->fgColor);
break; break;
} }
par->neo2200->dstStart = writel(dst * ((info->var.bits_per_pixel + 7) >> 3),
dst * ((info->var.bits_per_pixel + 7) >> 3); &par->neo2200->dstStart);
par->neo2200->xyExt = writel((rect->height << 16) | (rect->width & 0xffff),
(rect->height << 16) | (rect->width & 0xffff); &par->neo2200->xyExt);
} }
static void static void
...@@ -1466,12 +1466,12 @@ neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area) ...@@ -1466,12 +1466,12 @@ neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area)
neo2200_wait_fifo(info, 4); neo2200_wait_fifo(info, 4);
/* set blt control */ /* set blt control */
par->neo2200->bltCntl = bltCntl; writel(bltCntl, &par->neo2200->bltCntl);
par->neo2200->srcStart = src; writel(src, &par->neo2200->srcStart);
par->neo2200->dstStart = dst; writel(dst, &par->neo2200->dstStart);
par->neo2200->xyExt = writel((area->height << 16) | (area->width & 0xffff),
(area->height << 16) | (area->width & 0xffff); &par->neo2200->xyExt);
} }
static void static void
...@@ -1481,7 +1481,7 @@ neo2200_imageblit(struct fb_info *info, const struct fb_image *image) ...@@ -1481,7 +1481,7 @@ neo2200_imageblit(struct fb_info *info, const struct fb_image *image)
int s_pitch = (image->width * image->depth + 7) >> 3; int s_pitch = (image->width * image->depth + 7) >> 3;
int scan_align = info->pixmap.scan_align - 1; int scan_align = info->pixmap.scan_align - 1;
int buf_align = info->pixmap.buf_align - 1; int buf_align = info->pixmap.buf_align - 1;
int bltCntl_flags, d_pitch, data_len; int bltCntl_flags, d_pitch, data_len, i;
// The data is padded for the hardware // The data is padded for the hardware
d_pitch = (s_pitch + scan_align) & ~scan_align; d_pitch = (s_pitch + scan_align) & ~scan_align;
...@@ -1509,32 +1509,32 @@ neo2200_imageblit(struct fb_info *info, const struct fb_image *image) ...@@ -1509,32 +1509,32 @@ neo2200_imageblit(struct fb_info *info, const struct fb_image *image)
switch (info->var.bits_per_pixel) { switch (info->var.bits_per_pixel) {
case 8: case 8:
par->neo2200->fgColor = image->fg_color; writel(image->fg_color, &par->neo2200->fgColor);
par->neo2200->bgColor = image->bg_color; writel(image->bg_color, &par->neo2200->bgColor);
break; break;
case 16: case 16:
case 24: case 24:
par->neo2200->fgColor = writel(((u32 *) (info->pseudo_palette))[image->fg_color],
((u32 *) (info->pseudo_palette))[image->fg_color]; &par->neo2200->fgColor);
par->neo2200->bgColor = writel(((u32 *) (info->pseudo_palette))[image->bg_color],
((u32 *) (info->pseudo_palette))[image->bg_color]; &par->neo2200->bgColor);
break; break;
} }
par->neo2200->bltCntl = NEO_BC0_SYS_TO_VID | writel(NEO_BC0_SYS_TO_VID |
NEO_BC3_SKIP_MAPPING | bltCntl_flags | NEO_BC3_SKIP_MAPPING | bltCntl_flags |
// NEO_BC3_DST_XY_ADDR | // NEO_BC3_DST_XY_ADDR |
0x0c0000; 0x0c0000, &par->neo2200->bltCntl);
par->neo2200->srcStart = 0; writel(0, &par->neo2200->srcStart);
// par->neo2200->dstStart = (image->dy << 16) | (image->dx & 0xffff); // par->neo2200->dstStart = (image->dy << 16) | (image->dx & 0xffff);
par->neo2200->dstStart = writel(((image->dx & 0xffff) * (info->var.bits_per_pixel >> 3) +
((image->dx & 0xffff) * (info->var.bits_per_pixel >> 3) + image->dy * info->fix.line_length), &par->neo2200->dstStart);
image->dy * info->fix.line_length); writel((image->height << 16) | (image->width & 0xffff),
par->neo2200->xyExt = &par->neo2200->xyExt);
(image->height << 16) | (image->width & 0xffff);
memcpy(par->mmio_vbase + 0x100000, image->data, data_len); for (i = 0; i < data_len; i++)
writeb(image->data[i], par->mmio_vbase + 0x100000);
} }
static void static void
...@@ -1765,7 +1765,7 @@ static int __devinit neo_map_video(struct fb_info *info, ...@@ -1765,7 +1765,7 @@ static int __devinit neo_map_video(struct fb_info *info,
#endif #endif
/* Clear framebuffer, it's all white in memory after boot */ /* Clear framebuffer, it's all white in memory after boot */
memset(info->screen_base, 0, info->fix.smem_len); memset_io(info->screen_base, 0, info->fix.smem_len);
/* Allocate Cursor drawing pad. /* Allocate Cursor drawing pad.
info->fix.smem_len -= PAGE_SIZE; info->fix.smem_len -= PAGE_SIZE;
...@@ -1946,7 +1946,7 @@ static int __devinit neo_init_hw(struct fb_info *info) ...@@ -1946,7 +1946,7 @@ static int __devinit neo_init_hw(struct fb_info *info)
maxWidth = 1280; maxWidth = 1280;
maxHeight = 1024; /* ???? */ maxHeight = 1024; /* ???? */
par->neo2200 = (Neo2200 *) par->mmio_vbase; par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
break; break;
case FB_ACCEL_NEOMAGIC_NM2230: case FB_ACCEL_NEOMAGIC_NM2230:
videoRam = 3008; videoRam = 3008;
...@@ -1957,7 +1957,7 @@ static int __devinit neo_init_hw(struct fb_info *info) ...@@ -1957,7 +1957,7 @@ static int __devinit neo_init_hw(struct fb_info *info)
maxWidth = 1280; maxWidth = 1280;
maxHeight = 1024; /* ???? */ maxHeight = 1024; /* ???? */
par->neo2200 = (Neo2200 *) par->mmio_vbase; par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
break; break;
case FB_ACCEL_NEOMAGIC_NM2360: case FB_ACCEL_NEOMAGIC_NM2360:
videoRam = 4096; videoRam = 4096;
...@@ -1968,7 +1968,7 @@ static int __devinit neo_init_hw(struct fb_info *info) ...@@ -1968,7 +1968,7 @@ static int __devinit neo_init_hw(struct fb_info *info)
maxWidth = 1280; maxWidth = 1280;
maxHeight = 1024; /* ???? */ maxHeight = 1024; /* ???? */
par->neo2200 = (Neo2200 *) par->mmio_vbase; par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
break; break;
case FB_ACCEL_NEOMAGIC_NM2380: case FB_ACCEL_NEOMAGIC_NM2380:
videoRam = 6144; videoRam = 6144;
...@@ -1979,7 +1979,7 @@ static int __devinit neo_init_hw(struct fb_info *info) ...@@ -1979,7 +1979,7 @@ static int __devinit neo_init_hw(struct fb_info *info)
maxWidth = 1280; maxWidth = 1280;
maxHeight = 1024; /* ???? */ maxHeight = 1024; /* ???? */
par->neo2200 = (Neo2200 *) par->mmio_vbase; par->neo2200 = (Neo2200 __iomem *) par->mmio_vbase;
break; break;
} }
/* /*
......
...@@ -179,11 +179,11 @@ struct neofb_par { ...@@ -179,11 +179,11 @@ struct neofb_par {
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
int mtrr; int mtrr;
#endif #endif
u8 *mmio_vbase; u8 __iomem *mmio_vbase;
u8 cursorOff; u8 cursorOff;
u8 *cursorPad; /* Must die !! */ u8 *cursorPad; /* Must die !! */
Neo2200 *neo2200; Neo2200 __iomem *neo2200;
/* Panels size */ /* Panels size */
int NeoPanelWidth; int NeoPanelWidth;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment