Lines Matching full:slot
29 struct cb710_slot *slot = cb710_mmc_to_slot(mmc); in cb710_mmc_select_clock_divider() local
30 struct pci_dev *pdev = cb710_slot_to_chip(slot)->pdev; in cb710_mmc_select_clock_divider()
56 dev_dbg(cb710_slot_dev(slot), in cb710_mmc_select_clock_divider()
62 static void __cb710_mmc_enable_irq(struct cb710_slot *slot, in __cb710_mmc_enable_irq() argument
74 enable = (cb710_read_port_16(slot, CB710_MMC_IRQ_ENABLE_PORT) in __cb710_mmc_enable_irq()
80 cb710_write_port_16(slot, CB710_MMC_IRQ_ENABLE_PORT, enable); in __cb710_mmc_enable_irq()
83 static void cb710_mmc_enable_irq(struct cb710_slot *slot, in cb710_mmc_enable_irq() argument
86 struct cb710_mmc_reader *reader = mmc_priv(cb710_slot_to_mmc(slot)); in cb710_mmc_enable_irq()
91 __cb710_mmc_enable_irq(slot, enable, mask); in cb710_mmc_enable_irq()
95 static void cb710_mmc_reset_events(struct cb710_slot *slot) in cb710_mmc_reset_events() argument
97 cb710_write_port_8(slot, CB710_MMC_STATUS0_PORT, 0xFF); in cb710_mmc_reset_events()
98 cb710_write_port_8(slot, CB710_MMC_STATUS1_PORT, 0xFF); in cb710_mmc_reset_events()
99 cb710_write_port_8(slot, CB710_MMC_STATUS2_PORT, 0xFF); in cb710_mmc_reset_events()
102 static void cb710_mmc_enable_4bit_data(struct cb710_slot *slot, int enable) in cb710_mmc_enable_4bit_data() argument
105 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, in cb710_mmc_enable_4bit_data()
108 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, in cb710_mmc_enable_4bit_data()
112 static int cb710_check_event(struct cb710_slot *slot, u8 what) in cb710_check_event() argument
116 status = cb710_read_port_16(slot, CB710_MMC_STATUS_PORT); in cb710_check_event()
120 dev_dbg(cb710_slot_dev(slot), in cb710_check_event()
122 cb710_write_port_8(slot, CB710_MMC_STATUS0_PORT, in cb710_check_event()
128 dev_dbg(cb710_slot_dev(slot), in cb710_check_event()
130 cb710_write_port_8(slot, CB710_MMC_STATUS0_PORT, status & 0xFF); in cb710_check_event()
131 cb710_write_port_8(slot, CB710_MMC_STATUS1_PORT, in cb710_check_event()
138 cb710_write_port_8(slot, CB710_MMC_STATUS1_PORT, what); in cb710_check_event()
145 static int cb710_wait_for_event(struct cb710_slot *slot, u8 what) in cb710_wait_for_event() argument
152 e = cb710_read_port_32(slot, CB710_MMC_STATUS_PORT); in cb710_wait_for_event()
155 while (!(err = cb710_check_event(slot, what))) { in cb710_wait_for_event()
157 cb710_dump_regs(cb710_slot_to_chip(slot), in cb710_wait_for_event()
166 x = cb710_read_port_32(slot, CB710_MMC_STATUS_PORT); in cb710_wait_for_event()
170 dev_dbg(cb710_slot_dev(slot), in cb710_wait_for_event()
178 static int cb710_wait_while_busy(struct cb710_slot *slot, uint8_t mask) in cb710_wait_while_busy() argument
185 e = cb710_read_port_32(slot, CB710_MMC_STATUS_PORT); in cb710_wait_while_busy()
188 while (cb710_read_port_8(slot, CB710_MMC_STATUS2_PORT) & mask) { in cb710_wait_while_busy()
190 cb710_dump_regs(cb710_slot_to_chip(slot), in cb710_wait_while_busy()
199 x = cb710_read_port_32(slot, CB710_MMC_STATUS_PORT); in cb710_wait_while_busy()
203 dev_dbg(cb710_slot_dev(slot), in cb710_wait_while_busy()
210 static void cb710_mmc_set_transfer_size(struct cb710_slot *slot, in cb710_mmc_set_transfer_size() argument
213 cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_set_transfer_size()
214 cb710_write_port_32(slot, CB710_MMC_TRANSFER_SIZE_PORT, in cb710_mmc_set_transfer_size()
217 dev_vdbg(cb710_slot_dev(slot), "set up for %zu block%s of %zu bytes\n", in cb710_mmc_set_transfer_size()
221 static void cb710_mmc_fifo_hack(struct cb710_slot *slot) in cb710_mmc_fifo_hack() argument
227 r1 = cb710_read_port_32(slot, CB710_MMC_DATA_PORT); in cb710_mmc_fifo_hack()
228 r2 = cb710_read_port_32(slot, CB710_MMC_DATA_PORT); in cb710_mmc_fifo_hack()
229 if (cb710_read_port_8(slot, CB710_MMC_STATUS0_PORT) in cb710_mmc_fifo_hack()
231 cb710_write_port_8(slot, CB710_MMC_STATUS0_PORT, in cb710_mmc_fifo_hack()
236 dev_dbg(cb710_slot_dev(slot), in cb710_mmc_fifo_hack()
239 dev_dbg(cb710_slot_dev(slot), in cb710_mmc_fifo_hack()
244 static int cb710_mmc_receive_pio(struct cb710_slot *slot, in cb710_mmc_receive_pio() argument
247 if (!(cb710_read_port_8(slot, CB710_MMC_STATUS2_PORT) & CB710_MMC_S2_FIFO_READY)) { in cb710_mmc_receive_pio()
248 int err = cb710_wait_for_event(slot, in cb710_mmc_receive_pio()
255 slot->iobase + CB710_MMC_DATA_PORT, dw_count); in cb710_mmc_receive_pio()
265 static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data) in cb710_mmc_receive() argument
278 cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, in cb710_mmc_receive()
281 cb710_mmc_fifo_hack(slot); in cb710_mmc_receive()
287 err = cb710_mmc_receive_pio(slot, &miter, 4); in cb710_mmc_receive()
296 cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, in cb710_mmc_receive()
300 err = cb710_mmc_receive_pio(slot, &miter, len); in cb710_mmc_receive()
309 static int cb710_mmc_send(struct cb710_slot *slot, struct mmc_data *data) in cb710_mmc_send() argument
322 cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, in cb710_mmc_send()
328 if (!(cb710_read_port_8(slot, CB710_MMC_STATUS2_PORT) in cb710_mmc_send()
330 err = cb710_wait_for_event(slot, in cb710_mmc_send()
336 slot->iobase + CB710_MMC_DATA_PORT, 4); in cb710_mmc_send()
395 static void cb710_receive_response(struct cb710_slot *slot, in cb710_receive_response() argument
404 resp[0] = cb710_read_port_32(slot, CB710_MMC_RESPONSE3_PORT); in cb710_receive_response()
405 resp[1] = cb710_read_port_32(slot, CB710_MMC_RESPONSE2_PORT); in cb710_receive_response()
406 resp[2] = cb710_read_port_32(slot, CB710_MMC_RESPONSE1_PORT); in cb710_receive_response()
407 resp[3] = cb710_read_port_32(slot, CB710_MMC_RESPONSE0_PORT); in cb710_receive_response()
415 rsp_opcode = cb710_read_port_32(slot, CB710_MMC_RESPONSE1_PORT) & 0x3F; in cb710_receive_response()
416 cmd->resp[0] = cb710_read_port_32(slot, CB710_MMC_RESPONSE0_PORT); in cb710_receive_response()
424 static int cb710_mmc_transfer_data(struct cb710_slot *slot, in cb710_mmc_transfer_data() argument
430 error = cb710_mmc_receive(slot, data); in cb710_mmc_transfer_data()
432 error = cb710_mmc_send(slot, data); in cb710_mmc_transfer_data()
434 to = cb710_wait_for_event(slot, CB710_MMC_S1_DATA_TRANSFER_DONE); in cb710_mmc_transfer_data()
445 struct cb710_slot *slot = cb710_mmc_to_slot(mmc); in cb710_mmc_command() local
450 dev_dbg(cb710_slot_dev(slot), "cmd request: 0x%04X\n", cb_cmd); in cb710_mmc_command()
457 cb710_mmc_set_transfer_size(slot, data->blocks, data->blksz); in cb710_mmc_command()
460 cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20|CB710_MMC_S2_BUSY_10); in cb710_mmc_command()
461 cb710_write_port_16(slot, CB710_MMC_CMD_TYPE_PORT, cb_cmd); in cb710_mmc_command()
462 cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_command()
463 cb710_write_port_32(slot, CB710_MMC_CMD_PARAM_PORT, cmd->arg); in cb710_mmc_command()
464 cb710_mmc_reset_events(slot); in cb710_mmc_command()
465 cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_command()
466 cb710_modify_port_8(slot, CB710_MMC_CONFIG0_PORT, 0x01, 0); in cb710_mmc_command()
468 cmd->error = cb710_wait_for_event(slot, CB710_MMC_S1_COMMAND_SENT); in cb710_mmc_command()
473 cb710_receive_response(slot, cmd); in cb710_mmc_command()
479 data->error = cb710_mmc_transfer_data(slot, data); in cb710_mmc_command()
485 struct cb710_slot *slot = cb710_mmc_to_slot(mmc); in cb710_mmc_request() local
491 cb710_mmc_enable_irq(slot, CB710_MMC_IE_TEST_MASK, 0); in cb710_mmc_request()
499 static int cb710_mmc_powerup(struct cb710_slot *slot) in cb710_mmc_powerup() argument
502 struct cb710_chip *chip = cb710_slot_to_chip(slot); in cb710_mmc_powerup()
507 dev_dbg(cb710_slot_dev(slot), "bus powerup\n"); in cb710_mmc_powerup()
509 err = cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_powerup()
512 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, 0x80, 0); in cb710_mmc_powerup()
513 cb710_modify_port_8(slot, CB710_MMC_CONFIG3_PORT, 0x80, 0); in cb710_mmc_powerup()
516 dev_dbg(cb710_slot_dev(slot), "after delay 1\n"); in cb710_mmc_powerup()
518 err = cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_powerup()
521 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, 0x09, 0); in cb710_mmc_powerup()
524 dev_dbg(cb710_slot_dev(slot), "after delay 2\n"); in cb710_mmc_powerup()
526 err = cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_powerup()
529 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, 0, 0x08); in cb710_mmc_powerup()
532 dev_dbg(cb710_slot_dev(slot), "after delay 3\n"); in cb710_mmc_powerup()
534 cb710_modify_port_8(slot, CB710_MMC_CONFIG0_PORT, 0x06, 0); in cb710_mmc_powerup()
535 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, 0x70, 0); in cb710_mmc_powerup()
536 cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, 0x80, 0); in cb710_mmc_powerup()
537 cb710_modify_port_8(slot, CB710_MMC_CONFIG3_PORT, 0x03, 0); in cb710_mmc_powerup()
539 err = cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_powerup()
546 cb710_write_port_16(slot, CB710_MMC_CONFIGB_PORT, 0xFFFF); in cb710_mmc_powerup()
547 cb710_modify_port_8(slot, CB710_MMC_CONFIG0_PORT, 0x06, 0); in cb710_mmc_powerup()
549 dev_dbg(cb710_slot_dev(slot), "bus powerup finished\n"); in cb710_mmc_powerup()
551 return cb710_check_event(slot, 0); in cb710_mmc_powerup()
554 static void cb710_mmc_powerdown(struct cb710_slot *slot) in cb710_mmc_powerdown() argument
556 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, 0, 0x81); in cb710_mmc_powerdown()
557 cb710_modify_port_8(slot, CB710_MMC_CONFIG3_PORT, 0, 0x80); in cb710_mmc_powerdown()
562 struct cb710_slot *slot = cb710_mmc_to_slot(mmc); in cb710_mmc_set_ios() local
571 err = cb710_mmc_powerup(slot); in cb710_mmc_set_ios()
573 dev_warn(cb710_slot_dev(slot), in cb710_mmc_set_ios()
575 cb710_mmc_powerdown(slot); in cb710_mmc_set_ios()
577 err = cb710_mmc_powerup(slot); in cb710_mmc_set_ios()
579 dev_warn(cb710_slot_dev(slot), in cb710_mmc_set_ios()
586 cb710_mmc_powerdown(slot); in cb710_mmc_set_ios()
596 cb710_mmc_enable_4bit_data(slot, ios->bus_width != MMC_BUS_WIDTH_1); in cb710_mmc_set_ios()
598 cb710_mmc_enable_irq(slot, CB710_MMC_IE_TEST_MASK, 0); in cb710_mmc_set_ios()
603 struct cb710_slot *slot = cb710_mmc_to_slot(mmc); in cb710_mmc_get_ro() local
605 return cb710_read_port_8(slot, CB710_MMC_STATUS3_PORT) in cb710_mmc_get_ro()
611 struct cb710_slot *slot = cb710_mmc_to_slot(mmc); in cb710_mmc_get_cd() local
613 return cb710_read_port_8(slot, CB710_MMC_STATUS3_PORT) in cb710_mmc_get_cd()
617 static int cb710_mmc_irq_handler(struct cb710_slot *slot) in cb710_mmc_irq_handler() argument
619 struct mmc_host *mmc = cb710_slot_to_mmc(slot); in cb710_mmc_irq_handler()
623 status = cb710_read_port_32(slot, CB710_MMC_STATUS_PORT); in cb710_mmc_irq_handler()
624 irqen = cb710_read_port_32(slot, CB710_MMC_IRQ_ENABLE_PORT); in cb710_mmc_irq_handler()
625 config2 = cb710_read_port_32(slot, CB710_MMC_CONFIGB_PORT); in cb710_mmc_irq_handler()
626 config1 = cb710_read_port_32(slot, CB710_MMC_CONFIG_PORT); in cb710_mmc_irq_handler()
628 dev_dbg(cb710_slot_dev(slot), "interrupt; status: %08X, " in cb710_mmc_irq_handler()
634 cb710_write_port_8(slot, CB710_MMC_STATUS1_PORT, in cb710_mmc_irq_handler()
640 dev_dbg(cb710_slot_dev(slot), "unknown interrupt (test)\n"); in cb710_mmc_irq_handler()
642 __cb710_mmc_enable_irq(slot, 0, CB710_MMC_IE_TEST_MASK); in cb710_mmc_irq_handler()
670 struct cb710_slot *slot = cb710_pdev_to_slot(pdev); in cb710_mmc_suspend() local
672 cb710_mmc_enable_irq(slot, 0, ~0); in cb710_mmc_suspend()
678 struct cb710_slot *slot = cb710_pdev_to_slot(pdev); in cb710_mmc_resume() local
680 cb710_mmc_enable_irq(slot, 0, ~0); in cb710_mmc_resume()
688 struct cb710_slot *slot = cb710_pdev_to_slot(pdev); in cb710_mmc_init() local
689 struct cb710_chip *chip = cb710_slot_to_chip(slot); in cb710_mmc_init()
695 mmc = mmc_alloc_host(sizeof(*reader), cb710_slot_dev(slot)); in cb710_mmc_init()
704 dev_dbg(cb710_slot_dev(slot), "source frequency: %dMHz\n", val); in cb710_mmc_init()
726 cb710_mmc_enable_irq(slot, 0, ~0); in cb710_mmc_init()
727 cb710_set_irq_handler(slot, cb710_mmc_irq_handler); in cb710_mmc_init()
733 dev_dbg(cb710_slot_dev(slot), "mmc_hostname is %s\n", in cb710_mmc_init()
736 cb710_mmc_enable_irq(slot, CB710_MMC_IE_CARD_INSERTION_STATUS, 0); in cb710_mmc_init()
741 dev_dbg(cb710_slot_dev(slot), "mmc_add_host() failed: %d\n", err); in cb710_mmc_init()
743 cb710_set_irq_handler(slot, NULL); in cb710_mmc_init()
750 struct cb710_slot *slot = cb710_pdev_to_slot(pdev); in cb710_mmc_exit() local
751 struct mmc_host *mmc = cb710_slot_to_mmc(slot); in cb710_mmc_exit()
754 cb710_mmc_enable_irq(slot, 0, CB710_MMC_IE_CARD_INSERTION_STATUS); in cb710_mmc_exit()
759 cb710_mmc_enable_irq(slot, 0, ~0); in cb710_mmc_exit()
760 cb710_set_irq_handler(slot, NULL); in cb710_mmc_exit()
763 cb710_write_port_32(slot, CB710_MMC_CONFIG_PORT, 0); in cb710_mmc_exit()
764 cb710_write_port_16(slot, CB710_MMC_CONFIGB_PORT, 0); in cb710_mmc_exit()