Browse Source

feat(mt8188): add pmic and pwrap support

Add PWRAP and PMIC driver to support power-off.

TEST=build pass.
BUG=b:233720142

Signed-off-by: Hui Liu <hui.liu@mediatek.corp-partner.google.com>
Change-Id: Id9951134925f6cb5f8d304a7b8e7901837809bd9
pull/1988/head
Hui Liu 2 years ago
committed by Bo-Chen Chen
parent
commit
e9310c34b0
  1. 15
      plat/mediatek/drivers/pmic/rules.mk
  2. 30
      plat/mediatek/drivers/pmic_wrap/mt8188/pmic_wrap_init.h
  3. 20
      plat/mediatek/drivers/pmic_wrap/rules.mk
  4. 5
      plat/mediatek/include/mt8188/platform_def.h
  5. 1
      plat/mediatek/mt8188/plat_config.mk
  6. 2
      plat/mediatek/mt8188/platform.mk

15
plat/mediatek/drivers/pmic/rules.mk

@ -0,0 +1,15 @@
#
# Copyright (c) 2022, MediaTek Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
LOCAL_DIR := $(call GET_LOCAL_DIR)
MODULE := pmic
LOCAL_SRCS-y += ${LOCAL_DIR}/pmic.c
PLAT_INCLUDES += -I${LOCAL_DIR}/
$(eval $(call MAKE_MODULE,$(MODULE),$(LOCAL_SRCS-y),$(MTK_BL)))

30
plat/mediatek/drivers/pmic_wrap/mt8188/pmic_wrap_init.h

@ -0,0 +1,30 @@
/*
* Copyright (c) 2022, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PMIC_WRAP_INIT_H
#define PMIC_WRAP_INIT_H
#include <stdint.h>
#include "platform_def.h"
#include <pmic_wrap_init_common.h>
static struct mt8188_pmic_wrap_regs *const mtk_pwrap = (void *)PMIC_WRAP_BASE;
/* PMIC_WRAP registers */
struct mt8188_pmic_wrap_regs {
uint32_t init_done;
uint32_t reserved[543];
uint32_t wacs2_cmd;
uint32_t wacs2_wdata;
uint32_t reserved1[3];
uint32_t wacs2_rdata;
uint32_t reserved2[3];
uint32_t wacs2_vldclr;
uint32_t wacs2_sta;
};
#endif /* PMIC_WRAP_INIT_H */

20
plat/mediatek/drivers/pmic_wrap/rules.mk

@ -0,0 +1,20 @@
#
# Copyright (c) 2022, MediaTek Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
LOCAL_DIR := $(call GET_LOCAL_DIR)
MODULE := pmic_wrap
ifeq (${USE_PMIC_WRAP_INIT_V2}, 1)
LOCAL_SRCS-y += ${LOCAL_DIR}/pmic_wrap_init_v2.c
else
LOCAL_SRCS-y += ${LOCAL_DIR}/pmic_wrap_init.c
endif
PLAT_INCLUDES += -I${LOCAL_DIR}/
PLAT_INCLUDES += -I${LOCAL_DIR}/${MTK_SOC}
$(eval $(call MAKE_MODULE,$(MODULE),$(LOCAL_SRCS-y),$(MTK_BL)))

5
plat/mediatek/include/mt8188/platform_def.h

@ -25,6 +25,11 @@
#define UART0_BASE (IO_PHYS + 0x01002000)
#define UART_BAUDRATE (115200)
/*******************************************************************************
* PMIC related constants
******************************************************************************/
#define PMIC_WRAP_BASE (IO_PHYS + 0x00024000)
/*******************************************************************************
* Infra IOMMU related constants
******************************************************************************/

1
plat/mediatek/mt8188/plat_config.mk

@ -16,6 +16,7 @@ GICV3_SUPPORT_GIC600 := 1
# MTK options
#
PLAT_EXTRA_RODATA_INCLUDES := 1
USE_PMIC_WRAP_INIT_V2 := 1
# Configs for A78 and A55
CTX_INCLUDE_AARCH32_REGS := 0

2
plat/mediatek/mt8188/platform.mk

@ -26,6 +26,8 @@ MODULES-y += $(MTK_PLAT)/drivers/cirq
MODULES-y += $(MTK_PLAT)/drivers/dp
MODULES-y += $(MTK_PLAT)/drivers/gic600
MODULES-y += $(MTK_PLAT)/drivers/iommu
MODULES-y += $(MTK_PLAT)/drivers/pmic
MODULES-y += $(MTK_PLAT)/drivers/pmic_wrap
MODULES-y += $(MTK_PLAT)/drivers/timer
PLAT_BL_COMMON_SOURCES := common/desc_image_load.c \

Loading…
Cancel
Save