summaryrefslogtreecommitdiff
path: root/drivers/soc/mediatek/mtk-infracfg.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-02 03:17:40 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-02 03:17:40 +0300
commitadbc128fa8b4e9ecfdd11d5dd0a7d9845c6ea510 (patch)
tree55137f446ffd127530fdcbe86dafdfb436fe1c20 /drivers/soc/mediatek/mtk-infracfg.c
parent537433b6241e067de2d9da3bed5f4fed9c9eac58 (diff)
parent0ca14cdea789f70c4dc7ef5844aad52cb9675aee (diff)
downloadlinux-adbc128fa8b4e9ecfdd11d5dd0a7d9845c6ea510.tar.xz
Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC platform updates from Arnd Bergmann: "These are mostly minor bugfixes, cleanup and many defconfig updates to support added drivers. In particular OMAP and PXA keep cleaning up the legacy code base, as usual. Nvidia adds some more SoC support code for Tegra 186. For the first time on years, we are actually adding a non-DT platform for the EP93xx based Liebherr controller BK3.1. It's a minor variation of the EP93xx reference design and in active use, while EP93xx apparently doesn't have enough new development to have any device tree support" * tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (73 commits) ARM: omap: hwmod: fix section mismatch warnings ARM: pxa/tosa-bt: add MODULE_LICENSE tag arm64: defconfig: enable CONFIG_ACPI_APEI_EINJ arm64: defconfig: enable EDAC GHES option arm64: defconfig: enable CONFIG_ACPI_APEI_MEMORY_FAILURE ARM: imx_v6_v7_defconfig: enable CONFIG_CPU_FREQ_STAT Wind down ARM/TANGO port ARM: davinci: constify gpio_led ARM: davinci: drop unneeded newline soc: Add SoC driver for Gemini ARM: SAMSUNG: Add SPDX license identifiers ARM: S5PV210: Add SPDX license identifiers ARM: S3C64XX: Add SPDX license identifiers ARM: S3C24XX: Add SPDX license identifiers ARM: EXYNOS: Add SPDX license identifiers ARM: imx: remove unused imx3 pm definitions ARM: imx: don't abort MMDC probe if power saving status doesn't match ARM: imx_v6_v7_defconfig: enable RTC_DRV_MXC_V2 ARM: imx_v6_v7_defconfig: Add missing config for DART-MX6 SoM ARM: davinci: Use PTR_ERR_OR_ZERO() ...
Diffstat (limited to 'drivers/soc/mediatek/mtk-infracfg.c')
-rw-r--r--drivers/soc/mediatek/mtk-infracfg.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/soc/mediatek/mtk-infracfg.c b/drivers/soc/mediatek/mtk-infracfg.c
index dba3055a9493..8c310de01e93 100644
--- a/drivers/soc/mediatek/mtk-infracfg.c
+++ b/drivers/soc/mediatek/mtk-infracfg.c
@@ -19,23 +19,33 @@
#define INFRA_TOPAXI_PROTECTEN 0x0220
#define INFRA_TOPAXI_PROTECTSTA1 0x0228
+#define INFRA_TOPAXI_PROTECTEN_SET 0x0260
+#define INFRA_TOPAXI_PROTECTEN_CLR 0x0264
/**
* mtk_infracfg_set_bus_protection - enable bus protection
* @regmap: The infracfg regmap
* @mask: The mask containing the protection bits to be enabled.
+ * @reg_update: The boolean flag determines to set the protection bits
+ * by regmap_update_bits with enable register(PROTECTEN) or
+ * by regmap_write with set register(PROTECTEN_SET).
*
* This function enables the bus protection bits for disabled power
* domains so that the system does not hang when some unit accesses the
* bus while in power down.
*/
-int mtk_infracfg_set_bus_protection(struct regmap *infracfg, u32 mask)
+int mtk_infracfg_set_bus_protection(struct regmap *infracfg, u32 mask,
+ bool reg_update)
{
unsigned long expired;
u32 val;
int ret;
- regmap_update_bits(infracfg, INFRA_TOPAXI_PROTECTEN, mask, mask);
+ if (reg_update)
+ regmap_update_bits(infracfg, INFRA_TOPAXI_PROTECTEN, mask,
+ mask);
+ else
+ regmap_write(infracfg, INFRA_TOPAXI_PROTECTEN_SET, mask);
expired = jiffies + HZ;
@@ -59,16 +69,24 @@ int mtk_infracfg_set_bus_protection(struct regmap *infracfg, u32 mask)
* mtk_infracfg_clear_bus_protection - disable bus protection
* @regmap: The infracfg regmap
* @mask: The mask containing the protection bits to be disabled.
+ * @reg_update: The boolean flag determines to clear the protection bits
+ * by regmap_update_bits with enable register(PROTECTEN) or
+ * by regmap_write with clear register(PROTECTEN_CLR).
*
* This function disables the bus protection bits previously enabled with
* mtk_infracfg_set_bus_protection.
*/
-int mtk_infracfg_clear_bus_protection(struct regmap *infracfg, u32 mask)
+
+int mtk_infracfg_clear_bus_protection(struct regmap *infracfg, u32 mask,
+ bool reg_update)
{
unsigned long expired;
int ret;
- regmap_update_bits(infracfg, INFRA_TOPAXI_PROTECTEN, mask, 0);
+ if (reg_update)
+ regmap_update_bits(infracfg, INFRA_TOPAXI_PROTECTEN, mask, 0);
+ else
+ regmap_write(infracfg, INFRA_TOPAXI_PROTECTEN_CLR, mask);
expired = jiffies + HZ;