| // SPDX-License-Identifier: GPL-2.0+ |
| * Copyright (C) 2019 Frank Wunderlich <frank-w@public-files.de> |
| #define PWRAP_BASE 0x1000d000 |
| #define PWRAP_WACS2_CMD 0x9c |
| #define PWRAP_CALC(adr, wdata) ((1 << 31) | (((adr) >> 1) << 16) | (wdata)) |
| #define MT6323_PWRC_BASE 0x8000 |
| #define RTC_BBPU_KEY (0x43 << 8) |
| int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
| addr = PWRAP_BASE + PWRAP_WACS2_CMD; |
| val = PWRAP_CALC(MT6323_PWRC_BASE + RTC_BBPU, RTC_BBPU_KEY); |
| val = PWRAP_CALC(MT6323_PWRC_BASE + RTC_WRTGR, 1); |
| // wait some time and then print error |
| printf("Failed to power off!!!\n"); |