Lines Matching +full:mmc +full:- +full:slot
2 * Driver for MMC and SSD cards for Cavium ThunderX SOCs.
11 #include <linux/dma-mapping.h>
13 #include <linux/mmc/mmc.h>
23 down(&host->mmc_serializer); in thunder_mmc_acquire_bus()
28 up(&host->mmc_serializer); in thunder_mmc_release_bus()
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()
48 ret = devm_request_irq(&pdev->dev, pci_irq_vector(pdev, i), in thunder_mmc_register_interrupts()
60 struct device_node *node = pdev->dev.of_node; in thunder_mmc_probe()
61 struct device *dev = &pdev->dev; in thunder_mmc_probe()
68 return -ENOMEM; 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()
81 ret = -EINVAL; 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()
134 * mmc_of_parse and devm* require one device per slot. in thunder_mmc_probe()
135 * Create a dummy device per slot and set the node pointer to in thunder_mmc_probe()
136 * the slot. The easiest way to get this is using in thunder_mmc_probe()
139 if (of_device_is_compatible(child_node, "mmc-slot")) { in thunder_mmc_probe()
140 host->slot_pdev[i] = of_platform_device_create(child_node, NULL, in thunder_mmc_probe()
141 &pdev->dev); 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()
178 if (host->slot[i]) in thunder_mmc_remove()
179 cvm_mmc_of_slot_remove(host->slot[i]); in thunder_mmc_remove()
181 dma_cfg = readq(host->dma_base + MIO_EMM_DMA_CFG(host)); in thunder_mmc_remove()
183 writeq(dma_cfg, host->dma_base + MIO_EMM_DMA_CFG(host)); in thunder_mmc_remove()
185 clk_disable_unprepare(host->clk); in thunder_mmc_remove()