Lines Matching full:host
2 * OMAP on-chip MMC/SD host emulation.
80 static void omap_mmc_fifolevel_update(OMAPMMCState *host) in omap_mmc_fifolevel_update() argument
82 if (!host->transfer && !host->fifo_len) { in omap_mmc_fifolevel_update()
83 host->status &= 0xf3ff; in omap_mmc_fifolevel_update()
87 if (host->fifo_len > host->af_level && host->ddir) { in omap_mmc_fifolevel_update()
88 if (host->rx_dma) { in omap_mmc_fifolevel_update()
89 host->status &= 0xfbff; in omap_mmc_fifolevel_update()
90 qemu_irq_raise(host->dma_rx_gpio); in omap_mmc_fifolevel_update()
92 host->status |= 0x0400; in omap_mmc_fifolevel_update()
94 host->status &= 0xfbff; in omap_mmc_fifolevel_update()
95 qemu_irq_lower(host->dma_rx_gpio); in omap_mmc_fifolevel_update()
98 if (host->fifo_len < host->ae_level && !host->ddir) { in omap_mmc_fifolevel_update()
99 if (host->tx_dma) { in omap_mmc_fifolevel_update()
100 host->status &= 0xf7ff; in omap_mmc_fifolevel_update()
101 qemu_irq_raise(host->dma_tx_gpio); in omap_mmc_fifolevel_update()
103 host->status |= 0x0800; in omap_mmc_fifolevel_update()
105 qemu_irq_lower(host->dma_tx_gpio); in omap_mmc_fifolevel_update()
106 host->status &= 0xf7ff; in omap_mmc_fifolevel_update()
128 static void omap_mmc_command(OMAPMMCState *host, int cmd, int dir, in omap_mmc_command() argument
138 host->status |= 0x0001; in omap_mmc_command()
146 host->fifo_start = 0; in omap_mmc_command()
147 host->fifo_len = 0; in omap_mmc_command()
148 host->transfer = 1; in omap_mmc_command()
149 host->ddir = dir; in omap_mmc_command()
151 host->transfer = 0; in omap_mmc_command()
157 request.arg = host->arg; in omap_mmc_command()
160 rsplen = sdbus_do_command(&host->sdbus, &request, response); in omap_mmc_command()
181 if (host->sdio & (1 << 13)) in omap_mmc_command()
203 host->status &= 0xe000; in omap_mmc_command()
205 host->status |= 0x1000; in omap_mmc_command()
220 host->status |= 0x4000; in omap_mmc_command()
222 host->status &= 0xb000; in omap_mmc_command()
226 host->rsp[~rsplen & 7] = response[(rsplen << 1) | 1] | in omap_mmc_command()
230 host->status |= 0x0080; in omap_mmc_command()
232 host->status |= 0x0005; /* Makes it more real */ in omap_mmc_command()
234 host->status |= 0x0001; in omap_mmc_command()
237 static void omap_mmc_transfer(OMAPMMCState *host) in omap_mmc_transfer() argument
241 if (!host->transfer) in omap_mmc_transfer()
245 if (host->ddir) { in omap_mmc_transfer()
246 if (host->fifo_len > host->af_level) in omap_mmc_transfer()
249 value = sdbus_read_byte(&host->sdbus); in omap_mmc_transfer()
250 host->fifo[(host->fifo_start + host->fifo_len) & 31] = value; in omap_mmc_transfer()
251 if (-- host->blen_counter) { in omap_mmc_transfer()
252 value = sdbus_read_byte(&host->sdbus); in omap_mmc_transfer()
253 host->fifo[(host->fifo_start + host->fifo_len) & 31] |= in omap_mmc_transfer()
255 host->blen_counter --; in omap_mmc_transfer()
258 host->fifo_len ++; in omap_mmc_transfer()
260 if (!host->fifo_len) in omap_mmc_transfer()
263 value = host->fifo[host->fifo_start] & 0xff; in omap_mmc_transfer()
264 sdbus_write_byte(&host->sdbus, value); in omap_mmc_transfer()
265 if (-- host->blen_counter) { in omap_mmc_transfer()
266 value = host->fifo[host->fifo_start] >> 8; in omap_mmc_transfer()
267 sdbus_write_byte(&host->sdbus, value); in omap_mmc_transfer()
268 host->blen_counter --; in omap_mmc_transfer()
271 host->fifo_start ++; in omap_mmc_transfer()
272 host->fifo_len --; in omap_mmc_transfer()
273 host->fifo_start &= 31; in omap_mmc_transfer()
276 if (host->blen_counter == 0) { in omap_mmc_transfer()
277 host->nblk_counter --; in omap_mmc_transfer()
278 host->blen_counter = host->blen; in omap_mmc_transfer()
280 if (host->nblk_counter == 0) { in omap_mmc_transfer()
281 host->nblk_counter = host->nblk; in omap_mmc_transfer()
282 host->transfer = 0; in omap_mmc_transfer()
283 host->status |= 0x0008; in omap_mmc_transfer()
298 static void omap_mmc_pseudo_reset(OMAPMMCState *host) in omap_mmc_pseudo_reset() argument
300 host->status = 0; in omap_mmc_pseudo_reset()
301 host->fifo_len = 0; in omap_mmc_pseudo_reset()
304 static void omap_mmc_reset(OMAPMMCState *host) in omap_mmc_reset() argument
306 host->last_cmd = 0; in omap_mmc_reset()
307 memset(host->rsp, 0, sizeof(host->rsp)); in omap_mmc_reset()
308 host->arg = 0; in omap_mmc_reset()
309 host->dw = 0; in omap_mmc_reset()
310 host->mode = 0; in omap_mmc_reset()
311 host->enable = 0; in omap_mmc_reset()
312 host->mask = 0; in omap_mmc_reset()
313 host->cto = 0; in omap_mmc_reset()
314 host->dto = 0; in omap_mmc_reset()
315 host->blen = 0; in omap_mmc_reset()
316 host->blen_counter = 0; in omap_mmc_reset()
317 host->nblk = 0; in omap_mmc_reset()
318 host->nblk_counter = 0; in omap_mmc_reset()
319 host->tx_dma = 0; in omap_mmc_reset()
320 host->rx_dma = 0; in omap_mmc_reset()
321 host->ae_level = 0x00; in omap_mmc_reset()
322 host->af_level = 0x1f; in omap_mmc_reset()
323 host->transfer = 0; in omap_mmc_reset()
324 host->cdet_wakeup = 0; in omap_mmc_reset()
325 host->cdet_enable = 0; in omap_mmc_reset()
326 host->clkdiv = 0; in omap_mmc_reset()
328 omap_mmc_pseudo_reset(host); in omap_mmc_reset()