Lines Matching full:ss

3  * sun4i-ss-core.c - hardware cryptographic accelerator for Allwinner A20 SoC
7 * Core file which registers crypto algorithms supported by the SS.
24 #include "sun4i-ss.h"
50 .cra_driver_name = "md5-sun4i-ss",
76 .cra_driver_name = "sha1-sun4i-ss",
97 .cra_driver_name = "cbc-aes-sun4i-ss",
118 .cra_driver_name = "ecb-aes-sun4i-ss",
140 .cra_driver_name = "cbc-des-sun4i-ss",
161 .cra_driver_name = "ecb-des-sun4i-ss",
183 .cra_driver_name = "cbc-des3-sun4i-ss",
204 .cra_driver_name = "ecb-des3-sun4i-ss",
240 if (!ss_algs[i].ss) in sun4i_ss_debugfs_show()
274 struct sun4i_ss_ctx *ss = dev_get_drvdata(dev); in sun4i_ss_pm_suspend() local
276 reset_control_assert(ss->reset); in sun4i_ss_pm_suspend()
278 clk_disable_unprepare(ss->ssclk); in sun4i_ss_pm_suspend()
279 clk_disable_unprepare(ss->busclk); in sun4i_ss_pm_suspend()
285 struct sun4i_ss_ctx *ss = dev_get_drvdata(dev); in sun4i_ss_pm_resume() local
289 err = clk_prepare_enable(ss->busclk); in sun4i_ss_pm_resume()
291 dev_err(ss->dev, "Cannot prepare_enable busclk\n"); in sun4i_ss_pm_resume()
295 err = clk_prepare_enable(ss->ssclk); in sun4i_ss_pm_resume()
297 dev_err(ss->dev, "Cannot prepare_enable ssclk\n"); in sun4i_ss_pm_resume()
301 err = reset_control_deassert(ss->reset); in sun4i_ss_pm_resume()
303 dev_err(ss->dev, "Cannot deassert reset control\n"); in sun4i_ss_pm_resume()
322 static int sun4i_ss_pm_init(struct sun4i_ss_ctx *ss) in sun4i_ss_pm_init() argument
326 pm_runtime_use_autosuspend(ss->dev); in sun4i_ss_pm_init()
327 pm_runtime_set_autosuspend_delay(ss->dev, 2000); in sun4i_ss_pm_init()
329 err = pm_runtime_set_suspended(ss->dev); in sun4i_ss_pm_init()
332 pm_runtime_enable(ss->dev); in sun4i_ss_pm_init()
336 static void sun4i_ss_pm_exit(struct sun4i_ss_ctx *ss) in sun4i_ss_pm_exit() argument
338 pm_runtime_disable(ss->dev); in sun4i_ss_pm_exit()
348 struct sun4i_ss_ctx *ss; in sun4i_ss_probe() local
353 ss = devm_kzalloc(&pdev->dev, sizeof(*ss), GFP_KERNEL); in sun4i_ss_probe()
354 if (!ss) in sun4i_ss_probe()
357 ss->base = devm_platform_ioremap_resource(pdev, 0); in sun4i_ss_probe()
358 if (IS_ERR(ss->base)) { in sun4i_ss_probe()
360 return PTR_ERR(ss->base); in sun4i_ss_probe()
363 ss->variant = of_device_get_match_data(&pdev->dev); in sun4i_ss_probe()
364 if (!ss->variant) { in sun4i_ss_probe()
369 ss->ssclk = devm_clk_get(&pdev->dev, "mod"); in sun4i_ss_probe()
370 if (IS_ERR(ss->ssclk)) { in sun4i_ss_probe()
371 err = PTR_ERR(ss->ssclk); in sun4i_ss_probe()
372 dev_err(&pdev->dev, "Cannot get SS clock err=%d\n", err); in sun4i_ss_probe()
375 dev_dbg(&pdev->dev, "clock ss acquired\n"); in sun4i_ss_probe()
377 ss->busclk = devm_clk_get(&pdev->dev, "ahb"); in sun4i_ss_probe()
378 if (IS_ERR(ss->busclk)) { in sun4i_ss_probe()
379 err = PTR_ERR(ss->busclk); in sun4i_ss_probe()
380 dev_err(&pdev->dev, "Cannot get AHB SS clock err=%d\n", err); in sun4i_ss_probe()
385 ss->reset = devm_reset_control_get_optional(&pdev->dev, "ahb"); in sun4i_ss_probe()
386 if (IS_ERR(ss->reset)) in sun4i_ss_probe()
387 return PTR_ERR(ss->reset); in sun4i_ss_probe()
388 if (!ss->reset) in sun4i_ss_probe()
395 err = clk_set_rate(ss->ssclk, cr_mod); in sun4i_ss_probe()
406 cr = clk_get_rate(ss->busclk); in sun4i_ss_probe()
414 cr = clk_get_rate(ss->ssclk); in sun4i_ss_probe()
417 dev_warn(&pdev->dev, "Clock ss %lu (%lu MHz) (must be <= %lu)\n", in sun4i_ss_probe()
420 dev_dbg(&pdev->dev, "Clock ss %lu (%lu MHz) (must be <= %lu)\n", in sun4i_ss_probe()
423 dev_warn(&pdev->dev, "Clock ss is at %lu (%lu MHz) (must be <= %lu)\n", in sun4i_ss_probe()
426 ss->dev = &pdev->dev; in sun4i_ss_probe()
427 platform_set_drvdata(pdev, ss); in sun4i_ss_probe()
429 spin_lock_init(&ss->slock); in sun4i_ss_probe()
431 err = sun4i_ss_pm_init(ss); in sun4i_ss_probe()
438 * Since the A80 seems to have an other version of SS in sun4i_ss_probe()
442 err = pm_runtime_resume_and_get(ss->dev); in sun4i_ss_probe()
446 writel(SS_ENABLED, ss->base + SS_CTL); in sun4i_ss_probe()
447 v = readl(ss->base + SS_CTL); in sun4i_ss_probe()
451 writel(0, ss->base + SS_CTL); in sun4i_ss_probe()
453 pm_runtime_put_sync(ss->dev); in sun4i_ss_probe()
456 ss_algs[i].ss = ss; in sun4i_ss_probe()
461 dev_err(ss->dev, "Fail to register %s\n", in sun4i_ss_probe()
469 dev_err(ss->dev, "Fail to register %s\n", in sun4i_ss_probe()
477 dev_err(ss->dev, "Fail to register %s\n", in sun4i_ss_probe()
485 ss->dbgfs_dir = debugfs_create_dir("sun4i-ss", NULL); in sun4i_ss_probe()
486 ss->dbgfs_stats = debugfs_create_file("stats", 0444, ss->dbgfs_dir, ss, in sun4i_ss_probe()
506 sun4i_ss_pm_exit(ss); in sun4i_ss_probe()
513 struct sun4i_ss_ctx *ss = platform_get_drvdata(pdev); in sun4i_ss_remove() local
529 sun4i_ss_pm_exit(ss); in sun4i_ss_remove()
547 .name = "sun4i-ss",
555 MODULE_ALIAS("platform:sun4i-ss");