1/*-
2 * Copyright (c) 2011 Jakub Wojciech Klama <jceel@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 11 unchanged lines hidden (view full) ---
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/arm/lpc/lpc_mmc.c 260326 2014-01-05 18:40:06Z ian $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bio.h>
33#include <sys/bus.h>
34#include <sys/conf.h>
35#include <sys/endian.h>
36#include <sys/kernel.h>
--- 465 unchanged lines hidden (view full) ---
502 sc->lm_xfer_done = 0;
503
504 debugf("data: %p, len: %d, %s\n", data,
505 data->len, (data->flags & MMC_DATA_READ) ? "read" : "write");
506
507 if (data->flags & MMC_DATA_READ) {
508 sc->lm_xfer_direction = DIRECTION_READ;
509 lpc_dmac_setup_transfer(sc->lm_dev, LPC_MMC_DMACH_READ,
510 LPC_SD_PHYS_BASE + LPC_SD_FIFO, sc->lm_buffer_phys,
511 data_words, 0);
512 }
513
514 if (data->flags & MMC_DATA_WRITE) {
515 sc->lm_xfer_direction = DIRECTION_WRITE;
516 lpc_dmac_setup_transfer(sc->lm_dev, LPC_MMC_DMACH_WRITE,
517 sc->lm_buffer_phys, LPC_SD_PHYS_BASE + LPC_SD_FIFO,
518 data_words, 0);
519 }
520
521 datactrl |= (sc->lm_xfer_direction
522 ? LPC_SD_DATACTRL_WRITE
523 : LPC_SD_DATACTRL_READ);
524
525 datactrl |= LPC_SD_DATACTRL_DMAENABLE | LPC_SD_DATACTRL_ENABLE;
--- 248 unchanged lines hidden ---
2 * Copyright (c) 2011 Jakub Wojciech Klama <jceel@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 11 unchanged lines hidden (view full) ---
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/arm/lpc/lpc_mmc.c 260326 2014-01-05 18:40:06Z ian $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bio.h>
33#include <sys/bus.h>
34#include <sys/conf.h>
35#include <sys/endian.h>
36#include <sys/kernel.h>
--- 465 unchanged lines hidden (view full) ---
502 sc->lm_xfer_done = 0;
503
504 debugf("data: %p, len: %d, %s\n", data,
505 data->len, (data->flags & MMC_DATA_READ) ? "read" : "write");
506
507 if (data->flags & MMC_DATA_READ) {
508 sc->lm_xfer_direction = DIRECTION_READ;
509 lpc_dmac_setup_transfer(sc->lm_dev, LPC_MMC_DMACH_READ,
510 LPC_SD_PHYS_BASE + LPC_SD_FIFO, sc->lm_buffer_phys,
511 data_words, 0);
512 }
513
514 if (data->flags & MMC_DATA_WRITE) {
515 sc->lm_xfer_direction = DIRECTION_WRITE;
516 lpc_dmac_setup_transfer(sc->lm_dev, LPC_MMC_DMACH_WRITE,
517 sc->lm_buffer_phys, LPC_SD_PHYS_BASE + LPC_SD_FIFO,
518 data_words, 0);
519 }
520
521 datactrl |= (sc->lm_xfer_direction
522 ? LPC_SD_DATACTRL_WRITE
523 : LPC_SD_DATACTRL_READ);
524
525 datactrl |= LPC_SD_DATACTRL_DMAENABLE | LPC_SD_DATACTRL_ENABLE;
--- 248 unchanged lines hidden ---