Lines Matching refs:esp

31 	sbus_readl(esp->dma_regs + (REG))
33 sbus_writel((VAL), esp->dma_regs + (REG))
46 static int __devinit esp_sbus_setup_dma(struct esp *esp,
49 esp->dma = dma_of;
51 esp->dma_regs = of_ioremap(&dma_of->resource[0], 0,
54 if (!esp->dma_regs)
59 esp->dmarev = dvmarev0;
62 esp->dmarev = dvmaesc1;
65 esp->dmarev = dvmarev1;
68 esp->dmarev = dvmarev2;
71 esp->dmarev = dvmahme;
74 esp->dmarev = dvmarevplus;
82 static int __devinit esp_sbus_map_regs(struct esp *esp, int hme)
84 struct platform_device *op = esp->dev;
95 esp->regs = of_ioremap(res, 0, SBUS_ESP_REG_SIZE, "ESP");
96 if (!esp->regs)
102 static int __devinit esp_sbus_map_command_block(struct esp *esp)
104 struct platform_device *op = esp->dev;
106 esp->command_block = dma_alloc_coherent(&op->dev, 16,
107 &esp->command_block_dma,
109 if (!esp->command_block)
114 static int __devinit esp_sbus_register_irq(struct esp *esp)
116 struct Scsi_Host *host = esp->host;
117 struct platform_device *op = esp->dev;
120 return request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp);
123 static void __devinit esp_get_scsi_id(struct esp *esp, struct platform_device *espdma)
125 struct platform_device *op = esp->dev;
129 esp->scsi_id = of_getintprop_default(dp, "initiator-id", 0xff);
130 if (esp->scsi_id != 0xff)
133 esp->scsi_id = of_getintprop_default(dp, "scsi-initiator-id", 0xff);
134 if (esp->scsi_id != 0xff)
137 esp->scsi_id = of_getintprop_default(espdma->dev.of_node,
141 esp->host->this_id = esp->scsi_id;
142 esp->scsi_id_mask = (1 << esp->scsi_id);
145 static void __devinit esp_get_differential(struct esp *esp)
147 struct platform_device *op = esp->dev;
152 esp->flags |= ESP_FLAG_DIFFERENTIAL;
154 esp->flags &= ~ESP_FLAG_DIFFERENTIAL;
157 static void __devinit esp_get_clock_params(struct esp *esp)
159 struct platform_device *op = esp->dev;
170 esp->cfreq = fmhz;
173 static void __devinit esp_get_bursts(struct esp *esp, struct platform_device *dma_of)
176 struct platform_device *op = esp->dev;
195 esp->bursts = bursts;
198 static void __devinit esp_sbus_get_props(struct esp *esp, struct platform_device *espdma)
200 esp_get_scsi_id(esp, espdma);
201 esp_get_differential(esp);
202 esp_get_clock_params(esp);
203 esp_get_bursts(esp, espdma);
206 static void sbus_esp_write8(struct esp *esp, u8 val, unsigned long reg)
208 sbus_writeb(val, esp->regs + (reg * 4UL));
211 static u8 sbus_esp_read8(struct esp *esp, unsigned long reg)
213 return sbus_readb(esp->regs + (reg * 4UL));
216 static dma_addr_t sbus_esp_map_single(struct esp *esp, void *buf,
219 struct platform_device *op = esp->dev;
224 static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg,
227 struct platform_device *op = esp->dev;
232 static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr,
235 struct platform_device *op = esp->dev;
240 static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg,
243 struct platform_device *op = esp->dev;
248 static int sbus_esp_irq_pending(struct esp *esp)
255 static void sbus_esp_reset_dma(struct esp *esp)
262 can_do_burst16 = (esp->bursts & DMA_BURST16) != 0;
263 can_do_burst32 = (esp->bursts & DMA_BURST32) != 0;
266 op = esp->dev;
270 can_do_burst64 = (esp->bursts & DMA_BURST64) != 0;
273 if (esp->dmarev != dvmahme) {
278 switch (esp->dmarev) {
283 esp->prev_hme_dmacsr = (DMA_PARITY_OFF | DMA_2CLKS |
286 esp->prev_hme_dmacsr &= ~(DMA_ENABLE | DMA_ST_WRITE |
290 esp->prev_hme_dmacsr |= DMA_BRST64;
292 esp->prev_hme_dmacsr |= DMA_BRST32;
295 esp->prev_hme_dmacsr |= DMA_SCSI_SBUS64;
296 sbus_set_sbus64(&op->dev, esp->bursts);
302 printk(KERN_ALERT PFX "esp%d: DMA_PEND_READ "
304 esp->host->unique_id);
311 dma_write32(esp->prev_hme_dmacsr, DMA_CSR);
317 if (esp->rev != ESP100) {
355 static void sbus_esp_dma_drain(struct esp *esp)
360 if (esp->dmarev == dvmahme)
367 if (esp->dmarev != dvmarev3 && esp->dmarev != dvmaesc1)
373 printk(KERN_ALERT PFX "esp%d: DMA will not drain!\n",
374 esp->host->unique_id);
381 static void sbus_esp_dma_invalidate(struct esp *esp)
383 if (esp->dmarev == dvmahme) {
386 esp->prev_hme_dmacsr = ((esp->prev_hme_dmacsr |
392 dma_write32(esp->prev_hme_dmacsr, DMA_CSR);
405 printk(KERN_ALERT PFX "esp%d: DMA will not "
406 "invalidate!\n", esp->host->unique_id);
420 static void sbus_esp_send_dma_cmd(struct esp *esp, u32 addr, u32 esp_count,
427 sbus_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW);
428 sbus_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED);
429 if (esp->rev == FASHME) {
430 sbus_esp_write8(esp, (esp_count >> 16) & 0xff, FAS_RLO);
431 sbus_esp_write8(esp, 0, FAS_RHI);
433 scsi_esp_cmd(esp, cmd);
435 csr = esp->prev_hme_dmacsr;
441 esp->prev_hme_dmacsr = csr;
454 if (esp->dmarev == dvmaesc1) {
460 scsi_esp_cmd(esp, cmd);
465 static int sbus_esp_dma_error(struct esp *esp)
496 struct esp *esp;
499 host = scsi_host_alloc(tpnt, sizeof(struct esp));
506 esp = shost_priv(host);
508 esp->host = host;
509 esp->dev = op;
510 esp->ops = &sbus_esp_ops;
513 esp->flags |= ESP_FLAG_WIDE_CAPABLE;
515 err = esp_sbus_setup_dma(esp, espdma);
519 err = esp_sbus_map_regs(esp, hme);
523 err = esp_sbus_map_command_block(esp);
527 err = esp_sbus_register_irq(esp);
531 esp_sbus_get_props(esp, espdma);
537 if (esp->dmarev == dvmaesc1) {
543 dev_set_drvdata(&op->dev, esp);
545 err = scsi_esp_register(esp, &op->dev);
552 free_irq(host->irq, esp);
555 esp->command_block,
556 esp->command_block_dma);
558 of_iounmap(&op->resource[(hme ? 1 : 0)], esp->regs, SBUS_ESP_REG_SIZE);
590 struct esp *esp = dev_get_drvdata(&op->dev);
591 struct platform_device *dma_of = esp->dma;
592 unsigned int irq = esp->host->irq;
596 scsi_esp_unregister(esp);
602 free_irq(irq, esp);
604 is_hme = (esp->dmarev == dvmahme);
607 esp->command_block,
608 esp->command_block_dma);
609 of_iounmap(&op->resource[(is_hme ? 1 : 0)], esp->regs,
611 of_iounmap(&dma_of->resource[0], esp->dma_regs,
614 scsi_host_put(esp->host);
623 .name = "SUNW,esp",
629 .name = "esp",
637 .name = "esp",