[PATCH] savagefb: Convert from VGA IO access to MMIO access
Use MMIO registers instead of banging the VGA IO registers. Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
1013d26663
commit
1cc650c69f
|
@ -169,6 +169,7 @@ struct savagefb_par {
|
||||||
struct savagefb_i2c_chan chan;
|
struct savagefb_i2c_chan chan;
|
||||||
unsigned char *edid;
|
unsigned char *edid;
|
||||||
u32 pseudo_palette[16];
|
u32 pseudo_palette[16];
|
||||||
|
int paletteEnabled;
|
||||||
int pm_state;
|
int pm_state;
|
||||||
int display_type;
|
int display_type;
|
||||||
int dvi;
|
int dvi;
|
||||||
|
@ -244,105 +245,150 @@ struct savagefb_par {
|
||||||
|
|
||||||
|
|
||||||
/* IO functions */
|
/* IO functions */
|
||||||
|
static inline u8 savage_in8(u32 addr, struct savagefb_par *par)
|
||||||
#define vga_in8(addr) (inb (addr))
|
|
||||||
#define vga_in16(addr) (inw (addr))
|
|
||||||
#define vga_in32(addr) (inl (addr))
|
|
||||||
|
|
||||||
#define vga_out8(addr,val) (outb ((val), (addr)))
|
|
||||||
#define vga_out16(addr,val) (outw ((val), (addr)))
|
|
||||||
#define vga_out32(addr,val) (outl ((val), (addr)))
|
|
||||||
|
|
||||||
#define savage_in16(addr) readw(par->mmio.vbase + (addr))
|
|
||||||
#define savage_in32(addr) readl(par->mmio.vbase + (addr))
|
|
||||||
|
|
||||||
#define savage_out16(addr,val) writew((val), par->mmio.vbase + (addr))
|
|
||||||
#define savage_out32(addr,val) writel((val), par->mmio.vbase + (addr))
|
|
||||||
|
|
||||||
static inline u8 VGArCR (u8 index)
|
|
||||||
{
|
{
|
||||||
outb (index, 0x3d4);
|
return readb(par->mmio.vbase + addr);
|
||||||
return inb (0x3d5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u8 VGArGR (u8 index)
|
static inline u16 savage_in16(u32 addr, struct savagefb_par *par)
|
||||||
{
|
{
|
||||||
outb (index, 0x3ce);
|
return readw(par->mmio.vbase + addr);
|
||||||
return inb (0x3cf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u8 VGArSEQ (u8 index)
|
static inline u32 savage_in32(u32 addr, struct savagefb_par *par)
|
||||||
{
|
{
|
||||||
outb (index, 0x3c4);
|
return readl(par->mmio.vbase + addr);
|
||||||
return inb (0x3c5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VGAwCR(index, val) \
|
static inline void savage_out8(u32 addr, u8 val, struct savagefb_par *par)
|
||||||
do { \
|
{
|
||||||
vga_out8 (0x3d4, index); \
|
writeb(val, par->mmio.vbase + addr);
|
||||||
vga_out8 (0x3d5, val); \
|
}
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define VGAwGR(index, val) \
|
static inline void savage_out16(u32 addr, u16 val, struct savagefb_par *par)
|
||||||
do { \
|
{
|
||||||
vga_out8 (0x3ce, index); \
|
writew(val, par->mmio.vbase + addr);
|
||||||
vga_out8 (0x3cf, val); \
|
}
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define VGAwSEQ(index, val) \
|
static inline void savage_out32(u32 addr, u32 val, struct savagefb_par *par)
|
||||||
do { \
|
{
|
||||||
vga_out8 (0x3c4, index); \
|
writel(val, par->mmio.vbase + addr);
|
||||||
vga_out8 (0x3c5, val); \
|
}
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define VGAenablePalette() \
|
static inline u8 vga_in8(int addr, struct savagefb_par *par)
|
||||||
do { \
|
{
|
||||||
u8 tmp; \
|
return savage_in8(0x8000 + addr, par);
|
||||||
\
|
}
|
||||||
tmp = vga_in8 (0x3da); \
|
|
||||||
vga_out8 (0x3c0, 0x00); \
|
|
||||||
paletteEnabled = 1; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define VGAdisablePalette() \
|
static inline u16 vga_in16(int addr, struct savagefb_par *par)
|
||||||
do { \
|
{
|
||||||
u8 tmp; \
|
return savage_in16(0x8000 + addr, par);
|
||||||
\
|
}
|
||||||
tmp = vga_in8 (0x3da); \
|
|
||||||
vga_out8 (0x3c0, 0x20); \
|
|
||||||
paletteEnabled = 0; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define VGAwATTR(index, value) \
|
static inline u8 vga_in32(int addr, struct savagefb_par *par)
|
||||||
do { \
|
{
|
||||||
u8 tmp; \
|
return savage_in32(0x8000 + addr, par);
|
||||||
\
|
}
|
||||||
if (paletteEnabled) \
|
|
||||||
index &= ~0x20; \
|
|
||||||
else \
|
|
||||||
index |= 0x20; \
|
|
||||||
\
|
|
||||||
tmp = vga_in8 (0x3da); \
|
|
||||||
vga_out8 (0x3c0, index); \
|
|
||||||
vga_out8 (0x3c0, value); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define VGAwMISC(value) \
|
static inline void vga_out8(int addr, u8 val, struct savagefb_par *par)
|
||||||
do { \
|
{
|
||||||
vga_out8 (0x3c2, value); \
|
savage_out8(0x8000 + addr, val, par);
|
||||||
} while (0)
|
}
|
||||||
|
|
||||||
|
static inline void vga_out16(int addr, u16 val, struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
savage_out16(0x8000 + addr, val, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void vga_out32(int addr, u32 val, struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
savage_out32(0x8000 + addr, val, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u8 VGArCR (u8 index, struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
vga_out8(0x3d4, index, par);
|
||||||
|
return vga_in8(0x3d5, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u8 VGArGR (u8 index, struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
vga_out8(0x3ce, index, par);
|
||||||
|
return vga_in8(0x3cf, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u8 VGArSEQ (u8 index, struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
vga_out8(0x3c4, index, par);
|
||||||
|
return vga_in8(0x3c5, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void VGAwCR(u8 index, u8 val, struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
vga_out8(0x3d4, index, par);
|
||||||
|
vga_out8(0x3d5, val, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void VGAwGR(u8 index, u8 val, struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
vga_out8(0x3ce, index, par);
|
||||||
|
vga_out8(0x3cf, val, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void VGAwSEQ(u8 index, u8 val, struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
vga_out8(0x3c4, index, par);
|
||||||
|
vga_out8 (0x3c5, val, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void VGAenablePalette(struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
u8 tmp;
|
||||||
|
|
||||||
|
tmp = vga_in8(0x3da, par);
|
||||||
|
vga_out8(0x3c0, 0x00, par);
|
||||||
|
par->paletteEnabled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void VGAdisablePalette(struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
u8 tmp;
|
||||||
|
|
||||||
|
tmp = vga_in8(0x3da, par);
|
||||||
|
vga_out8(0x3c0, 0x20, par);
|
||||||
|
par->paletteEnabled = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void VGAwATTR(u8 index, u8 value, struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
u8 tmp;
|
||||||
|
|
||||||
|
if (par->paletteEnabled)
|
||||||
|
index &= ~0x20;
|
||||||
|
else
|
||||||
|
index |= 0x20;
|
||||||
|
|
||||||
|
tmp = vga_in8(0x3da, par);
|
||||||
|
vga_out8(0x3c0, index, par);
|
||||||
|
vga_out8 (0x3c0, value, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void VGAwMISC(u8 value, struct savagefb_par *par)
|
||||||
|
{
|
||||||
|
vga_out8(0x3c2, value, par);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_FB_SAVAGE_ACCEL
|
#ifndef CONFIG_FB_SAVAGE_ACCEL
|
||||||
#define savagefb_set_clip(x)
|
#define savagefb_set_clip(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VerticalRetraceWait() \
|
static inline void VerticalRetraceWait(struct savagefb_par *par)
|
||||||
{ \
|
{
|
||||||
vga_out8 (0x3d4, 0x17); \
|
vga_out8(0x3d4, 0x17, par);
|
||||||
if (vga_in8 (0x3d5) & 0x80) { \
|
if (vga_in8(0x3d5, par) & 0x80) {
|
||||||
while ((vga_in8(0x3da) & 0x08) == 0x08) ; \
|
while ((vga_in8(0x3da, par) & 0x08) == 0x08);
|
||||||
while ((vga_in8(0x3da) & 0x08) == 0x00) ; \
|
while ((vga_in8(0x3da, par) & 0x08) == 0x00);
|
||||||
} \
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int savagefb_probe_i2c_connector(struct fb_info *info,
|
extern int savagefb_probe_i2c_connector(struct fb_info *info,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue