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))
54 struct device *dev = ice->dev; in qcom_ice_check_supported()
106 * Wait until the ICE BIST (built-in self-test) has completed.
115 * and not relying on hardware-level self-tests.
122 err = readl_poll_timeout(ice->base + QCOM_ICE_REG_BIST_STATUS, in qcom_ice_wait_bist_status()
126 dev_err(ice->dev, "Timed out waiting for ICE self-test to complete\n"); in qcom_ice_wait_bist_status()
142 struct device *dev = ice->dev; in qcom_ice_resume()
145 err = clk_prepare_enable(ice->core_clk); in qcom_ice_resume()
158 clk_disable_unprepare(ice->core_clk); in qcom_ice_suspend()
169 struct device *dev = ice->dev; in qcom_ice_program_key()
177 /* Only AES-256-XTS has been tested so far. */ in qcom_ice_program_key()
183 return -EINVAL; in qcom_ice_program_key()
214 return ERR_PTR(-EPROBE_DEFER); in qcom_ice_create()
223 return ERR_PTR(-ENOMEM); in qcom_ice_create()
225 engine->dev = dev; in qcom_ice_create()
226 engine->base = base; in qcom_ice_create()
229 * Legacy DT binding uses different clk names for each consumer, in qcom_ice_create()
231 * the we only have one clock and it is part of the dedicated DT node. in qcom_ice_create()
235 engine->core_clk = devm_clk_get_optional_enabled(dev, "ice_core_clk"); in qcom_ice_create()
236 if (!engine->core_clk) in qcom_ice_create()
237 engine->core_clk = devm_clk_get_optional_enabled(dev, "ice"); in qcom_ice_create()
238 if (!engine->core_clk) in qcom_ice_create()
239 engine->core_clk = devm_clk_get_enabled(dev, NULL); in qcom_ice_create()
240 if (IS_ERR(engine->core_clk)) in qcom_ice_create()
241 return ERR_CAST(engine->core_clk); in qcom_ice_create()
244 return ERR_PTR(-EOPNOTSUPP); in qcom_ice_create()
252 * of_qcom_ice_get() - get an ICE instance from a DT node
256 * consumer device if its DT node provides the 'ice' reg range and the 'ice'
257 * clock (for legacy DT style). On the other hand, if consumer provides a
258 * 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 link = device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER); 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",