blob: 587886c689dd28192dd450c7be4cae9d90dd1e25 [file] [log] [blame]
developer65014b82015-04-13 14:47:57 +08001/*
2 * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
developer65014b82015-04-13 14:47:57 +08005 */
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00006
developer65014b82015-04-13 14:47:57 +08007#include <assert.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008#include <common/debug.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009
developer65014b82015-04-13 14:47:57 +080010#include <mt8173_def.h>
developer65014b82015-04-13 14:47:57 +080011#include <rtc.h>
12
developer65014b82015-04-13 14:47:57 +080013void rtc_bbpu_power_down(void)
14{
15 uint16_t bbpu;
16
17 /* pull PWRBB low */
18 bbpu = RTC_BBPU_KEY | RTC_BBPU_AUTO | RTC_BBPU_PWREN;
19 if (Writeif_unlock()) {
20 RTC_Write(RTC_BBPU, bbpu);
developer037da992019-05-02 21:06:05 +080021 if (!RTC_Write_Trigger())
developere3ae6d02015-11-16 13:44:31 +080022 assert(0);
developer65014b82015-04-13 14:47:57 +080023 } else {
developere3ae6d02015-11-16 13:44:31 +080024 assert(0);
developer65014b82015-04-13 14:47:57 +080025 }
26}