mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-27 22:56:49 +08:00
poweroff: add poweroff for mt6323 pmic
this adds poweroff to bananapi r2 / mt7623 / mt6323 pmic Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
This commit is contained in:
parent
0b326fc296
commit
36b8b5d3ad
@ -366,4 +366,11 @@ config TWL4030_POWER
|
|||||||
The TWL4030 in a combination audio CODEC/power management with
|
The TWL4030 in a combination audio CODEC/power management with
|
||||||
GPIO and it is commonly used with the OMAP3 family of processors
|
GPIO and it is commonly used with the OMAP3 family of processors
|
||||||
|
|
||||||
|
config POWER_MT6323
|
||||||
|
bool "Poweroff driver for mediatek mt6323"
|
||||||
|
select CMD_POWEROFF
|
||||||
|
help
|
||||||
|
This adds poweroff driver for mt6323
|
||||||
|
this pmic is used on mt7623 / Bananapi R2
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -20,3 +20,4 @@ obj-$(CONFIG_DIALOG_POWER) += power_dialog.o
|
|||||||
obj-$(CONFIG_POWER_FSL) += power_fsl.o
|
obj-$(CONFIG_POWER_FSL) += power_fsl.o
|
||||||
obj-$(CONFIG_POWER_I2C) += power_i2c.o
|
obj-$(CONFIG_POWER_I2C) += power_i2c.o
|
||||||
obj-$(CONFIG_POWER_SPI) += power_spi.o
|
obj-$(CONFIG_POWER_SPI) += power_spi.o
|
||||||
|
obj-$(CONFIG_POWER_MT6323) += mt6323.o
|
||||||
|
37
drivers/power/mt6323.c
Normal file
37
drivers/power/mt6323.c
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 Frank Wunderlich <frank-w@public-files.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <command.h>
|
||||||
|
#include <asm/io.h>
|
||||||
|
|
||||||
|
#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 0x0000
|
||||||
|
#define RTC_BBPU_KEY (0x43 << 8)
|
||||||
|
#define RTC_WRTGR 0x003c
|
||||||
|
|
||||||
|
int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
|
{
|
||||||
|
u32 addr, val;
|
||||||
|
|
||||||
|
addr = PWRAP_BASE + PWRAP_WACS2_CMD;
|
||||||
|
val = PWRAP_CALC(MT6323_PWRC_BASE + RTC_BBPU, RTC_BBPU_KEY);
|
||||||
|
writel(val, addr);
|
||||||
|
|
||||||
|
mdelay(10);
|
||||||
|
|
||||||
|
val = PWRAP_CALC(MT6323_PWRC_BASE + RTC_WRTGR, 1);
|
||||||
|
writel(val, addr);
|
||||||
|
|
||||||
|
// wait some time and then print error
|
||||||
|
mdelay(10000);
|
||||||
|
printf("Failed to power off!!!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user