mirror of
https://github.com/torvalds/linux.git
synced 2024-12-17 08:31:39 +00:00
bfce552d0b
This patch moves Exynos PMU driver implementation from "arm/mach-exynos" to "drivers/soc/samsung". This driver is mainly used for setting misc bits of register from PMU IP of Exynos SoC which will be required to configure before Suspend/Resume. Currently all these settings are done in "arch/arm/mach-exynos/pmu.c" but moving ahead for ARM64 based SoC support, there is a need of this PMU driver in driver/* folder. This driver uses existing DT binding information and there should be no functionality change in the supported platforms. Signed-off-by: Amit Daniel Kachhap <amitdanielk@gmail.com> [tested on Peach-Pi (Exynos5880)] Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> [for testing on Trats2 (Exynos4412) and Odroid XU3 (Exynos5422)] Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> [k.kozlowski: Rebased, add necessary infrastructure for building and selecting drivers/soc because original patchset was on top of movement SROMc to drivers/soc] Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
223 lines
10 KiB
C
223 lines
10 KiB
C
/*
|
|
* Copyright (c) 2011-2015 Samsung Electronics Co., Ltd.
|
|
* http://www.samsung.com/
|
|
*
|
|
* EXYNOS4 - CPU PMU(Power Management Unit) support
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#include <linux/soc/samsung/exynos-regs-pmu.h>
|
|
#include <linux/soc/samsung/exynos-pmu.h>
|
|
|
|
#include "exynos-pmu.h"
|
|
|
|
static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
|
|
/* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
|
|
{ S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
|
|
{ S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } },
|
|
{ S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
|
|
{ S5P_ARM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|
|
{ S5P_SATA_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_DRAM_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
|
|
{ S5P_PAD_RETENTION_GPIO_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_UART_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_MMCA_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_MMCB_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_EBIA_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_EBIB_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_ISOLATION_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_ALV_SEL_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_XUSBXTI_LOWPWR, { 0x1, 0x1, 0x0 } },
|
|
{ S5P_XXTI_LOWPWR, { 0x1, 0x1, 0x0 } },
|
|
{ S5P_EXT_REGULATOR_LOWPWR, { 0x1, 0x1, 0x0 } },
|
|
{ S5P_GPIO_MODE_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_GPIO_MODE_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
|
|
{ S5P_CAM_LOWPWR, { 0x7, 0x0, 0x0 } },
|
|
{ S5P_TV_LOWPWR, { 0x7, 0x0, 0x0 } },
|
|
{ S5P_MFC_LOWPWR, { 0x7, 0x0, 0x0 } },
|
|
{ S5P_G3D_LOWPWR, { 0x7, 0x0, 0x0 } },
|
|
{ S5P_LCD0_LOWPWR, { 0x7, 0x0, 0x0 } },
|
|
{ S5P_LCD1_LOWPWR, { 0x7, 0x0, 0x0 } },
|
|
{ S5P_MAUDIO_LOWPWR, { 0x7, 0x7, 0x0 } },
|
|
{ S5P_GPS_LOWPWR, { 0x7, 0x0, 0x0 } },
|
|
{ S5P_GPS_ALIVE_LOWPWR, { 0x7, 0x0, 0x0 } },
|
|
{ PMU_TABLE_END,},
|
|
};
|
|
|
|
static const struct exynos_pmu_conf exynos4x12_pmu_config[] = {
|
|
{ S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
|
|
{ S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } },
|
|
{ S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
|
|
{ S5P_ARM_CORE1_LOWPWR, { 0x0, 0x0, 0x2 } },
|
|
{ S5P_DIS_IRQ_CORE1, { 0x0, 0x0, 0x0 } },
|
|
{ S5P_DIS_IRQ_CENTRAL1, { 0x0, 0x0, 0x0 } },
|
|
{ S5P_ISP_ARM_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR, { 0x0, 0x0, 0x0 } },
|
|
{ S5P_DIS_IRQ_ISP_ARM_CENTRAL_LOWPWR, { 0x0, 0x0, 0x0 } },
|
|
{ S5P_ARM_COMMON_LOWPWR, { 0x0, 0x0, 0x2 } },
|
|
{ S5P_L2_0_LOWPWR, { 0x0, 0x0, 0x3 } },
|
|
/* XXX_OPTION register should be set other field */
|
|
{ S5P_ARM_L2_0_OPTION, { 0x10, 0x10, 0x0 } },
|
|
{ S5P_L2_1_LOWPWR, { 0x0, 0x0, 0x3 } },
|
|
{ S5P_ARM_L2_1_OPTION, { 0x10, 0x10, 0x0 } },
|
|
{ S5P_CMU_ACLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_CMU_SCLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_CMU_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
|
|
{ S5P_DRAM_FREQ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5P_CMU_CLKSTOP_GPS_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_CMU_RESET_CAM_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_CMU_RESET_TV_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_CMU_RESET_MFC_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_CMU_RESET_G3D_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_CMU_RESET_LCD0_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_CMU_RESET_ISP_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_CMU_RESET_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
|
|
{ S5P_CMU_RESET_GPS_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_TOP_BUS_LOWPWR, { 0x3, 0x0, 0x0 } },
|
|
{ S5P_TOP_RETENTION_LOWPWR, { 0x1, 0x0, 0x1 } },
|
|
{ S5P_TOP_PWR_LOWPWR, { 0x3, 0x0, 0x3 } },
|
|
{ S5P_TOP_BUS_COREBLK_LOWPWR, { 0x3, 0x0, 0x0 } },
|
|
{ S5P_TOP_RETENTION_COREBLK_LOWPWR, { 0x1, 0x0, 0x1 } },
|
|
{ S5P_TOP_PWR_COREBLK_LOWPWR, { 0x3, 0x0, 0x3 } },
|
|
{ S5P_LOGIC_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
|
|
{ S5P_OSCCLK_GATE_LOWPWR, { 0x1, 0x0, 0x1 } },
|
|
{ S5P_LOGIC_RESET_COREBLK_LOWPWR, { 0x1, 0x1, 0x0 } },
|
|
{ S5P_OSCCLK_GATE_COREBLK_LOWPWR, { 0x1, 0x0, 0x1 } },
|
|
{ S5P_ONENAND_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
|
|
{ S5P_ONENAND_MEM_OPTION, { 0x10, 0x10, 0x0 } },
|
|
{ S5P_HSI_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
|
|
{ S5P_HSI_MEM_OPTION, { 0x10, 0x10, 0x0 } },
|
|
{ S5P_G2D_ACP_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
|
|
{ S5P_G2D_ACP_MEM_OPTION, { 0x10, 0x10, 0x0 } },
|
|
{ S5P_USBOTG_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
|
|
{ S5P_USBOTG_MEM_OPTION, { 0x10, 0x10, 0x0 } },
|
|
{ S5P_HSMMC_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
|
|
{ S5P_HSMMC_MEM_OPTION, { 0x10, 0x10, 0x0 } },
|
|
{ S5P_CSSYS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
|
|
{ S5P_CSSYS_MEM_OPTION, { 0x10, 0x10, 0x0 } },
|
|
{ S5P_SECSS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
|
|
{ S5P_SECSS_MEM_OPTION, { 0x10, 0x10, 0x0 } },
|
|
{ S5P_ROTATOR_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
|
|
{ S5P_ROTATOR_MEM_OPTION, { 0x10, 0x10, 0x0 } },
|
|
{ S5P_PAD_RETENTION_DRAM_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
|
|
{ S5P_PAD_RETENTION_GPIO_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_UART_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_MMCA_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_MMCB_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_EBIA_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ S5P_PAD_RETENTION_EBIB_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
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U_SYSCLK_GPS_LOWPWR, { 0x1, 0x0, 0x0 } },
|
|
{ PMU_TABLE_END,},
|
|
};
|
|
|
|
static const struct exynos_pmu_conf exynos4412_pmu_config[] = {
|
|
{ S5P_ARM_CORE2_LOWPWR, { 0x0, 0x0, 0x2 } },
|
|
{ S5P_DIS_IRQ_CORE2, { 0x0, 0x0, 0x0 } },
|
|
{ S5P_DIS_IRQ_CENTRAL2, { 0x0, 0x0, 0x0 } },
|
|
{ S5P_ARM_CORE3_LOWPWR, { 0x0, 0x0, 0x2 } },
|
|
{ S5P_DIS_IRQ_CORE3, { 0x0, 0x0, 0x0 } },
|
|
{ S5P_DIS_IRQ_CENTRAL3, { 0x0, 0x0, 0x0 } },
|
|
{ PMU_TABLE_END,},
|
|
};
|
|
|
|
const struct exynos_pmu_data exynos4210_pmu_data = {
|
|
.pmu_config = exynos4210_pmu_config,
|
|
};
|
|
|
|
const struct exynos_pmu_data exynos4212_pmu_data = {
|
|
.pmu_config = exynos4x12_pmu_config,
|
|
};
|
|
|
|
const struct exynos_pmu_data exynos4412_pmu_data = {
|
|
.pmu_config = exynos4x12_pmu_config,
|
|
.pmu_config_extra = exynos4412_pmu_config,
|
|
};
|