Exemplo n.º 1
0
static int __devinit a4000t_probe(struct device *dev)
{
	struct Scsi_Host * host = NULL;
	struct NCR_700_Host_Parameters *hostdata;

	if (!(MACH_IS_AMIGA && AMIGAHW_PRESENT(A4000_SCSI)))
		goto out;

	if (!request_mem_region(A4000T_SCSI_ADDR, 0x1000,
				"A4000T builtin SCSI"))
		goto out;

	hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
	if (hostdata == NULL) {
		printk(KERN_ERR "a4000t-scsi: Failed to allocate host data\n");
		goto out_release;
	}
	memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));

	/* Fill in the required pieces of hostdata */
	hostdata->base = (void __iomem *)ZTWO_VADDR(A4000T_SCSI_ADDR);
	hostdata->clock = 50;
	hostdata->chip710 = 1;
	hostdata->dmode_extra = DMODE_FC2;
	hostdata->dcntl_extra = EA_710;

	/* and register the chip */
	host = NCR_700_detect(&a4000t_scsi_driver_template, hostdata, dev);
	if (!host) {
		printk(KERN_ERR "a4000t-scsi: No host detected; "
				"board configuration problem?\n");
		goto out_free;
	}

	host->this_id = 7;
	host->base = A4000T_SCSI_ADDR;
	host->irq = IRQ_AMIGA_PORTS;

	if (request_irq(host->irq, NCR_700_intr, IRQF_SHARED, "a4000t-scsi",
			host)) {
		printk(KERN_ERR "a4000t-scsi: request_irq failed\n");
		goto out_put_host;
	}

	dev_set_drvdata(dev, host);
	scsi_scan_host(host);

	return 0;

 out_put_host:
	scsi_host_put(host);
 out_free:
	kfree(hostdata);
 out_release:
	release_mem_region(A4000T_SCSI_ADDR, 0x1000);
 out:
	return -ENODEV;
}
Exemplo n.º 2
0
static __devinit int
sim710_probe_common(struct device *dev, unsigned long base_addr,
		    int irq, int clock, int differential, int scsi_id)
{
	struct Scsi_Host * host = NULL;
	struct NCR_700_Host_Parameters *hostdata =
		kzalloc(sizeof(struct NCR_700_Host_Parameters),	GFP_KERNEL);

;
//	printk(KERN_NOTICE "sim710: irq = %d, clock = %d, base = 0x%lx, scsi_id = %d\n",
;

	if(hostdata == NULL) {
;
		goto out;
	}

	if(request_region(base_addr, 64, "sim710") == NULL) {
//		printk(KERN_ERR "sim710: Failed to reserve IO region 0x%lx\n",
;
		goto out_free;
	}

	/* Fill in the three required pieces of hostdata */
	hostdata->base = ioport_map(base_addr, 64);
	hostdata->differential = differential;
	hostdata->clock = clock;
	hostdata->chip710 = 1;
	hostdata->burst_length = 8;

	/* and register the chip */
	if((host = NCR_700_detect(&sim710_driver_template, hostdata, dev))
	   == NULL) {
;
		goto out_release;
	}
	host->this_id = scsi_id;
	host->base = base_addr;
	host->irq = irq;
	if (request_irq(irq, NCR_700_intr, IRQF_SHARED, "sim710", host)) {
;
		goto out_put_host;
	}

	dev_set_drvdata(dev, host);
	scsi_scan_host(host);

	return 0;

 out_put_host:
	scsi_host_put(host);
 out_release:
	release_region(base_addr, 64);
 out_free:
	kfree(hostdata);
 out:
	return -ENODEV;
}
Exemplo n.º 3
0
static int __init
lasi700_probe(struct parisc_device *dev)
{
	unsigned long base = dev->hpa + LASI_SCSI_CORE_OFFSET;
	struct NCR_700_Host_Parameters *hostdata;
	struct Scsi_Host *host;

	hostdata = kmalloc(sizeof(*hostdata), GFP_KERNEL);
	if (!hostdata) {
		printk(KERN_ERR "%s: Failed to allocate host data\n",
		       dev->dev.bus_id);
		return -ENOMEM;
	}
	memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));

	hostdata->dev = &dev->dev;
	dma_set_mask(&dev->dev, DMA_32BIT_MASK);
	hostdata->base = ioremap(base, 0x100);
	hostdata->differential = 0;

	if (dev->id.sversion == LASI_700_SVERSION) {
		hostdata->clock = LASI700_CLOCK;
		hostdata->force_le_on_be = 1;
	} else {
		hostdata->clock = LASI710_CLOCK;
		hostdata->force_le_on_be = 0;
		hostdata->chip710 = 1;
		hostdata->dmode_extra = DMODE_FC2;
	}

	NCR_700_set_mem_mapped(hostdata);

	host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev);
	if (!host)
		goto out_kfree;
	host->this_id = 7;
	host->base = base;
	host->irq = dev->irq;
	if(request_irq(dev->irq, NCR_700_intr, SA_SHIRQ, "lasi700", host)) {
		printk(KERN_ERR "lasi700: request_irq failed!\n");
		goto out_put_host;
	}

	dev_set_drvdata(&dev->dev, host);
	scsi_scan_host(host);

	return 0;

 out_put_host:
	scsi_host_put(host);
 out_kfree:
	iounmap(hostdata->base);
	kfree(hostdata);
	return -ENODEV;
}
Exemplo n.º 4
0
static int __init
lasi700_driver_callback(struct parisc_device *dev)
{
	unsigned long base = dev->hpa + LASI_SCSI_CORE_OFFSET;
	int irq = busdevice_alloc_irq(dev);
	char *driver_name;
	struct Scsi_Host *host;
	struct NCR_700_Host_Parameters *hostdata =
		kmalloc(sizeof(struct NCR_700_Host_Parameters),
			GFP_KERNEL);
	if(dev->id.sversion == LASI_700_SVERSION) {
		driver_name = "lasi700";
	} else {
		driver_name = "lasi710";
	}
	if(hostdata == NULL) {
		printk(KERN_ERR "%s: Failed to allocate host data\n",
		       driver_name);
		return 1;
	}
	memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));
	if(request_mem_region(base, 64, driver_name) == NULL) {
		printk(KERN_ERR "%s: Failed to claim memory region\n",
		       driver_name);
		kfree(hostdata);
		return 1;
	}
	hostdata->base = base;
	hostdata->differential = 0;
	if(dev->id.sversion == LASI_700_SVERSION) {
		hostdata->clock = LASI700_CLOCK;
		hostdata->force_le_on_be = 1;
	} else {
		hostdata->clock = LASI710_CLOCK;
		hostdata->force_le_on_be = 0;
		hostdata->chip710 = 1;
		hostdata->dmode_extra = DMODE_FC2;
	}
	if((host = NCR_700_detect(host_tpnt, hostdata)) == NULL) {
		kfree(hostdata);
		release_mem_region(host->base, 64);
		return 1;
	}
	host->irq = irq;
	if(request_irq(irq, NCR_700_intr, SA_SHIRQ, driver_name, host)) {
		printk(KERN_ERR "%s: irq problem, detatching\n",
		       driver_name);
		scsi_unregister(host);
		NCR_700_release(host);
		return 1;
	}
	host_count++;
	return 0;
}
Exemplo n.º 5
0
static __devinit int
bvme6000_probe(struct platform_device *dev)
{
	struct Scsi_Host *host;
	struct NCR_700_Host_Parameters *hostdata;

	if (!MACH_IS_BVME6000)
		goto out;

	hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
	if (!hostdata) {
		printk(KERN_ERR "bvme6000-scsi: "
				"Failed to allocate host data\n");
		goto out;
	}

	
	hostdata->base = (void __iomem *)BVME_NCR53C710_BASE;
	hostdata->clock = 40;	
	hostdata->chip710 = 1;
	hostdata->dmode_extra = DMODE_FC2;
	hostdata->dcntl_extra = EA_710;
	hostdata->ctest7_extra = CTEST7_TT1;

	
	host = NCR_700_detect(&bvme6000_scsi_driver_template, hostdata,
			      &dev->dev);
	if (!host) {
		printk(KERN_ERR "bvme6000-scsi: No host detected; "
				"board configuration problem?\n");
		goto out_free;
	}
	host->base = BVME_NCR53C710_BASE;
	host->this_id = 7;
	host->irq = BVME_IRQ_SCSI;
	if (request_irq(BVME_IRQ_SCSI, NCR_700_intr, 0, "bvme6000-scsi",
			host)) {
		printk(KERN_ERR "bvme6000-scsi: request_irq failed\n");
		goto out_put_host;
	}

	platform_set_drvdata(dev, host);
	scsi_scan_host(host);

	return 0;

 out_put_host:
	scsi_host_put(host);
 out_free:
	kfree(hostdata);
 out:
	return -ENODEV;
}
Exemplo n.º 6
0
static int __init snirm710_probe(struct platform_device *dev)
{
	unsigned long base;
	struct NCR_700_Host_Parameters *hostdata;
	struct Scsi_Host *host;
	struct  resource *res;

	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
	if (!res)
		return -ENODEV;

	base = res->start;
	hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL);
	if (!hostdata) {
		printk(KERN_ERR "%s: Failed to allocate host data\n",
		       dev->dev.bus_id);
		return -ENOMEM;
	}

	hostdata->dev = &dev->dev;
	dma_set_mask(&dev->dev, DMA_32BIT_MASK);
	hostdata->base = ioremap_nocache(CPHYSADDR(base), 0x100);
	hostdata->differential = 0;

	hostdata->clock = SNIRM710_CLOCK;
	hostdata->force_le_on_be = 1;
	hostdata->chip710 = 1;
	hostdata->burst_length = 4;

	host = NCR_700_detect(&snirm710_template, hostdata, &dev->dev);
	if (!host)
		goto out_kfree;
	host->this_id = 7;
	host->base = base;
	host->irq = platform_get_irq(dev, 0);
	if(request_irq(host->irq, NCR_700_intr, SA_SHIRQ, "snirm710", host)) {
		printk(KERN_ERR "snirm710: request_irq failed!\n");
		goto out_put_host;
	}

	dev_set_drvdata(&dev->dev, host);
	scsi_scan_host(host);

	return 0;

 out_put_host:
	scsi_host_put(host);
 out_kfree:
	iounmap(hostdata->base);
	kfree(hostdata);
	return -ENODEV;
}
Exemplo n.º 7
0
static int __devinit
NCR_D700_probe_one(struct NCR_D700_private *p, int siop, int irq,
		   int slot, u32 region, int differential)
{
	struct NCR_700_Host_Parameters *hostdata;
	struct Scsi_Host *host;
	int ret;

	hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL);
	if (!hostdata) {
//		printk(KERN_ERR "NCR D700: SIOP%d: Failed to allocate host"
;
		return -ENOMEM;
	}

	if (!request_region(region, 64, "NCR_D700")) {
//		printk(KERN_ERR "NCR D700: Failed to reserve IO region 0x%x\n",
;
		ret = -ENODEV;
		goto region_failed;
	}
		
	/* Fill in the three required pieces of hostdata */
	hostdata->base = ioport_map(region, 64);
	hostdata->differential = (((1<<siop) & differential) != 0);
	hostdata->clock = NCR_D700_CLOCK_MHZ;
	hostdata->burst_length = 8;

	/* and register the siop */
	host = NCR_700_detect(&NCR_D700_driver_template, hostdata, p->dev);
	if (!host) {
		ret = -ENOMEM;
		goto detect_failed;
	}

	p->hosts[siop] = host;
	/* FIXME: read this from SUS */
	host->this_id = id_array[slot * 2 + siop];
	host->irq = irq;
	host->base = region;
	scsi_scan_host(host);

	return 0;

 detect_failed:
	release_region(region, 64);
 region_failed:
	kfree(hostdata);

	return ret;
}
Exemplo n.º 8
0
static int __init
lasi700_probe(struct parisc_device *dev)
{
	unsigned long base = dev->hpa + LASI_SCSI_CORE_OFFSET;
	struct NCR_700_Host_Parameters *hostdata;
	struct Scsi_Host *host;

	hostdata = kmalloc(sizeof(*hostdata), GFP_KERNEL);
	if (!hostdata) {
		printk(KERN_ERR "%s: Failed to allocate host data\n",
		       dev->dev.bus_id);
		return -ENOMEM;
	}
	memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));

	hostdata->dev = &dev->dev;
	dma_set_mask(&dev->dev, 0xffffffffUL);
	hostdata->base = base;
	hostdata->differential = 0;

	if (dev->id.sversion == LASI_700_SVERSION) {
		hostdata->clock = LASI700_CLOCK;
		hostdata->force_le_on_be = 1;
	} else {
		hostdata->clock = LASI710_CLOCK;
		hostdata->force_le_on_be = 0;
		hostdata->chip710 = 1;
		hostdata->dmode_extra = DMODE_FC2;
	}

	NCR_700_set_mem_mapped(hostdata);

	host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev,
			      dev->irq, 7);
	if (!host)
		goto out_kfree;

	dev_set_drvdata(&dev->dev, host);
	scsi_scan_host(host);

	return 0;

 out_kfree:
	kfree(hostdata);
	return -ENODEV;
}
Exemplo n.º 9
0
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 = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
    if (hostdata == NULL) {
        printk(KERN_ERR "mvme16x-scsi: "
                "Failed to allocate host data\n");
        goto out;
    }

    /* Fill in the required pieces of hostdata */
    hostdata->base = (void __iomem *)0xfff47000UL;
    hostdata->clock = 50;    /* XXX - depends on the CPU clock! */
    hostdata->chip710 = 1;
    hostdata->dmode_extra = DMODE_FC2;
    hostdata->dcntl_extra = EA_710;
    hostdata->ctest7_extra = CTEST7_TT1;

    /* and register the chip */
    host = NCR_700_detect(&mvme16x_scsi_driver_template, hostdata, dev);
    if (!host) {
        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(host->irq, NCR_700_intr, 0, "mvme16x-scsi", host)) {
        printk(KERN_ERR "mvme16x-scsi: request_irq failed\n");
        goto out_put_host;
    }

    /* Enable scsi chip ints */
    {
        volatile unsigned long v;

        /* Enable scsi interrupts at level 4 in PCCchip2 */
        v = in_be32(0xfff4202c);
        v = (v & ~0xff) | 0x10 | 4;
        out_be32(0xfff4202c, v);
    }

    dev_set_drvdata(dev, host);
    scsi_scan_host(host);

    return 0;

 out_put_host:
    scsi_host_put(host);
 out_free:
    kfree(hostdata);
 out:
    return -ENODEV;
}
Exemplo n.º 10
0
static int __devinit zorro7xx_init_one(struct zorro_dev *z,
				       const struct zorro_device_id *ent)
{
	struct Scsi_Host * host = NULL;
	struct NCR_700_Host_Parameters *hostdata;
	struct zorro_driver_data *zdd;
	unsigned long board, ioaddr;

	board = zorro_resource_start(z);
	zdd = (struct zorro_driver_data *)ent->driver_data;

	if (zdd->absolute) {
		ioaddr = zdd->offset;
	} else {
		ioaddr = board + zdd->offset;
	}

	if (!zorro_request_device(z, zdd->name)) {
		printk(KERN_ERR "zorro7xx: cannot reserve region 0x%lx, abort\n",
		       board);
		return -EBUSY;
	}

	hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
	if (hostdata == NULL) {
		printk(KERN_ERR "zorro7xx: Failed to allocate host data\n");
		goto out_release;
	}

	memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));

	/* Fill in the required pieces of hostdata */
	if (ioaddr > 0x01000000)
		hostdata->base = ioremap(ioaddr, zorro_resource_len(z));
	else
		hostdata->base = (void __iomem *)ZTWO_VADDR(ioaddr);

	hostdata->clock = 50;
	hostdata->chip710 = 1;

	/* Settings for at least WarpEngine 40xx */
	hostdata->ctest7_extra = CTEST7_TT1;

	zorro7xx_scsi_driver_template.name = zdd->name;

	/* and register the chip */
	host = NCR_700_detect(&zorro7xx_scsi_driver_template, hostdata,
			      &z->dev);
	if (!host) {
		printk(KERN_ERR "zorro7xx: No host detected; "
				"board configuration problem?\n");
		goto out_free;
	}

	host->this_id = 7;
	host->base = ioaddr;
	host->irq = IRQ_AMIGA_PORTS;

	if (request_irq(host->irq, NCR_700_intr, IRQF_SHARED, "zorro7xx-scsi",
			host)) {
		printk(KERN_ERR "zorro7xx: request_irq failed\n");
		goto out_put_host;
	}

	zorro_set_drvdata(z, host);
	scsi_scan_host(host);

	return 0;

 out_put_host:
	scsi_host_put(host);
 out_free:
	if (ioaddr > 0x01000000)
		iounmap(hostdata->base);
	kfree(hostdata);
 out_release:
	zorro_release_device(z);

	return -ENODEV;
}