rockchip: rk322x: default enable SPL LIBCOMMON and LIBGENERIC
[oweals/u-boot.git] / arch / arm / mach-aspeed / ast2500 / clk_ast2500.c
index 079909fa6462218a93ada767df11349657c443f2..7d864a4088036b065036803f385731223e23d9db 100644 (file)
@@ -1,11 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2016 Google, Inc
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <dm.h>
+#include <asm/io.h>
 #include <asm/arch/scu_ast2500.h>
 
 int ast_get_clk(struct udevice **devp)
@@ -28,3 +28,17 @@ void *ast_get_scu(void)
 
        return priv->scu;
 }
+
+void ast_scu_unlock(struct ast2500_scu *scu)
+{
+       writel(SCU_UNLOCK_VALUE, &scu->protection_key);
+       while (!readl(&scu->protection_key))
+               ;
+}
+
+void ast_scu_lock(struct ast2500_scu *scu)
+{
+       writel(~SCU_UNLOCK_VALUE, &scu->protection_key);
+       while (readl(&scu->protection_key))
+               ;
+}