Commit fef702be authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] HP9000/300 I/O access fixes

HP9000/300: Replace remaining readb() and friends by in_8() and friends
parent 0cfcb1f1
...@@ -40,7 +40,7 @@ static void hp300_tick(int irq, void *dev_id, struct pt_regs *regs) ...@@ -40,7 +40,7 @@ static void hp300_tick(int irq, void *dev_id, struct pt_regs *regs)
{ {
unsigned long tmp; unsigned long tmp;
void (*vector)(int, void *, struct pt_regs *) = dev_id; void (*vector)(int, void *, struct pt_regs *) = dev_id;
readb(CLOCKBASE + CLKSR); in_8(CLOCKBASE + CLKSR);
asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE)); asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
vector(irq, NULL, regs); vector(irq, NULL, regs);
} }
...@@ -51,25 +51,25 @@ unsigned long hp300_gettimeoffset(void) ...@@ -51,25 +51,25 @@ unsigned long hp300_gettimeoffset(void)
unsigned char lsb, msb1, msb2; unsigned char lsb, msb1, msb2;
unsigned short ticks; unsigned short ticks;
msb1 = readb(CLOCKBASE + 5); msb1 = in_8(CLOCKBASE + 5);
lsb = readb(CLOCKBASE + 7); lsb = in_8(CLOCKBASE + 7);
msb2 = readb(CLOCKBASE + 5); msb2 = in_8(CLOCKBASE + 5);
if (msb1 != msb2) if (msb1 != msb2)
/* A carry happened while we were reading. Read it again */ /* A carry happened while we were reading. Read it again */
lsb = readb(CLOCKBASE + 7); lsb = in_8(CLOCKBASE + 7);
ticks = INTVAL - ((msb2 << 8) | lsb); ticks = INTVAL - ((msb2 << 8) | lsb);
return (USECS_PER_JIFFY * ticks) / INTVAL; return (USECS_PER_JIFFY * ticks) / INTVAL;
} }
void __init hp300_sched_init(void (*vector)(int, void *, struct pt_regs *)) void __init hp300_sched_init(void (*vector)(int, void *, struct pt_regs *))
{ {
writeb(0x1, CLOCKBASE + CLKCR2); /* select CR1 */ out_8(CLOCKBASE + CLKCR2, 0x1); /* select CR1 */
writeb(0x1, CLOCKBASE + CLKCR1); /* reset */ out_8(CLOCKBASE + CLKCR1, 0x1); /* reset */
asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE)); asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
sys_request_irq(6, hp300_tick, IRQ_FLG_STD, "timer tick", vector); sys_request_irq(6, hp300_tick, IRQ_FLG_STD, "timer tick", vector);
writeb(0x1, CLOCKBASE + CLKCR2); /* select CR1 */ out_8(CLOCKBASE + CLKCR2, 0x1); /* select CR1 */
writeb(0x40, CLOCKBASE + CLKCR1); /* enable irq */ out_8(CLOCKBASE + CLKCR1, 0x40); /* enable irq */
} }
...@@ -78,29 +78,29 @@ static int hpfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -78,29 +78,29 @@ static int hpfb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp, unsigned blue, unsigned transp,
struct fb_info *info) struct fb_info *info)
{ {
while (readw(fb_regs + 0x6002) & 0x4) udelay(1); while (in_be16(fb_regs + 0x6002) & 0x4) udelay(1);
writew(0, fb_regs + 0x60f0); out_be16(fb_regs + 0x60f0, 0);
writew(regno, fb_regs + 0x60b8); out_be16(fb_regs + 0x60b8, regno);
writew(red, fb_regs + 0x60b2); out_be16(fb_regs + 0x60b2, red);
writew(green, fb_regs + 0x60b4); out_be16(fb_regs + 0x60b4, green);
writew(blue, fb_regs + 0x60b6); out_be16(fb_regs + 0x60b6, blue);
writew(0xff, fb_regs + 0x60f0); out_be16(fb_regs + 0x60f0, 0xff);
udelay(100); udelay(100);
writew(0xffff, fb_regs + 0x60ba); out_be16(fb_regs + 0x60ba, 0xffff);
return 0; return 0;
} }
void hpfb_copyarea(struct fb_info *info, struct fb_copyarea *area) void hpfb_copyarea(struct fb_info *info, struct fb_copyarea *area)
{ {
while (readb(fb_regs + BUSY) & fb_bitmask); while (in_8(fb_regs + BUSY) & fb_bitmask);
writeb(0x3, fb_regs + WMRR); out_8(fb_regs + WMRR, 0x3);
writew(area->sx, fb_regs + SOURCE_X); out_be16(fb_regs + SOURCE_X, area->sx);
writew(area->sy, fb_regs + SOURCE_Y); out_be16(fb_regs + SOURCE_Y, area->sy);
writew(area->dx, fb_regs + DEST_X); out_be16(fb_regs + DEST_X, area->dx);
writew(area->dy, fb_regs + DEST_Y); out_be16(fb_regs + DEST_Y, area->dy);
writew(area->height, fb_regs + WHEIGHT); out_be16(fb_regs + WHEIGHT, area->height);
writew(area->width, fb_regs + WWIDTH); out_be16(fb_regs + WWIDTH, area->width);
writeb(fb_bitmask, fb_regs + WMOVE); out_8(fb_regs + WMOVE, fb_bitmask);
} }
static struct fb_ops hpfb_ops = { static struct fb_ops hpfb_ops = {
...@@ -121,38 +121,37 @@ int __init hpfb_init_one(unsigned long base) ...@@ -121,38 +121,37 @@ int __init hpfb_init_one(unsigned long base)
{ {
unsigned long fboff; unsigned long fboff;
fboff = (readb(base + TOPCAT_FBOMSB) << 8) fboff = (in_8(base + TOPCAT_FBOMSB) << 8) | in_8(base + TOPCAT_FBOLSB);
| readb(base + TOPCAT_FBOLSB);
hpfb_fix.smem_start = 0xf0000000 | (readb(base + fboff) << 16); hpfb_fix.smem_start = 0xf0000000 | (in_8(base + fboff) << 16);
fb_regs = base; fb_regs = base;
#if 0 #if 0
/* This is the magic incantation NetBSD uses to make Catseye boards work. */ /* This is the magic incantation NetBSD uses to make Catseye boards work. */
writeb(0, base+0x4800); out_8(base+0x4800, 0);
writeb(0, base+0x4510); out_8(base+0x4510, 0);
writeb(0, base+0x4512); out_8(base+0x4512, 0);
writeb(0, base+0x4514); out_8(base+0x4514, 0);
writeb(0, base+0x4516); out_8(base+0x4516, 0);
writeb(0x90, base+0x4206); out_8(base+0x4206, 0x90);
#endif #endif
/* /*
* Give the hardware a bit of a prod and work out how many bits per * Give the hardware a bit of a prod and work out how many bits per
* pixel are supported. * pixel are supported.
*/ */
writeb(0xff, base + TC_WEN); out_8(base + TC_WEN, 0xff);
writeb(0xff, base + TC_FBEN); out_8(base + TC_FBEN, 0xff);
writeb(0xff, hpfb_fix.smem_start); out_8(hpfb_fix.smem_start, 0xff);
fb_bitmask = readb(hpfb_fix.smem_start); fb_bitmask = in_8(hpfb_fix.smem_start);
/* /*
* Enable reading/writing of all the planes. * Enable reading/writing of all the planes.
*/ */
writeb(fb_bitmask, base + TC_WEN); out_8(base + TC_WEN, fb_bitmask);
writeb(fb_bitmask, base + TC_REN); out_8(base + TC_REN, fb_bitmask);
writeb(fb_bitmask, base + TC_FBEN); out_8(base + TC_FBEN, fb_bitmask);
writeb(0x1, base + TC_NBLANK); out_8(base + TC_NBLANK, 0x1);
/* /*
* Let there be consoles.. * Let there be consoles..
......
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