Lines Matching refs:sock
116 struct tifm_dev *sock = host->dev; in tifm_sd_read_fifo() local
127 val = readl(sock->addr + SOCK_MMCSD_DATA); in tifm_sd_read_fifo()
142 struct tifm_dev *sock = host->dev; in tifm_sd_write_fifo() local
149 writel(val, sock->addr + SOCK_MMCSD_DATA); in tifm_sd_write_fifo()
161 writel(val, sock->addr + SOCK_MMCSD_DATA); in tifm_sd_write_fifo()
264 struct tifm_dev *sock = host->dev; in tifm_sd_set_dma_data() local
312 dev_dbg(&sock->dev, "setting dma for %d blocks\n", dma_blk_cnt); in tifm_sd_set_dma_data()
313 writel(sg_dma_address(sg) + dma_off, sock->addr + SOCK_DMA_ADDRESS); in tifm_sd_set_dma_data()
316 sock->addr + SOCK_DMA_CONTROL); in tifm_sd_set_dma_data()
319 sock->addr + SOCK_DMA_CONTROL); in tifm_sd_set_dma_data()
369 struct tifm_dev *sock = host->dev; in tifm_sd_exec() local
378 dev_dbg(&sock->dev, "executing opcode 0x%x, arg: 0x%x, mask: 0x%x\n", in tifm_sd_exec()
381 writel((cmd->arg >> 16) & 0xffff, sock->addr + SOCK_MMCSD_ARG_HIGH); in tifm_sd_exec()
382 writel(cmd->arg & 0xffff, sock->addr + SOCK_MMCSD_ARG_LOW); in tifm_sd_exec()
383 writel(cmd->opcode | cmd_mask, sock->addr + SOCK_MMCSD_COMMAND); in tifm_sd_exec()
386 static void tifm_sd_fetch_resp(struct mmc_command *cmd, struct tifm_dev *sock) in tifm_sd_fetch_resp() argument
388 cmd->resp[0] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x1c) << 16) in tifm_sd_fetch_resp()
389 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x18); in tifm_sd_fetch_resp()
390 cmd->resp[1] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x14) << 16) in tifm_sd_fetch_resp()
391 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x10); in tifm_sd_fetch_resp()
392 cmd->resp[2] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x0c) << 16) in tifm_sd_fetch_resp()
393 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x08); in tifm_sd_fetch_resp()
394 cmd->resp[3] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x04) << 16) in tifm_sd_fetch_resp()
395 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x00); in tifm_sd_fetch_resp()
400 struct tifm_dev *sock = host->dev; in tifm_sd_check_status() local
429 | readl(sock->addr in tifm_sd_check_status()
431 sock->addr in tifm_sd_check_status()
440 & readl(sock->addr in tifm_sd_check_status()
442 sock->addr in tifm_sd_check_status()
449 & readl(sock->addr in tifm_sd_check_status()
451 sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_check_status()
471 static void tifm_sd_data_event(struct tifm_dev *sock) in tifm_sd_data_event() argument
477 spin_lock(&sock->lock); in tifm_sd_data_event()
478 host = mmc_priv((struct mmc_host*)tifm_get_drvdata(sock)); in tifm_sd_data_event()
479 fifo_status = readl(sock->addr + SOCK_DMA_FIFO_STATUS); in tifm_sd_data_event()
480 dev_dbg(&sock->dev, "data event: fifo_status %x, flags %x\n", in tifm_sd_data_event()
494 writel(fifo_status, sock->addr + SOCK_DMA_FIFO_STATUS); in tifm_sd_data_event()
495 spin_unlock(&sock->lock); in tifm_sd_data_event()
499 static void tifm_sd_card_event(struct tifm_dev *sock) in tifm_sd_card_event() argument
506 spin_lock(&sock->lock); in tifm_sd_card_event()
507 host = mmc_priv((struct mmc_host*)tifm_get_drvdata(sock)); in tifm_sd_card_event()
508 host_status = readl(sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_card_event()
509 dev_dbg(&sock->dev, "host event: host_status %x, flags %x\n", in tifm_sd_card_event()
517 sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_card_event()
531 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); in tifm_sd_card_event()
532 writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); in tifm_sd_card_event()
550 tifm_sd_fetch_resp(cmd, sock); in tifm_sd_card_event()
554 sock); in tifm_sd_card_event()
564 sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_card_event()
581 writel(host_status, sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_card_event()
582 spin_unlock(&sock->lock); in tifm_sd_card_event()
588 struct tifm_dev *sock = host->dev; in tifm_sd_set_data_timeout() local
598 writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO); in tifm_sd_set_data_timeout()
600 & readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG), in tifm_sd_set_data_timeout()
601 sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG); in tifm_sd_set_data_timeout()
606 writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO); in tifm_sd_set_data_timeout()
608 | readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG), in tifm_sd_set_data_timeout()
609 sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG); in tifm_sd_set_data_timeout()
616 struct tifm_dev *sock = host->dev; in tifm_sd_request() local
620 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_request()
628 dev_name(&sock->dev)); in tifm_sd_request()
647 | readl(sock->addr + SOCK_MMCSD_INT_ENABLE), in tifm_sd_request()
648 sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_request()
652 | readl(sock->addr + SOCK_MMCSD_INT_ENABLE), in tifm_sd_request()
653 sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_request()
656 sock->addr + SOCK_MMCSD_BUFFER_CONFIG); in tifm_sd_request()
663 if(1 != tifm_map_sg(sock, &host->bounce_buf, 1, in tifm_sd_request()
668 dev_name(&sock->dev)); in tifm_sd_request()
672 host->sg_len = tifm_map_sg(sock, r_data->sg, in tifm_sd_request()
680 dev_name(&sock->dev)); in tifm_sd_request()
681 tifm_unmap_sg(sock, &host->bounce_buf, 1, in tifm_sd_request()
690 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); in tifm_sd_request()
692 sock->addr + SOCK_FIFO_PAGE_SIZE); in tifm_sd_request()
694 sock->addr + SOCK_FIFO_CONTROL); in tifm_sd_request()
696 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); in tifm_sd_request()
700 sock->addr + SOCK_MMCSD_BUFFER_CONFIG); in tifm_sd_request()
703 sock->addr + SOCK_MMCSD_BUFFER_CONFIG); in tifm_sd_request()
709 sock->addr + SOCK_MMCSD_NUM_BLOCKS); in tifm_sd_request()
711 sock->addr + SOCK_MMCSD_BLOCK_LEN); in tifm_sd_request()
716 writel(TIFM_CTRL_LED | readl(sock->addr + SOCK_CONTROL), in tifm_sd_request()
717 sock->addr + SOCK_CONTROL); in tifm_sd_request()
719 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_request()
723 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_request()
730 struct tifm_dev *sock = host->dev; in tifm_sd_end_cmd() local
731 struct mmc_host *mmc = tifm_get_drvdata(sock); in tifm_sd_end_cmd()
736 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_end_cmd()
744 dev_name(&sock->dev)); in tifm_sd_end_cmd()
745 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_end_cmd()
753 & readl(sock->addr + SOCK_MMCSD_INT_ENABLE), in tifm_sd_end_cmd()
754 sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_end_cmd()
756 tifm_unmap_sg(sock, &host->bounce_buf, 1, in tifm_sd_end_cmd()
759 tifm_unmap_sg(sock, r_data->sg, r_data->sg_len, in tifm_sd_end_cmd()
765 - readl(sock->addr + SOCK_MMCSD_NUM_BLOCKS) - 1; in tifm_sd_end_cmd()
768 - readl(sock->addr + SOCK_MMCSD_BLOCK_LEN) + 1; in tifm_sd_end_cmd()
771 writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL), in tifm_sd_end_cmd()
772 sock->addr + SOCK_CONTROL); in tifm_sd_end_cmd()
774 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_end_cmd()
792 struct tifm_dev *sock = host->dev; in tifm_sd_ios() local
796 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_ios()
798 dev_dbg(&sock->dev, "ios: clock = %u, vdd = %x, bus_mode = %x, " in tifm_sd_ios()
804 writel(TIFM_MMCSD_4BBUS | readl(sock->addr + SOCK_MMCSD_CONFIG), in tifm_sd_ios()
805 sock->addr + SOCK_MMCSD_CONFIG); in tifm_sd_ios()
808 & readl(sock->addr + SOCK_MMCSD_CONFIG), in tifm_sd_ios()
809 sock->addr + SOCK_MMCSD_CONFIG); in tifm_sd_ios()
829 & readl(sock->addr + SOCK_CONTROL), in tifm_sd_ios()
830 sock->addr + SOCK_CONTROL); in tifm_sd_ios()
835 | readl(sock->addr + SOCK_CONTROL), in tifm_sd_ios()
836 sock->addr + SOCK_CONTROL); in tifm_sd_ios()
844 & readl(sock->addr + SOCK_MMCSD_CONFIG)), in tifm_sd_ios()
845 sock->addr + SOCK_MMCSD_CONFIG); in tifm_sd_ios()
853 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_ios()
860 struct tifm_dev *sock = host->dev; in tifm_sd_ro() local
863 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_ro()
864 if (TIFM_MMCSD_CARD_RO & readl(sock->addr + SOCK_PRESENT_STATE)) in tifm_sd_ro()
866 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_ro()
880 struct tifm_dev *sock = host->dev; in tifm_sd_initialize_host() local
882 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_initialize_host()
885 writel(TIFM_MMCSD_RESET, sock->addr + SOCK_MMCSD_SYSTEM_CONTROL); in tifm_sd_initialize_host()
887 sock->addr + SOCK_MMCSD_CONFIG); in tifm_sd_initialize_host()
891 if (1 & readl(sock->addr + SOCK_MMCSD_SYSTEM_STATUS)) { in tifm_sd_initialize_host()
900 dev_name(&sock->dev)); in tifm_sd_initialize_host()
904 writel(0, sock->addr + SOCK_MMCSD_NUM_BLOCKS); in tifm_sd_initialize_host()
906 sock->addr + SOCK_MMCSD_CONFIG); in tifm_sd_initialize_host()
907 writel(TIFM_MMCSD_RXDE, sock->addr + SOCK_MMCSD_BUFFER_CONFIG); in tifm_sd_initialize_host()
910 writel(64, sock->addr + SOCK_MMCSD_COMMAND_TO); in tifm_sd_initialize_host()
911 writel(TIFM_MMCSD_INAB, sock->addr + SOCK_MMCSD_COMMAND); in tifm_sd_initialize_host()
914 host_status = readl(sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_initialize_host()
915 writel(host_status, sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_initialize_host()
926 dev_name(&sock->dev)); in tifm_sd_initialize_host()
932 sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_initialize_host()
937 static int tifm_sd_probe(struct tifm_dev *sock) in tifm_sd_probe() argument
944 & readl(sock->addr + SOCK_PRESENT_STATE))) { in tifm_sd_probe()
946 dev_name(&sock->dev)); in tifm_sd_probe()
950 mmc = mmc_alloc_host(sizeof(struct tifm_sd), &sock->dev); in tifm_sd_probe()
955 tifm_set_drvdata(sock, mmc); in tifm_sd_probe()
956 host->dev = sock; in tifm_sd_probe()
979 sock->card_event = tifm_sd_card_event; in tifm_sd_probe()
980 sock->data_event = tifm_sd_data_event; in tifm_sd_probe()
992 static void tifm_sd_remove(struct tifm_dev *sock) in tifm_sd_remove() argument
994 struct mmc_host *mmc = tifm_get_drvdata(sock); in tifm_sd_remove()
998 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_remove()
1000 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_remove()
1001 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_remove()
1005 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_remove()
1008 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); in tifm_sd_remove()
1009 writel(0, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); in tifm_sd_remove()
1015 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_remove()
1017 dev_dbg(&sock->dev, "after remove\n"); in tifm_sd_remove()
1024 static int tifm_sd_suspend(struct tifm_dev *sock, pm_message_t state) in tifm_sd_suspend() argument
1029 static int tifm_sd_resume(struct tifm_dev *sock) in tifm_sd_resume() argument
1031 struct mmc_host *mmc = tifm_get_drvdata(sock); in tifm_sd_resume()
1036 dev_dbg(&sock->dev, "resume initialize %d\n", rc); in tifm_sd_resume()