]> Git Repo - u-boot.git/blame - arch/arm/mach-aspeed/ast2500/clk_ast2500.c
dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()
[u-boot.git] / arch / arm / mach-aspeed / ast2500 / clk_ast2500.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
14e4b149 2/*
3 * Copyright (C) 2016 Google, Inc
14e4b149 4 */
5
6#include <common.h>
7#include <dm.h>
413353b3 8#include <asm/io.h>
14e4b149 9#include <asm/arch/scu_ast2500.h>
61b29b82 10#include <linux/err.h>
14e4b149 11
12int ast_get_clk(struct udevice **devp)
13{
14 return uclass_get_device_by_driver(UCLASS_CLK,
65e25bea 15 DM_DRIVER_GET(aspeed_ast2500_scu), devp);
14e4b149 16}
17
18void *ast_get_scu(void)
19{
20 struct ast2500_clk_priv *priv;
21 struct udevice *dev;
22 int ret;
23
24 ret = ast_get_clk(&dev);
25 if (ret)
26 return ERR_PTR(ret);
27
28 priv = dev_get_priv(dev);
29
30 return priv->scu;
31}
413353b3 32
33void ast_scu_unlock(struct ast2500_scu *scu)
34{
35 writel(SCU_UNLOCK_VALUE, &scu->protection_key);
36 while (!readl(&scu->protection_key))
37 ;
38}
39
40void ast_scu_lock(struct ast2500_scu *scu)
41{
42 writel(~SCU_UNLOCK_VALUE, &scu->protection_key);
43 while (readl(&scu->protection_key))
44 ;
45}
This page took 0.114877 seconds and 4 git commands to generate.