diff mbox series

[15/17] pinctrl: samsung: Add support for pad retention control for Exynos5260

Message ID 20190128230700.7325-16-stuart.menefy@mathembedded.com (mailing list archive)
State Changes Requested
Headers show
Series Resuscitate Exynos 5260 support | expand

Commit Message

Stuart Menefy Jan. 28, 2019, 11:06 p.m. UTC
This patch adds support for retention control for Exynos5260 SoC.

Signed-off-by: Stuart Menefy <stuart.menefy@mathembedded.com>
---
 .../bindings/pinctrl/samsung-pinctrl.txt           |  2 ++
 arch/arm/boot/dts/exynos5260.dtsi                  |  2 +-
 drivers/pinctrl/samsung/pinctrl-exynos-arm.c       | 25 ++++++++++++++++++++++
 drivers/pinctrl/samsung/pinctrl-exynos.c           | 21 ++++++++++++++++++
 4 files changed, 49 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
index 70659c917bdc..548d5786c400 100644
--- a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
@@ -163,6 +163,8 @@  B. External Wakeup Interrupts: For supporting external wakeup interrupts, a
        found on Samsung S5Pv210 SoCs,
      - samsung,exynos4210-wakeup-eint: represents wakeup interrupt controller
        found on Samsung Exynos4210 and S5PC110/S5PV210 SoCs.
+     - samsung,exynos5260-wakeup-eint: represents wakeup interrupt controller
+       found on Samsung Exynos5260 SoCs.
      - samsung,exynos7-wakeup-eint: represents wakeup interrupt controller
        found on Samsung Exynos7 SoC.
    - interrupts: interrupt used by multiplexed wakeup interrupts.
diff --git a/arch/arm/boot/dts/exynos5260.dtsi b/arch/arm/boot/dts/exynos5260.dtsi
index e8a5c8715b94..8b46f7078d5d 100644
--- a/arch/arm/boot/dts/exynos5260.dtsi
+++ b/arch/arm/boot/dts/exynos5260.dtsi
@@ -296,7 +296,7 @@ 
 			interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
 
 			wakeup-interrupt-controller {
-				compatible = "samsung,exynos4210-wakeup-eint";
+				compatible = "samsung,exynos5260-wakeup-eint";
 				interrupt-parent = <&gic>;
 				interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
 			};
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
index 44c6b753f692..997b938eecb2 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c
@@ -605,6 +605,28 @@  static const struct samsung_pin_bank_data exynos5260_pin_banks2[] __initconst =
 	EXYNOS_PIN_BANK_EINTG(4, 0x020, "gpz1", 0x04),
 };
 
+/* PMU pad retention groups registers for Exynos5260 */
+static const u32 exynos5260_retention_regs[] = {
+	EXYNOS5260_PAD_RETENTION_LPDDR3_OPTION,
+	EXYNOS5260_PAD_RETENTION_JTAG_OPTION,
+	EXYNOS5260_PAD_RETENTION_MMC2_OPTION,
+	EXYNOS5260_PAD_RETENTION_TOP_OPTION,
+	EXYNOS5260_PAD_RETENTION_UART_OPTION,
+	EXYNOS5260_PAD_RETENTION_MMC0_OPTION,
+	EXYNOS5260_PAD_RETENTION_MMC1_OPTION,
+	EXYNOS5260_PAD_RETENTION_SPI_OPTION,
+	EXYNOS5260_PAD_RETENTION_MIF_OPTION,
+	EXYNOS5260_PAD_RETENTION_BOOTLDO_OPTION,
+};
+
+static const struct samsung_retention_data exynos5260_retention_data __initconst = {
+	.regs	 = exynos5260_retention_regs,
+	.nr_regs = ARRAY_SIZE(exynos5260_retention_regs),
+	.value	 = EXYNOS_WAKEUP_FROM_LOWPWR,
+	.refcnt	 = &exynos_shared_retention_refcnt,
+	.init	 = exynos_retention_init,
+};
+
 /*
  * Samsung pinctrl driver data for Exynos5260 SoC. Exynos5260 SoC includes
  * three gpio/pin-mux/pinconfig controllers.
@@ -618,6 +640,7 @@  static const struct samsung_pin_ctrl exynos5260_pin_ctrl[] __initconst = {
 		.eint_wkup_init = exynos_eint_wkup_init,
 		.suspend	= exynos_pinctrl_suspend,
 		.resume		= exynos_pinctrl_resume,
+		.retention_data	= &exynos5260_retention_data,
 	}, {
 		/* pin-controller instance 1 data */
 		.pin_banks	= exynos5260_pin_banks1,
@@ -625,6 +648,7 @@  static const struct samsung_pin_ctrl exynos5260_pin_ctrl[] __initconst = {
 		.eint_gpio_init = exynos_eint_gpio_init,
 		.suspend	= exynos_pinctrl_suspend,
 		.resume		= exynos_pinctrl_resume,
+		.retention_data	= &exynos5260_retention_data,
 	}, {
 		/* pin-controller instance 2 data */
 		.pin_banks	= exynos5260_pin_banks2,
@@ -632,6 +656,7 @@  static const struct samsung_pin_ctrl exynos5260_pin_ctrl[] __initconst = {
 		.eint_gpio_init = exynos_eint_gpio_init,
 		.suspend	= exynos_pinctrl_suspend,
 		.resume		= exynos_pinctrl_resume,
+		.retention_data	= &exynos5260_retention_data,
 	},
 };
 
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c
index f49ea3d92aa1..c11343967632 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos.c
@@ -372,6 +372,25 @@  static const struct exynos_irq_chip s5pv210_wkup_irq_chip __initconst = {
 	.eint_wake_mask_reg = S5PV210_EINT_WAKEUP_MASK,
 };
 
+static const struct exynos_irq_chip exynos5260_wkup_irq_chip __initconst = {
+	.chip = {
+		.name = "exynos5260_wkup_irq_chip",
+		.irq_unmask = exynos_irq_unmask,
+		.irq_mask = exynos_irq_mask,
+		.irq_ack = exynos_irq_ack,
+		.irq_set_type = exynos_irq_set_type,
+		.irq_set_wake = exynos_wkup_irq_set_wake,
+		.irq_request_resources = exynos_irq_request_resources,
+		.irq_release_resources = exynos_irq_release_resources,
+	},
+	.eint_con = EXYNOS_WKUP_ECON_OFFSET,
+	.eint_mask = EXYNOS_WKUP_EMASK_OFFSET,
+	.eint_pend = EXYNOS_WKUP_EPEND_OFFSET,
+	.eint_wake_mask_value = EXYNOS_EINT_WAKEUP_MASK_DISABLED,
+	/* Only difference with exynos4210_wkup_irq_chip: */
+	.eint_wake_mask_reg = EXYNOS5260_EINT_WAKEUP_MASK,
+};
+
 static const struct exynos_irq_chip exynos4210_wkup_irq_chip __initconst = {
 	.chip = {
 		.name = "exynos4210_wkup_irq_chip",
@@ -412,6 +431,8 @@  static const struct exynos_irq_chip exynos7_wkup_irq_chip __initconst = {
 static const struct of_device_id exynos_wkup_irq_ids[] = {
 	{ .compatible = "samsung,s5pv210-wakeup-eint",
 			.data = &s5pv210_wkup_irq_chip },
+	{ .compatible = "samsung,exynos5260-wakeup-eint",
+			.data = &exynos5260_wkup_irq_chip },
 	{ .compatible = "samsung,exynos4210-wakeup-eint",
 			.data = &exynos4210_wkup_irq_chip },
 	{ .compatible = "samsung,exynos7-wakeup-eint",