Lines Matching refs:dev_data
36 struct dthe_data *dev_data; in dthe_get_dev() local
38 if (ctx->dev_data) in dthe_get_dev()
39 return ctx->dev_data; in dthe_get_dev()
42 dev_data = list_first_entry(&dthe_dev_list.dev_list, struct dthe_data, list); in dthe_get_dev()
43 if (dev_data) in dthe_get_dev()
44 list_move_tail(&dev_data->list, &dthe_dev_list.dev_list); in dthe_get_dev()
47 return dev_data; in dthe_get_dev()
69 static int dthe_dma_init(struct dthe_data *dev_data) in dthe_dma_init() argument
74 dev_data->dma_aes_rx = NULL; in dthe_dma_init()
75 dev_data->dma_aes_tx = NULL; in dthe_dma_init()
76 dev_data->dma_sha_tx = NULL; in dthe_dma_init()
78 dev_data->dma_aes_rx = dma_request_chan(dev_data->dev, "rx"); in dthe_dma_init()
79 if (IS_ERR(dev_data->dma_aes_rx)) { in dthe_dma_init()
80 return dev_err_probe(dev_data->dev, PTR_ERR(dev_data->dma_aes_rx), in dthe_dma_init()
84 dev_data->dma_aes_tx = dma_request_chan(dev_data->dev, "tx1"); in dthe_dma_init()
85 if (IS_ERR(dev_data->dma_aes_tx)) { in dthe_dma_init()
86 ret = dev_err_probe(dev_data->dev, PTR_ERR(dev_data->dma_aes_tx), in dthe_dma_init()
91 dev_data->dma_sha_tx = dma_request_chan(dev_data->dev, "tx2"); in dthe_dma_init()
92 if (IS_ERR(dev_data->dma_sha_tx)) { in dthe_dma_init()
93 ret = dev_err_probe(dev_data->dev, PTR_ERR(dev_data->dma_sha_tx), in dthe_dma_init()
103 ret = dmaengine_slave_config(dev_data->dma_aes_rx, &cfg); in dthe_dma_init()
105 dev_err(dev_data->dev, "Can't configure IN dmaengine slave: %d\n", ret); in dthe_dma_init()
112 ret = dmaengine_slave_config(dev_data->dma_aes_tx, &cfg); in dthe_dma_init()
114 dev_err(dev_data->dev, "Can't configure OUT dmaengine slave: %d\n", ret); in dthe_dma_init()
121 dma_release_channel(dev_data->dma_sha_tx); in dthe_dma_init()
123 dma_release_channel(dev_data->dma_aes_tx); in dthe_dma_init()
125 dma_release_channel(dev_data->dma_aes_rx); in dthe_dma_init()
143 struct dthe_data *dev_data; in dthe_probe() local
146 dev_data = devm_kzalloc(dev, sizeof(*dev_data), GFP_KERNEL); in dthe_probe()
147 if (!dev_data) in dthe_probe()
150 dev_data->dev = dev; in dthe_probe()
151 dev_data->regs = devm_platform_ioremap_resource(pdev, 0); in dthe_probe()
152 if (IS_ERR(dev_data->regs)) in dthe_probe()
153 return PTR_ERR(dev_data->regs); in dthe_probe()
155 platform_set_drvdata(pdev, dev_data); in dthe_probe()
158 list_add(&dev_data->list, &dthe_dev_list.dev_list); in dthe_probe()
161 ret = dthe_dma_init(dev_data); in dthe_probe()
165 dev_data->engine = crypto_engine_alloc_init(dev, 1); in dthe_probe()
166 if (!dev_data->engine) { in dthe_probe()
171 ret = crypto_engine_start(dev_data->engine); in dthe_probe()
186 crypto_engine_exit(dev_data->engine); in dthe_probe()
188 dma_release_channel(dev_data->dma_aes_rx); in dthe_probe()
189 dma_release_channel(dev_data->dma_aes_tx); in dthe_probe()
190 dma_release_channel(dev_data->dma_sha_tx); in dthe_probe()
193 list_del(&dev_data->list); in dthe_probe()
201 struct dthe_data *dev_data = platform_get_drvdata(pdev); in dthe_remove() local
204 list_del(&dev_data->list); in dthe_remove()
209 crypto_engine_exit(dev_data->engine); in dthe_remove()
211 dma_release_channel(dev_data->dma_aes_rx); in dthe_remove()
212 dma_release_channel(dev_data->dma_aes_tx); in dthe_remove()
213 dma_release_channel(dev_data->dma_sha_tx); in dthe_remove()