Lines Matching refs:esp
32 sbus_readl(esp->dma_regs + (REG))
34 sbus_writel((VAL), esp->dma_regs + (REG))
47 static int esp_sbus_setup_dma(struct esp *esp, struct platform_device *dma_of) in esp_sbus_setup_dma() argument
49 esp->dma = dma_of; in esp_sbus_setup_dma()
51 esp->dma_regs = of_ioremap(&dma_of->resource[0], 0, in esp_sbus_setup_dma()
54 if (!esp->dma_regs) in esp_sbus_setup_dma()
59 esp->dmarev = dvmarev0; in esp_sbus_setup_dma()
62 esp->dmarev = dvmaesc1; in esp_sbus_setup_dma()
65 esp->dmarev = dvmarev1; in esp_sbus_setup_dma()
68 esp->dmarev = dvmarev2; in esp_sbus_setup_dma()
71 esp->dmarev = dvmahme; in esp_sbus_setup_dma()
74 esp->dmarev = dvmarevplus; in esp_sbus_setup_dma()
82 static int esp_sbus_map_regs(struct esp *esp, int hme) in esp_sbus_map_regs() argument
84 struct platform_device *op = to_platform_device(esp->dev); in esp_sbus_map_regs()
95 esp->regs = of_ioremap(res, 0, SBUS_ESP_REG_SIZE, "ESP"); in esp_sbus_map_regs()
96 if (!esp->regs) in esp_sbus_map_regs()
102 static int esp_sbus_map_command_block(struct esp *esp) in esp_sbus_map_command_block() argument
104 esp->command_block = dma_alloc_coherent(esp->dev, 16, in esp_sbus_map_command_block()
105 &esp->command_block_dma, in esp_sbus_map_command_block()
107 if (!esp->command_block) in esp_sbus_map_command_block()
112 static int esp_sbus_register_irq(struct esp *esp) in esp_sbus_register_irq() argument
114 struct Scsi_Host *host = esp->host; in esp_sbus_register_irq()
115 struct platform_device *op = to_platform_device(esp->dev); in esp_sbus_register_irq()
118 return request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp); in esp_sbus_register_irq()
121 static void esp_get_scsi_id(struct esp *esp, struct platform_device *espdma) in esp_get_scsi_id() argument
123 struct platform_device *op = to_platform_device(esp->dev); in esp_get_scsi_id()
127 esp->scsi_id = of_getintprop_default(dp, "initiator-id", 0xff); in esp_get_scsi_id()
128 if (esp->scsi_id != 0xff) in esp_get_scsi_id()
131 esp->scsi_id = of_getintprop_default(dp, "scsi-initiator-id", 0xff); in esp_get_scsi_id()
132 if (esp->scsi_id != 0xff) in esp_get_scsi_id()
135 esp->scsi_id = of_getintprop_default(espdma->dev.of_node, in esp_get_scsi_id()
139 esp->host->this_id = esp->scsi_id; in esp_get_scsi_id()
140 esp->scsi_id_mask = (1 << esp->scsi_id); in esp_get_scsi_id()
143 static void esp_get_differential(struct esp *esp) in esp_get_differential() argument
145 struct platform_device *op = to_platform_device(esp->dev); in esp_get_differential()
150 esp->flags |= ESP_FLAG_DIFFERENTIAL; in esp_get_differential()
152 esp->flags &= ~ESP_FLAG_DIFFERENTIAL; in esp_get_differential()
155 static void esp_get_clock_params(struct esp *esp) in esp_get_clock_params() argument
157 struct platform_device *op = to_platform_device(esp->dev); in esp_get_clock_params()
168 esp->cfreq = fmhz; in esp_get_clock_params()
171 static void esp_get_bursts(struct esp *esp, struct platform_device *dma_of) in esp_get_bursts() argument
174 struct platform_device *op = to_platform_device(esp->dev); in esp_get_bursts()
193 esp->bursts = bursts; in esp_get_bursts()
196 static void esp_sbus_get_props(struct esp *esp, struct platform_device *espdma) in esp_sbus_get_props() argument
198 esp_get_scsi_id(esp, espdma); in esp_sbus_get_props()
199 esp_get_differential(esp); in esp_sbus_get_props()
200 esp_get_clock_params(esp); in esp_sbus_get_props()
201 esp_get_bursts(esp, espdma); in esp_sbus_get_props()
204 static void sbus_esp_write8(struct esp *esp, u8 val, unsigned long reg) in sbus_esp_write8() argument
206 sbus_writeb(val, esp->regs + (reg * 4UL)); in sbus_esp_write8()
209 static u8 sbus_esp_read8(struct esp *esp, unsigned long reg) in sbus_esp_read8() argument
211 return sbus_readb(esp->regs + (reg * 4UL)); in sbus_esp_read8()
214 static int sbus_esp_irq_pending(struct esp *esp) in sbus_esp_irq_pending() argument
221 static void sbus_esp_reset_dma(struct esp *esp) in sbus_esp_reset_dma() argument
225 struct platform_device *op = to_platform_device(esp->dev); in sbus_esp_reset_dma()
228 can_do_burst16 = (esp->bursts & DMA_BURST16) != 0; in sbus_esp_reset_dma()
229 can_do_burst32 = (esp->bursts & DMA_BURST32) != 0; in sbus_esp_reset_dma()
235 can_do_burst64 = (esp->bursts & DMA_BURST64) != 0; in sbus_esp_reset_dma()
238 if (esp->dmarev != dvmahme) { in sbus_esp_reset_dma()
243 switch (esp->dmarev) { in sbus_esp_reset_dma()
248 esp->prev_hme_dmacsr = (DMA_PARITY_OFF | DMA_2CLKS | in sbus_esp_reset_dma()
251 esp->prev_hme_dmacsr &= ~(DMA_ENABLE | DMA_ST_WRITE | in sbus_esp_reset_dma()
255 esp->prev_hme_dmacsr |= DMA_BRST64; in sbus_esp_reset_dma()
257 esp->prev_hme_dmacsr |= DMA_BRST32; in sbus_esp_reset_dma()
260 esp->prev_hme_dmacsr |= DMA_SCSI_SBUS64; in sbus_esp_reset_dma()
261 sbus_set_sbus64(&op->dev, esp->bursts); in sbus_esp_reset_dma()
269 esp->host->unique_id); in sbus_esp_reset_dma()
276 dma_write32(esp->prev_hme_dmacsr, DMA_CSR); in sbus_esp_reset_dma()
282 if (esp->rev != ESP100) { in sbus_esp_reset_dma()
320 static void sbus_esp_dma_drain(struct esp *esp) in sbus_esp_dma_drain() argument
325 if (esp->dmarev == dvmahme) in sbus_esp_dma_drain()
332 if (esp->dmarev != dvmarev3 && esp->dmarev != dvmaesc1) in sbus_esp_dma_drain()
339 esp->host->unique_id); in sbus_esp_dma_drain()
346 static void sbus_esp_dma_invalidate(struct esp *esp) in sbus_esp_dma_invalidate() argument
348 if (esp->dmarev == dvmahme) { in sbus_esp_dma_invalidate()
351 esp->prev_hme_dmacsr = ((esp->prev_hme_dmacsr | in sbus_esp_dma_invalidate()
357 dma_write32(esp->prev_hme_dmacsr, DMA_CSR); in sbus_esp_dma_invalidate()
371 "invalidate!\n", esp->host->unique_id); in sbus_esp_dma_invalidate()
385 static void sbus_esp_send_dma_cmd(struct esp *esp, u32 addr, u32 esp_count, in sbus_esp_send_dma_cmd() argument
392 sbus_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW); in sbus_esp_send_dma_cmd()
393 sbus_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED); in sbus_esp_send_dma_cmd()
394 if (esp->rev == FASHME) { in sbus_esp_send_dma_cmd()
395 sbus_esp_write8(esp, (esp_count >> 16) & 0xff, FAS_RLO); in sbus_esp_send_dma_cmd()
396 sbus_esp_write8(esp, 0, FAS_RHI); in sbus_esp_send_dma_cmd()
398 scsi_esp_cmd(esp, cmd); in sbus_esp_send_dma_cmd()
400 csr = esp->prev_hme_dmacsr; in sbus_esp_send_dma_cmd()
406 esp->prev_hme_dmacsr = csr; in sbus_esp_send_dma_cmd()
419 if (esp->dmarev == dvmaesc1) { in sbus_esp_send_dma_cmd()
425 scsi_esp_cmd(esp, cmd); in sbus_esp_send_dma_cmd()
430 static int sbus_esp_dma_error(struct esp *esp) in sbus_esp_dma_error() argument
456 struct esp *esp; in esp_sbus_probe_one() local
459 host = scsi_host_alloc(tpnt, sizeof(struct esp)); in esp_sbus_probe_one()
466 esp = shost_priv(host); in esp_sbus_probe_one()
468 esp->host = host; in esp_sbus_probe_one()
469 esp->dev = &op->dev; in esp_sbus_probe_one()
470 esp->ops = &sbus_esp_ops; in esp_sbus_probe_one()
473 esp->flags |= ESP_FLAG_WIDE_CAPABLE; in esp_sbus_probe_one()
475 err = esp_sbus_setup_dma(esp, espdma); in esp_sbus_probe_one()
479 err = esp_sbus_map_regs(esp, hme); in esp_sbus_probe_one()
483 err = esp_sbus_map_command_block(esp); in esp_sbus_probe_one()
487 err = esp_sbus_register_irq(esp); in esp_sbus_probe_one()
491 esp_sbus_get_props(esp, espdma); in esp_sbus_probe_one()
497 if (esp->dmarev == dvmaesc1) { in esp_sbus_probe_one()
503 dev_set_drvdata(&op->dev, esp); in esp_sbus_probe_one()
505 err = scsi_esp_register(esp); in esp_sbus_probe_one()
512 free_irq(host->irq, esp); in esp_sbus_probe_one()
515 esp->command_block, in esp_sbus_probe_one()
516 esp->command_block_dma); in esp_sbus_probe_one()
518 of_iounmap(&op->resource[(hme ? 1 : 0)], esp->regs, SBUS_ESP_REG_SIZE); in esp_sbus_probe_one()
554 struct esp *esp = dev_get_drvdata(&op->dev); in esp_sbus_remove() local
555 struct platform_device *dma_of = esp->dma; in esp_sbus_remove()
556 unsigned int irq = esp->host->irq; in esp_sbus_remove()
560 scsi_esp_unregister(esp); in esp_sbus_remove()
566 free_irq(irq, esp); in esp_sbus_remove()
568 is_hme = (esp->dmarev == dvmahme); in esp_sbus_remove()
571 esp->command_block, in esp_sbus_remove()
572 esp->command_block_dma); in esp_sbus_remove()
573 of_iounmap(&op->resource[(is_hme ? 1 : 0)], esp->regs, in esp_sbus_remove()
575 of_iounmap(&dma_of->resource[0], esp->dma_regs, in esp_sbus_remove()
578 scsi_host_put(esp->host); in esp_sbus_remove()