Lines Matching +full:dt +full:- +full:node

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
31 /* BIST ("built-in self-test") status flags */
39 writel((val), (engine)->base + (reg))
42 readl((engine)->base + (reg))
55 struct device *dev = ice->dev; in qcom_ice_check_supported()
107 * Wait until the ICE BIST (built-in self-test) has completed.
116 * and not relying on hardware-level self-tests.
123 err = readl_poll_timeout(ice->base + QCOM_ICE_REG_BIST_STATUS, in qcom_ice_wait_bist_status()
127 dev_err(ice->dev, "Timed out waiting for ICE self-test to complete\n"); in qcom_ice_wait_bist_status()
143 struct device *dev = ice->dev; in qcom_ice_resume()
146 err = clk_prepare_enable(ice->core_clk); in qcom_ice_resume()
159 clk_disable_unprepare(ice->core_clk); in qcom_ice_suspend()
170 struct device *dev = ice->dev; in qcom_ice_program_key()
178 /* Only AES-256-XTS has been tested so far. */ in qcom_ice_program_key()
184 return -EINVAL; in qcom_ice_program_key()
215 return ERR_PTR(-EPROBE_DEFER); in qcom_ice_create()
224 return ERR_PTR(-ENOMEM); in qcom_ice_create()
226 engine->dev = dev; in qcom_ice_create()
227 engine->base = base; in qcom_ice_create()
230 * Legacy DT binding uses different clk names for each consumer, in qcom_ice_create()
232 * the we only have one clock and it is part of the dedicated DT node. in qcom_ice_create()
236 engine->core_clk = devm_clk_get_optional_enabled(dev, "ice_core_clk"); in qcom_ice_create()
237 if (!engine->core_clk) in qcom_ice_create()
238 engine->core_clk = devm_clk_get_optional_enabled(dev, "ice"); in qcom_ice_create()
239 if (!engine->core_clk) in qcom_ice_create()
240 engine->core_clk = devm_clk_get_enabled(dev, NULL); in qcom_ice_create()
241 if (IS_ERR(engine->core_clk)) in qcom_ice_create()
242 return ERR_CAST(engine->core_clk); in qcom_ice_create()
245 return ERR_PTR(-EOPNOTSUPP); in qcom_ice_create()
253 * of_qcom_ice_get() - get an ICE instance from a DT node
257 * consumer device if its DT node provides the 'ice' reg range and the 'ice'
258 * clock (for legacy DT style). On the other hand, if consumer provides a
259 * phandle via 'qcom,ice' property to an ICE DT, the ICE instance will already
272 if (!dev || !dev->of_node) in of_qcom_ice_get()
273 return ERR_PTR(-ENODEV); in of_qcom_ice_get()
282 base = devm_ioremap_resource(&pdev->dev, res); in of_qcom_ice_get()
287 return qcom_ice_create(&pdev->dev, base); in of_qcom_ice_get()
291 * If the consumer node does not provider an 'ice' reg range in of_qcom_ice_get()
292 * (legacy DT binding), then it must at least provide a phandle in of_qcom_ice_get()
293 * to the ICE devicetree node, otherwise ICE is not supported. in of_qcom_ice_get()
295 struct device_node *node __free(device_node) = of_parse_phandle(dev->of_node, in of_qcom_ice_get()
297 if (!node) in of_qcom_ice_get()
300 pdev = of_find_device_by_node(node); in of_qcom_ice_get()
302 dev_err(dev, "Cannot find device node %s\n", node->name); in of_qcom_ice_get()
303 return ERR_PTR(-EPROBE_DEFER); in of_qcom_ice_get()
309 dev_name(&pdev->dev)); in of_qcom_ice_get()
311 return ERR_PTR(-EPROBE_DEFER); in of_qcom_ice_get()
314 ice->link = device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER); in of_qcom_ice_get()
315 if (!ice->link) { in of_qcom_ice_get()
316 dev_err(&pdev->dev, in of_qcom_ice_get()
320 ice = ERR_PTR(-EINVAL); in of_qcom_ice_get()
334 dev_warn(&pdev->dev, "ICE registers not found\n"); in qcom_ice_probe()
338 engine = qcom_ice_create(&pdev->dev, base); in qcom_ice_probe()
348 { .compatible = "qcom,inline-crypto-engine" },
356 .name = "qcom-ice",