Lines Matching full:host
21 static void thunder_mmc_acquire_bus(struct cvm_mmc_host *host) in thunder_mmc_acquire_bus() argument
23 down(&host->mmc_serializer); in thunder_mmc_acquire_bus()
26 static void thunder_mmc_release_bus(struct cvm_mmc_host *host) in thunder_mmc_release_bus() argument
28 up(&host->mmc_serializer); in thunder_mmc_release_bus()
31 static void thunder_mmc_int_enable(struct cvm_mmc_host *host, u64 val) in thunder_mmc_int_enable() argument
33 writeq(val, host->base + MIO_EMM_INT(host)); in thunder_mmc_int_enable()
34 writeq(val, host->base + MIO_EMM_INT_EN_SET(host)); in thunder_mmc_int_enable()
37 static int thunder_mmc_register_interrupts(struct cvm_mmc_host *host, in thunder_mmc_register_interrupts() argument
50 0, cvm_mmc_irq_names[i], host); in thunder_mmc_register_interrupts()
63 struct cvm_mmc_host *host; in thunder_mmc_probe() local
66 host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); in thunder_mmc_probe()
67 if (!host) in thunder_mmc_probe()
70 pci_set_drvdata(pdev, host); in thunder_mmc_probe()
79 host->base = pcim_iomap(pdev, 0, pci_resource_len(pdev, 0)); in thunder_mmc_probe()
80 if (!host->base) { in thunder_mmc_probe()
86 host->dma_base = host->base; in thunder_mmc_probe()
88 host->reg_off = 0x2000; in thunder_mmc_probe()
89 host->reg_off_dma = 0x160; in thunder_mmc_probe()
91 host->clk = devm_clk_get(dev, NULL); in thunder_mmc_probe()
92 if (IS_ERR(host->clk)) { in thunder_mmc_probe()
93 ret = PTR_ERR(host->clk); in thunder_mmc_probe()
97 ret = clk_prepare_enable(host->clk); in thunder_mmc_probe()
100 host->sys_freq = clk_get_rate(host->clk); in thunder_mmc_probe()
102 spin_lock_init(&host->irq_handler_lock); in thunder_mmc_probe()
103 sema_init(&host->mmc_serializer, 1); in thunder_mmc_probe()
105 host->dev = dev; in thunder_mmc_probe()
106 host->acquire_bus = thunder_mmc_acquire_bus; in thunder_mmc_probe()
107 host->release_bus = thunder_mmc_release_bus; in thunder_mmc_probe()
108 host->int_enable = thunder_mmc_int_enable; in thunder_mmc_probe()
110 host->use_sg = true; in thunder_mmc_probe()
111 host->big_dma_addr = true; in thunder_mmc_probe()
112 host->need_irq_handler_lock = true; in thunder_mmc_probe()
113 host->last_slot = -1; in thunder_mmc_probe()
123 writeq(127, host->base + MIO_EMM_INT_EN(host)); in thunder_mmc_probe()
124 writeq(3, host->base + MIO_EMM_DMA_INT_ENA_W1C(host)); in thunder_mmc_probe()
126 writeq(BIT_ULL(16), host->base + MIO_EMM_DMA_FIFO_CFG(host)); in thunder_mmc_probe()
128 ret = thunder_mmc_register_interrupts(host, pdev); in thunder_mmc_probe()
140 host->slot_pdev[i] = of_platform_device_create(child_node, NULL, in thunder_mmc_probe()
142 if (!host->slot_pdev[i]) in thunder_mmc_probe()
145 ret = cvm_mmc_of_slot_probe(&host->slot_pdev[i]->dev, host); in thunder_mmc_probe()
158 if (host->slot[i]) in thunder_mmc_probe()
159 cvm_mmc_of_slot_remove(host->slot[i]); in thunder_mmc_probe()
160 if (host->slot_pdev[i]) { in thunder_mmc_probe()
161 get_device(&host->slot_pdev[i]->dev); in thunder_mmc_probe()
162 of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL); in thunder_mmc_probe()
163 put_device(&host->slot_pdev[i]->dev); in thunder_mmc_probe()
166 clk_disable_unprepare(host->clk); in thunder_mmc_probe()
172 struct cvm_mmc_host *host = pci_get_drvdata(pdev); in thunder_mmc_remove() local
177 if (host->slot[i]) in thunder_mmc_remove()
178 cvm_mmc_of_slot_remove(host->slot[i]); in thunder_mmc_remove()
180 dma_cfg = readq(host->dma_base + MIO_EMM_DMA_CFG(host)); in thunder_mmc_remove()
182 writeq(dma_cfg, host->dma_base + MIO_EMM_DMA_CFG(host)); in thunder_mmc_remove()
184 clk_disable_unprepare(host->clk); in thunder_mmc_remove()