6 #include <linux/kernel.h>
8 #include <linux/types.h>
10 #include <linux/module.h>
22 #define DMA_CSR 0x00UL
23 #define DMA_ADDR 0x04UL
24 #define DMA_COUNT 0x08UL
25 #define DMA_TEST 0x0cUL
31 #define DRV_MODULE_NAME "sun3x_esp"
32 #define PFX DRV_MODULE_NAME ": "
33 #define DRV_VERSION "1.000"
34 #define DRV_MODULE_RELDATE "Nov 1, 2007"
42 #define dma_read32(REG) \
43 readl(esp->dma_regs + (REG))
44 #define dma_write32(VAL, REG) \
45 writel((VAL), esp->dma_regs + (REG))
47 #define dma_read32(REG) \
48 *(volatile u32 *)(esp->dma_regs + (REG))
49 #define dma_write32(VAL, REG) \
50 do { *(volatile u32 *)(esp->dma_regs + (REG)) = (VAL); } while (0)
53 static void sun3x_esp_write8(
struct esp *
esp,
u8 val,
unsigned long reg)
58 static u8 sun3x_esp_read8(
struct esp *
esp,
unsigned long reg)
87 static int sun3x_esp_irq_pending(
struct esp *
esp)
94 static void sun3x_esp_reset_dma(
struct esp *esp)
107 static void sun3x_esp_dma_drain(
struct esp *esp)
122 esp->
host->unique_id);
129 static void sun3x_esp_dma_invalidate(
struct esp *esp)
138 "invalidate!\n", esp->
host->unique_id);
151 static void sun3x_esp_send_dma_cmd(
struct esp *esp,
u32 addr,
u32 esp_count,
158 sun3x_esp_write8(esp, (esp_count >> 0) & 0xff,
ESP_TCLOW);
159 sun3x_esp_write8(esp, (esp_count >> 8) & 0xff,
ESP_TCMED);
172 static int sun3x_esp_dma_error(
struct esp *esp)
183 .esp_write8 = sun3x_esp_write8,
184 .esp_read8 = sun3x_esp_read8,
185 .map_single = sun3x_esp_map_single,
186 .map_sg = sun3x_esp_map_sg,
187 .unmap_single = sun3x_esp_unmap_single,
188 .unmap_sg = sun3x_esp_unmap_sg,
189 .irq_pending = sun3x_esp_irq_pending,
190 .reset_dma = sun3x_esp_reset_dma,
191 .dma_drain = sun3x_esp_dma_drain,
192 .dma_invalidate = sun3x_esp_dma_invalidate,
193 .send_dma_cmd = sun3x_esp_send_dma_cmd,
194 .dma_error = sun3x_esp_dma_error,
210 esp = shost_priv(host);
214 esp->
ops = &sun3x_esp_ops;
217 if (!res || !res->
start)
222 goto fail_unmap_regs;
225 if (!res || !res->
start)
226 goto fail_unmap_regs;
234 goto fail_unmap_regs_dma;
240 goto fail_unmap_command_block;
245 esp->
cfreq = 20000000;
257 fail_unmap_command_block:
274 unsigned int irq = esp->
host->irq;
294 .probe = esp_sun3x_probe,
302 static int __init sun3x_esp_init(
void)
307 static void __exit sun3x_esp_exit(
void)