developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 1 | /* |
2 | * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. | ||||
3 | * | ||||
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 5 | */ |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 6 | |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 7 | #include <assert.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | #include <common/debug.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 9 | |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 10 | #include <mt8173_def.h> |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 11 | #include <rtc.h> |
12 | |||||
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 13 | void 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); | ||||
developer | 037da99 | 2019-05-02 21:06:05 +0800 | [diff] [blame] | 21 | if (!RTC_Write_Trigger()) |
developer | e3ae6d0 | 2015-11-16 13:44:31 +0800 | [diff] [blame] | 22 | assert(0); |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 23 | } else { |
developer | e3ae6d0 | 2015-11-16 13:44:31 +0800 | [diff] [blame] | 24 | assert(0); |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 25 | } |
26 | } |