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

[PATCH] M68k update (part 32)

Mac/m68k Nubus updates
  - Use nubus_{read,write}[bwl]()
  - Fix /proc/bus/nubus
  - Fix type and linkage of nubus_init()
  - Use nubus_{read,write}[bwl]()
  - Kill some address assignment warnings
  - Include <asm/nubus.h>
  - nubus_init() is an initcall, hence static
parent e8c65708
......@@ -144,28 +144,28 @@ static int set_mac_address(struct net_device *dev, void *addr);
static int inline
readreg_io(struct net_device *dev, int portno)
{
writew(swab16(portno), dev->base_addr + ADD_PORT);
return swab16(readw(dev->base_addr + DATA_PORT));
nubus_writew(swab16(portno), dev->base_addr + ADD_PORT);
return swab16(nubus_readw(dev->base_addr + DATA_PORT));
}
static void inline
writereg_io(struct net_device *dev, int portno, int value)
{
writew(swab16(portno), dev->base_addr + ADD_PORT);
writew(swab16(value), dev->base_addr + DATA_PORT);
nubus_writew(swab16(portno), dev->base_addr + ADD_PORT);
nubus_writew(swab16(value), dev->base_addr + DATA_PORT);
}
/* These are for reading/writing registers in shared memory */
static int inline
readreg(struct net_device *dev, int portno)
{
return swab16(readw(dev->mem_start + portno));
return swab16(nubus_readw(dev->mem_start + portno));
}
static void inline
writereg(struct net_device *dev, int portno, int value)
{
writew(swab16(value), dev->mem_start + portno);
nubus_writew(swab16(value), dev->mem_start + portno);
}
/* Probe for the CS8900 card in slot E. We won't bother looking
......@@ -210,8 +210,8 @@ int __init mac89x0_probe(struct net_device *dev)
return -ENODEV;
}
writew(0, ioaddr + ADD_PORT);
sig = readw(ioaddr + DATA_PORT);
nubus_writew(0, ioaddr + ADD_PORT);
sig = nubus_readw(ioaddr + DATA_PORT);
if (sig != swab16(CHIP_EISA_ID_SIG))
return -ENODEV;
......@@ -450,7 +450,7 @@ static void net_interrupt(int irq, void *dev_id, struct pt_regs * regs)
course, if you're on a slow machine, and packets are arriving
faster than you can read them off, you're screwed. Hasta la
vista, baby! */
while ((status = swab16(readw(dev->base_addr + ISQ_PORT)))) {
while ((status = swab16(nubus_readw(dev->base_addr + ISQ_PORT)))) {
if (net_debug > 4)printk("%s: event=%04x\n", dev->name, status);
switch(status & ISQ_EVENT_MASK) {
case ISQ_RECEIVER_EVENT:
......@@ -653,7 +653,7 @@ cleanup_module(void)
#endif
#ifdef MODULE
writew(0, dev_cs89x0.base_addr + ADD_PORT);
nubus_writew(0, dev_cs89x0.base_addr + ADD_PORT);
#endif
#ifdef MODULE
......
......@@ -961,18 +961,18 @@ static int sprint_nubus_board(struct nubus_board* board, char* ptr, int len)
return strlen(ptr);
}
static int nubus_read_proc(char *buf, char **start, off_t off,
static int nubus_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int nprinted, len, begin = 0;
int slot,size;
int size = PAGE_SIZE;
struct nubus_board* board;
len = sprintf(buf, "Nubus devices found:\n");
len = sprintf(page, "Nubus devices found:\n");
/* Walk the list of NuBus boards */
for (board = nubus_boards; board != NULL; board = board->next)
{
nprinted = sprint_nubus_board(board, buf + len, size - len);
nprinted = sprint_nubus_board(board, page + len, size - len);
if (nprinted < 0)
break;
len += nprinted;
......@@ -983,10 +983,10 @@ static int nubus_read_proc(char *buf, char **start, off_t off,
if (len+begin >= off+count)
break;
}
if (slot==16 || len+begin < off)
if (len+begin < off)
*eof = 1;
off -= begin;
*start = buf + off;
*start = page + off;
len -= off;
if (len>count)
len = count;
......@@ -1009,10 +1009,10 @@ void __init nubus_scan_bus(void)
}
}
void __init nubus_init(void)
static int __init nubus_init(void)
{
if (!MACH_IS_MAC)
return;
return 0;
/* Initialize the NuBus interrupts */
if (oss_present) {
......@@ -1038,6 +1038,7 @@ void __init nubus_init(void)
create_proc_read_entry("nubus", 0, NULL, nubus_read_proc, NULL);
nubus_proc_init();
#endif
return 0;
}
subsys_initcall(nubus_init);
......@@ -155,7 +155,7 @@ struct jet_cmap_regs {
#define PIXEL_TO_MM(a) (((a)*10)/28) /* width in mm at 72 dpi */
static char* video_base;
static unsigned long video_base;
static int video_size;
static char* video_vbase; /* mapped */
......@@ -349,15 +349,15 @@ static int valkyrie_setpalette (unsigned int regno, unsigned int red,
cli();
/* tell clut which address to fill */
writeb(regno, &valkyrie_cmap_regs->addr);
nubus_writeb(regno, &valkyrie_cmap_regs->addr);
nop();
/* send one color channel at a time */
writeb(red, &valkyrie_cmap_regs->lut);
nubus_writeb(red, &valkyrie_cmap_regs->lut);
nop();
writeb(green, &valkyrie_cmap_regs->lut);
nubus_writeb(green, &valkyrie_cmap_regs->lut);
nop();
writeb(blue, &valkyrie_cmap_regs->lut);
nubus_writeb(blue, &valkyrie_cmap_regs->lut);
restore_flags(flags);
......@@ -389,25 +389,25 @@ static int dafb_setpalette (unsigned int regno, unsigned int red,
int i;
/* Stab in the dark trying to reset the CLUT pointer */
writel(0, &dafb_cmap_regs->reset);
nubus_writel(0, &dafb_cmap_regs->reset);
nop();
/* Loop until we get to the register we want */
for (i = 0; i < regno; i++) {
writeb(palette[i].red >> 8, &dafb_cmap_regs->lut);
nubus_writeb(palette[i].red >> 8, &dafb_cmap_regs->lut);
nop();
writeb(palette[i].green >> 8, &dafb_cmap_regs->lut);
nubus_writeb(palette[i].green >> 8, &dafb_cmap_regs->lut);
nop();
writeb(palette[i].blue >> 8, &dafb_cmap_regs->lut);
nubus_writeb(palette[i].blue >> 8, &dafb_cmap_regs->lut);
nop();
}
}
writeb(red, &dafb_cmap_regs->lut);
nubus_writeb(red, &dafb_cmap_regs->lut);
nop();
writeb(green, &dafb_cmap_regs->lut);
nubus_writeb(green, &dafb_cmap_regs->lut);
nop();
writeb(blue, &dafb_cmap_regs->lut);
nubus_writeb(blue, &dafb_cmap_regs->lut);
restore_flags(flags);
......@@ -439,12 +439,12 @@ static int v8_brazil_setpalette (unsigned int regno, unsigned int red,
In 2bpp, the regnos are 0x3f, 0x7f, 0xbf, 0xff */
_regno = (regno<<(8-video_bpp)) | (0xFF>>video_bpp);
writeb(_regno, &v8_brazil_cmap_regs->addr); nop();
nubus_writeb(_regno, &v8_brazil_cmap_regs->addr); nop();
/* send one color channel at a time */
writeb(_red, &v8_brazil_cmap_regs->lut); nop();
writeb(_green, &v8_brazil_cmap_regs->lut); nop();
writeb(_blue, &v8_brazil_cmap_regs->lut);
nubus_writeb(_red, &v8_brazil_cmap_regs->lut); nop();
nubus_writeb(_green, &v8_brazil_cmap_regs->lut); nop();
nubus_writeb(_blue, &v8_brazil_cmap_regs->lut);
restore_flags(flags);
......@@ -473,15 +473,15 @@ static int rbv_setpalette (unsigned int regno, unsigned int red,
_regno = regno + (256-(1<<video_bpp));
/* reset clut? (VideoToolbox sez "not necessary") */
writeb(0xFF, &rbv_cmap_regs->cntl); nop();
nubus_writeb(0xFF, &rbv_cmap_regs->cntl); nop();
/* tell clut which address to use. */
writeb(_regno, &rbv_cmap_regs->addr); nop();
nubus_writeb(_regno, &rbv_cmap_regs->addr); nop();
/* send one color channel at a time. */
writeb(_red, &rbv_cmap_regs->lut); nop();
writeb(_green, &rbv_cmap_regs->lut); nop();
writeb(_blue, &rbv_cmap_regs->lut);
nubus_writeb(_red, &rbv_cmap_regs->lut); nop();
nubus_writeb(_green, &rbv_cmap_regs->lut); nop();
nubus_writeb(_blue, &rbv_cmap_regs->lut);
restore_flags(flags);
/* done. */
......@@ -505,10 +505,10 @@ static int mdc_setpalette(unsigned int regno, unsigned int red,
cli();
/* the nop's are there to order writes. */
writeb(_regno, &cmap_regs->addr); nop();
writeb(_red, &cmap_regs->lut); nop();
writeb(_green, &cmap_regs->lut); nop();
writeb(_blue, &cmap_regs->lut);
nubus_writeb(_regno, &cmap_regs->addr); nop();
nubus_writeb(_red, &cmap_regs->lut); nop();
nubus_writeb(_green, &cmap_regs->lut); nop();
nubus_writeb(_blue, &cmap_regs->lut);
restore_flags(flags);
return 0;
......@@ -530,10 +530,10 @@ static int toby_setpalette(unsigned int regno, unsigned int red,
save_flags(flags);
cli();
writeb(_regno, &cmap_regs->addr); nop();
writeb(_red, &cmap_regs->lut); nop();
writeb(_green, &cmap_regs->lut); nop();
writeb(_blue, &cmap_regs->lut);
nubus_writeb(_regno, &cmap_regs->addr); nop();
nubus_writeb(_red, &cmap_regs->lut); nop();
nubus_writeb(_green, &cmap_regs->lut); nop();
nubus_writeb(_blue, &cmap_regs->lut);
restore_flags(flags);
return 0;
......@@ -554,10 +554,10 @@ static int jet_setpalette(unsigned int regno, unsigned int red,
save_flags(flags);
cli();
writeb(regno, &cmap_regs->addr); nop();
writeb(_red, &cmap_regs->lut); nop();
writeb(_green, &cmap_regs->lut); nop();
writeb(_blue, &cmap_regs->lut);
nubus_writeb(regno, &cmap_regs->addr); nop();
nubus_writeb(_red, &cmap_regs->lut); nop();
nubus_writeb(_green, &cmap_regs->lut); nop();
nubus_writeb(_blue, &cmap_regs->lut);
restore_flags(flags);
return 0;
......@@ -593,7 +593,7 @@ static int civic_setpalette (unsigned int regno, unsigned int red,
/*
* Set the register address
*/
writeb(regno, &civic_cmap_regs->addr); nop();
nubus_writeb(regno, &civic_cmap_regs->addr); nop();
/*
* Wait for VBL interrupt here;
......@@ -602,7 +602,7 @@ static int civic_setpalette (unsigned int regno, unsigned int red,
#if 0
{
#define CIVIC_VBL_OFFSET 0x120
volatile unsigned long *vbl = readl(civic_cmap_regs->vbl_addr + CIVIC_VBL_OFFSET);
volatile unsigned long *vbl = nubus_readl(civic_cmap_regs->vbl_addr + CIVIC_VBL_OFFSET);
/* do interrupt setup stuff here? */
*vbl = 0L; nop(); /* clear */
*vbl = 1L; nop(); /* set */
......@@ -618,42 +618,42 @@ static int civic_setpalette (unsigned int regno, unsigned int red,
* Grab a status word and do some checking;
* Then finally write the clut!
*/
clut_status = readb(&civic_cmap_regs->status2);
clut_status = nubus_readb(&civic_cmap_regs->status2);
if ((clut_status & 0x0008) == 0)
{
#if 0
if ((clut_status & 0x000D) != 0)
{
writeb(0x00, &civic_cmap_regs->lut); nop();
writeb(0x00, &civic_cmap_regs->lut); nop();
nubus_writeb(0x00, &civic_cmap_regs->lut); nop();
nubus_writeb(0x00, &civic_cmap_regs->lut); nop();
}
#endif
writeb( red, &civic_cmap_regs->lut); nop();
writeb(green, &civic_cmap_regs->lut); nop();
writeb( blue, &civic_cmap_regs->lut); nop();
writeb( 0x00, &civic_cmap_regs->lut); nop();
nubus_writeb( red, &civic_cmap_regs->lut); nop();
nubus_writeb(green, &civic_cmap_regs->lut); nop();
nubus_writeb( blue, &civic_cmap_regs->lut); nop();
nubus_writeb( 0x00, &civic_cmap_regs->lut); nop();
}
else
{
unsigned char junk;
junk = readb(&civic_cmap_regs->lut); nop();
junk = readb(&civic_cmap_regs->lut); nop();
junk = readb(&civic_cmap_regs->lut); nop();
junk = readb(&civic_cmap_regs->lut); nop();
junk = nubus_readb(&civic_cmap_regs->lut); nop();
junk = nubus_readb(&civic_cmap_regs->lut); nop();
junk = nubus_readb(&civic_cmap_regs->lut); nop();
junk = nubus_readb(&civic_cmap_regs->lut); nop();
if ((clut_status & 0x000D) != 0)
{
writeb(0x00, &civic_cmap_regs->lut); nop();
writeb(0x00, &civic_cmap_regs->lut); nop();
nubus_writeb(0x00, &civic_cmap_regs->lut); nop();
nubus_writeb(0x00, &civic_cmap_regs->lut); nop();
}
writeb( red, &civic_cmap_regs->lut); nop();
writeb(green, &civic_cmap_regs->lut); nop();
writeb( blue, &civic_cmap_regs->lut); nop();
writeb( junk, &civic_cmap_regs->lut); nop();
nubus_writeb( red, &civic_cmap_regs->lut); nop();
nubus_writeb(green, &civic_cmap_regs->lut); nop();
nubus_writeb( blue, &civic_cmap_regs->lut); nop();
nubus_writeb( junk, &civic_cmap_regs->lut); nop();
}
restore_flags(flags);
......@@ -862,7 +862,7 @@ void __init macfb_init(void)
video_linelength = mac_bi_data.videorow;
video_size = video_linelength * video_height;
/* Note: physical address (since 2.1.127) */
video_base = (void*) mac_bi_data.videoaddr;
video_base = mac_bi_data.videoaddr;
/* This is actually redundant with the initial mappings.
However, there are some non-obvious aspects to the way
those mappings are set up, so this is in fact the safest
......@@ -870,7 +870,7 @@ void __init macfb_init(void)
Mac */
video_vbase = ioremap(mac_bi_data.videoaddr, video_size);
printk("macfb: framebuffer at 0x%p, mapped to 0x%p, size %dk\n",
printk("macfb: framebuffer at 0x%08lx, mapped to 0x%p, size %dk\n",
video_base, video_vbase, video_size/1024);
printk("macfb: mode is %dx%dx%d, linelength=%d\n",
video_width, video_height, video_bpp, video_linelength);
......
#ifndef _ASM_M68K_NUBUS_H
#define _ASM_M68K_NUBUS_H
#include <asm/io.h>
#define nubus_readb raw_inb
#define nubus_readw raw_inw
#define nubus_readl raw_inl
#define nubus_writeb raw_outb
#define nubus_writew raw_outw
#define nubus_writel raw_outl
#define nubus_memset_io(a,b,c) memset((void *)(a),(b),(c))
#define nubus_memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
#define nubus_memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
extern inline void *nubus_remap_nocache_ser(unsigned long physaddr,
unsigned long size)
{
return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
}
extern inline void *nubus_remap_nocache_nonser(unsigned long physaddr,
unsigned long size)
{
return __ioremap(physaddr, size, IOMAP_NOCACHE_NONSER);
}
extern inline void *nbus_remap_writethrough(unsigned long physaddr,
unsigned long size)
{
return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
}
extern inline void *nubus_remap_fullcache(unsigned long physaddr,
unsigned long size)
{
return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
}
#define nubus_unmap iounmap
#define nubus_iounmap iounmap
#define nubus_ioremap nubus_remap_nocache_ser
#endif /* _ASM_NUBUS_H */
......@@ -12,6 +12,10 @@
#ifndef LINUX_NUBUS_H
#define LINUX_NUBUS_H
#ifdef __KERNEL__
#include <asm/nubus.h>
#endif
enum nubus_category {
NUBUS_CAT_BOARD = 0x0001,
NUBUS_CAT_DISPLAY = 0x0003,
......@@ -262,7 +266,6 @@ extern struct nubus_dev* nubus_devices;
extern struct nubus_board* nubus_boards;
/* Generic NuBus interface functions, modelled after the PCI interface */
extern void nubus_init(void);
void nubus_scan_bus(void);
extern void nubus_proc_init(void);
int get_nubus_list(char *buf);
......
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