Lines Matching refs:sock

115 	struct tifm_dev *sock = host->dev;  in tifm_sd_read_fifo()  local
126 val = readl(sock->addr + SOCK_MMCSD_DATA); in tifm_sd_read_fifo()
141 struct tifm_dev *sock = host->dev; in tifm_sd_write_fifo() local
148 writel(val, sock->addr + SOCK_MMCSD_DATA); in tifm_sd_write_fifo()
160 writel(val, sock->addr + SOCK_MMCSD_DATA); in tifm_sd_write_fifo()
263 struct tifm_dev *sock = host->dev; in tifm_sd_set_dma_data() local
316 dev_dbg(&sock->dev, "setting dma for %d blocks\n", dma_blk_cnt); in tifm_sd_set_dma_data()
317 writel(sg_dma_address(sg) + dma_off, sock->addr + SOCK_DMA_ADDRESS); in tifm_sd_set_dma_data()
320 sock->addr + SOCK_DMA_CONTROL); in tifm_sd_set_dma_data()
323 sock->addr + SOCK_DMA_CONTROL); in tifm_sd_set_dma_data()
373 struct tifm_dev *sock = host->dev; in tifm_sd_exec() local
382 dev_dbg(&sock->dev, "executing opcode 0x%x, arg: 0x%x, mask: 0x%x\n", in tifm_sd_exec()
385 writel((cmd->arg >> 16) & 0xffff, sock->addr + SOCK_MMCSD_ARG_HIGH); in tifm_sd_exec()
386 writel(cmd->arg & 0xffff, sock->addr + SOCK_MMCSD_ARG_LOW); in tifm_sd_exec()
387 writel(cmd->opcode | cmd_mask, sock->addr + SOCK_MMCSD_COMMAND); in tifm_sd_exec()
390 static void tifm_sd_fetch_resp(struct mmc_command *cmd, struct tifm_dev *sock) in tifm_sd_fetch_resp() argument
392 cmd->resp[0] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x1c) << 16) in tifm_sd_fetch_resp()
393 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x18); in tifm_sd_fetch_resp()
394 cmd->resp[1] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x14) << 16) in tifm_sd_fetch_resp()
395 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x10); in tifm_sd_fetch_resp()
396 cmd->resp[2] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x0c) << 16) in tifm_sd_fetch_resp()
397 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x08); in tifm_sd_fetch_resp()
398 cmd->resp[3] = (readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x04) << 16) in tifm_sd_fetch_resp()
399 | readl(sock->addr + SOCK_MMCSD_RESPONSE + 0x00); in tifm_sd_fetch_resp()
404 struct tifm_dev *sock = host->dev; in tifm_sd_check_status() local
433 | readl(sock->addr in tifm_sd_check_status()
435 sock->addr in tifm_sd_check_status()
444 & readl(sock->addr in tifm_sd_check_status()
446 sock->addr in tifm_sd_check_status()
453 & readl(sock->addr in tifm_sd_check_status()
455 sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_check_status()
475 static void tifm_sd_data_event(struct tifm_dev *sock) in tifm_sd_data_event() argument
481 spin_lock(&sock->lock); in tifm_sd_data_event()
482 host = mmc_priv((struct mmc_host*)tifm_get_drvdata(sock)); in tifm_sd_data_event()
483 fifo_status = readl(sock->addr + SOCK_DMA_FIFO_STATUS); in tifm_sd_data_event()
484 dev_dbg(&sock->dev, "data event: fifo_status %x, flags %x\n", in tifm_sd_data_event()
498 writel(fifo_status, sock->addr + SOCK_DMA_FIFO_STATUS); in tifm_sd_data_event()
499 spin_unlock(&sock->lock); in tifm_sd_data_event()
503 static void tifm_sd_card_event(struct tifm_dev *sock) in tifm_sd_card_event() argument
511 spin_lock(&sock->lock); in tifm_sd_card_event()
512 host = mmc_priv((struct mmc_host*)tifm_get_drvdata(sock)); in tifm_sd_card_event()
513 host_status = readl(sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_card_event()
514 dev_dbg(&sock->dev, "host event: host_status %x, flags %x\n", in tifm_sd_card_event()
522 sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_card_event()
536 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); in tifm_sd_card_event()
537 writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); in tifm_sd_card_event()
555 tifm_sd_fetch_resp(cmd, sock); in tifm_sd_card_event()
559 sock); in tifm_sd_card_event()
569 sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_card_event()
588 writel(host_status, sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_card_event()
589 spin_unlock(&sock->lock); in tifm_sd_card_event()
595 struct tifm_dev *sock = host->dev; in tifm_sd_set_data_timeout() local
605 writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO); in tifm_sd_set_data_timeout()
607 & readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG), in tifm_sd_set_data_timeout()
608 sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG); in tifm_sd_set_data_timeout()
613 writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO); in tifm_sd_set_data_timeout()
615 | readl(sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG), in tifm_sd_set_data_timeout()
616 sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG); in tifm_sd_set_data_timeout()
623 struct tifm_dev *sock = host->dev; in tifm_sd_request() local
627 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_request()
635 dev_name(&sock->dev)); in tifm_sd_request()
654 | readl(sock->addr + SOCK_MMCSD_INT_ENABLE), in tifm_sd_request()
655 sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_request()
659 | readl(sock->addr + SOCK_MMCSD_INT_ENABLE), in tifm_sd_request()
660 sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_request()
663 sock->addr + SOCK_MMCSD_BUFFER_CONFIG); in tifm_sd_request()
670 if(1 != tifm_map_sg(sock, &host->bounce_buf, 1, in tifm_sd_request()
675 dev_name(&sock->dev)); in tifm_sd_request()
679 host->sg_len = tifm_map_sg(sock, r_data->sg, in tifm_sd_request()
687 dev_name(&sock->dev)); in tifm_sd_request()
688 tifm_unmap_sg(sock, &host->bounce_buf, 1, in tifm_sd_request()
697 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); in tifm_sd_request()
699 sock->addr + SOCK_FIFO_PAGE_SIZE); in tifm_sd_request()
701 sock->addr + SOCK_FIFO_CONTROL); in tifm_sd_request()
703 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); in tifm_sd_request()
707 sock->addr + SOCK_MMCSD_BUFFER_CONFIG); in tifm_sd_request()
710 sock->addr + SOCK_MMCSD_BUFFER_CONFIG); in tifm_sd_request()
716 sock->addr + SOCK_MMCSD_NUM_BLOCKS); in tifm_sd_request()
718 sock->addr + SOCK_MMCSD_BLOCK_LEN); in tifm_sd_request()
723 writel(TIFM_CTRL_LED | readl(sock->addr + SOCK_CONTROL), in tifm_sd_request()
724 sock->addr + SOCK_CONTROL); in tifm_sd_request()
726 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_request()
730 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_request()
737 struct tifm_dev *sock = host->dev; in tifm_sd_end_cmd() local
738 struct mmc_host *mmc = tifm_get_drvdata(sock); in tifm_sd_end_cmd()
743 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_end_cmd()
751 dev_name(&sock->dev)); in tifm_sd_end_cmd()
752 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_end_cmd()
760 & readl(sock->addr + SOCK_MMCSD_INT_ENABLE), in tifm_sd_end_cmd()
761 sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_end_cmd()
763 tifm_unmap_sg(sock, &host->bounce_buf, 1, in tifm_sd_end_cmd()
766 tifm_unmap_sg(sock, r_data->sg, r_data->sg_len, in tifm_sd_end_cmd()
772 - readl(sock->addr + SOCK_MMCSD_NUM_BLOCKS) - 1; in tifm_sd_end_cmd()
775 - readl(sock->addr + SOCK_MMCSD_BLOCK_LEN) + 1; in tifm_sd_end_cmd()
778 writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL), in tifm_sd_end_cmd()
779 sock->addr + SOCK_CONTROL); in tifm_sd_end_cmd()
781 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_end_cmd()
799 struct tifm_dev *sock = host->dev; in tifm_sd_ios() local
803 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_ios()
805 dev_dbg(&sock->dev, "ios: clock = %u, vdd = %x, bus_mode = %x, " in tifm_sd_ios()
811 writel(TIFM_MMCSD_4BBUS | readl(sock->addr + SOCK_MMCSD_CONFIG), in tifm_sd_ios()
812 sock->addr + SOCK_MMCSD_CONFIG); in tifm_sd_ios()
815 & readl(sock->addr + SOCK_MMCSD_CONFIG), in tifm_sd_ios()
816 sock->addr + SOCK_MMCSD_CONFIG); in tifm_sd_ios()
836 & readl(sock->addr + SOCK_CONTROL), in tifm_sd_ios()
837 sock->addr + SOCK_CONTROL); in tifm_sd_ios()
842 | readl(sock->addr + SOCK_CONTROL), in tifm_sd_ios()
843 sock->addr + SOCK_CONTROL); in tifm_sd_ios()
851 & readl(sock->addr + SOCK_MMCSD_CONFIG)), in tifm_sd_ios()
852 sock->addr + SOCK_MMCSD_CONFIG); in tifm_sd_ios()
860 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_ios()
867 struct tifm_dev *sock = host->dev; in tifm_sd_ro() local
870 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_ro()
871 if (TIFM_MMCSD_CARD_RO & readl(sock->addr + SOCK_PRESENT_STATE)) in tifm_sd_ro()
873 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_ro()
887 struct tifm_dev *sock = host->dev; in tifm_sd_initialize_host() local
889 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_initialize_host()
892 writel(TIFM_MMCSD_RESET, sock->addr + SOCK_MMCSD_SYSTEM_CONTROL); in tifm_sd_initialize_host()
894 sock->addr + SOCK_MMCSD_CONFIG); in tifm_sd_initialize_host()
898 if (1 & readl(sock->addr + SOCK_MMCSD_SYSTEM_STATUS)) { in tifm_sd_initialize_host()
907 dev_name(&sock->dev)); in tifm_sd_initialize_host()
911 writel(0, sock->addr + SOCK_MMCSD_NUM_BLOCKS); in tifm_sd_initialize_host()
913 sock->addr + SOCK_MMCSD_CONFIG); in tifm_sd_initialize_host()
914 writel(TIFM_MMCSD_RXDE, sock->addr + SOCK_MMCSD_BUFFER_CONFIG); in tifm_sd_initialize_host()
917 writel(64, sock->addr + SOCK_MMCSD_COMMAND_TO); in tifm_sd_initialize_host()
918 writel(TIFM_MMCSD_INAB, sock->addr + SOCK_MMCSD_COMMAND); in tifm_sd_initialize_host()
921 host_status = readl(sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_initialize_host()
922 writel(host_status, sock->addr + SOCK_MMCSD_STATUS); in tifm_sd_initialize_host()
933 dev_name(&sock->dev)); in tifm_sd_initialize_host()
939 sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_initialize_host()
944 static int tifm_sd_probe(struct tifm_dev *sock) in tifm_sd_probe() argument
951 & readl(sock->addr + SOCK_PRESENT_STATE))) { in tifm_sd_probe()
953 dev_name(&sock->dev)); in tifm_sd_probe()
957 mmc = mmc_alloc_host(sizeof(struct tifm_sd), &sock->dev); in tifm_sd_probe()
962 tifm_set_drvdata(sock, mmc); in tifm_sd_probe()
963 host->dev = sock; in tifm_sd_probe()
986 sock->card_event = tifm_sd_card_event; in tifm_sd_probe()
987 sock->data_event = tifm_sd_data_event; in tifm_sd_probe()
999 static void tifm_sd_remove(struct tifm_dev *sock) in tifm_sd_remove() argument
1001 struct mmc_host *mmc = tifm_get_drvdata(sock); in tifm_sd_remove()
1005 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_remove()
1007 writel(0, sock->addr + SOCK_MMCSD_INT_ENABLE); in tifm_sd_remove()
1008 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_remove()
1012 spin_lock_irqsave(&sock->lock, flags); in tifm_sd_remove()
1015 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); in tifm_sd_remove()
1016 writel(0, sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); in tifm_sd_remove()
1022 spin_unlock_irqrestore(&sock->lock, flags); in tifm_sd_remove()
1024 dev_dbg(&sock->dev, "after remove\n"); in tifm_sd_remove()
1031 static int tifm_sd_suspend(struct tifm_dev *sock, pm_message_t state) in tifm_sd_suspend() argument
1036 static int tifm_sd_resume(struct tifm_dev *sock) in tifm_sd_resume() argument
1038 struct mmc_host *mmc = tifm_get_drvdata(sock); in tifm_sd_resume()
1043 dev_dbg(&sock->dev, "resume initialize %d\n", rc); in tifm_sd_resume()