wkup_m3_ipc: Add support for IO Isolation
authorDave Gerlach <d-gerlach@ti.com>
Fri, 2 Nov 2018 10:29:07 +0000 (15:59 +0530)
committerTero Kristo <t-kristo@ti.com>
Tue, 6 Nov 2018 13:06:17 +0000 (15:06 +0200)
AM43xx support isolation of the IOs so that control is taken
from the peripheral they are connected to and overridden by values
present in the CTRL_CONF_* registers for the pad in the control module.

The actual toggling happens from the wkup_m3, so use a DT property from
thea wkup_m3_ipc node to allow the PM code to communicate the necessity
for placing the IOs into isolation to the firmware.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt
drivers/soc/ti/wkup_m3_ipc.c
include/linux/wkup_m3_ipc.h

index 4cdbb60fd0d0bace26aed3155b7dcf942545275b..2d6c66ba1cdaf76dc9cfa130403501524de30e80 100644 (file)
@@ -89,3 +89,51 @@ Example:
                ti,vtt-gpio-pin = <7>;
                ...
        };
+
+VTT Toggle using any GPIO
+----------------------------------
+Supported by: AM437x ONLY
+Used on: AM437x GP EVM
+
+Many of the pins on AM437x have the ability to configure both normal and
+sleep states. Because of this it is possible to use any pin with a
+corresponding CTRL_CONF_* register in the control module and the
+DS_PAD_CONFIG bits to toggle the VTT regulator enable pin. The DS state of
+the pin must be configured such that the pin disables the VTT regulator. The
+normal state of the pin must be configured such that the VTT regulator is
+enabled by the state alone. This is because the VTT regulator must be enabled
+before context is restored to the controlling GPIO.
+
+Optional properties:
+- ti,set-io-isolation: Indicates that the IO's should be placed into
+                       isolation and the DS_PAD_CONFIG values should be
+                       used during suspend.
+
+Example:
+
+On the AM437x GP EVM, the VTT enable line must be held low to disable VTT
+regulator and held high to enable, so the following pinctrl entry is used.
+The DS pull is enabled which uses a pull down by default and DS off mode is
+used which outputs a low by default. For the normal state, a pull up is
+specified so that the VTT enable line gets pulled high immediately after
+the DS states are removed upon exit from DeepSleep0.
+
+       &am43xx_pinmux {
+               pinctrl-names = "default";
+               pinctrl-0 = <&ddr3_vtt_toggle_default>;
+
+               ddr3_vtt_toggle_default: ddr_vtt_toggle_default {
+               pinctrl-single,pins = <
+                       0x25C (DS0_PULL_UP_DOWN_EN | PIN_OUTPUT_PULLUP |
+                              DS0_FORCE_OFF_MODE | MUX_MODE7)>;
+               };
+               ...
+       };
+
+       wkup_m3_ipc: wkup_m3_ipc@1324 {
+               compatible = "ti,am4372-wkup-m3-ipc";
+               ...
+               ...
+               ti,set-io-isolation;
+               ...
+       };
index 5a9c1f5042207f84390f4cdeebae538896b1a99c..75b99b7e23ce0c08a8dfc3b488a56d55d1ebfeeb 100644 (file)
@@ -54,6 +54,8 @@
 #define IPC_VTT_STAT_MASK              (0x1 << 3)
 #define IPC_VTT_GPIO_PIN_SHIFT         (0x4)
 #define IPC_VTT_GPIO_PIN_MASK          (0x3f << 4)
+#define IPC_IO_ISOLATION_STAT_SHIFT    (10)
+#define IPC_IO_ISOLATION_STAT_MASK     (0x1 << 10)
 
 #define M3_STATE_UNKNOWN               0
 #define M3_STATE_RESET                 1
@@ -235,6 +237,11 @@ static void wkup_m3_set_vtt_gpio(struct wkup_m3_ipc *m3_ipc, int gpio)
                            (gpio << IPC_VTT_GPIO_PIN_SHIFT);
 }
 
+static void wkup_m3_set_io_isolation(struct wkup_m3_ipc *m3_ipc)
+{
+       m3_ipc->isolation_conf = (1 << IPC_IO_ISOLATION_STAT_SHIFT);
+}
+
 /* Public functions */
 /**
  * wkup_m3_set_mem_type - Pass wkup_m3 which type of memory is in use
@@ -311,8 +318,8 @@ static int wkup_m3_prepare_low_power(struct wkup_m3_ipc *m3_ipc, int state)
        wkup_m3_ctrl_ipc_write(m3_ipc, m3_ipc->resume_addr, 0);
        wkup_m3_ctrl_ipc_write(m3_ipc, m3_power_state, 1);
        wkup_m3_ctrl_ipc_write(m3_ipc, m3_ipc->mem_type |
-                              m3_ipc->vtt_conf, 4);
-
+                              m3_ipc->vtt_conf |
+                              m3_ipc->isolation_conf, 4);
        wkup_m3_ctrl_ipc_write(m3_ipc, DS_IPC_DEFAULT, 2);
        wkup_m3_ctrl_ipc_write(m3_ipc, DS_IPC_DEFAULT, 3);
        wkup_m3_ctrl_ipc_write(m3_ipc, DS_IPC_DEFAULT, 5);
@@ -521,6 +528,9 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)
                        dev_warn(dev, "Invalid VTT GPIO(%d) pin\n", temp);
        }
 
+       if (of_find_property(np, "ti,set-io-isolation", NULL))
+               wkup_m3_set_io_isolation(m3_ipc);
+
        /*
         * Wait for firmware loading completion in a thread so we
         * can boot the wkup_m3 as soon as it's ready without holding
index 682efbb7d401e50e232d1d5098c8afe619ce9c5b..bd79c1fcf299f52eac6daee9e87098804eae331a 100644 (file)
@@ -34,6 +34,7 @@ struct wkup_m3_ipc {
        int mem_type;
        unsigned long resume_addr;
        int vtt_conf;
+       int isolation_conf;
        int state;
 
        struct completion sync_complete;