Lines Matching +full:clk +full:- +full:csr
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * linux/drivers/mmc/host/wbsd.c - Winbond W83L51xD SD/MMC driver
5 * Copyright (C) 2004-2007 Pierre Ossman, All Rights Reserved.
12 * - FIFO size field in FSR is always zero.
14 * - FIFO interrupts tend not to work as they should. Interrupts are
17 * - On APIC systems the FIFO empty interrupt is sometimes lost.
26 #include <linux/dma-mapping.h>
86 BUG_ON(host->config == 0); in wbsd_unlock_config()
88 outb(host->unlock_code, host->config); in wbsd_unlock_config()
89 outb(host->unlock_code, host->config); in wbsd_unlock_config()
94 BUG_ON(host->config == 0); in wbsd_lock_config()
96 outb(LOCK_CODE, host->config); in wbsd_lock_config()
101 BUG_ON(host->config == 0); in wbsd_write_config()
103 outb(reg, host->config); in wbsd_write_config()
104 outb(value, host->config + 1); in wbsd_write_config()
109 BUG_ON(host->config == 0); in wbsd_read_config()
111 outb(reg, host->config); in wbsd_read_config()
112 return inb(host->config + 1); in wbsd_read_config()
117 outb(index, host->base + WBSD_IDXR); in wbsd_write_index()
118 outb(value, host->base + WBSD_DATAR); in wbsd_write_index()
123 outb(index, host->base + WBSD_IDXR); in wbsd_read_index()
124 return inb(host->base + WBSD_DATAR); in wbsd_read_index()
147 host->flags &= ~WBSD_FIGNORE_DETECT; in wbsd_init_device()
152 host->clk = wbsd_read_index(host, WBSD_IDX_CLK); in wbsd_init_device()
157 outb(WBSD_POWER_N, host->base + WBSD_CSR); in wbsd_init_device()
167 if (inb(host->base + WBSD_CSR) & WBSD_CARDPRESENT) in wbsd_init_device()
168 host->flags |= WBSD_FCARD_PRESENT; in wbsd_init_device()
170 host->flags &= ~WBSD_FCARD_PRESENT; in wbsd_init_device()
182 outb(ier, host->base + WBSD_EIR); in wbsd_init_device()
187 inb(host->base + WBSD_ISR); in wbsd_init_device()
194 pr_err("%s: Resetting chip\n", mmc_hostname(host->mmc)); in wbsd_reset()
208 if (host->dma >= 0) { in wbsd_request_end()
213 disable_dma(host->dma); in wbsd_request_end()
214 clear_dma_ff(host->dma); in wbsd_request_end()
223 host->mrq = NULL; in wbsd_request_end()
228 spin_unlock(&host->lock); in wbsd_request_end()
229 mmc_request_done(host->mmc, mrq); in wbsd_request_end()
230 spin_lock(&host->lock); in wbsd_request_end()
242 host->cur_sg = data->sg; in wbsd_init_sg()
243 host->num_sg = data->sg_len; in wbsd_init_sg()
245 host->offset = 0; in wbsd_init_sg()
246 host->remain = host->cur_sg->length; in wbsd_init_sg()
254 host->cur_sg++; in wbsd_next_sg()
255 host->num_sg--; in wbsd_next_sg()
260 if (host->num_sg > 0) { in wbsd_next_sg()
261 host->offset = 0; in wbsd_next_sg()
262 host->remain = host->cur_sg->length; in wbsd_next_sg()
265 return host->num_sg; in wbsd_next_sg()
270 return kmap_local_page(sg_page(host->cur_sg)) + host->cur_sg->offset; in wbsd_map_sg()
278 for (i = 0; i < data->sg_len; i++) in wbsd_sg_to_dma()
279 len += data->sg[i].length; in wbsd_sg_to_dma()
280 sg_copy_to_buffer(data->sg, data->sg_len, host->dma_buffer, len); in wbsd_sg_to_dma()
288 for (i = 0; i < data->sg_len; i++) in wbsd_dma_to_sg()
289 len += data->sg[i].length; in wbsd_dma_to_sg()
290 sg_copy_from_buffer(data->sg, data->sg_len, host->dma_buffer, len); in wbsd_dma_to_sg()
304 cmd->error = -EILSEQ; in wbsd_get_short_reply()
308 cmd->resp[0] = wbsd_read_index(host, WBSD_IDX_RESP12) << 24; in wbsd_get_short_reply()
309 cmd->resp[0] |= wbsd_read_index(host, WBSD_IDX_RESP13) << 16; in wbsd_get_short_reply()
310 cmd->resp[0] |= wbsd_read_index(host, WBSD_IDX_RESP14) << 8; in wbsd_get_short_reply()
311 cmd->resp[0] |= wbsd_read_index(host, WBSD_IDX_RESP15) << 0; in wbsd_get_short_reply()
312 cmd->resp[1] = wbsd_read_index(host, WBSD_IDX_RESP16) << 24; in wbsd_get_short_reply()
324 cmd->error = -EILSEQ; in wbsd_get_long_reply()
329 cmd->resp[i] = in wbsd_get_long_reply()
331 cmd->resp[i] |= in wbsd_get_long_reply()
333 cmd->resp[i] |= in wbsd_get_long_reply()
335 cmd->resp[i] |= in wbsd_get_long_reply()
350 host->isr = 0; in wbsd_send_command()
355 outb(cmd->opcode, host->base + WBSD_CMDR); in wbsd_send_command()
356 for (i = 3; i >= 0; i--) in wbsd_send_command()
357 outb((cmd->arg >> (i * 8)) & 0xff, host->base + WBSD_CMDR); in wbsd_send_command()
359 cmd->error = 0; in wbsd_send_command()
371 if (cmd->flags & MMC_RSP_PRESENT) { in wbsd_send_command()
375 isr = host->isr; in wbsd_send_command()
379 cmd->error = -ENOMEDIUM; in wbsd_send_command()
382 cmd->error = -ETIMEDOUT; in wbsd_send_command()
384 else if ((cmd->flags & MMC_RSP_CRC) && (isr & WBSD_INT_CRC)) in wbsd_send_command()
385 cmd->error = -EILSEQ; in wbsd_send_command()
388 if (cmd->flags & MMC_RSP_136) in wbsd_send_command()
402 struct mmc_data *data = host->mrq->cmd->data; in wbsd_empty_fifo()
409 if (host->num_sg == 0) in wbsd_empty_fifo()
412 buffer = wbsd_map_sg(host) + host->offset; in wbsd_empty_fifo()
419 while (!((fsr = inb(host->base + WBSD_FSR)) & WBSD_FIFO_EMPTY)) { in wbsd_empty_fifo()
432 buffer[idx++] = inb(host->base + WBSD_DFR); in wbsd_empty_fifo()
433 host->offset++; in wbsd_empty_fifo()
434 host->remain--; in wbsd_empty_fifo()
436 data->bytes_xfered++; in wbsd_empty_fifo()
441 if (host->remain == 0) { in wbsd_empty_fifo()
461 if ((data->blocks * data->blksz - data->bytes_xfered) < 16) in wbsd_empty_fifo()
462 queue_work(system_bh_wq, &host->fifo_bh_work); in wbsd_empty_fifo()
467 struct mmc_data *data = host->mrq->cmd->data; in wbsd_fill_fifo()
475 if (host->num_sg == 0) in wbsd_fill_fifo()
478 buffer = wbsd_map_sg(host) + host->offset; in wbsd_fill_fifo()
485 while (!((fsr = inb(host->base + WBSD_FSR)) & WBSD_FIFO_FULL)) { in wbsd_fill_fifo()
497 for (i = 16; i > fifo; i--) { in wbsd_fill_fifo()
498 outb(buffer[idx], host->base + WBSD_DFR); in wbsd_fill_fifo()
499 host->offset++; in wbsd_fill_fifo()
500 host->remain--; in wbsd_fill_fifo()
502 data->bytes_xfered++; in wbsd_fill_fifo()
507 if (host->remain == 0) { in wbsd_fill_fifo()
525 * need to be a bit more pro-active. in wbsd_fill_fifo()
527 queue_work(system_bh_wq, &host->fifo_bh_work); in wbsd_fill_fifo()
540 size = data->blocks * data->blksz; in wbsd_prepare_data()
546 if (data->timeout_ns > 127000000) in wbsd_prepare_data()
550 data->timeout_ns / 1000000); in wbsd_prepare_data()
553 if (data->timeout_clks > 255) in wbsd_prepare_data()
556 wbsd_write_index(host, WBSD_IDX_NSAC, data->timeout_clks); in wbsd_prepare_data()
566 if (host->bus_width == MMC_BUS_WIDTH_1) { in wbsd_prepare_data()
567 blksize = data->blksz + 2; in wbsd_prepare_data()
571 } else if (host->bus_width == MMC_BUS_WIDTH_4) { in wbsd_prepare_data()
572 blksize = data->blksz + 2 * 4; in wbsd_prepare_data()
578 data->error = -EINVAL; in wbsd_prepare_data()
594 if (host->dma >= 0) { in wbsd_prepare_data()
600 data->error = -EINVAL; in wbsd_prepare_data()
608 if (data->flags & MMC_DATA_WRITE) in wbsd_prepare_data()
615 disable_dma(host->dma); in wbsd_prepare_data()
616 clear_dma_ff(host->dma); in wbsd_prepare_data()
617 if (data->flags & MMC_DATA_READ) in wbsd_prepare_data()
618 set_dma_mode(host->dma, DMA_MODE_READ & ~0x40); in wbsd_prepare_data()
620 set_dma_mode(host->dma, DMA_MODE_WRITE & ~0x40); in wbsd_prepare_data()
621 set_dma_addr(host->dma, host->dma_addr); in wbsd_prepare_data()
622 set_dma_count(host->dma, size); in wbsd_prepare_data()
624 enable_dma(host->dma); in wbsd_prepare_data()
636 host->firsterr = 1; in wbsd_prepare_data()
652 if (data->flags & MMC_DATA_READ) { in wbsd_prepare_data()
662 data->error = 0; in wbsd_prepare_data()
671 WARN_ON(host->mrq == NULL); in wbsd_finish_data()
676 if (data->stop) in wbsd_finish_data()
677 wbsd_send_command(host, data->stop); in wbsd_finish_data()
690 if (host->dma >= 0) { in wbsd_finish_data()
700 disable_dma(host->dma); in wbsd_finish_data()
701 clear_dma_ff(host->dma); in wbsd_finish_data()
702 count = get_dma_residue(host->dma); in wbsd_finish_data()
705 data->bytes_xfered = host->mrq->data->blocks * in wbsd_finish_data()
706 host->mrq->data->blksz - count; in wbsd_finish_data()
707 data->bytes_xfered -= data->bytes_xfered % data->blksz; in wbsd_finish_data()
715 mmc_hostname(host->mmc), count); in wbsd_finish_data()
717 if (!data->error) in wbsd_finish_data()
718 data->error = -EIO; in wbsd_finish_data()
724 if (data->flags & MMC_DATA_READ) in wbsd_finish_data()
728 if (data->error) { in wbsd_finish_data()
729 if (data->bytes_xfered) in wbsd_finish_data()
730 data->bytes_xfered -= data->blksz; in wbsd_finish_data()
734 wbsd_request_end(host, host->mrq); in wbsd_finish_data()
751 spin_lock_bh(&host->lock); in wbsd_request()
753 BUG_ON(host->mrq != NULL); in wbsd_request()
755 cmd = mrq->cmd; in wbsd_request()
757 host->mrq = mrq; in wbsd_request()
762 if (!(host->flags & WBSD_FCARD_PRESENT)) { in wbsd_request()
763 cmd->error = -ENOMEDIUM; in wbsd_request()
767 if (cmd->data) { in wbsd_request()
774 switch (cmd->opcode) { in wbsd_request()
795 mmc_hostname(host->mmc), cmd->opcode); in wbsd_request()
796 cmd->error = -EINVAL; in wbsd_request()
805 if (cmd->data) { in wbsd_request()
806 wbsd_prepare_data(host, cmd->data); in wbsd_request()
808 if (cmd->data->error) in wbsd_request()
819 if (cmd->data && !cmd->error) { in wbsd_request()
823 if (host->dma == -1) in wbsd_request()
824 queue_work(system_bh_wq, &host->fifo_bh_work); in wbsd_request()
826 spin_unlock_bh(&host->lock); in wbsd_request()
834 spin_unlock_bh(&host->lock); in wbsd_request()
840 u8 clk, setup, pwr; in wbsd_set_ios() local
842 spin_lock_bh(&host->lock); in wbsd_set_ios()
848 if (ios->power_mode == MMC_POWER_OFF) in wbsd_set_ios()
851 if (ios->clock >= 24000000) in wbsd_set_ios()
852 clk = WBSD_CLK_24M; in wbsd_set_ios()
853 else if (ios->clock >= 16000000) in wbsd_set_ios()
854 clk = WBSD_CLK_16M; in wbsd_set_ios()
855 else if (ios->clock >= 12000000) in wbsd_set_ios()
856 clk = WBSD_CLK_12M; in wbsd_set_ios()
858 clk = WBSD_CLK_375K; in wbsd_set_ios()
864 if (clk != host->clk) { in wbsd_set_ios()
865 wbsd_write_index(host, WBSD_IDX_CLK, clk); in wbsd_set_ios()
866 host->clk = clk; in wbsd_set_ios()
872 if (ios->power_mode != MMC_POWER_OFF) { in wbsd_set_ios()
873 pwr = inb(host->base + WBSD_CSR); in wbsd_set_ios()
875 outb(pwr, host->base + WBSD_CSR); in wbsd_set_ios()
884 if (ios->chip_select == MMC_CS_HIGH) { in wbsd_set_ios()
885 BUG_ON(ios->bus_width != MMC_BUS_WIDTH_1); in wbsd_set_ios()
887 host->flags |= WBSD_FIGNORE_DETECT; in wbsd_set_ios()
896 mod_timer(&host->ignore_timer, jiffies + HZ / 100); in wbsd_set_ios()
905 host->bus_width = ios->bus_width; in wbsd_set_ios()
907 spin_unlock_bh(&host->lock); in wbsd_set_ios()
913 u8 csr; in wbsd_get_ro() local
915 spin_lock_bh(&host->lock); in wbsd_get_ro()
917 csr = inb(host->base + WBSD_CSR); in wbsd_get_ro()
918 csr |= WBSD_MSLED; in wbsd_get_ro()
919 outb(csr, host->base + WBSD_CSR); in wbsd_get_ro()
923 csr = inb(host->base + WBSD_CSR); in wbsd_get_ro()
924 csr &= ~WBSD_MSLED; in wbsd_get_ro()
925 outb(csr, host->base + WBSD_CSR); in wbsd_get_ro()
927 spin_unlock_bh(&host->lock); in wbsd_get_ro()
929 return !!(csr & WBSD_WRPT); in wbsd_get_ro()
956 spin_lock_bh(&host->lock); in wbsd_reset_ignore()
958 host->flags &= ~WBSD_FIGNORE_DETECT; in wbsd_reset_ignore()
964 queue_work(system_bh_wq, &host->card_bh_work); in wbsd_reset_ignore()
966 spin_unlock_bh(&host->lock); in wbsd_reset_ignore()
975 WARN_ON(!host->mrq); in wbsd_get_data()
976 if (!host->mrq) in wbsd_get_data()
979 WARN_ON(!host->mrq->cmd); in wbsd_get_data()
980 if (!host->mrq->cmd) in wbsd_get_data()
983 WARN_ON(!host->mrq->cmd->data); in wbsd_get_data()
984 if (!host->mrq->cmd->data) in wbsd_get_data()
987 return host->mrq->cmd->data; in wbsd_get_data()
993 u8 csr; in wbsd_card_bh_work() local
994 int delay = -1; in wbsd_card_bh_work()
996 spin_lock(&host->lock); in wbsd_card_bh_work()
998 if (host->flags & WBSD_FIGNORE_DETECT) { in wbsd_card_bh_work()
999 spin_unlock(&host->lock); in wbsd_card_bh_work()
1003 csr = inb(host->base + WBSD_CSR); in wbsd_card_bh_work()
1004 WARN_ON(csr == 0xff); in wbsd_card_bh_work()
1006 if (csr & WBSD_CARDPRESENT) { in wbsd_card_bh_work()
1007 if (!(host->flags & WBSD_FCARD_PRESENT)) { in wbsd_card_bh_work()
1009 host->flags |= WBSD_FCARD_PRESENT; in wbsd_card_bh_work()
1013 } else if (host->flags & WBSD_FCARD_PRESENT) { in wbsd_card_bh_work()
1015 host->flags &= ~WBSD_FCARD_PRESENT; in wbsd_card_bh_work()
1017 if (host->mrq) { in wbsd_card_bh_work()
1019 mmc_hostname(host->mmc)); in wbsd_card_bh_work()
1022 host->mrq->cmd->error = -ENOMEDIUM; in wbsd_card_bh_work()
1023 queue_work(system_bh_wq, &host->finish_bh_work); in wbsd_card_bh_work()
1033 spin_unlock(&host->lock); in wbsd_card_bh_work()
1035 if (delay != -1) in wbsd_card_bh_work()
1036 mmc_detect_change(host->mmc, msecs_to_jiffies(delay)); in wbsd_card_bh_work()
1044 spin_lock(&host->lock); in wbsd_fifo_bh_work()
1046 if (!host->mrq) in wbsd_fifo_bh_work()
1053 if (data->flags & MMC_DATA_WRITE) in wbsd_fifo_bh_work()
1061 if (host->num_sg == 0) { in wbsd_fifo_bh_work()
1063 queue_work(system_bh_wq, &host->finish_bh_work); in wbsd_fifo_bh_work()
1067 spin_unlock(&host->lock); in wbsd_fifo_bh_work()
1075 spin_lock(&host->lock); in wbsd_crc_bh_work()
1077 if (!host->mrq) in wbsd_crc_bh_work()
1086 data->error = -EILSEQ; in wbsd_crc_bh_work()
1088 queue_work(system_bh_wq, &host->finish_bh_work); in wbsd_crc_bh_work()
1091 spin_unlock(&host->lock); in wbsd_crc_bh_work()
1099 spin_lock(&host->lock); in wbsd_timeout_bh_work()
1101 if (!host->mrq) in wbsd_timeout_bh_work()
1110 data->error = -ETIMEDOUT; in wbsd_timeout_bh_work()
1112 queue_work(system_bh_wq, &host->finish_bh_work); in wbsd_timeout_bh_work()
1115 spin_unlock(&host->lock); in wbsd_timeout_bh_work()
1123 spin_lock(&host->lock); in wbsd_finish_bh_work()
1125 WARN_ON(!host->mrq); in wbsd_finish_bh_work()
1126 if (!host->mrq) in wbsd_finish_bh_work()
1136 spin_unlock(&host->lock); in wbsd_finish_bh_work()
1148 isr = inb(host->base + WBSD_ISR); in wbsd_irq()
1156 host->isr |= isr; in wbsd_irq()
1162 queue_work(system_bh_wq, &host->card_bh_work); in wbsd_irq()
1164 queue_work(system_bh_wq, &host->fifo_bh_work); in wbsd_irq()
1166 queue_work(system_bh_highpri_wq, &host->crc_bh_work); in wbsd_irq()
1168 queue_work(system_bh_highpri_wq, &host->timeout_bh_work); in wbsd_irq()
1170 queue_work(system_bh_wq, &host->finish_bh_work); in wbsd_irq()
1195 return -ENOMEM; in wbsd_alloc_mmc()
1198 host->mmc = mmc; in wbsd_alloc_mmc()
1200 host->dma = -1; in wbsd_alloc_mmc()
1205 mmc->ops = &wbsd_ops; in wbsd_alloc_mmc()
1206 mmc->f_min = 375000; in wbsd_alloc_mmc()
1207 mmc->f_max = 24000000; in wbsd_alloc_mmc()
1208 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; in wbsd_alloc_mmc()
1209 mmc->caps = MMC_CAP_4_BIT_DATA; in wbsd_alloc_mmc()
1211 spin_lock_init(&host->lock); in wbsd_alloc_mmc()
1216 timer_setup(&host->ignore_timer, wbsd_reset_ignore, 0); in wbsd_alloc_mmc()
1222 mmc->max_segs = 128; in wbsd_alloc_mmc()
1227 mmc->max_req_size = 65536; in wbsd_alloc_mmc()
1233 mmc->max_seg_size = mmc->max_req_size; in wbsd_alloc_mmc()
1237 * space for CRC. So the maximum is 4095 - 4*2 = 4087. in wbsd_alloc_mmc()
1239 mmc->max_blk_size = 4087; in wbsd_alloc_mmc()
1245 mmc->max_blk_count = mmc->max_req_size; in wbsd_alloc_mmc()
1264 del_timer_sync(&host->ignore_timer); in wbsd_free_mmc()
1287 host->config = config_ports[i]; in wbsd_scan()
1288 host->unlock_code = unlock_codes[j]; in wbsd_scan()
1302 host->chip_id = id; in wbsd_scan()
1317 host->config = 0; in wbsd_scan()
1318 host->unlock_code = 0; in wbsd_scan()
1320 return -ENODEV; in wbsd_scan()
1330 return -EINVAL; in wbsd_request_region()
1333 return -EIO; in wbsd_request_region()
1335 host->base = base; in wbsd_request_region()
1342 if (host->base) in wbsd_release_regions()
1343 release_region(host->base, 8); in wbsd_release_regions()
1345 host->base = 0; in wbsd_release_regions()
1347 if (host->config) in wbsd_release_regions()
1348 release_region(host->config, 2); in wbsd_release_regions()
1350 host->config = 0; in wbsd_release_regions()
1369 host->dma_buffer = kmalloc(WBSD_DMA_SIZE, in wbsd_request_dma()
1371 if (!host->dma_buffer) in wbsd_request_dma()
1377 host->dma_addr = dma_map_single(mmc_dev(host->mmc), host->dma_buffer, in wbsd_request_dma()
1379 if (dma_mapping_error(mmc_dev(host->mmc), host->dma_addr)) in wbsd_request_dma()
1385 if ((host->dma_addr & 0xffff) != 0) in wbsd_request_dma()
1390 else if (host->dma_addr >= 0x1000000) in wbsd_request_dma()
1393 host->dma = dma; in wbsd_request_dma()
1403 dma_unmap_single(mmc_dev(host->mmc), host->dma_addr, in wbsd_request_dma()
1405 host->dma_addr = 0; in wbsd_request_dma()
1408 kfree(host->dma_buffer); in wbsd_request_dma()
1409 host->dma_buffer = NULL; in wbsd_request_dma()
1415 pr_warn(DRIVER_NAME ": Unable to allocate DMA %d - falling back on FIFO\n", in wbsd_request_dma()
1422 * host->dma_addr is valid here iff host->dma_buffer is not NULL. in wbsd_release_dma()
1424 if (host->dma_buffer) { in wbsd_release_dma()
1425 dma_unmap_single(mmc_dev(host->mmc), host->dma_addr, in wbsd_release_dma()
1427 kfree(host->dma_buffer); in wbsd_release_dma()
1429 if (host->dma >= 0) in wbsd_release_dma()
1430 free_dma(host->dma); in wbsd_release_dma()
1432 host->dma = -1; in wbsd_release_dma()
1433 host->dma_buffer = NULL; in wbsd_release_dma()
1434 host->dma_addr = 0; in wbsd_release_dma()
1448 INIT_WORK(&host->card_bh_work, wbsd_card_bh_work); in wbsd_request_irq()
1449 INIT_WORK(&host->fifo_bh_work, wbsd_fifo_bh_work); in wbsd_request_irq()
1450 INIT_WORK(&host->crc_bh_work, wbsd_crc_bh_work); in wbsd_request_irq()
1451 INIT_WORK(&host->timeout_bh_work, wbsd_timeout_bh_work); in wbsd_request_irq()
1452 INIT_WORK(&host->finish_bh_work, wbsd_finish_bh_work); in wbsd_request_irq()
1461 host->irq = irq; in wbsd_request_irq()
1468 if (!host->irq) in wbsd_release_irq()
1471 free_irq(host->irq, host); in wbsd_release_irq()
1473 host->irq = 0; in wbsd_release_irq()
1475 cancel_work_sync(&host->card_bh_work); in wbsd_release_irq()
1476 cancel_work_sync(&host->fifo_bh_work); in wbsd_release_irq()
1477 cancel_work_sync(&host->crc_bh_work); in wbsd_release_irq()
1478 cancel_work_sync(&host->timeout_bh_work); in wbsd_release_irq()
1479 cancel_work_sync(&host->finish_bh_work); in wbsd_release_irq()
1551 wbsd_write_config(host, WBSD_CONF_PORT_HI, host->base >> 8); in wbsd_chip_config()
1552 wbsd_write_config(host, WBSD_CONF_PORT_LO, host->base & 0xff); in wbsd_chip_config()
1554 wbsd_write_config(host, WBSD_CONF_IRQ, host->irq); in wbsd_chip_config()
1556 if (host->dma >= 0) in wbsd_chip_config()
1557 wbsd_write_config(host, WBSD_CONF_DRQ, host->dma); in wbsd_chip_config()
1598 if (base != host->base) in wbsd_chip_validate()
1600 if (irq != host->irq) in wbsd_chip_validate()
1602 if ((dma != host->dma) && (host->dma != -1)) in wbsd_chip_validate()
1647 if (pnp && (ret == -ENODEV)) { in wbsd_init()
1648 pr_warn(DRIVER_NAME ": Unable to confirm device presence - you may experience lock-ups\n"); in wbsd_init()
1669 if ((host->config != 0) && !wbsd_chip_validate(host)) { in wbsd_init()
1681 if (host->config) { in wbsd_init()
1708 if (host->chip_id != 0) in wbsd_init()
1709 printk(" id %x", (int)host->chip_id); in wbsd_init()
1710 printk(" at 0x%x irq %d", (int)host->base, (int)host->irq); in wbsd_init()
1711 if (host->dma >= 0) in wbsd_init()
1712 printk(" dma %d", (int)host->dma); in wbsd_init()
1746 * Non-PnP
1752 return wbsd_init(&dev->dev, param_io, param_irq, param_dma, 0); in wbsd_probe()
1757 wbsd_shutdown(&dev->dev, 0); in wbsd_remove()
1779 dma = -1; in wbsd_pnp_probe()
1783 return wbsd_init(&pnpdev->dev, io, irq, dma, 1); in wbsd_pnp_probe()
1788 wbsd_shutdown(&dev->dev, 1); in wbsd_pnp_remove()
1843 struct mmc_host *mmc = dev_get_drvdata(&pnp_dev->dev); in wbsd_pnp_suspend()
1854 struct mmc_host *mmc = dev_get_drvdata(&pnp_dev->dev); in wbsd_pnp_resume()
1867 if (host->config != 0) { in wbsd_pnp_resume()
1948 wbsd_device = platform_device_alloc(DRIVER_NAME, -1); in wbsd_drv_init()
1951 return -ENOMEM; in wbsd_drv_init()
2001 MODULE_PARM_DESC(dma, "DMA channel to allocate. -1 for no DMA. (default 2)");