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

[PATCH] M68k Apollo I/O updates

M68k Apollo I/O updates for MMIO and pseudo-MMIO (ISA I/O after translation):
  - Use out_8() and out_be16() instead of outb() and outw()
  - Remove conflicting definitions of {in,out}[bw]()
parent 84834c7d
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/apollodma.h> #include <asm/apollodma.h>
#include <asm/io.h>
/* note only works for 16 Bit 1 page DMA's */ /* note only works for 16 Bit 1 page DMA's */
...@@ -27,7 +28,7 @@ unsigned short dma_map_page(unsigned long phys_addr,int count,int type) { ...@@ -27,7 +28,7 @@ unsigned short dma_map_page(unsigned long phys_addr,int count,int type) {
#if 0 #if 0
printk("phys_addr: %x, page_aligned_addr: %x, start_map_addr: %x\n",phys_addr,page_aligned_addr,start_map_addr+i); printk("phys_addr: %x, page_aligned_addr: %x, start_map_addr: %x\n",phys_addr,page_aligned_addr,start_map_addr+i);
#endif #endif
outw(start_map_addr+i, xlat_map_entry); out_be16(xlat_map_entry, start_map_addr+i);
} }
next_free_xlat_entry+=2; next_free_xlat_entry+=2;
......
...@@ -103,11 +103,6 @@ ...@@ -103,11 +103,6 @@
#define SWAP(A) ((A>>8) | ((A&0xff) <<8)) #define SWAP(A) ((A>>8) | ((A&0xff) <<8))
#if 0
#define outb(a,d) *(char *)(a)=(d)
#define outw(a,d) *(unsigned short *)a=d
#endif
static struct fb_info fb_info; static struct fb_info fb_info;
/* frame buffer operations */ /* frame buffer operations */
...@@ -147,9 +142,9 @@ static struct fb_fix_screeninfo dnfb_fix __initdata = { ...@@ -147,9 +142,9 @@ static struct fb_fix_screeninfo dnfb_fix __initdata = {
static int dnfb_blank(int blank, struct fb_info *info) static int dnfb_blank(int blank, struct fb_info *info)
{ {
if (blank) if (blank)
outb(0x0, AP_CONTROL_3A); out_8(AP_CONTROL_3A, 0x0);
else else
outb(0x1, AP_CONTROL_3A); out_8(AP_CONTROL_3A, 0x1);
return 0; return 0;
} }
...@@ -175,8 +170,8 @@ void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area) ...@@ -175,8 +170,8 @@ void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area)
x_word_count = (x_end >> 4) - (area->dx >> 4) + 1; x_word_count = (x_end >> 4) - (area->dx >> 4) + 1;
start_mask = 0xffff0000 >> (area->dx & 0xf); start_mask = 0xffff0000 >> (area->dx & 0xf);
end_mask = 0x7ffff >> (x_end & 0xf); end_mask = 0x7ffff >> (x_end & 0xf);
outb((((area->dx & 0xf) - (area->sx & 0xf)) % 16) | (0x4 << 5), out_8(AP_CONTROL_0,
AP_CONTROL_0); (((area->dx & 0xf) - (area->sx & 0xf)) % 16) | (0x4 << 5));
if ((area->dx & 0xf) < (area->sx & 0xf)) if ((area->dx & 0xf) < (area->sx & 0xf))
pre_read = 1; pre_read = 1;
} else { } else {
...@@ -185,15 +180,16 @@ void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area) ...@@ -185,15 +180,16 @@ void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area)
x_word_count = (area->dx >> 4) - (x_end >> 4) + 1; x_word_count = (area->dx >> 4) - (x_end >> 4) + 1;
start_mask = 0x7ffff >> (area->dx & 0xf); start_mask = 0x7ffff >> (area->dx & 0xf);
end_mask = 0xffff0000 >> (x_end & 0xf); end_mask = 0xffff0000 >> (x_end & 0xf);
outb(((-((area->sx & 0xf) - (area->dx & 0xf))) % out_8(AP_CONTROL_0,
16) | (0x4 << 5), AP_CONTROL_0); ((-((area->sx & 0xf) - (area->dx & 0xf))) % 16) |
(0x4 << 5));
if ((area->dx & 0xf) > (area->sx & 0xf)) if ((area->dx & 0xf) > (area->sx & 0xf))
pre_read = 1; pre_read = 1;
} }
for (i = 0; i < area->height; i++) { for (i = 0; i < area->height; i++) {
outb(0xc | (dest >> 16), AP_CONTROL_3A); out_8(AP_CONTROL_3A, 0xc | (dest >> 16));
if (pre_read) { if (pre_read) {
dummy = *src; dummy = *src;
...@@ -201,11 +197,11 @@ void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area) ...@@ -201,11 +197,11 @@ void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area)
} }
if (x_word_count) { if (x_word_count) {
outb(start_mask, AP_WRITE_ENABLE); out_8(AP_WRITE_ENABLE, start_mask);
*src = dest; *src = dest;
src += incr; src += incr;
dest += incr; dest += incr;
outb(0, AP_WRITE_ENABLE); out_8(AP_WRITE_ENABLE, 0);
for (j = 1; j < (x_word_count - 1); j++) { for (j = 1; j < (x_word_count - 1); j++) {
*src = dest; *src = dest;
...@@ -213,12 +209,12 @@ void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area) ...@@ -213,12 +209,12 @@ void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area)
dest += incr; dest += incr;
} }
outb(start_mask, AP_WRITE_ENABLE); out_8(AP_WRITE_ENABLE, start_mask);
*src = dest; *src = dest;
dest += incr; dest += incr;
src += incr; src += incr;
} else { } else {
outb(start_mask | end_mask, AP_WRITE_ENABLE); out_8(AP_WRITE_ENABLE, start_mask | end_mask);
*src = dest; *src = dest;
dest += incr; dest += incr;
src += incr; src += incr;
...@@ -226,7 +222,7 @@ void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area) ...@@ -226,7 +222,7 @@ void dnfb_copyarea(struct fb_info *info, struct fb_copyarea *area)
src += (y_delta / 16); src += (y_delta / 16);
dest += (y_delta / 16); dest += (y_delta / 16);
} }
outb(NORMAL_MODE, AP_CONTROL_0); out_8(AP_CONTROL_0, NORMAL_MODE);
} }
...@@ -247,12 +243,12 @@ unsigned long __init dnfb_init(unsigned long mem_start) ...@@ -247,12 +243,12 @@ unsigned long __init dnfb_init(unsigned long mem_start)
panic("unable to register apollo frame buffer\n"); panic("unable to register apollo frame buffer\n");
/* now we have registered we can safely setup the hardware */ /* now we have registered we can safely setup the hardware */
outb(RESET_CREG, AP_CONTROL_3A); out_8(AP_CONTROL_3A, RESET_CREG);
outw(0x0, AP_WRITE_ENABLE); out_be16(AP_WRITE_ENABLE, 0x0);
outb(NORMAL_MODE, AP_CONTROL_0); out_8(AP_CONTROL_0, NORMAL_MODE);
outb((AD_BLT | DST_EQ_SRC | NORM_CREG1), AP_CONTROL_1); out_8(AP_CONTROL_1, (AD_BLT | DST_EQ_SRC | NORM_CREG1));
outb(S_DATA_PLN, AP_CONTROL_2); out_8(AP_CONTROL_2, S_DATA_PLN);
outw(SWAP(0x3), AP_ROP_1); out_be16(AP_ROP_1, SWAP(0x3));
printk("apollo frame buffer alive and kicking !\n"); printk("apollo frame buffer alive and kicking !\n");
return mem_start; return mem_start;
......
...@@ -101,9 +101,4 @@ extern u_long timer_physaddr; ...@@ -101,9 +101,4 @@ extern u_long timer_physaddr;
#define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE) #define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE)
#define inb(addr) (*((volatile unsigned char *)(addr)))
#define outb(val,addr) (*((volatile unsigned char *)(addr)) = (val))
#define inw(addr) (*((volatile unsigned short *)(addr)))
#define outw(val,addr) (*((volatile unsigned short *)(addr)) = (val))
#endif #endif
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