OSDN Git Service

X68030
authorYoshinori Sato <ysato@users.sourceforge.jp>
Fri, 20 Mar 2020 14:57:25 +0000 (23:57 +0900)
committerYoshinori Sato <ysato@users.sourceforge.jp>
Fri, 20 Mar 2020 14:57:25 +0000 (23:57 +0900)
14 files changed:
arch/m68k/Kconfig.machine
arch/m68k/Makefile
arch/m68k/include/uapi/asm/bootinfo.h
arch/m68k/kernel/Makefile
arch/m68k/kernel/head.S
arch/m68k/kernel/setup_mm.c
arch/m68k/x68k/Makefile
arch/m68k/x68k/mfp-timer.c
arch/m68k/x68k/x68k.c
arch/m68k/x68k/zs_earlyprintk.c
block/partitions/x68k.c
drivers/input/serio/x68kmfp.c
drivers/scsi/mb89352.c
drivers/video/fbdev/x68kfb.c

index c954a63..0aeff3f 100644 (file)
@@ -136,12 +136,13 @@ config SUN3
          If you don't want to compile a kernel exclusively for a Sun 3, say N.
 
 config X68000
-       bool "SHARP X68000 support"
-       depends on !MMU
-       select M68000
+       bool "SHARP X680x0 support"
+       select M68000 if !MMU
+       select M68030 if MMU
+       select MMU_MOTOROLA if MMU
        select GENERIC_CLOCKEVENTS
        help
-         This option enbales support for SHARP X68000 series (exclude X68030).
+         This option enbales support for SHARP X680x0 series.
 
 endif # M68KCLASSIC
 
index 013b156..b7ebf39 100644 (file)
@@ -96,7 +96,9 @@ head-y                                := arch/m68k/kernel/head.o
 head-$(CONFIG_SUN3)            := arch/m68k/kernel/sun3-head.o
 head-$(CONFIG_M68000)          := arch/m68k/68000/head.o
 head-$(CONFIG_COLDFIRE)                := arch/m68k/coldfire/head.o
+ifndef CONFIG_MMU
 head-$(CONFIG_X68000)          := arch/m68k/x68k/head.o
+endif
 
 core-y                         += arch/m68k/kernel/    arch/m68k/mm/
 libs-y                         += arch/m68k/lib/
index 38d3140..205caf7 100644 (file)
@@ -83,7 +83,7 @@ struct mem_info {
 #define MACH_SUN3X             11
 #define MACH_M54XX             12
 #define MACH_M5441X            13
-
+#define MACH_X68000            14
 
     /*
      *  CPU, FPU and MMU types (BI_CPUTYPE, BI_FPUTYPE, BI_MMUTYPE)
index 8fa04e1..1b26130 100644 (file)
@@ -11,6 +11,7 @@ extra-$(CONFIG_VME)   := head.o
 extra-$(CONFIG_HP300)  := head.o
 extra-$(CONFIG_Q40)    := head.o
 extra-$(CONFIG_SUN3X)  := head.o
+extra-$(CONFIG_X68000) := head.o
 extra-$(CONFIG_SUN3)   := sun3-head.o
 extra-y                        += vmlinux.lds
 
index a547884..7c45b6d 100644 (file)
@@ -534,6 +534,7 @@ func_define putn,1
 #define is_not_apollo(lab) cmpl &MACH_APOLLO,%pc@(m68k_machtype); jne lab
 #define is_not_q40(lab) cmpl &MACH_Q40,%pc@(m68k_machtype); jne lab
 #define is_not_sun3x(lab) cmpl &MACH_SUN3X,%pc@(m68k_machtype); jne lab
+#define is_not_x68000(lab) cmpl &MACH_X68000,%pc@(m68k_machtype); jne lab
 
 #define hasnt_leds(lab) cmpl &MACH_HP300,%pc@(m68k_machtype); \
                        jeq 42f; \
@@ -1247,6 +1248,16 @@ L(notapollo):
        jbra    L(mmu_init_done)
 #endif
 
+#ifdef CONFIG_X68000
+       is_not_x68000(L(notx68000))
+
+       putc    'X'
+       mmu_map #0xff000000,#0x00000000,#0x01000000,#_PAGE_NOCACHE030
+
+L(notx68000):
+       jbra    L(mmu_init_done)
+#endif
+
 L(mmu_init_done):
 
        putc    'G'
@@ -2807,6 +2818,21 @@ LMFP_UDR     = 0xfffa2f
 #endif
 #endif /* CONFIG_ATARI */
 
+#ifdef CONFIG_X68000
+/* Initialisation table for SCC with 5 MHz PCLK */
+L(scc_initable_x68000):
+       .byte   4,0x44          /* x16, 1 stopbit, no parity */
+       .byte   3,0xc0          /* receiver: 8 bpc */
+       .byte   5,0xe2          /* transmitter: 8 bpc, assert dtr/rts */
+       .byte   14,0x00         /* Baud rate generator disable */
+       .byte   12,2,13,0       /* 38400 baud */
+       .byte   14,0x03         /* Baud rate generator enable */
+       .byte   3,0xc1          /* enable receiver */
+       .byte   5,0xea          /* enable transmitter */
+       .byte   -1
+       .even
+#endif /* CONFIG_X68000 */
+
 /*
  * Serial port output support.
  */
@@ -2828,6 +2854,10 @@ func_start       serial_init,%d0/%d1/%a0/%a1
         *              a0 = address of SCC
         *              a1 = address of scc_initable_mac
         *              d0 = init data for serial port
+        *      CONFIG_X68000
+        *              a0 = address of SCC
+        *              a1 = address of scc_initable_mac
+        *              d0 = init data for serial port
         */
 
 #ifdef CONFIG_AMIGA
@@ -2977,6 +3007,28 @@ L(serial_init_not_mvme16x):
 /* We count on the boot loader initialising the UART */
 #endif
 
+#ifdef CONFIG_X68000
+       is_not_x68000(1f)
+       movel   #X68K_SCC_CTRL_A,%a0
+       /* Reset SCC register pointer */
+       moveb   %a0@,%d0
+       /* Reset SCC device: write register pointer then register value */
+       moveb   #9,%a0@
+       moveb   #0xc0,%a0@
+       /* Wait for 5 PCLK cycles, which is about 33 CPU cycles */
+       /* 5 / 5 MHz = approx. 0.1 us = 33 MHz */
+       movel   #10,%d0
+3:
+       subq    #1,%d0
+       jne     3b
+       lea     %pc@(L(scc_initable_x68000)),%a1
+2:     moveb   %a1@+,%d0
+       jmi     1f
+       moveb   %d0,%a0@
+       moveb   %a1@+,%a0@
+       jra     2b
+1:
+#endif
 L(serial_init_done):
 func_return    serial_init
 
@@ -3185,6 +3237,14 @@ func_start       serial_putc,%d0/%d1/%a0/%a1
        jbra    L(serial_putc_done)
 3:
 #endif
+#ifdef CONFIG_X68000
+       is_not_x68000(5f)
+3:     btst    #2,X68K_SCC_CTRL_A
+       jeq     3b
+       moveb   %d0,X68K_SCC_DATA_A
+       jra     L(serial_putc_done)
+5:
+#endif /* CONFIG_X68000 */
 
 L(serial_putc_done):
 func_return    serial_putc
@@ -3845,6 +3905,11 @@ L(uart_scode):
        .long   -1
 #endif
 
+#if defined (CONFIG_X68000)
+X68K_SCC_CTRL_A        = 0xffe98005
+X68K_SCC_DATA_A        = 0xffe98007
+#endif
+
 __FINIT
        .data
        .align  4
index 528484f..d627919 100644 (file)
@@ -135,6 +135,7 @@ extern void config_bvme6000(void);
 extern void config_hp300(void);
 extern void config_q40(void);
 extern void config_sun3x(void);
+extern void config_x68k(void);
 
 #define MASK_256K 0xfffc0000
 
@@ -342,6 +343,11 @@ void __init setup_arch(char **cmdline_p)
                config_BSP(NULL, 0);
                break;
 #endif
+#ifdef CONFIG_X68000
+       case MACH_X68000:
+               config_x68k();
+               break;
+#endif
        default:
                panic("No configuration setup");
        }
index 530c4d5..98e53f5 100644 (file)
@@ -4,8 +4,12 @@
 #
 # Copyright 2016 Yoshinori Sato
 
+ifndef CONFIG_MMU
 extra-y                        := head.o
-obj-y                  += entry.o ints.o mfp-timer.o x68k.o zs_earlyprintk.o
+obj-y                  += entry.o ints.o
+endif
+obj-y                  += mfp-timer.o x68k.o
+obj-$(CONFIG_MMU)      += x68kints.o
 
 targets := vmlinux.bin vmlinux.bin.gz
 
index afc46e4..9c2864f 100644 (file)
@@ -9,11 +9,18 @@
 #include <linux/clockchips.h>
 
 #define INPUT_FREQ (4000000 / 200)
-#define MFP_IRQ 0x44
+#define MFP_IRQ 12
+#if !defined(CONFIG_MMU)
 #define TDDR (void *)0xe88025
 #define TCDCR (void *)0xe8801d
 #define IERB (void *)0xe88009
 #define IMRB (void *)0xe88015
+#else
+#define TDDR (void *)0xffe88025
+#define TCDCR (void *)0xffe8801d
+#define IERB (void *)0xffe88009
+#define IMRB (void *)0xffe88015
+#endif
 
 static irqreturn_t interrupt(int irq, void *dev_id)
 {
@@ -41,8 +48,10 @@ static struct clock_event_device mfp_ced = {
 
 void __init hw_timer_init(irq_handler_t handler)
 {
-       if (request_irq(MFP_IRQ, interrupt, IRQF_TIMER, "timer", &mfp_ced) < 0) {
-               pr_err("%s: Failed to request_irq\n", __func__);
+       int ret;
+       ret = request_irq(MFP_IRQ, interrupt, IRQF_TIMER, "timer", &mfp_ced);
+       if (ret < 0) {
+               pr_err("%s: Failed to request_irq %d\n", __func__, ret);
                return;
        }
        clockevents_config_and_register(&mfp_ced, INPUT_FREQ, 2, 0xff);
index 558c766..7423e34 100644 (file)
@@ -3,26 +3,83 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <asm/machdep.h>
+#include <asm/io.h>
 #include <asm/scsi_spc.h>
 
+extern void x68k_init_IRQ(void);
+
 /***************************************************************************/
 
 static void reset(void)
 {
-       __asm__ volatile("movw #0x2700,%sr\n\t"
-                        "movel #0xff0000, %a0\n\t"
+       local_irq_disable(); /* lets not screw this up, ok? */
+       if (CPU_IS_030) {
+
+               /* 030-specific reset routine.  The idea is general, but the
+                * specific registers to reset are '030-specific.  Until I
+                * have a non-030 machine, I can't test anything else.
+                *  -- C. Scott Ananian <cananian@alumni.princeton.edu>
+                */
+
+               unsigned long rombase = 0x40000000;
+
+               /* make a 1-to-1 mapping, using the transparent tran. reg. */
+               unsigned long virt = (unsigned long) reset;
+               unsigned long phys = virt_to_phys(reset);
+               unsigned long addr = (phys&0xFF000000)|0x8777;
+               unsigned long offset = phys-virt;
+
+               __asm__ __volatile__(".chip 68030\n\t"
+                                    "pmove %0,%/tt0\n\t"
+                                    ".chip 68k"
+                                    : : "m" (addr));
+               /* Now jump to physical address so we can disable MMU */
+               __asm__ __volatile__(
+                   ".chip 68030\n\t"
+                   "lea %/pc@(1f),%/a0\n\t"
+                   "addl %0,%/a0\n\t"/* fixup target address and stack ptr */
+                   "addl %0,%/sp\n\t"
+                   "pflusha\n\t"
+                   "jmp %/a0@\n\t" /* jump into physical memory */
+                   "0:.long 0\n\t" /* a constant zero. */
+                   /* OK.  Now reset everything and jump to reset vector. */
+                   "1:\n\t"
+                   "lea %/pc@(0b),%/a0\n\t"
+                   "pmove %/a0@, %/tc\n\t" /* disable mmu */
+                   "pmove %/a0@, %/tt0\n\t" /* disable tt0 */
+                   "pmove %/a0@, %/tt1\n\t" /* disable tt1 */
+                   "movel #0, %/a0\n\t"
+                   "movec %/a0, %/vbr\n\t" /* clear vector base register */
+                   "movec %/a0, %/cacr\n\t" /* disable caches */
+                   "movel #0x0808,%/a0\n\t"
+                   "movec %/a0, %/cacr\n\t" /* flush i&d caches */
+                   "movew #0x2700,%/sr\n\t" /* set up status register */
+                   "movel %1@(0x0),%/a0\n\t"/* load interrupt stack pointer */
+                   "movec %/a0, %/isp\n\t"
+                   ".chip 68k"
+                   : : "r" (offset), "a" (rombase) : "a0");
+       } else {
+               __asm__ volatile( "movel #0xff0000, %a0\n\t"
                         "movel %a0@+,%sp\n\t"
                         "movel %a0@+,%a1\n\t"
                         "jmp %a1@");
+       }
 }
 
+#if !defined(CONFIG_MMU)
+#define SYSPORT6 0xe8e00f
+#else
+#define SYSPORT6 0xffe8e00f
+#endif
+
 static void poweroff(void)
 {
-       __raw_writeb(0x00, (void *)0xe8e00f);
-       __raw_writeb(0x0f, (void *)0xe8e00f);
-       __raw_writeb(0x0f, (void *)0xe8e00f);
+       __raw_writeb(0x00, (void *)SYSPORT6);
+       __raw_writeb(0x0f, (void *)SYSPORT6);
+       __raw_writeb(0x0f, (void *)SYSPORT6);
 }
 
+#if !defined(CONFIG_MMU)
 void __init config_BSP(char *command, int len)
 {
        mach_sched_init = hw_timer_init;
@@ -31,17 +88,29 @@ void __init config_BSP(char *command, int len)
        mach_power_off = poweroff;
        memcpy(command, (void *)0x7e00, len);
 }
+#else
+void __init config_x68k(void)
+{
+       mach_sched_init = hw_timer_init;
+       mach_init_IRQ = x68k_init_IRQ;
+       mach_hwclk = NULL;
+       mach_reset = reset;
+       mach_max_dma_address = 0xffffff;
+       mach_power_off = poweroff;
+}
+
+#endif
 
 struct resource scc_a_rsrcs[] = {
        {
                .flags = IORESOURCE_MEM,
-               .start = 0xe98005,
-               .end = 0xe98007,
+               .start = 0xffe98005,
+               .end = 0xffe98007,
        },
        
        {
                .flags = IORESOURCE_IRQ,
-               .start = 0x50,
+               .start = 24,
        },
 };
                
@@ -61,13 +130,13 @@ struct platform_device scc_b_pdev = {
 static struct resource spc_rsrcs[] = {
        {
                .flags = IORESOURCE_MEM,
-               .start = 0xe96020,
-               .end = 0xe96040,
+               .start = 0xffe96020,
+               .end = 0xffe96040,
        },
        
        {
                .flags = IORESOURCE_IRQ,
-               .start = 0x6c,
+               .start = 52,
        },
 };
 
@@ -95,7 +164,7 @@ static struct platform_device *x68k_devices[] = {
 
 static int __init x68k_platform_init(void)
 {
-       __raw_writeb(0, (void *)0xe86001);
+       __raw_writeb(0, (void *)0xffe86001);
        platform_add_devices(x68k_devices, ARRAY_SIZE(x68k_devices));
 
        return 0;
index 73614eb..84c8908 100644 (file)
@@ -4,8 +4,13 @@
 #include <linux/io.h>
 #include <linux/platform_device.h>
 
+#if !defined(CONFIG_MMU)
 #define CMD ((void *)0xe98005)
 #define DATA ((void *)0xe98007)
+#else
+#define CMD ((void *)0xffe98005)
+#define DATA ((void *)0xffe98007)
+#endif
 
 static void zs_write(struct console *co, const char *ptr,
                                 unsigned len)
index 1a814bc..333e151 100644 (file)
@@ -13,7 +13,7 @@ int x68k_partition(struct parsed_partitions *state)
        struct x68k_partition_info *pi;
        int slot;
 
-       rs = read_part_sector(state, 4, &sect);
+       rs = read_part_sector(state, 2 * 2, &sect);
        if (!rs)
                return -1;
 
@@ -24,11 +24,11 @@ int x68k_partition(struct parsed_partitions *state)
 
        pi = &rs->partition[0];
        for (slot = 1; slot < 16; slot++, pi++) {
-               if (pi->start >= 0x01000000 || !pi->start)
+               if (!pi->start)
                        continue;
                put_partition(state, slot,
-                             be32_to_cpu(pi->start) * 2,
-                             be32_to_cpu(pi->length) * 2);
+                             (be32_to_cpu(pi->start) & 0xffffff) * 2,
+                             (be32_to_cpu(pi->length) & 0xffffff) * 2);
        }
        strlcat(state->pp_buf, "\n", PAGE_SIZE);
 
index 0695faa..d2f47f1 100644 (file)
@@ -30,7 +30,7 @@ MODULE_AUTHOR("Yoshinori Sato <ysato@users.sourceforge.jp>");
 MODULE_DESCRIPTION("X68000 MFP serial driver");
 MODULE_LICENSE("GPL");
 
-#define MFP_USART (void *)0xe88027
+#define MFP_USART (void *)0xffe88027
 #define MFP_CSR (MFP_USART + 0)
 #define MFP_UCR (MFP_USART + 2)
 #define MFP_RSR (MFP_USART + 4)
@@ -45,7 +45,7 @@ MODULE_LICENSE("GPL");
 
 #define MFP_CTL_TIMEOUT        1000
 #define MFP_KBD_PHYS_DESC "X68Kbus/serio"
-#define MFP_KBD_IRQ 0x4c
+#define MFP_KBD_IRQ 20
 
 /*
  * mfp_lock protects serialization between mfp_command and
index 471b0aa..d630992 100644 (file)
@@ -51,6 +51,7 @@
 /* Some macros to manipulate ports and their bits */
 
 #define SETPORT(VAL, PORT)     outb( (VAL), shpnt->base + (PORT) )
+
 #define GETPORT(PORT)          inb( shpnt->base + PORT )
 
 
@@ -143,16 +144,16 @@ enum spc_state {
  *
  */
 struct spc_hostdata {
-       Scsi_Cmnd *issue_SC;
+       struct scsi_cmnd *issue_SC;
                /* pending commands to issue */
 
-       Scsi_Cmnd *current_SC;
+       struct scsi_cmnd *current_SC;
                /* current command on the bus */
 
-       Scsi_Cmnd *disconnected_SC;
+       struct scsi_cmnd *disconnected_SC;
                /* commands that disconnected */
 
-       Scsi_Cmnd *done_SC;
+       struct scsi_cmnd *done_SC;
                /* command that was completed */
 
        spinlock_t lock;
@@ -217,7 +218,7 @@ struct spc_hostdata {
  *
  */
 struct spc_scdata {
-       Scsi_Cmnd *next;        /* next sc in queue */
+       struct scsi_cmnd *next; /* next sc in queue */
        struct completion *done;/* semaphore to block on */
        struct scsi_eh_save ses;
 };
@@ -327,12 +328,11 @@ static struct {
 
 /* setup & interrupt */
 static irqreturn_t spc_intr(int irq, void *dev_id);
-static void reset_ports(struct Scsi_Host *shpnt);
 static void spc_error(struct Scsi_Host *shpnt, char *msg);
 static void done(struct Scsi_Host *shpnt, int error);
 
 /* diagnostics */
-static void show_command(Scsi_Cmnd * ptr);
+static void show_command(struct scsi_cmnd * ptr);
 static void show_queues(struct Scsi_Host *shpnt);
 
 
@@ -340,9 +340,9 @@ static void show_queues(struct Scsi_Host *shpnt);
  *  queue services:
  *
  */
-static inline void append_SC(Scsi_Cmnd **SC, Scsi_Cmnd *new_SC)
+static inline void append_SC(struct scsi_cmnd **SC, struct scsi_cmnd *new_SC)
 {
-       Scsi_Cmnd *end;
+       struct scsi_cmnd *end;
 
        SCNEXT(new_SC) = NULL;
        if (!*SC)
@@ -354,9 +354,9 @@ static inline void append_SC(Scsi_Cmnd **SC, Scsi_Cmnd *new_SC)
        }
 }
 
-static inline Scsi_Cmnd *remove_first_SC(Scsi_Cmnd ** SC)
+static inline struct scsi_cmnd *remove_first_SC(struct scsi_cmnd ** SC)
 {
-       Scsi_Cmnd *ptr;
+       struct scsi_cmnd *ptr;
 
        ptr = *SC;
        if (ptr) {
@@ -366,9 +366,9 @@ static inline Scsi_Cmnd *remove_first_SC(Scsi_Cmnd ** SC)
        return ptr;
 }
 
-static inline Scsi_Cmnd *remove_lun_SC(Scsi_Cmnd ** SC, int target, int lun)
+static inline struct scsi_cmnd *remove_lun_SC(struct scsi_cmnd ** SC, int target, int lun)
 {
-       Scsi_Cmnd *ptr, *prev;
+       struct scsi_cmnd *ptr, *prev;
 
        for (ptr = *SC, prev = NULL;
             ptr && ((ptr->device->id != target) || (ptr->device->lun != lun));
@@ -387,9 +387,9 @@ static inline Scsi_Cmnd *remove_lun_SC(Scsi_Cmnd ** SC, int target, int lun)
        return ptr;
 }
 
-static inline Scsi_Cmnd *remove_SC(Scsi_Cmnd **SC, Scsi_Cmnd *SCp)
+static inline struct scsi_cmnd *remove_SC(struct scsi_cmnd **SC, struct scsi_cmnd *SCp)
 {
-       Scsi_Cmnd *ptr, *prev;
+       struct scsi_cmnd *ptr, *prev;
 
        for (ptr = *SC, prev = NULL;
             ptr && SCp!=ptr;
@@ -412,8 +412,8 @@ static void run(struct work_struct *work);
 /*
  *  Queue a command and setup interrupts for a free bus.
  */
-static int spc_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
-               int phase, void (*done)(Scsi_Cmnd *))
+static int spc_internal_queue(struct scsi_cmnd *SCpnt, struct completion *complete,
+               int phase, void (*done)(struct scsi_cmnd *))
 {
        struct Scsi_Host *shpnt = SCpnt->device->host;
        unsigned long flags;
@@ -484,7 +484,7 @@ static int spc_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
  *  queue a command
  *
  */
-static int spc_queue_lck(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
+static int spc_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
 {
        return spc_internal_queue(SCpnt, NULL, 0, done);
 }
@@ -494,7 +494,7 @@ static DEF_SCSI_QCMD(spc_queue)
 /*
  *
  */
-static void reset_done(Scsi_Cmnd *SCpnt)
+static void reset_done(struct scsi_cmnd *SCpnt)
 {
        if(SCSEM(SCpnt)) {
                complete(SCSEM(SCpnt));
@@ -507,10 +507,10 @@ static void reset_done(Scsi_Cmnd *SCpnt)
  *  Abort a command
  *
  */
-static int spc_abort(Scsi_Cmnd *SCpnt)
+static int spc_abort(struct scsi_cmnd *SCpnt)
 {
        struct Scsi_Host *shpnt = SCpnt->device->host;
-       Scsi_Cmnd *ptr;
+       struct scsi_cmnd *ptr;
        unsigned long flags;
 
        DO_LOCK(flags);
@@ -544,7 +544,7 @@ static int spc_abort(Scsi_Cmnd *SCpnt)
  * Reset a device
  *
  */
-static int spc_device_reset(Scsi_Cmnd * SCpnt)
+static int spc_device_reset(struct scsi_cmnd * SCpnt)
 {
        struct Scsi_Host *shpnt = SCpnt->device->host;
        DECLARE_COMPLETION(done);
@@ -600,13 +600,13 @@ static int spc_device_reset(Scsi_Cmnd * SCpnt)
        return ret;
 }
 
-static void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs)
+static void free_hard_reset_SCs(struct Scsi_Host *shpnt, struct scsi_cmnd **SCs)
 {
-       Scsi_Cmnd *ptr;
+       struct scsi_cmnd *ptr;
 
        ptr=*SCs;
        while(ptr) {
-               Scsi_Cmnd *next;
+               struct scsi_cmnd *next;
 
                if(SCDATA(ptr)) {
                        next = SCNEXT(ptr);
@@ -631,8 +631,9 @@ static void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs)
  * Reset the bus
  *
  */
-static int spc_bus_reset_host(struct Scsi_Host *shpnt)
+static int spc_bus_reset_host(struct scsi_cmnd *cmd)
 {
+       struct Scsi_Host *shpnt = cmd->device->host;
        unsigned long flags;
 
        DO_LOCK(flags);
@@ -667,10 +668,10 @@ static int spc_host_reset_host(struct Scsi_Host *shpnt)
  * Reset the host (bus and controller)
  *
  */
-static int spc_host_reset(Scsi_Cmnd *SCpnt)
+static int spc_host_reset(struct scsi_cmnd *SCpnt)
 {
        spc_host_reset_host(SCpnt->device->host);
-       spc_bus_reset_host(SCpnt->device->host);
+       spc_bus_reset_host(SCpnt);
        return SUCCESS;
 }
 
@@ -811,7 +812,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
 
                        if(!(DONE_SC->SCp.phase & not_issued)) {
                                struct spc_scdata *sc;
-                               Scsi_Cmnd *ptr = DONE_SC;
+                               struct scsi_cmnd *ptr = DONE_SC;
                                DONE_SC=NULL;
 
                                sc = SCDATA(ptr);
@@ -826,7 +827,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
                }
 
                if(DONE_SC && DONE_SC->scsi_done) {
-                       Scsi_Cmnd *ptr = DONE_SC;
+                       struct scsi_cmnd *ptr = DONE_SC;
                        DONE_SC=NULL;
 
                        HOSTDATA(shpnt)->commands--;
@@ -876,7 +877,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
                HOSTDATA(shpnt)->busfree_without_new_command++;
 #endif
                HOSTDATA(shpnt)->sctl = GETPORT(SCTL) |
-                       (DISCONNECTED_SC?0x04:0x00) & 0xfe;
+                       ((DISCONNECTED_SC ? 0x04 : 0x00) & 0xfe);
                SETPORT(0x00, PCTL);
        }
 
@@ -1237,47 +1238,34 @@ static void status_run(struct Scsi_Host *shpnt)
 static void datai_init(struct Scsi_Host *shpnt)
 {
        SETPORT(0x01, PCTL);
-       SETPORT(0x80, SCMD);
        DATA_LEN=0;
 }
 
 static void datai_run(struct Scsi_Host *shpnt)
 {
-       char *p;
-       int i;
-
        /*
         * loop while the phase persists or the fifos are not empty
         *
         */
-       while((GETPORT(SSTS) & 0x11) == 0x10) {
-               /* FIXME: maybe this should be done by setting up
-                * STCNT to trigger ENSWRAP interrupt, instead of
-                * polling for DFIFOFULL
-                */
+       do {
 
-               if(CURRENT_SC->SCp.this_residual>0) {
-                       SETPORT(CURRENT_SC->SCp.this_residual >> 16, TCH);
-                       SETPORT((CURRENT_SC->SCp.this_residual >> 8) & 0xff, TCM);
-                       SETPORT(CURRENT_SC->SCp.this_residual & 0xff, TCL);
-                       SETPORT(0x80, SCMD);
+               SETPORT(CURRENT_SC->SCp.this_residual >> 16, TCH);
+               SETPORT((CURRENT_SC->SCp.this_residual >> 8) & 0xff, TCM);
+               SETPORT(CURRENT_SC->SCp.this_residual & 0xff, TCL);
+               SETPORT(0x80, SCMD);
 
-                       while(CURRENT_SC->SCp.this_residual>0) {
-                               *CURRENT_SC->SCp.ptr++ = GETPORT(DREG);
-                               CURRENT_SC->SCp.this_residual--;
-                               DATA_LEN++;
-                       }
-                       if (CURRENT_SC->SCp.buffers_residual > 0) {
-                               /* advance to next buffer */
-                               CURRENT_SC->SCp.buffers_residual--;
-                               CURRENT_SC->SCp.buffer++;
-                               CURRENT_SC->SCp.ptr           = SG_ADDRESS(CURRENT_SC->SCp.buffer);
-                               CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length;
-                       } else
-                               break;
+               for (;CURRENT_SC->SCp.this_residual > 0;
+                       CURRENT_SC->SCp.this_residual--) {
+                       *CURRENT_SC->SCp.ptr++ = GETPORT(DREG);
+                       DATA_LEN++;
                }
-       }
-
+               if (CURRENT_SC->SCp.buffers_residual > 0) {
+                       CURRENT_SC->SCp.buffer = sg_next(CURRENT_SC->SCp.buffer);
+                       CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length;
+                       CURRENT_SC->SCp.ptr = sg_virt(CURRENT_SC->SCp.buffer);
+               }
+               CURRENT_SC->SCp.buffers_residual--;
+       } while(CURRENT_SC->SCp.buffers_residual >= 0);
 }
 
 static void datai_end(struct Scsi_Host *shpnt)
@@ -1299,9 +1287,6 @@ static void datao_init(struct Scsi_Host *shpnt)
 
 static void datao_run(struct Scsi_Host *shpnt)
 {
-       unsigned long the_time;
-       int data_count;
-
        /* until phase changes or all data sent */
        while(CURRENT_SC->SCp.this_residual>0) {
                SETPORT(CURRENT_SC->SCp.this_residual >> 16, TCH);
@@ -1359,7 +1344,7 @@ static int update_state(struct Scsi_Host *shpnt)
        } else if(ints & 0x02) {
                STATE=parerr;
                HOSTDATA(shpnt)->ints &= ~0x02;
-       } else if((GETPORT(SSTS) & 0xf0) == 0xa0) {
+       } else if((GETPORT(SSTS) & 0xc0) == 0x80) {
                switch(GETPORT(PSNS) & P_MASK) {
                case P_MSGI:    STATE=msgi;     break;
                case P_MSGO:    STATE=msgo;     break;
@@ -1377,7 +1362,6 @@ static int update_state(struct Scsi_Host *shpnt)
        if(STATE!=PREVSTATE) {
                LASTSTATE=PREVSTATE;
        }
-
        return dataphase;
 }
 
@@ -1399,13 +1383,13 @@ static void parerr_run(struct Scsi_Host *shpnt)
  */
 static void rsti_run(struct Scsi_Host *shpnt)
 {
-       Scsi_Cmnd *ptr;
+       struct scsi_cmnd *ptr;
 
        shost_printk(KERN_NOTICE, shpnt, "scsi reset in\n");
 
        ptr=DISCONNECTED_SC;
        while(ptr) {
-               Scsi_Cmnd *next = SCNEXT(ptr);
+               struct scsi_cmnd *next = SCNEXT(ptr);
 
                if (!ptr->device->soft_reset) {
                        remove_SC(&DISCONNECTED_SC, ptr);
@@ -1433,7 +1417,6 @@ static void is_complete(struct Scsi_Host *shpnt)
 {
        int dataphase = 0;
        unsigned long flags;
-       int pending;
 
        if(!shpnt)
                return;
@@ -1528,12 +1511,12 @@ static void spc_error(struct Scsi_Host *shpnt, char *msg)
 /*
  * Show the command data of a command
  */
-static void show_command(Scsi_Cmnd *ptr)
+static void show_command(struct scsi_cmnd *ptr)
 {
        scsi_print_command(ptr);
        scmd_printk(KERN_DEBUG, ptr,
                    "request_bufflen=%d; resid=%d; "
-                   "phase |%s%s%s%s%s%s%s%s%s; next=0x%p",
+                   "phase |%s%s%s%s%s%s%s%s; next=0x%p",
                    scsi_bufflen(ptr), scsi_get_resid(ptr),
                    (ptr->SCp.phase & not_issued) ? "not issued|" : "",
                    (ptr->SCp.phase & selecting) ? "selecting|" : "",
@@ -1551,7 +1534,7 @@ static void show_command(Scsi_Cmnd *ptr)
  */
 static void show_queues(struct Scsi_Host *shpnt)
 {
-       Scsi_Cmnd *ptr;
+       struct scsi_cmnd *ptr;
        unsigned long flags;
 
        DO_LOCK(flags);
@@ -1589,7 +1572,6 @@ static struct scsi_host_template spc_driver_template = {
        .bios_param                     = spc_biosparam,
        .can_queue                      = 1,
        .sg_tablesize                   = SG_ALL,
-       .use_clustering                 = DISABLE_CLUSTERING,
        .slave_alloc                    = spc_adjust_queue,
 };
 
@@ -1598,7 +1580,7 @@ static int spc_probe(struct platform_device *pdev)
        struct Scsi_Host *shpnt;
        const struct resource *res;
        struct spc_platform_data *pdata = pdev->dev.platform_data;
-       struct resource *ret;
+       int ret;
 
        shpnt = scsi_host_alloc(&spc_driver_template, sizeof(struct Scsi_Host));
        if (!shpnt)
@@ -1621,23 +1603,25 @@ static int spc_probe(struct platform_device *pdev)
        SETPORT(0x00, SCTL);
        mdelay(256);
 
-       printk(KERN_INFO "spc: io=0x%08x, irq=%d, scsiid=%d\n",
+       printk(KERN_INFO "spc: io=0x%08lx, irq=%d, scsiid=%d\n",
               shpnt->base,
               shpnt->irq,
               shpnt->this_id);
 
        if (!request_mem_region(res->start, res->end - res->start, "spc")) {
-               printk(KERN_ERR "spc: mem %08x busy. %d\n", res->start);
+               printk(KERN_ERR "spc: mem %08x busy.\n", res->start);
                ret = -EBUSY;
                goto out_host_put1;
        }
 
-       if (ret = request_irq(shpnt->irq, spc_intr, IRQF_SHARED, "spc", shpnt)) {
-               printk(KERN_ERR "spc: irq %d busy.\n", shpnt->irq);
+       ret = request_irq(shpnt->irq, spc_intr, IRQF_SHARED, "spc", shpnt);
+       if (ret) {
+               printk(KERN_ERR "spc: irq %d busy. %d\n", shpnt->irq, ret);
                goto out_host_put2;
        }
 
-       if(ret = scsi_add_host(shpnt, NULL) ) {
+       ret = scsi_add_host(shpnt, NULL);
+       if (ret) {
                printk(KERN_ERR "spc%d: failed to add host.\n", shpnt->host_no);
                goto out_host_put3;
        }
index 9aaa816..2d842c5 100644 (file)
@@ -487,7 +487,7 @@ static int x68kfb_probe(struct platform_device *dev)
        info->pseudo_palette = info->par;
        info->par = NULL;
        info->flags = FBINFO_FLAG_DEFAULT;
-       info->pseudo_palette = (void *)0xe82000;;
+       info->pseudo_palette = (void *)0xffe82000;;
 
        retval = fb_alloc_cmap(&info->cmap, 256, 0);
        if (retval < 0)