]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] M68k update (part 14)
authorGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 23 Jul 2002 13:21:54 +0000 (06:21 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 23 Jul 2002 13:21:54 +0000 (06:21 -0700)
HP300 DIO bus updates

drivers/dio/dio.c
include/linux/dio.h

index 2ddffd21d393ad27e07fdd37aa8acfca0b165eed..3bcc6f5639aeb3ccaa70f63d10c4836e03468374 100644 (file)
@@ -115,8 +115,14 @@ static struct dioboard *blist = NULL;
 static int __init dio_find_slow(int deviceid)
 {
        /* Called to find a DIO device before the full bus scan has run.  Basically
-          only used by the console driver.  */
+         * only used by the console driver.
+         * We don't do the primary+secondary ID encoding thing here. Maybe we should.
+         * (that would break the topcat detection, though. I need to think about
+         * the whole primary/secondary ID thing.)
+         */
        int scode;
+        u_char prid;
+
        for (scode = 0; scode < DIO_SCMAX; scode++)
        {
                void *va;
@@ -128,12 +134,23 @@ static int __init dio_find_slow(int deviceid)
                 if (!va || !hwreg_present(va + DIO_IDOFF))
                         continue;             /* no board present at that select code */
 
-               if (DIO_ID(va) == deviceid)
+                /* We aren't very likely to want to use this to get at the IHPIB,
+                 * but maybe it's returning the same ID as the card we do want...
+                 */
+                if (!DIO_ISIHPIB(scode))
+                        prid = DIO_ID(va);
+                else
+                        prid = DIO_ID_IHPIB;
+
+               if (prid == deviceid)
                        return scode;
        }
        return 0;
 }
 
+/* Aargh: we use 0 for an error return code, but select code 0 exists!
+ * FIXME (trivial, use -1, but requires changes to all the drivers :-< )
+ */
 int dio_find(int deviceid)
 {
        if (blist) 
@@ -151,7 +168,7 @@ int dio_find(int deviceid)
 /* This is the function that scans the DIO space and works out what
  * hardware is actually present.
  */
-void __init dio_init(void)
+static int __init dio_init(void)
 {
         int scode;
         struct dioboard *b, *bprev = NULL;
@@ -193,10 +210,10 @@ void __init dio_init(void)
                 b->scode = scode;
                 b->ipl = DIO_IPL(va);
                 b->name = dio_getname(b->id);
-                printk("select code %3d: ID %02X", scode, prid);
+                printk("select code %3d: ipl %d: ID %02X", scode, b->ipl, prid);
                 if (DIO_NEEDSSECID(b->id))
                         printk(":%02X", secid);
-                printk(" %s\n", b->name);
+                printk(": %s\n", b->name);
                 
                 b->next = NULL;
 
@@ -206,6 +223,7 @@ void __init dio_init(void)
                         blist = b;
                 bprev = b;
         }
+       return 0;
 }
 
 subsys_initcall(dio_init);
@@ -224,9 +242,9 @@ void *dio_scodetoviraddr(int scode)
                 return 0;
         else if (DIO_SCINHOLE(scode))
                 return 0;
-        else if (scode == DIO_IHPIBSCODE) /* this should really be #ifdef CONFIG_IHPIB */
-                return (void*)DIO_IHPIBADDR;   /* or something similar... */
-        
+        else if (DIO_ISIHPIB(scode))
+                return (void*)DIO_IHPIBADDR;
+
         return (void*)(DIO_VIRADDRBASE + DIO_BASE + scode * 0x10000);
 }
 
index 087b06ec1011982b75ecd3bc1b0ce1b43347cc95..75166393b98274d951492d204f3347db3aafd2d9 100644 (file)
 #define DIO_SCINHOLE(scode) (((scode) >= 32) && ((scode) < DIOII_SCBASE))
 
 /* macros to read device IDs, given base address */
-#define DIO_ID(baseaddr) readb((baseaddr) + DIO_IDOFF)
-#define DIO_SECID(baseaddr) readb((baseaddr) + DIO_SECIDOFF)
+#define DIO_ID(baseaddr) in_8((baseaddr) + DIO_IDOFF)
+#define DIO_SECID(baseaddr) in_8((baseaddr) + DIO_SECIDOFF)
 
 /* extract the interrupt level */
-#define DIO_IPL(baseaddr) (((readb((baseaddr) + DIO_IPLOFF) >> 4) & 0x03) + 3)
+#define DIO_IPL(baseaddr) (((in_8((baseaddr) + DIO_IPLOFF) >> 4) & 0x03) + 3)
 
 /* find the size of a DIO-II board's address space.
  * DIO boards are all fixed length.
  */
-#define DIOII_SIZE(baseaddr) ((readb((baseaddr) + DIOII_SIZEOFF) + 1) * 0x100000)
+#define DIOII_SIZE(baseaddr) ((in_8((baseaddr) + DIOII_SIZEOFF) + 1) * 0x100000)
 
 /* general purpose macro for both DIO and DIO-II */
 #define DIO_SIZE(scode, base) (DIO_ISDIOII((scode)) ? DIOII_SIZE((base)) : DIO_DEVSIZE)
 #define DIO_ID_DCMREM   0x85 /* 98642A serial MUX */
 #define DIO_DESC_DCMREM "98642A DCMREM serial MUX"
 #define DIO_ID_LAN      0x15 /* 98643A LAN */
-#define DIO_DESC_LAN "98643A LAN"
+#define DIO_DESC_LAN "98643A LANCE ethernet"
 #define DIO_ID_FHPIB    0x08 /* 98625A/98625B fast HP-IB */
 #define DIO_DESC_FHPIB "98625A/98625B fast HPIB"
 #define DIO_ID_NHPIB    0x80 /* 98624A HP-IB (normal ie slow) */
  * identify them...
  */
 
-extern void dio_init(void);
 extern int dio_find(int deviceid);
 extern void *dio_scodetoviraddr(int scode);
 extern int dio_scodetoipl(int scode);
+extern const char *dio_scodetoname(int scode);
 extern void dio_config_board(int scode);
 extern void dio_unconfig_board(int scode);