[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [d-i] Testing daily image of d-i



> The current d-i daily build (2.6.17-2) doesn't boot on my Amiga 3000 (spice)
> with the WarpEngine accel card. The reason is a kernel panic in the NCR scsi
> driver.
>
> Kars de Jonk ported the new version of the driver (or somewhat like this)
> last year to the new ABI/API/whatever. His kernel 2.6.14 does work great on
> that particular box and on my A4000T (which has the same chip onboard):
>
> Linux vivaldi 2.6.14-m68k-amiga #10 Thu Dec 1 21:40:17 CET 2005 m68k
> GNU/Linux
>
> This means, that at least 3 m68k buildds aren't able to run newer kernels
> with the stock Debian kernel. I think this is bad.
>
> Kars, Christian? Can you please work on intergrating the needed patches into
> the Debian kernel source?

The patch in question appears to be obsolete/520-53c7xx.diff in Geert's
patch queue. Kars suggested to drop the 53c7xx driver in favor of the
53c700 one (and Richard Hirst submitted a patch to 53c700.c fixing some
issues) but the switch was never made (at least not in CVS). I'm unsure
what driver is actually used in the kernel you're running, can you check
the log messages or look at /proc/scsi to help decide between 53c7xx and
53c700?

The old 520-53c7xx.diff would have to be changed to reflect the new dma
API. The 53c700 diff would have to be reconstructed from scratch, or
resubmitted by Richard if the attached 53700 patch doesn't work anymore.

	Michael
diff -ur -X dodiffs-exclude --new-file linux-dma/arch/m68k/kernel/dma.c linux/arch/m68k/kernel/dma.c
--- linux-dma/arch/m68k/kernel/dma.c	2005-10-25 10:02:26.000000000 +0100
+++ linux/arch/m68k/kernel/dma.c	2005-10-24 18:27:13.000000000 +0100
@@ -37,8 +37,10 @@
 		map[i] = page + i;
 		get_page(map[i]);
 	}
-	for (; i < order; i++)
+	for (; i < order; i++) {
+		get_page(page + i);
 		__free_page(page + i);
+	}
 	pgprot = __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY);
 	if (CPU_IS_040_OR_060)
 		pgprot_val(pgprot) |= _PAGE_GLOBAL040 | _PAGE_NOCACHE_S;
@@ -56,6 +58,15 @@
 	vfree(addr);
 }
 
+void dma_cache_sync(void *vaddr, size_t size,
+				       enum dma_data_direction dir)
+{
+	if (dir == DMA_TO_DEVICE)
+		cache_push(virt_to_bus(vaddr), size);
+	else if (dir == DMA_FROM_DEVICE)
+		cache_clear(virt_to_bus(vaddr), size);
+}
+
 inline void dma_sync_single_for_device(struct device *dev, dma_addr_t handle, size_t size,
 				       enum dma_data_direction dir)
 {
@@ -110,3 +121,4 @@
 EXPORT_SYMBOL(dma_map_sg);
 EXPORT_SYMBOL(dma_sync_single_for_device);
 EXPORT_SYMBOL(dma_sync_sg_for_device);
+EXPORT_SYMBOL(dma_cache_sync);
diff -ur -X dodiffs-exclude --new-file linux-dma/drivers/scsi/53c700.c linux/drivers/scsi/53c700.c
--- linux-dma/drivers/scsi/53c700.c	2005-10-25 00:08:46.000000000 +0100
+++ linux/drivers/scsi/53c700.c	2005-10-24 17:56:22.000000000 +0100
@@ -675,16 +675,15 @@
 {
 	struct NCR_700_Host_Parameters *hostdata = 
 		(struct NCR_700_Host_Parameters *)host->hostdata[0];
-	__u32 dcntl_extra = 0;
 	__u8 min_period;
 	__u8 min_xferp = (hostdata->chip710 ? NCR_710_MIN_XFERP : NCR_700_MIN_XFERP);
 
 	if(hostdata->chip710) {
 		__u8 burst_disable = hostdata->burst_disable
 			? BURST_DISABLE : 0;
-		dcntl_extra = COMPAT_700_MODE;
+		hostdata->dcntl_extra |= COMPAT_700_MODE;
 
-		NCR_700_writeb(dcntl_extra, host, DCNTL_REG);
+		NCR_700_writeb(hostdata->dcntl_extra, host, DCNTL_REG);
 		NCR_700_writeb(BURST_LENGTH_8  | hostdata->dmode_extra,
 			       host, DMODE_710_REG);
 		NCR_700_writeb(burst_disable | (hostdata->differential ? 
@@ -723,13 +722,13 @@
 		 * of spec: sync divider 2, async divider 3 */
 		DEBUG(("53c700: sync 2 async 3\n"));
 		NCR_700_writeb(SYNC_DIV_2_0, host, SBCL_REG);
-		NCR_700_writeb(ASYNC_DIV_3_0 | dcntl_extra, host, DCNTL_REG);
+		NCR_700_writeb(ASYNC_DIV_3_0 | hostdata->dcntl_extra, host, DCNTL_REG);
 		hostdata->sync_clock = hostdata->clock/2;
 	} else	if(hostdata->clock > 50  && hostdata->clock <= 75) {
 		/* sync divider 1.5, async divider 3 */
 		DEBUG(("53c700: sync 1.5 async 3\n"));
 		NCR_700_writeb(SYNC_DIV_1_5, host, SBCL_REG);
-		NCR_700_writeb(ASYNC_DIV_3_0 | dcntl_extra, host, DCNTL_REG);
+		NCR_700_writeb(ASYNC_DIV_3_0 | hostdata->dcntl_extra, host, DCNTL_REG);
 		hostdata->sync_clock = hostdata->clock*2;
 		hostdata->sync_clock /= 3;
 		
@@ -737,18 +736,18 @@
 		/* sync divider 1, async divider 2 */
 		DEBUG(("53c700: sync 1 async 2\n"));
 		NCR_700_writeb(SYNC_DIV_1_0, host, SBCL_REG);
-		NCR_700_writeb(ASYNC_DIV_2_0 | dcntl_extra, host, DCNTL_REG);
+		NCR_700_writeb(ASYNC_DIV_2_0 | hostdata->dcntl_extra, host, DCNTL_REG);
 		hostdata->sync_clock = hostdata->clock;
 	} else if(hostdata->clock > 25 && hostdata->clock <=37) {
 		/* sync divider 1, async divider 1.5 */
 		DEBUG(("53c700: sync 1 async 1.5\n"));
 		NCR_700_writeb(SYNC_DIV_1_0, host, SBCL_REG);
-		NCR_700_writeb(ASYNC_DIV_1_5 | dcntl_extra, host, DCNTL_REG);
+		NCR_700_writeb(ASYNC_DIV_1_5 | hostdata->dcntl_extra, host, DCNTL_REG);
 		hostdata->sync_clock = hostdata->clock;
 	} else {
 		DEBUG(("53c700: sync 1 async 1\n"));
 		NCR_700_writeb(SYNC_DIV_1_0, host, SBCL_REG);
-		NCR_700_writeb(ASYNC_DIV_1_0 | dcntl_extra, host, DCNTL_REG);
+		NCR_700_writeb(ASYNC_DIV_1_0 | hostdata->dcntl_extra, host, DCNTL_REG);
 		/* sync divider 1, async divider 1 */
 		hostdata->sync_clock = hostdata->clock;
 	}
diff -ur -X dodiffs-exclude --new-file linux-dma/drivers/scsi/53c700.h linux/drivers/scsi/53c700.h
--- linux-dma/drivers/scsi/53c700.h	2005-10-25 00:21:17.000000000 +0100
+++ linux/drivers/scsi/53c700.h	2005-10-18 00:18:03.000000000 +0100
@@ -157,6 +157,7 @@
 	#define NCR_700_SLOT_BUSY (1|NCR_700_SLOT_MAGIC) /* slot has command active on HA */
 	#define NCR_700_SLOT_QUEUED (2|NCR_700_SLOT_MAGIC) /* slot has command to be made active on HA */
 	__u8	state;
+	__u8	pad1[3];	/* Needed for m68k where min alignment is 2 bytes */
 	int	tag;
 	__u32	resume_offset;
 	struct scsi_cmnd *cmnd;
@@ -176,6 +177,7 @@
 	void __iomem	*base;		/* the base for the port (copied to host) */
 	struct device	*dev;
 	__u32	dmode_extra;	/* adjustable bus settings */
+	__u32	dcntl_extra;	/* adjustable bus settings */
 	__u32	differential:1;	/* if we are differential */
 #ifdef CONFIG_53C700_LE_ON_BE
 	/* This option is for HP only.  Set it if your chip is wired for
@@ -363,6 +365,7 @@
 #define		SOFTWARE_RESET		0x01
 #define		COMPAT_700_MODE		0x01
 #define 	SCRPTS_16BITS		0x20
+#define		EA_710			0x20
 #define		ASYNC_DIV_2_0		0x00
 #define		ASYNC_DIV_1_5		0x40
 #define		ASYNC_DIV_1_0		0x80
diff -ur -X dodiffs-exclude --new-file linux-dma/drivers/scsi/Kconfig linux/drivers/scsi/Kconfig
--- linux-dma/drivers/scsi/Kconfig	2005-10-25 00:08:46.000000000 +0100
+++ linux/drivers/scsi/Kconfig	2005-10-17 00:53:07.000000000 +0100
@@ -1725,6 +1725,7 @@
 config MVME16x_SCSI
 	bool "NCR53C710 SCSI driver for MVME16x"
 	depends on MVME16x && SCSI
+	select SCSI_SPI_ATTRS
 	help
 	  The Motorola MVME162, 166, 167, 172 and 177 boards use the NCR53C710
 	  SCSI controller chip.  Almost everyone using one of these boards
@@ -1738,14 +1739,6 @@
 	  SCSI controller chip.  Almost everyone using one of these boards
 	  will want to say Y to this question.
 
-config SCSI_NCR53C7xx_FAST
-	bool "allow FAST-SCSI [10MHz]"
-	depends on SCSI_AMIGA7XX || MVME16x_SCSI || BVME6000_SCSI
-	help
-	  This will enable 10MHz FAST-SCSI transfers with your host
-	  adapter. Some systems have problems with that speed, so it's safest
-	  to say N here.
-
 config SUN3_SCSI
 	tristate "Sun3 NCR5380 SCSI"
 	depends on SUN3 && SCSI && BROKEN
diff -ur -X dodiffs-exclude --new-file linux-dma/drivers/scsi/Makefile linux/drivers/scsi/Makefile
--- linux-dma/drivers/scsi/Makefile	2005-10-25 00:08:46.000000000 +0100
+++ linux/drivers/scsi/Makefile	2005-10-17 00:53:07.000000000 +0100
@@ -46,7 +46,7 @@
 obj-$(CONFIG_MAC_SCSI)		+= mac_scsi.o
 obj-$(CONFIG_SCSI_MAC_ESP)	+= mac_esp.o	NCR53C9x.o
 obj-$(CONFIG_SUN3_SCSI)		+= sun3_scsi.o  sun3_scsi_vme.o
-obj-$(CONFIG_MVME16x_SCSI)	+= mvme16x.o	53c7xx.o
+obj-$(CONFIG_MVME16x_SCSI)	+= 53c700.o	mvme16x_scsi.o
 obj-$(CONFIG_BVME6000_SCSI)	+= bvme6000.o	53c7xx.o
 obj-$(CONFIG_SCSI_SIM710)	+= 53c700.o	sim710.o
 obj-$(CONFIG_SCSI_ADVANSYS)	+= advansys.o
diff -ur -X dodiffs-exclude --new-file linux-dma/drivers/scsi/mvme16x_scsi.c linux/drivers/scsi/mvme16x_scsi.c
--- linux-dma/drivers/scsi/mvme16x_scsi.c	1970-01-01 01:00:00.000000000 +0100
+++ linux/drivers/scsi/mvme16x_scsi.c	2005-10-24 23:52:06.000000000 +0100
@@ -0,0 +1,155 @@
+/*
+ * Detection routine for the NCR53c710 based MVME16x SCSI Controllers for Linux.
+ *
+ * Based on work by Alan Hourihane
+ *
+ * Rewritten to use 53c700.c by Kars de Jong <jongk@linux-m68k.org>
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+
+#include <linux/blkdev.h>
+#include <linux/device.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <asm/mvme16xhw.h>
+#include <scsi/scsi_host.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_transport.h>
+#include <scsi/scsi_transport_spi.h>
+
+#include "53c700.h"
+
+MODULE_AUTHOR("Kars de Jong <jongk@linux-m68k.org>");
+MODULE_DESCRIPTION("MVME16x NCR53C710 driver");
+MODULE_LICENSE("GPL");
+
+static struct scsi_host_template mvme16x_scsi_driver_template = {
+	.name			= "MVME16x NCR53c710 SCSI",
+	.proc_name		= "MVME16x",
+	.this_id		= 7,
+	.module			= THIS_MODULE,
+};
+
+static struct platform_device *mvme16x_scsi_device;
+
+static __devinit int
+mvme16x_probe(struct device *dev)
+{
+	struct Scsi_Host * host = NULL;
+	struct NCR_700_Host_Parameters *hostdata;
+
+	if (!MACH_IS_MVME16x)
+		goto out;
+
+	if (mvme16x_config & MVME16x_CONFIG_NO_SCSICHIP) {
+		printk(KERN_INFO "mvme16x-scsi: detection disabled, SCSI chip not present\n");
+		goto out;
+	}
+
+	hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
+	if (hostdata == NULL) {
+		printk(KERN_ERR "mvme16x-scsi: Failed to allocate host data\n");
+		goto out;
+	}
+	memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));
+
+	/* Fill in the required pieces of hostdata */
+	hostdata->base = (void __iomem *)0xfff47000;
+	hostdata->clock = 66;	/* XXX - depends on the CPU clock! */
+	hostdata->chip710 = 1;
+	hostdata->dmode_extra = DMODE_FC2;
+	hostdata->dcntl_extra = EA_710;
+
+	/* and register the chip */
+	if ((host = NCR_700_detect(&mvme16x_scsi_driver_template, hostdata, dev))
+	   == NULL) {
+		printk(KERN_ERR "mvme16x-scsi: No host detected; board configuration problem?\n");
+		goto out_free;
+	}
+	host->this_id = 7;
+	host->base = 0xfff47000UL;
+	host->irq = MVME16x_IRQ_SCSI;
+	if (request_irq(MVME16x_IRQ_SCSI, NCR_700_intr, 0, "mvme16x-scsi", host)) {
+		printk(KERN_ERR "mvme16x-scsi: request_irq failed\n");
+		goto out_put_host;
+	}
+
+	/* Enable scsi chip and s/w level 7 ints */
+	{
+		volatile unsigned long v;
+
+		/* Enable scsi interrupts at level 4 in PCCchip2 */
+		v = ioread32(0xfff4202c);
+		v = (v & ~0xff) | 0x10 | 4;
+		iowrite32(v, 0xfff4202c);
+	}
+
+	scsi_scan_host(host);
+
+	return 0;
+
+ out_put_host:
+	scsi_host_put(host);
+ out_free:
+	kfree(hostdata);
+ out:
+	return -ENODEV;
+}
+
+static __devexit int
+mvme16x_device_remove(struct device *dev)
+{
+	struct Scsi_Host *host = dev_to_shost(dev);
+	struct NCR_700_Host_Parameters *hostdata =
+		(struct NCR_700_Host_Parameters *)host->hostdata[0];
+
+	/* Disable scsi chip and s/w level 7 ints */
+	{
+		volatile unsigned long v;
+
+		v = ioread32(0xfff4202c);
+		v &= ~0x10;
+		iowrite32(v, 0xfff4202c);
+	}
+	scsi_remove_host(host);
+	NCR_700_release(host);
+	kfree(hostdata);
+	free_irq(host->irq, host);
+
+	return 0;
+}
+
+static struct device_driver mvme16x_scsi_driver = {
+	.name	= "mvme16x-scsi",
+	.bus	= &platform_bus_type,
+	.probe	= mvme16x_probe,
+	.remove	= __devexit_p(mvme16x_device_remove),
+};
+
+static int __init mvme16x_scsi_init(void)
+{
+	int err;
+
+	if ((err = driver_register(&mvme16x_scsi_driver)))
+		return err;
+
+	mvme16x_scsi_device = platform_device_register_simple("mvme16x-scsi", -1, NULL, 0);
+
+	if (IS_ERR(mvme16x_scsi_device)) {
+		driver_unregister(&mvme16x_scsi_driver);
+		return PTR_ERR(mvme16x_scsi_device);
+	}
+
+	return 0;
+}
+
+static void __exit mvme16x_scsi_exit(void)
+{
+	platform_device_unregister(mvme16x_scsi_device);
+	driver_unregister(&mvme16x_scsi_driver);
+}
+
+module_init(mvme16x_scsi_init);
+module_exit(mvme16x_scsi_exit);
diff -ur -X dodiffs-exclude --new-file linux-dma/include/asm-m68k/dma-mapping.h linux/include/asm-m68k/dma-mapping.h
--- linux-dma/include/asm-m68k/dma-mapping.h	2005-10-25 10:02:26.000000000 +0100
+++ linux/include/asm-m68k/dma-mapping.h	2005-10-24 20:37:24.000000000 +0100
@@ -1,6 +1,8 @@
 #ifndef _M68K_DMA_MAPPING_H
 #define _M68K_DMA_MAPPING_H
 
+#include <asm/cache.h>
+
 struct scatterlist;
 
 static inline int dma_supported(struct device *dev, u64 mask)
@@ -18,6 +20,20 @@
 extern void dma_free_coherent(struct device *, size_t,
 			      void *, dma_addr_t);
 
+static inline void *
+dma_alloc_noncoherent(struct device *dev, size_t size,
+		dma_addr_t *handle, int flag)
+{
+	return dma_alloc_coherent(dev, size, handle, flag);
+}
+
+static inline void
+dma_free_noncoherent(struct device *dev, size_t size,
+			      void *addr, dma_addr_t handle)
+{
+	dma_free_coherent(dev, size, addr, handle);
+}
+
 extern dma_addr_t dma_map_single(struct device *, void *, size_t,
 				 enum dma_data_direction);
 static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
@@ -25,6 +41,20 @@
 {
 }
 
+static inline int
+dma_get_cache_alignment(void)
+{
+	return 1 << L1_CACHE_SHIFT_MAX;
+}
+
+static inline int
+dma_is_consistent(dma_addr_t dma_addr)
+{
+	return 0;
+}
+
+extern void dma_cache_sync(void *, size_t, enum dma_data_direction);
+
 extern dma_addr_t dma_map_page(struct device *, struct page *,
 			       unsigned long, size_t size,
 			       enum dma_data_direction);
diff -ur -X dodiffs-exclude --new-file linux-dma/include/asm-m68k/io.h linux/include/asm-m68k/io.h
--- linux-dma/include/asm-m68k/io.h	2005-10-25 00:22:42.000000000 +0100
+++ linux/include/asm-m68k/io.h	2005-10-17 01:33:05.000000000 +0100
@@ -324,6 +324,13 @@
 #define writel(val,addr) out_le32((addr),(val))
 #endif
 
+#ifdef CONFIG_MVME16x
+#define ioread8(p)	raw_inb(p)
+#define iowrite8(v,p)	raw_outb(v,p)
+#define ioread32(p)	raw_inl(p)
+#define iowrite32(v,p)	raw_outl(v,p)
+#endif
+
 static inline void *ioremap(unsigned long physaddr, unsigned long size)
 {
 	return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);

Reply to: