Lines Matching refs:slot

30 	struct cb710_slot *slot = cb710_mmc_to_slot(mmc);  in cb710_mmc_select_clock_divider()  local
31 struct pci_dev *pdev = cb710_slot_to_chip(slot)->pdev; in cb710_mmc_select_clock_divider()
57 dev_dbg(cb710_slot_dev(slot), in cb710_mmc_select_clock_divider()
63 static void __cb710_mmc_enable_irq(struct cb710_slot *slot, in __cb710_mmc_enable_irq() argument
75 enable = (cb710_read_port_16(slot, CB710_MMC_IRQ_ENABLE_PORT) in __cb710_mmc_enable_irq()
81 cb710_write_port_16(slot, CB710_MMC_IRQ_ENABLE_PORT, enable); in __cb710_mmc_enable_irq()
84 static void cb710_mmc_enable_irq(struct cb710_slot *slot, in cb710_mmc_enable_irq() argument
87 struct cb710_mmc_reader *reader = mmc_priv(cb710_slot_to_mmc(slot)); in cb710_mmc_enable_irq()
92 __cb710_mmc_enable_irq(slot, enable, mask); in cb710_mmc_enable_irq()
96 static void cb710_mmc_reset_events(struct cb710_slot *slot) in cb710_mmc_reset_events() argument
98 cb710_write_port_8(slot, CB710_MMC_STATUS0_PORT, 0xFF); in cb710_mmc_reset_events()
99 cb710_write_port_8(slot, CB710_MMC_STATUS1_PORT, 0xFF); in cb710_mmc_reset_events()
100 cb710_write_port_8(slot, CB710_MMC_STATUS2_PORT, 0xFF); in cb710_mmc_reset_events()
103 static void cb710_mmc_enable_4bit_data(struct cb710_slot *slot, int enable) in cb710_mmc_enable_4bit_data() argument
106 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, in cb710_mmc_enable_4bit_data()
109 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, in cb710_mmc_enable_4bit_data()
113 static int cb710_check_event(struct cb710_slot *slot, u8 what) in cb710_check_event() argument
117 status = cb710_read_port_16(slot, CB710_MMC_STATUS_PORT); in cb710_check_event()
121 dev_dbg(cb710_slot_dev(slot), in cb710_check_event()
123 cb710_write_port_8(slot, CB710_MMC_STATUS0_PORT, in cb710_check_event()
129 dev_dbg(cb710_slot_dev(slot), in cb710_check_event()
131 cb710_write_port_8(slot, CB710_MMC_STATUS0_PORT, status & 0xFF); in cb710_check_event()
132 cb710_write_port_8(slot, CB710_MMC_STATUS1_PORT, in cb710_check_event()
139 cb710_write_port_8(slot, CB710_MMC_STATUS1_PORT, what); in cb710_check_event()
146 static int cb710_wait_for_event(struct cb710_slot *slot, u8 what) in cb710_wait_for_event() argument
153 e = cb710_read_port_32(slot, CB710_MMC_STATUS_PORT); in cb710_wait_for_event()
156 while (!(err = cb710_check_event(slot, what))) { in cb710_wait_for_event()
158 cb710_dump_regs(cb710_slot_to_chip(slot), in cb710_wait_for_event()
167 x = cb710_read_port_32(slot, CB710_MMC_STATUS_PORT); in cb710_wait_for_event()
171 dev_dbg(cb710_slot_dev(slot), in cb710_wait_for_event()
179 static int cb710_wait_while_busy(struct cb710_slot *slot, uint8_t mask) in cb710_wait_while_busy() argument
186 e = cb710_read_port_32(slot, CB710_MMC_STATUS_PORT); in cb710_wait_while_busy()
189 while (cb710_read_port_8(slot, CB710_MMC_STATUS2_PORT) & mask) { in cb710_wait_while_busy()
191 cb710_dump_regs(cb710_slot_to_chip(slot), in cb710_wait_while_busy()
200 x = cb710_read_port_32(slot, CB710_MMC_STATUS_PORT); in cb710_wait_while_busy()
204 dev_dbg(cb710_slot_dev(slot), in cb710_wait_while_busy()
211 static void cb710_mmc_set_transfer_size(struct cb710_slot *slot, in cb710_mmc_set_transfer_size() argument
214 cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_set_transfer_size()
215 cb710_write_port_32(slot, CB710_MMC_TRANSFER_SIZE_PORT, in cb710_mmc_set_transfer_size()
218 dev_vdbg(cb710_slot_dev(slot), "set up for %zu block%s of %zu bytes\n", in cb710_mmc_set_transfer_size()
222 static void cb710_mmc_fifo_hack(struct cb710_slot *slot) in cb710_mmc_fifo_hack() argument
228 r1 = cb710_read_port_32(slot, CB710_MMC_DATA_PORT); in cb710_mmc_fifo_hack()
229 r2 = cb710_read_port_32(slot, CB710_MMC_DATA_PORT); in cb710_mmc_fifo_hack()
230 if (cb710_read_port_8(slot, CB710_MMC_STATUS0_PORT) in cb710_mmc_fifo_hack()
232 cb710_write_port_8(slot, CB710_MMC_STATUS0_PORT, in cb710_mmc_fifo_hack()
237 dev_dbg(cb710_slot_dev(slot), in cb710_mmc_fifo_hack()
240 dev_dbg(cb710_slot_dev(slot), in cb710_mmc_fifo_hack()
245 static int cb710_mmc_receive_pio(struct cb710_slot *slot, in cb710_mmc_receive_pio() argument
248 if (!(cb710_read_port_8(slot, CB710_MMC_STATUS2_PORT) & CB710_MMC_S2_FIFO_READY)) { in cb710_mmc_receive_pio()
249 int err = cb710_wait_for_event(slot, in cb710_mmc_receive_pio()
256 slot->iobase + CB710_MMC_DATA_PORT, dw_count); in cb710_mmc_receive_pio()
266 static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data) in cb710_mmc_receive() argument
279 cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, in cb710_mmc_receive()
282 cb710_mmc_fifo_hack(slot); in cb710_mmc_receive()
288 err = cb710_mmc_receive_pio(slot, &miter, 4); in cb710_mmc_receive()
297 cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, in cb710_mmc_receive()
301 err = cb710_mmc_receive_pio(slot, &miter, len); in cb710_mmc_receive()
310 static int cb710_mmc_send(struct cb710_slot *slot, struct mmc_data *data) in cb710_mmc_send() argument
323 cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, in cb710_mmc_send()
329 if (!(cb710_read_port_8(slot, CB710_MMC_STATUS2_PORT) in cb710_mmc_send()
331 err = cb710_wait_for_event(slot, in cb710_mmc_send()
337 slot->iobase + CB710_MMC_DATA_PORT, 4); in cb710_mmc_send()
396 static void cb710_receive_response(struct cb710_slot *slot, in cb710_receive_response() argument
405 resp[0] = cb710_read_port_32(slot, CB710_MMC_RESPONSE3_PORT); in cb710_receive_response()
406 resp[1] = cb710_read_port_32(slot, CB710_MMC_RESPONSE2_PORT); in cb710_receive_response()
407 resp[2] = cb710_read_port_32(slot, CB710_MMC_RESPONSE1_PORT); in cb710_receive_response()
408 resp[3] = cb710_read_port_32(slot, CB710_MMC_RESPONSE0_PORT); in cb710_receive_response()
416 rsp_opcode = cb710_read_port_32(slot, CB710_MMC_RESPONSE1_PORT) & 0x3F; in cb710_receive_response()
417 cmd->resp[0] = cb710_read_port_32(slot, CB710_MMC_RESPONSE0_PORT); in cb710_receive_response()
425 static int cb710_mmc_transfer_data(struct cb710_slot *slot, in cb710_mmc_transfer_data() argument
431 error = cb710_mmc_receive(slot, data); in cb710_mmc_transfer_data()
433 error = cb710_mmc_send(slot, data); in cb710_mmc_transfer_data()
435 to = cb710_wait_for_event(slot, CB710_MMC_S1_DATA_TRANSFER_DONE); in cb710_mmc_transfer_data()
446 struct cb710_slot *slot = cb710_mmc_to_slot(mmc); in cb710_mmc_command() local
451 dev_dbg(cb710_slot_dev(slot), "cmd request: 0x%04X\n", cb_cmd); in cb710_mmc_command()
458 cb710_mmc_set_transfer_size(slot, data->blocks, data->blksz); in cb710_mmc_command()
461 cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20|CB710_MMC_S2_BUSY_10); in cb710_mmc_command()
462 cb710_write_port_16(slot, CB710_MMC_CMD_TYPE_PORT, cb_cmd); in cb710_mmc_command()
463 cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_command()
464 cb710_write_port_32(slot, CB710_MMC_CMD_PARAM_PORT, cmd->arg); in cb710_mmc_command()
465 cb710_mmc_reset_events(slot); in cb710_mmc_command()
466 cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_command()
467 cb710_modify_port_8(slot, CB710_MMC_CONFIG0_PORT, 0x01, 0); in cb710_mmc_command()
469 cmd->error = cb710_wait_for_event(slot, CB710_MMC_S1_COMMAND_SENT); in cb710_mmc_command()
474 cb710_receive_response(slot, cmd); in cb710_mmc_command()
480 data->error = cb710_mmc_transfer_data(slot, data); in cb710_mmc_command()
486 struct cb710_slot *slot = cb710_mmc_to_slot(mmc); in cb710_mmc_request() local
492 cb710_mmc_enable_irq(slot, CB710_MMC_IE_TEST_MASK, 0); in cb710_mmc_request()
500 static int cb710_mmc_powerup(struct cb710_slot *slot) in cb710_mmc_powerup() argument
503 struct cb710_chip *chip = cb710_slot_to_chip(slot); in cb710_mmc_powerup()
508 dev_dbg(cb710_slot_dev(slot), "bus powerup\n"); in cb710_mmc_powerup()
510 err = cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_powerup()
513 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, 0x80, 0); in cb710_mmc_powerup()
514 cb710_modify_port_8(slot, CB710_MMC_CONFIG3_PORT, 0x80, 0); in cb710_mmc_powerup()
517 dev_dbg(cb710_slot_dev(slot), "after delay 1\n"); in cb710_mmc_powerup()
519 err = cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_powerup()
522 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, 0x09, 0); in cb710_mmc_powerup()
525 dev_dbg(cb710_slot_dev(slot), "after delay 2\n"); in cb710_mmc_powerup()
527 err = cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_powerup()
530 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, 0, 0x08); in cb710_mmc_powerup()
533 dev_dbg(cb710_slot_dev(slot), "after delay 3\n"); in cb710_mmc_powerup()
535 cb710_modify_port_8(slot, CB710_MMC_CONFIG0_PORT, 0x06, 0); in cb710_mmc_powerup()
536 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, 0x70, 0); in cb710_mmc_powerup()
537 cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, 0x80, 0); in cb710_mmc_powerup()
538 cb710_modify_port_8(slot, CB710_MMC_CONFIG3_PORT, 0x03, 0); in cb710_mmc_powerup()
540 err = cb710_wait_while_busy(slot, CB710_MMC_S2_BUSY_20); in cb710_mmc_powerup()
547 cb710_write_port_16(slot, CB710_MMC_CONFIGB_PORT, 0xFFFF); in cb710_mmc_powerup()
548 cb710_modify_port_8(slot, CB710_MMC_CONFIG0_PORT, 0x06, 0); in cb710_mmc_powerup()
550 dev_dbg(cb710_slot_dev(slot), "bus powerup finished\n"); in cb710_mmc_powerup()
552 return cb710_check_event(slot, 0); in cb710_mmc_powerup()
555 static void cb710_mmc_powerdown(struct cb710_slot *slot) in cb710_mmc_powerdown() argument
557 cb710_modify_port_8(slot, CB710_MMC_CONFIG1_PORT, 0, 0x81); in cb710_mmc_powerdown()
558 cb710_modify_port_8(slot, CB710_MMC_CONFIG3_PORT, 0, 0x80); in cb710_mmc_powerdown()
563 struct cb710_slot *slot = cb710_mmc_to_slot(mmc); in cb710_mmc_set_ios() local
572 err = cb710_mmc_powerup(slot); in cb710_mmc_set_ios()
574 dev_warn(cb710_slot_dev(slot), in cb710_mmc_set_ios()
576 cb710_mmc_powerdown(slot); in cb710_mmc_set_ios()
578 err = cb710_mmc_powerup(slot); in cb710_mmc_set_ios()
580 dev_warn(cb710_slot_dev(slot), in cb710_mmc_set_ios()
587 cb710_mmc_powerdown(slot); in cb710_mmc_set_ios()
595 cb710_mmc_enable_4bit_data(slot, ios->bus_width != MMC_BUS_WIDTH_1); in cb710_mmc_set_ios()
597 cb710_mmc_enable_irq(slot, CB710_MMC_IE_TEST_MASK, 0); in cb710_mmc_set_ios()
602 struct cb710_slot *slot = cb710_mmc_to_slot(mmc); in cb710_mmc_get_ro() local
604 return cb710_read_port_8(slot, CB710_MMC_STATUS3_PORT) in cb710_mmc_get_ro()
610 struct cb710_slot *slot = cb710_mmc_to_slot(mmc); in cb710_mmc_get_cd() local
612 return cb710_read_port_8(slot, CB710_MMC_STATUS3_PORT) in cb710_mmc_get_cd()
616 static int cb710_mmc_irq_handler(struct cb710_slot *slot) in cb710_mmc_irq_handler() argument
618 struct mmc_host *mmc = cb710_slot_to_mmc(slot); in cb710_mmc_irq_handler()
622 status = cb710_read_port_32(slot, CB710_MMC_STATUS_PORT); in cb710_mmc_irq_handler()
623 irqen = cb710_read_port_32(slot, CB710_MMC_IRQ_ENABLE_PORT); in cb710_mmc_irq_handler()
624 config2 = cb710_read_port_32(slot, CB710_MMC_CONFIGB_PORT); in cb710_mmc_irq_handler()
625 config1 = cb710_read_port_32(slot, CB710_MMC_CONFIG_PORT); in cb710_mmc_irq_handler()
627 dev_dbg(cb710_slot_dev(slot), "interrupt; status: %08X, " in cb710_mmc_irq_handler()
633 cb710_write_port_8(slot, CB710_MMC_STATUS1_PORT, in cb710_mmc_irq_handler()
639 dev_dbg(cb710_slot_dev(slot), "unknown interrupt (test)\n"); in cb710_mmc_irq_handler()
641 __cb710_mmc_enable_irq(slot, 0, CB710_MMC_IE_TEST_MASK); in cb710_mmc_irq_handler()
669 struct cb710_slot *slot = cb710_pdev_to_slot(pdev); in cb710_mmc_suspend() local
671 cb710_mmc_enable_irq(slot, 0, ~0); in cb710_mmc_suspend()
677 struct cb710_slot *slot = cb710_pdev_to_slot(pdev); in cb710_mmc_resume() local
679 cb710_mmc_enable_irq(slot, 0, ~0); in cb710_mmc_resume()
687 struct cb710_slot *slot = cb710_pdev_to_slot(pdev); in cb710_mmc_init() local
688 struct cb710_chip *chip = cb710_slot_to_chip(slot); in cb710_mmc_init()
694 mmc = mmc_alloc_host(sizeof(*reader), cb710_slot_dev(slot)); in cb710_mmc_init()
703 dev_dbg(cb710_slot_dev(slot), "source frequency: %dMHz\n", val); in cb710_mmc_init()
719 cb710_mmc_enable_irq(slot, 0, ~0); in cb710_mmc_init()
720 cb710_set_irq_handler(slot, cb710_mmc_irq_handler); in cb710_mmc_init()
726 dev_dbg(cb710_slot_dev(slot), "mmc_hostname is %s\n", in cb710_mmc_init()
729 cb710_mmc_enable_irq(slot, CB710_MMC_IE_CARD_INSERTION_STATUS, 0); in cb710_mmc_init()
734 dev_dbg(cb710_slot_dev(slot), "mmc_add_host() failed: %d\n", err); in cb710_mmc_init()
736 cb710_set_irq_handler(slot, NULL); in cb710_mmc_init()
743 struct cb710_slot *slot = cb710_pdev_to_slot(pdev); in cb710_mmc_exit() local
744 struct mmc_host *mmc = cb710_slot_to_mmc(slot); in cb710_mmc_exit()
747 cb710_mmc_enable_irq(slot, 0, CB710_MMC_IE_CARD_INSERTION_STATUS); in cb710_mmc_exit()
752 cb710_mmc_enable_irq(slot, 0, ~0); in cb710_mmc_exit()
753 cb710_set_irq_handler(slot, NULL); in cb710_mmc_exit()
756 cb710_write_port_32(slot, CB710_MMC_CONFIG_PORT, 0); in cb710_mmc_exit()
757 cb710_write_port_16(slot, CB710_MMC_CONFIGB_PORT, 0); in cb710_mmc_exit()