Lines Matching refs:host

58 #define GOLDFISH_MMC_READ(host, addr)   (readl(host->reg_base + addr))  argument
59 #define GOLDFISH_MMC_WRITE(host, addr, x) (writel(x, host->reg_base + addr)) argument
135 goldfish_mmc_cover_is_open(struct goldfish_mmc_host *host) in goldfish_mmc_cover_is_open() argument
144 struct goldfish_mmc_host *host = dev_get_drvdata(dev); in goldfish_mmc_show_cover_switch() local
146 return sprintf(buf, "%s\n", goldfish_mmc_cover_is_open(host) ? "open" : in goldfish_mmc_show_cover_switch()
153 goldfish_mmc_start_command(struct goldfish_mmc_host *host, struct mmc_command *cmd) in goldfish_mmc_start_command() argument
159 host->cmd = cmd; in goldfish_mmc_start_command()
180 dev_err(mmc_dev(host->mmc), in goldfish_mmc_start_command()
196 if (host->bus_mode == MMC_BUSMODE_OPENDRAIN) in goldfish_mmc_start_command()
202 if (host->data && !(host->data->flags & MMC_DATA_WRITE)) in goldfish_mmc_start_command()
205 GOLDFISH_MMC_WRITE(host, MMC_ARG, cmd->arg); in goldfish_mmc_start_command()
206 GOLDFISH_MMC_WRITE(host, MMC_CMD, cmdreg); in goldfish_mmc_start_command()
209 static void goldfish_mmc_xfer_done(struct goldfish_mmc_host *host, in goldfish_mmc_xfer_done() argument
212 if (host->dma_in_use) { in goldfish_mmc_xfer_done()
226 memcpy(dest, host->virt_base, data->sg->length); in goldfish_mmc_xfer_done()
228 host->data->bytes_xfered += data->sg->length; in goldfish_mmc_xfer_done()
229 dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->sg_len, in goldfish_mmc_xfer_done()
233 host->data = NULL; in goldfish_mmc_xfer_done()
234 host->sg_len = 0; in goldfish_mmc_xfer_done()
243 host->mrq = NULL; in goldfish_mmc_xfer_done()
244 mmc_request_done(host->mmc, data->mrq); in goldfish_mmc_xfer_done()
248 goldfish_mmc_start_command(host, data->stop); in goldfish_mmc_xfer_done()
251 static void goldfish_mmc_end_of_data(struct goldfish_mmc_host *host, in goldfish_mmc_end_of_data() argument
254 if (!host->dma_in_use) { in goldfish_mmc_end_of_data()
255 goldfish_mmc_xfer_done(host, data); in goldfish_mmc_end_of_data()
258 if (host->dma_done) in goldfish_mmc_end_of_data()
259 goldfish_mmc_xfer_done(host, data); in goldfish_mmc_end_of_data()
262 static void goldfish_mmc_cmd_done(struct goldfish_mmc_host *host, in goldfish_mmc_cmd_done() argument
265 host->cmd = NULL; in goldfish_mmc_cmd_done()
270 GOLDFISH_MMC_READ(host, MMC_RESP_0); in goldfish_mmc_cmd_done()
272 GOLDFISH_MMC_READ(host, MMC_RESP_1); in goldfish_mmc_cmd_done()
274 GOLDFISH_MMC_READ(host, MMC_RESP_2); in goldfish_mmc_cmd_done()
276 GOLDFISH_MMC_READ(host, MMC_RESP_3); in goldfish_mmc_cmd_done()
280 GOLDFISH_MMC_READ(host, MMC_RESP_0); in goldfish_mmc_cmd_done()
284 if (host->data == NULL || cmd->error) { in goldfish_mmc_cmd_done()
285 host->mrq = NULL; in goldfish_mmc_cmd_done()
286 mmc_request_done(host->mmc, cmd->mrq); in goldfish_mmc_cmd_done()
292 struct goldfish_mmc_host *host = (struct goldfish_mmc_host *)dev_id; in goldfish_mmc_irq() local
300 while ((status = GOLDFISH_MMC_READ(host, MMC_INT_STATUS)) != 0) { in goldfish_mmc_irq()
301 GOLDFISH_MMC_WRITE(host, MMC_INT_STATUS, status); in goldfish_mmc_irq()
319 struct mmc_request *mrq = host->mrq; in goldfish_mmc_irq()
321 host->mrq = NULL; in goldfish_mmc_irq()
322 mmc_request_done(host->mmc, mrq); in goldfish_mmc_irq()
326 goldfish_mmc_cmd_done(host, host->cmd); in goldfish_mmc_irq()
329 goldfish_mmc_xfer_done(host, host->data); in goldfish_mmc_irq()
331 host->dma_done = 1; in goldfish_mmc_irq()
332 goldfish_mmc_end_of_data(host, host->data); in goldfish_mmc_irq()
333 } else if (host->data != NULL) { in goldfish_mmc_irq()
342 host->dma_done = 1; in goldfish_mmc_irq()
343 goldfish_mmc_end_of_data(host, host->data); in goldfish_mmc_irq()
347 u32 state = GOLDFISH_MMC_READ(host, MMC_STATE); in goldfish_mmc_irq()
350 mmc_detect_change(host->mmc, 0); in goldfish_mmc_irq()
355 status = GOLDFISH_MMC_READ(host, MMC_INT_STATUS); in goldfish_mmc_irq()
356 dev_info(mmc_dev(host->mmc),"spurious irq 0x%04x\n", status); in goldfish_mmc_irq()
358 GOLDFISH_MMC_WRITE(host, MMC_INT_STATUS, status); in goldfish_mmc_irq()
359 GOLDFISH_MMC_WRITE(host, MMC_INT_ENABLE, 0); in goldfish_mmc_irq()
366 static void goldfish_mmc_prepare_data(struct goldfish_mmc_host *host, in goldfish_mmc_prepare_data() argument
374 host->data = data; in goldfish_mmc_prepare_data()
376 GOLDFISH_MMC_WRITE(host, MMC_BLOCK_LENGTH, 0); in goldfish_mmc_prepare_data()
377 GOLDFISH_MMC_WRITE(host, MMC_BLOCK_COUNT, 0); in goldfish_mmc_prepare_data()
378 host->dma_in_use = 0; in goldfish_mmc_prepare_data()
384 GOLDFISH_MMC_WRITE(host, MMC_BLOCK_COUNT, data->blocks - 1); in goldfish_mmc_prepare_data()
385 GOLDFISH_MMC_WRITE(host, MMC_BLOCK_LENGTH, block_size - 1); in goldfish_mmc_prepare_data()
398 host->sg_len = dma_map_sg(mmc_dev(host->mmc), data->sg, in goldfish_mmc_prepare_data()
400 host->dma_done = 0; in goldfish_mmc_prepare_data()
401 host->dma_in_use = 1; in goldfish_mmc_prepare_data()
409 memcpy(host->virt_base, src, data->sg->length); in goldfish_mmc_prepare_data()
415 struct goldfish_mmc_host *host = mmc_priv(mmc); in goldfish_mmc_request() local
417 WARN_ON(host->mrq != NULL); in goldfish_mmc_request()
419 host->mrq = req; in goldfish_mmc_request()
420 goldfish_mmc_prepare_data(host, req); in goldfish_mmc_request()
421 goldfish_mmc_start_command(host, req->cmd); in goldfish_mmc_request()
434 struct goldfish_mmc_host *host = mmc_priv(mmc); in goldfish_mmc_set_ios() local
436 host->bus_mode = ios->bus_mode; in goldfish_mmc_set_ios()
437 host->hw_bus_mode = host->bus_mode; in goldfish_mmc_set_ios()
443 struct goldfish_mmc_host *host = mmc_priv(mmc); in goldfish_mmc_get_ro() local
445 state = GOLDFISH_MMC_READ(host, MMC_STATE); in goldfish_mmc_get_ro()
458 struct goldfish_mmc_host *host = NULL; in goldfish_mmc_probe() local
475 host = mmc_priv(mmc); in goldfish_mmc_probe()
476 host->mmc = mmc; in goldfish_mmc_probe()
479 host->reg_base = ioremap(res->start, resource_size(res)); in goldfish_mmc_probe()
480 if (host->reg_base == NULL) { in goldfish_mmc_probe()
484 host->virt_base = dma_alloc_coherent(&pdev->dev, BUFFER_SIZE, in goldfish_mmc_probe()
487 if (host->virt_base == 0) { in goldfish_mmc_probe()
491 host->phys_base = buf_addr; in goldfish_mmc_probe()
493 host->id = pdev->id; in goldfish_mmc_probe()
494 host->irq = irq; in goldfish_mmc_probe()
512 ret = request_irq(host->irq, goldfish_mmc_irq, 0, DRIVER_NAME, host); in goldfish_mmc_probe()
518 host->dev = &pdev->dev; in goldfish_mmc_probe()
519 platform_set_drvdata(pdev, host); in goldfish_mmc_probe()
523 dev_warn(mmc_dev(host->mmc), in goldfish_mmc_probe()
526 GOLDFISH_MMC_WRITE(host, MMC_SET_BUFFER, host->phys_base); in goldfish_mmc_probe()
527 GOLDFISH_MMC_WRITE(host, MMC_INT_ENABLE, in goldfish_mmc_probe()
535 dma_free_coherent(&pdev->dev, BUFFER_SIZE, host->virt_base, in goldfish_mmc_probe()
536 host->phys_base); in goldfish_mmc_probe()
538 iounmap(host->reg_base); in goldfish_mmc_probe()
540 mmc_free_host(host->mmc); in goldfish_mmc_probe()
547 struct goldfish_mmc_host *host = platform_get_drvdata(pdev); in goldfish_mmc_remove() local
549 BUG_ON(host == NULL); in goldfish_mmc_remove()
551 mmc_remove_host(host->mmc); in goldfish_mmc_remove()
552 free_irq(host->irq, host); in goldfish_mmc_remove()
553 dma_free_coherent(&pdev->dev, BUFFER_SIZE, host->virt_base, host->phys_base); in goldfish_mmc_remove()
554 iounmap(host->reg_base); in goldfish_mmc_remove()
555 mmc_free_host(host->mmc); in goldfish_mmc_remove()