Lines Matching refs:host

128 static struct mxcmci_host *host = &mxcmci_host;  variable
130 static inline int mxcmci_use_dma(struct mxcmci_host *host) in mxcmci_use_dma() argument
132 return host->do_dma; in mxcmci_use_dma()
135 static void mxcmci_softreset(struct mxcmci_host *host) in mxcmci_softreset() argument
140 writel(STR_STP_CLK_RESET, &host->base->str_stp_clk); in mxcmci_softreset()
142 &host->base->str_stp_clk); in mxcmci_softreset()
145 writel(STR_STP_CLK_START_CLK, &host->base->str_stp_clk); in mxcmci_softreset()
147 writel(0xff, &host->base->res_to); in mxcmci_softreset()
150 static void mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) in mxcmci_setup_data() argument
156 host->data = data; in mxcmci_setup_data()
158 writel(nob, &host->base->nob); in mxcmci_setup_data()
159 writel(blksz, &host->base->blk_len); in mxcmci_setup_data()
160 host->datasize = datasize; in mxcmci_setup_data()
163 static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_cmd *cmd, in mxcmci_start_cmd() argument
166 if (host->cmd != NULL) in mxcmci_start_cmd()
168 host->cmd = cmd; in mxcmci_start_cmd()
189 writel(cmd->cmdidx, &host->base->cmd); in mxcmci_start_cmd()
190 writel(cmd->cmdarg, &host->base->arg); in mxcmci_start_cmd()
191 writel(cmdat, &host->base->cmd_dat_cont); in mxcmci_start_cmd()
196 static void mxcmci_finish_request(struct mxcmci_host *host, in mxcmci_finish_request() argument
199 host->cmd = NULL; in mxcmci_finish_request()
200 host->data = NULL; in mxcmci_finish_request()
203 static int mxcmci_finish_data(struct mxcmci_host *host, unsigned int stat) in mxcmci_finish_data() argument
225 host->data = NULL; in mxcmci_finish_data()
230 static int mxcmci_read_response(struct mxcmci_host *host, unsigned int stat) in mxcmci_read_response() argument
232 struct mmc_cmd *cmd = host->cmd; in mxcmci_read_response()
251 a = readl(&host->base->res_fifo) & 0xFFFF; in mxcmci_read_response()
252 b = readl(&host->base->res_fifo) & 0xFFFF; in mxcmci_read_response()
256 a = readl(&host->base->res_fifo) & 0xFFFF; in mxcmci_read_response()
257 b = readl(&host->base->res_fifo) & 0xFFFF; in mxcmci_read_response()
258 c = readl(&host->base->res_fifo) & 0xFFFF; in mxcmci_read_response()
265 static int mxcmci_poll_status(struct mxcmci_host *host, u32 mask) in mxcmci_poll_status() argument
271 stat = readl(&host->base->status); in mxcmci_poll_status()
281 static int mxcmci_pull(struct mxcmci_host *host, void *_buf, int bytes) in mxcmci_pull() argument
287 stat = mxcmci_poll_status(host, in mxcmci_pull()
291 *buf++ = readl(&host->base->buffer_access); in mxcmci_pull()
299 stat = mxcmci_poll_status(host, in mxcmci_pull()
303 tmp = readl(&host->base->buffer_access); in mxcmci_pull()
310 static int mxcmci_push(struct mxcmci_host *host, const void *_buf, int bytes) in mxcmci_push() argument
316 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
319 writel(*buf++, &host->base->buffer_access); in mxcmci_push()
327 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
332 writel(tmp, &host->base->buffer_access); in mxcmci_push()
335 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
342 static int mxcmci_transfer_data(struct mxcmci_host *host) in mxcmci_transfer_data() argument
344 struct mmc_data *data = host->data; in mxcmci_transfer_data()
349 host->datasize = 0; in mxcmci_transfer_data()
352 stat = mxcmci_pull(host, data->dest, length); in mxcmci_transfer_data()
355 host->datasize += length; in mxcmci_transfer_data()
357 stat = mxcmci_push(host, (const void *)(data->src), length); in mxcmci_transfer_data()
360 host->datasize += length; in mxcmci_transfer_data()
361 stat = mxcmci_poll_status(host, STATUS_WRITE_OP_DONE); in mxcmci_transfer_data()
368 static int mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat) in mxcmci_cmd_done() argument
373 ret = mxcmci_read_response(host, stat); in mxcmci_cmd_done()
376 mxcmci_finish_request(host, host->cmd, host->data); in mxcmci_cmd_done()
380 if (!host->data) { in mxcmci_cmd_done()
381 mxcmci_finish_request(host, host->cmd, host->data); in mxcmci_cmd_done()
385 datastat = mxcmci_transfer_data(host); in mxcmci_cmd_done()
386 ret = mxcmci_finish_data(host, datastat); in mxcmci_cmd_done()
387 mxcmci_finish_request(host, host->cmd, host->data); in mxcmci_cmd_done()
394 struct mxcmci_host *host = mmc->priv; in mxcmci_request() local
395 unsigned int cmdat = host->cmdat; in mxcmci_request()
399 host->cmdat &= ~CMD_DAT_CONT_INIT; in mxcmci_request()
401 mxcmci_setup_data(host, data); in mxcmci_request()
409 if ((ret = mxcmci_start_cmd(host, cmd, cmdat))) { in mxcmci_request()
410 mxcmci_finish_request(host, cmd, data); in mxcmci_request()
415 stat = readl(&host->base->status); in mxcmci_request()
416 writel(stat, &host->base->status); in mxcmci_request()
419 return mxcmci_cmd_done(host, stat); in mxcmci_request()
422 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios) in mxcmci_set_clk_rate() argument
449 writel((prescaler << 4) | divider, &host->base->clk_rate); in mxcmci_set_clk_rate()
454 struct mxcmci_host *host = mmc->priv; in mxcmci_set_ios() local
456 host->cmdat |= CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
458 host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
461 mxcmci_set_clk_rate(host, mmc->clock); in mxcmci_set_ios()
462 writel(STR_STP_CLK_START_CLK, &host->base->str_stp_clk); in mxcmci_set_ios()
464 writel(STR_STP_CLK_STOP_CLK, &host->base->str_stp_clk); in mxcmci_set_ios()
467 host->clock = mmc->clock; in mxcmci_set_ios()
474 struct mxcmci_host *host = mmc->priv; in mxcmci_init() local
476 mxcmci_softreset(host); in mxcmci_init()
478 host->rev_no = readl(&host->base->rev_no); in mxcmci_init()
479 if (host->rev_no != 0x400) { in mxcmci_init()
481 host->rev_no); in mxcmci_init()
486 writel(0x2db4, &host->base->read_to); in mxcmci_init()
488 writel(0, &host->base->int_cntr); in mxcmci_init()
509 host->base = (struct mxcmci_regs *)CONFIG_MXC_MCI_REGS_BASE; in mxcmci_initialize()
514 host->mmc = mmc_create(&mxcmci_cfg, host); in mxcmci_initialize()
515 if (host->mmc == NULL) in mxcmci_initialize()