From patchwork Sat Feb 19 21:53:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 12752426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB1D8C4321E for ; Sat, 19 Feb 2022 21:55:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235325AbiBSV4B (ORCPT ); Sat, 19 Feb 2022 16:56:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231686AbiBSV4A (ORCPT ); Sat, 19 Feb 2022 16:56:00 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C04F541A9 for ; Sat, 19 Feb 2022 13:55:41 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id u5so9898741ple.3 for ; Sat, 19 Feb 2022 13:55:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=xFv8pYP/ZU+UReQceN+3cdKUVINAH0lfYR5sSaL4wpY=; b=XPsUi7jSiA5kjSrk5AzxuhDHnSy45szyngwKqcCazfH7MoUZob4Lm3qB/pUi+xGH1w tM2FTl2egymaCOspqlEYDrzD7iXa5xVrTZ5GeLKxYZzbH4R7UehkDivjq5OPJiotItOs fKrT6Etz8W7S5vIN7qCH3x04vVBdMLLHfjy+uoDjlbBK4EnnJyLJtPTURv+kLWXXhi39 +3ekYDxTkPkpAjFkPprNKmRbSUMpOa2XWRWcwRVdE/LKBcDKQ5qLIBZX0JoZDg9/gH4r ydgqdMa7gdqIe+e3fy3oMstvVM4dBgTXBGUGgEshGlHfPMQ8ULFmRInkq6jCb39i2CS+ LmsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xFv8pYP/ZU+UReQceN+3cdKUVINAH0lfYR5sSaL4wpY=; b=yYKH5/46iy/S5y0zrMaVhw8pZ87zK6yJNkCq9TzyUh400vKPNxFWpA75wJbEQNQNSD CQxH8/8onP0IeSs2Dy0BpU9GKWH/jIlNSN45CA5OxYDDiTxspWPb0wNe8ThHbEqPE5SQ 8b5gNick4lDuTdwCS+IVaQydrQkroS/9DQwRo1bbz67brnO03HRR77XjEaDUWi7rrtX7 MMxFvrmF/qKdL0qDTL4/EIqt89pdUGCqlQ/B4XDkh/NRsUODNf4EEzWsZuC5w/Vk752g k8akOkvi6powZ6d5NRtoKXA41IcjiBk9rqBPjNcgj/Irt+lDK25QthoSoCh92nbGxYVK 8cCQ== X-Gm-Message-State: AOAM531b+4mkCzI26ghbFqQ1OoKoziCLtClNJdsb/Pw/OBnlQM/EDCH9 dG0CZU657V3cna5gevBZuDRLwg== X-Google-Smtp-Source: ABdhPJyS54Vh+H8WNTs+GkpNEVkoLaIFTLqYsD/C0UVOD/Oa+ZbdqlFNf5Y7Edc06y/9TO+gZLiBSA== X-Received: by 2002:a17:90b:f88:b0:1b8:ad41:e200 with SMTP id ft8-20020a17090b0f8800b001b8ad41e200mr18633706pjb.1.1645307740514; Sat, 19 Feb 2022 13:55:40 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1001:7090:31ab:1e81:9550:f30a]) by smtp.gmail.com with ESMTPSA id i17sm13447337pgn.82.2022.02.19.13.55.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 13:55:39 -0800 (PST) From: Drew Fustini To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Bjorn Andersson , Dave Gerlach , devicetree@vger.kernel.org, Drew Fustini , Keerthy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier , Nishanth Menon , Rob Herring , Santosh Shilimkar , Tony Lindgren , s-anna@ti.com, khilman@baylibre.com Subject: [PATCH 01/11] remoteproc: move rproc_da_to_va declaration to remoteproc.h Date: Sat, 19 Feb 2022 13:53:18 -0800 Message-Id: <20220219215328.485660-2-dfustini@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219215328.485660-1-dfustini@baylibre.com> References: <20220219215328.485660-1-dfustini@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Suman Anna The rproc_da_to_va() API is an exported function, so move its declaration from the remoteproc local remoteproc_internal.h to the public remoteproc.h file. This will allow drivers outside of the remoteproc folder to be able to use this API. Signed-off-by: Suman Anna Signed-off-by: Dave Gerlach [dfustini: fix line number conflict] Signed-off-by: Drew Fustini --- drivers/remoteproc/remoteproc_internal.h | 1 - include/linux/remoteproc.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index a328e634b1de..72d4d3d7d94d 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -84,7 +84,6 @@ static inline void rproc_char_device_remove(struct rproc *rproc) void rproc_free_vring(struct rproc_vring *rvring); int rproc_alloc_vring(struct rproc_vdev *rvdev, int i); -void *rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem); phys_addr_t rproc_va_to_pa(void *cpu_addr); int rproc_trigger_recovery(struct rproc *rproc); diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index e0600e1e5c17..cc9dc9aef0c0 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -673,6 +673,7 @@ void rproc_shutdown(struct rproc *rproc); int rproc_detach(struct rproc *rproc); int rproc_set_firmware(struct rproc *rproc, const char *fw_name); void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type); +void *rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem); void rproc_coredump_using_sections(struct rproc *rproc); int rproc_coredump_add_segment(struct rproc *rproc, dma_addr_t da, size_t size); int rproc_coredump_add_custom_segment(struct rproc *rproc, From patchwork Sat Feb 19 21:53:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 12752425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89A41C4332F for ; Sat, 19 Feb 2022 21:55:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236444AbiBSV4C (ORCPT ); Sat, 19 Feb 2022 16:56:02 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234690AbiBSV4B (ORCPT ); Sat, 19 Feb 2022 16:56:01 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C10154188 for ; Sat, 19 Feb 2022 13:55:42 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id v4so11570053pjh.2 for ; Sat, 19 Feb 2022 13:55:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=tlXNd4WfVV+N9MiUaNSDYcpKd5QnvzkHB2jHSyxHiSE=; b=5CsPhfBVJpIWa/x8rm2/nRs+N1fPus18cLloeaRd9q55k67hSctSfb4OPSgzhhJRKN ds1xDXNKBbrg/YjO4G0VLVCjHl3B+o1j4RfesE2fybq4r4tYeUdXsR+h9I0zKcJRX1in ANy2eEEcRhi4ELUpvbxjt5gssa2HV/zXKk2xsUk1RXisQDOuDCvNlCnLYGYeJ6jUPjfR MxSpYh+aNtu+Y1K6tIqqytBwhlY1/fikjip6nBX029rlIymhVbR4Sj+dMNh/5faVGfUM EeXF5jv0IbknANDnNMHFurfvscQuwqwHttIU0niSRoEwE97/ecOlUqR7CWReYDyAIxo/ Fbkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tlXNd4WfVV+N9MiUaNSDYcpKd5QnvzkHB2jHSyxHiSE=; b=QqAiOr7Lgn/EcaoeNgsdKvJex2XjwjeGqadRULXAxVIp7qq8We3u5Q6+PSIz0PdVpv WN4MBFfvz/EAYUn7z7t1chup45tyOWwbh6+LqoGfOKs4ytT5i8yfy0L1cRZ7JLJOyjec 8rn9HG2029Df5H6n6PkvaSJcPQ+hs8lQDQLZFm+hsChGj34aFEJnVvbY2zODi3ieZ3Ez VZooKQjFoaYE3s/gDnMHWrCYikfDhoreNtme2JFSAxAMR4f4Ivo3zDwYqcgFtEc7btl5 D5Iha34HXPJU8leYqK12qMRl8mps8vpzTLQprQ2D3EWRfyjshjqbc0sCOvbybdlXXdSN 0MfA== X-Gm-Message-State: AOAM531YQ/6Hb5A0REDdT6Em5c61Ta92OH5CtSEE0IJxJSqFeBAj600b cgCc/S43A3L9mR9/kgvhelE7Lw== X-Google-Smtp-Source: ABdhPJxlo3caslaF3DdogQsF2CNkabNAPdTzgIT92VlqtQMgcaudXdsWCY5mLtbEZK5i64FQjhgHfg== X-Received: by 2002:a17:90b:4cc6:b0:1bc:210d:b6fa with SMTP id nd6-20020a17090b4cc600b001bc210db6famr741799pjb.104.1645307741905; Sat, 19 Feb 2022 13:55:41 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1001:7090:31ab:1e81:9550:f30a]) by smtp.gmail.com with ESMTPSA id i17sm13447337pgn.82.2022.02.19.13.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 13:55:41 -0800 (PST) From: Drew Fustini To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Bjorn Andersson , Dave Gerlach , devicetree@vger.kernel.org, Drew Fustini , Keerthy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier , Nishanth Menon , Rob Herring , Santosh Shilimkar , Tony Lindgren , s-anna@ti.com, khilman@baylibre.com Subject: [PATCH 02/11] dt-bindings: wkup_m3_ipc: Add vtt toggling bindings Date: Sat, 19 Feb 2022 13:53:19 -0800 Message-Id: <20220219215328.485660-3-dfustini@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219215328.485660-1-dfustini@baylibre.com> References: <20220219215328.485660-1-dfustini@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Dave Gerlach Add description of the wkup_m3_ipc DT properties that can be used to toggle VTT regulator during low power mode transitions. Signed-off-by: Dave Gerlach Signed-off-by: Drew Fustini --- .../bindings/soc/ti/wkup_m3_ipc.txt | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt index 401550487ed6..4cdbb60fd0d0 100644 --- a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt +++ b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt @@ -55,3 +55,37 @@ Example: ... }; }; + +Support for VTT Toggle +================================== +In order to enable the support for VTT toggle during Suspend/Resume +sequence needed by some boards (like AM335x EVM-SK & AM437x GP EVM), +the below DT properties are required. It is possible to toggle VTT +using one of two methods depending on the SoC being used, either +GPIO0 toggle (AM335x and AM437x), or any GPIO with DS_PAD_CONFIG +bits in the control module (AM437x only). + +VTT Toggle using GPIO0 +---------------------------------- +Supported by: AM335x and AM437x +Used on: AM335x EVM-SK + +Optional properties: +- ti,needs-vtt-toggle: Indicates that the boards requires VTT toggling + during suspend/resume. +- ti,vtt-gpio-pin: Specifies the GPIO0 pin used for VTT toggle. + +Important Note: +- Here it is assumed that VTT Toggle will be done using a pin on GPIO-0 Instance. + It will not work on any other GPIO using the above properties, regardless of + which part is being used. + +Example: + wkup_m3_ipc: wkup_m3_ipc@1324 { + compatible = "ti,am3352-wkup-m3-ipc"; + ... + ... + ti,needs-vtt-toggle; + ti,vtt-gpio-pin = <7>; + ... + }; From patchwork Sat Feb 19 21:53:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 12752427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 573ECC433F5 for ; Sat, 19 Feb 2022 21:55:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243172AbiBSV4J (ORCPT ); Sat, 19 Feb 2022 16:56:09 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243169AbiBSV4I (ORCPT ); Sat, 19 Feb 2022 16:56:08 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E1753B7F for ; Sat, 19 Feb 2022 13:55:44 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id t4-20020a17090a510400b001b8c4a6cd5dso11642966pjh.5 for ; Sat, 19 Feb 2022 13:55:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=DPqC7sk0jXG3KL4pgR3flZBRy+4blHrbIS6/yBS27Mg=; b=RCOdYH6WIaW2xVqRGFA32u3oOOKisUBbxh2bQZ6OLEuubkB37e/DLlUPUI/qS7ZsPp K9vvLxcUrbv9BMjXSg9sciDkhvYNEdsasmZcb9Ita6e1im3+L2SufG4wk2DJXmvo5pK+ Wx2IcMPhbQ1baTb9PqWZsTEBmfmjFo8u1nF5FRQu3fsbnEslXRYQAawKzZ/FeLpMmYU+ P3YLroiH1jtnPz8t/uPk7nZkuRosB1f+3Lu82Nd6FqbNMUN3ETXpC3qUUkI2D6KutTCV MvLoFxsc1KMYD2sK6O4571yQv32Zu02CNtmn8AKwLrNsFHFGSBRAnJHyhvH6+ZTianzC Gd9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DPqC7sk0jXG3KL4pgR3flZBRy+4blHrbIS6/yBS27Mg=; b=T89TBs8S3bfdD6DggBIl4jXgzGlcuYiRO3CthxoEisjGLgGjYXh77vH+9qTGdULIrv LrUzDsOpwDZwl6NJnggtQ1l07KFzCUmkuxYjkh06FdQZ5d6NdpEuyZ9hn8I01CItEk9Z ofsmUooDwrPhvDuqe8nzr2FDWEk6bwmGecMEgOZvgzj+00gy2VCAZB3n+L9m6oY3rtHk fKZuy04/u4qRTbB9YYtiSD5ElL6U4J2YFYkp3sr55PHsoGcnsXFCoF+upF4JZf8dcbPs 5xKAgUEVtflVN6Ja4Y+3MDQG9WZPrNgmbW8qAAQkMfQxKnyIIiCf6SvYs3JpczxYBrbu 6PLA== X-Gm-Message-State: AOAM533K8lE5fCxS/f8Bg0T0RySv0RFxfh1ILR5FqDJAZqTTvvr2yAHR yDRYJiSR8ibxaEjRY5JHMQSmqg== X-Google-Smtp-Source: ABdhPJyrjgGWD8uK2oJsFpdirNDfgtzWoV5CCSu0s9ORmrFOQ1CeFPo+nYa0r4tS45fI/XS//g8JLQ== X-Received: by 2002:a17:90a:9309:b0:1bc:1bf1:dad4 with SMTP id p9-20020a17090a930900b001bc1bf1dad4mr1336912pjo.169.1645307744093; Sat, 19 Feb 2022 13:55:44 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1001:7090:31ab:1e81:9550:f30a]) by smtp.gmail.com with ESMTPSA id i17sm13447337pgn.82.2022.02.19.13.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 13:55:43 -0800 (PST) From: Drew Fustini To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Bjorn Andersson , Dave Gerlach , devicetree@vger.kernel.org, Drew Fustini , Keerthy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier , Nishanth Menon , Rob Herring , Santosh Shilimkar , Tony Lindgren , s-anna@ti.com, khilman@baylibre.com Subject: [PATCH 03/11] soc: ti: wkup_m3_ipc: Add support for toggling VTT regulator Date: Sat, 19 Feb 2022 13:53:20 -0800 Message-Id: <20220219215328.485660-4-dfustini@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219215328.485660-1-dfustini@baylibre.com> References: <20220219215328.485660-1-dfustini@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Dave Gerlach Some boards (currently AM335x EVM-SK) provides s/w control via GPIO to toggle VTT regulator to reduce power consumption in low power state. The VTT regulator should be disabled after enabling self-refresh on suspend, and should be enabled before disabling self-refresh on resume. This is to allow proper self-refresh entry/exit commands to be transmitted to the memory. Add support for toggling VTT regulator using DT properties. Actual toggling happens in CM3 Firmware. The enable option & the GPIO pin used is collected in A8 Core and then sent to CM3 using IPC registers. Note: Here it is assumed that VTT Toggle will be done using a pin on GPIO-0 Instance. The reason is GPIO-0 is in wakeup domain. Signed-off-by: Dave Gerlach Signed-off-by: Keerthy Signed-off-by: Drew Fustini --- drivers/soc/ti/wkup_m3_ipc.c | 27 +++++++++++++++++++++++++-- include/linux/wkup_m3_ipc.h | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c index 72386bd393fe..974b4118a893 100644 --- a/drivers/soc/ti/wkup_m3_ipc.c +++ b/drivers/soc/ti/wkup_m3_ipc.c @@ -40,6 +40,13 @@ #define M3_FW_VERSION_MASK 0xffff #define M3_WAKE_SRC_MASK 0xff +#define IPC_MEM_TYPE_SHIFT (0x0) +#define IPC_MEM_TYPE_MASK (0x7 << 0) +#define IPC_VTT_STAT_SHIFT (0x3) +#define IPC_VTT_STAT_MASK (0x1 << 3) +#define IPC_VTT_GPIO_PIN_SHIFT (0x4) +#define IPC_VTT_GPIO_PIN_MASK (0x3f << 4) + #define M3_STATE_UNKNOWN 0 #define M3_STATE_RESET 1 #define M3_STATE_INITED 2 @@ -215,6 +222,12 @@ static int wkup_m3_is_available(struct wkup_m3_ipc *m3_ipc) (m3_ipc->state != M3_STATE_UNKNOWN)); } +static void wkup_m3_set_vtt_gpio(struct wkup_m3_ipc *m3_ipc, int gpio) +{ + m3_ipc->vtt_conf = (1 << IPC_VTT_STAT_SHIFT) | + (gpio << IPC_VTT_GPIO_PIN_SHIFT); +} + /* Public functions */ /** * wkup_m3_set_mem_type - Pass wkup_m3 which type of memory is in use @@ -294,7 +307,8 @@ static int wkup_m3_prepare_low_power(struct wkup_m3_ipc *m3_ipc, int state) /* Program each required IPC register then write defaults to others */ 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, 4); + wkup_m3_ctrl_ipc_write(m3_ipc, m3_ipc->mem_type | + m3_ipc->vtt_conf, 4); wkup_m3_ctrl_ipc_write(m3_ipc, DS_IPC_DEFAULT, 2); wkup_m3_ctrl_ipc_write(m3_ipc, DS_IPC_DEFAULT, 3); @@ -433,12 +447,13 @@ static int wkup_m3_rproc_boot_thread(void *arg) static int wkup_m3_ipc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - int irq, ret; + int irq, ret, temp; phandle rproc_phandle; struct rproc *m3_rproc; struct resource *res; struct task_struct *task; struct wkup_m3_ipc *m3_ipc; + struct device_node *np = dev->of_node; m3_ipc = devm_kzalloc(dev, sizeof(*m3_ipc), GFP_KERNEL); if (!m3_ipc) @@ -496,6 +511,14 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) m3_ipc->ops = &ipc_ops; + if (of_find_property(np, "ti,needs-vtt-toggle", NULL) && + !(of_property_read_u32(np, "ti,vtt-gpio-pin", &temp))) { + if (temp >= 0 && temp <= 31) + wkup_m3_set_vtt_gpio(m3_ipc, temp); + else + dev_warn(dev, "Invalid VTT GPIO(%d) pin\n", temp); + } + /* * Wait for firmware loading completion in a thread so we * can boot the wkup_m3 as soon as it's ready without holding diff --git a/include/linux/wkup_m3_ipc.h b/include/linux/wkup_m3_ipc.h index 3f496967b538..2bc52c6381d5 100644 --- a/include/linux/wkup_m3_ipc.h +++ b/include/linux/wkup_m3_ipc.h @@ -33,6 +33,7 @@ struct wkup_m3_ipc { int mem_type; unsigned long resume_addr; + int vtt_conf; int state; struct completion sync_complete; From patchwork Sat Feb 19 21:53:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 12752428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20A36C433F5 for ; Sat, 19 Feb 2022 21:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243211AbiBSV4N (ORCPT ); Sat, 19 Feb 2022 16:56:13 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243176AbiBSV4L (ORCPT ); Sat, 19 Feb 2022 16:56:11 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0295541AA for ; Sat, 19 Feb 2022 13:55:45 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id g1so5324986pfv.1 for ; Sat, 19 Feb 2022 13:55:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=DZiOtxBgoTtwB9UJCoY4ZWmHfqn+dNPJ6H+DmBuShUo=; b=VsBO4YCWPc6ib471hmScxdPkd5daMf5/3q37Dx+GlNpIVyuhM1J3OTEnzAq3ifa2Nk ThSiij4+tIN2Dd/oF+tW6xv2JAJqAmURHr4Ny+pX9XNRQYFyIBL1mGJ953LQ0GCTSKUO uoNTgpN5gGcy7yeBAPELm0gJMt+qeTXLf/RkPjoIDpdVlreCHJu0HEBwnvEx5IpZJW14 D2EOiCLdJvp4lwuPO8Qitwkd6x+sikjvvc/wyk/Wutdh1YYpPBEvR+fOQTy7lcSjP4ZV WniLF2oSAtEmrfQfRWq2tnzfGF4X5+hk3oWPKLo76jIl3SPcNdt1CFQS89M/v9zjIUUM m6bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DZiOtxBgoTtwB9UJCoY4ZWmHfqn+dNPJ6H+DmBuShUo=; b=IVLnCy6xwfwR/VRPF/qkZmKAFzu4/iHCuvohj1mqD7WfB2xsc3QEHAhp4cf1/J25hw 0T9ia3kujlw4rSpgfZlf/hgTeJcuDeb4rU4XUpwPtGzr8baFampzfpWazQjtI9nU8QhG nEzTsTK2RapYDVufvJN2nrL2vq+mm1+ZNoc/4n16dMDGcghnX/nX9Xlqy9fiX8DMYP+f i4wCc7dtzoIS2GSgXs/ckTzTyJk7RD0cd6AF7w6k6TAPmiSKMayX/mEDGBddWEeu/9m+ 3DGTZ+mG8/6aANdt6WGdWw4ZYH9thkbmOWixhmGoAaLyxsSOpxQVYbM5UAQkfWYSMMG2 YSnQ== X-Gm-Message-State: AOAM531/467KcvHJ/cTjyrxBc825bIxNN6AznfUrUkLrwtI+nu193iQL MfFxKC9eSGB9+RcUpAK514yRHQ== X-Google-Smtp-Source: ABdhPJyoFjeAb5/4d7KaIVBfHrlpcRCkYuPnEHCv4zupG3KFWCHinQulVyzNGCV+KsSAPxCBwWg1TQ== X-Received: by 2002:a63:e403:0:b0:365:5657:7b4d with SMTP id a3-20020a63e403000000b0036556577b4dmr10908413pgi.130.1645307745264; Sat, 19 Feb 2022 13:55:45 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1001:7090:31ab:1e81:9550:f30a]) by smtp.gmail.com with ESMTPSA id i17sm13447337pgn.82.2022.02.19.13.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 13:55:44 -0800 (PST) From: Drew Fustini To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Bjorn Andersson , Dave Gerlach , devicetree@vger.kernel.org, Drew Fustini , Keerthy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier , Nishanth Menon , Rob Herring , Santosh Shilimkar , Tony Lindgren , s-anna@ti.com, khilman@baylibre.com Subject: [PATCH 04/11] dt-bindings: wkup_m3_ipc: Add ti,io-isolation property Date: Sat, 19 Feb 2022 13:53:21 -0800 Message-Id: <20220219215328.485660-5-dfustini@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219215328.485660-1-dfustini@baylibre.com> References: <20220219215328.485660-1-dfustini@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Dave Gerlach Add documentation for the ti,io-isolation DT property on the wkup_m3_ipc node which tells the wkup_m3_ipc driver to use the wkup_m3 to enable IO Isolation during low power mode transitions on am43xx platforms. Signed-off-by: Dave Gerlach Signed-off-by: Drew Fustini --- .../bindings/soc/ti/wkup_m3_ipc.txt | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt index 4cdbb60fd0d0..df6b600abf4c 100644 --- a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt +++ b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt @@ -89,3 +89,49 @@ Example: ti,vtt-gpio-pin = <7>; ... }; + + +IO Isolation +============ +Supported by: AM43xx SoCs + +It is possible to configure any pin with a corresponding CTRL_CONF_* +register in the control module to use the states defined in the DS_PAD_CONFIG +bits by enabling IO isolation on the SoC. The 'ti,set-io-isolation' property +tells the wkup_m3_ipc driver to enable IO isolation late in the suspend path +after all drivers have been disabled. + +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 (VTT Toggle using any GPIO on am437x-gp-evm): +----------------------------------------------------- + +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; + ... + }; From patchwork Sat Feb 19 21:53:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 12752429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B04FC433F5 for ; Sat, 19 Feb 2022 21:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243192AbiBSV4P (ORCPT ); Sat, 19 Feb 2022 16:56:15 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243193AbiBSV4N (ORCPT ); Sat, 19 Feb 2022 16:56:13 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A4DE541B8 for ; Sat, 19 Feb 2022 13:55:47 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id b8so11538487pjb.4 for ; Sat, 19 Feb 2022 13:55:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=9DbHqa7/PuuNUMOB7llAk+nGQ8XUCY82hlr70rx3hVw=; b=lMjdjwfj/yDZTTN1HHuqEqPG/1HemUUV8Zai5f4adJ5QtFzGfu892IQ+bv5mTvsCdC hKeH346azPEzDp7/Qee0oz31oraJBCRHEJBp+3bc0zfjWKaIC/2DErWJW/PlQiSEp796 +pDt3kN28gf1Bgr0wZ8xOlhxKf6CBK7MQleRRBLx3tdSPuDwDfxkjCdpPfluTJXCWWke fLVHPkKFGUsMUAwLRWalE3t5L6NumiQ64GU6D0CahKtRD5D562bkHFyaSM+XyjtTwnL5 cxTLxN6H3KPXLOyCgUmogh5pOcF1ugmkJvBage57cVzRK9F2p5b1aDgP+nRfPkWEfAj8 HA2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9DbHqa7/PuuNUMOB7llAk+nGQ8XUCY82hlr70rx3hVw=; b=shoOZWqezUmZtAI05s/JSOOWJyZCl0rBJ6vEAqcZrvEb2awqeN/d9iEVoeX670Vk6Q xHNpjANar7yUpX9L0oX59XUCQhp6wFRE1PHftJyGX7gRMsjfscMLQ8mWgX07FouJdZTU om8HRFWyD+SJNUNdgdY0uIT/7zuJ3lRFt294aiWW38MK5VVtAGZLX9B1J5Am7kEtJG5r ZDqPYJrqXrhntWacQMtEKZmVnTHzt2QVFTyCm288a4cGVksMD2V6qVHuY2wVsyctCn1h OBgEun1Q9MhHbasQN3yW0wZf9vuRGH1Yws/irpLi4W9Oo9vL4g6AsNjUpkyWEIe3oatS PrKw== X-Gm-Message-State: AOAM5317ptKJhBsk7iNWMiDxVkVkUNgv32WrVwr/bXiJlggODKZ2awrC yE75CF/YLag6yXHkjda2MFI+Lg== X-Google-Smtp-Source: ABdhPJwn7h7JYGRUMVhMEzpjLHw+5/dBjRfY4qeN6ev9JfTP0JOjdKzAk7hp+6ntGi56C2g+1y40Vg== X-Received: by 2002:a17:90b:358d:b0:1bb:74a3:7088 with SMTP id mm13-20020a17090b358d00b001bb74a37088mr14369662pjb.141.1645307746444; Sat, 19 Feb 2022 13:55:46 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1001:7090:31ab:1e81:9550:f30a]) by smtp.gmail.com with ESMTPSA id i17sm13447337pgn.82.2022.02.19.13.55.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 13:55:46 -0800 (PST) From: Drew Fustini To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Bjorn Andersson , Dave Gerlach , devicetree@vger.kernel.org, Drew Fustini , Keerthy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier , Nishanth Menon , Rob Herring , Santosh Shilimkar , Tony Lindgren , s-anna@ti.com, khilman@baylibre.com Subject: [PATCH 05/11] soc: ti: wkup_m3_ipc: Add support for IO Isolation Date: Sat, 19 Feb 2022 13:53:22 -0800 Message-Id: <20220219215328.485660-6-dfustini@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219215328.485660-1-dfustini@baylibre.com> References: <20220219215328.485660-1-dfustini@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Dave Gerlach 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 Signed-off-by: Keerthy Signed-off-by: Drew Fustini --- drivers/soc/ti/wkup_m3_ipc.c | 14 ++++++++++++-- include/linux/wkup_m3_ipc.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c index 974b4118a893..e7ae942b7014 100644 --- a/drivers/soc/ti/wkup_m3_ipc.c +++ b/drivers/soc/ti/wkup_m3_ipc.c @@ -46,6 +46,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 @@ -228,6 +230,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 @@ -308,8 +315,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); @@ -519,6 +526,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 diff --git a/include/linux/wkup_m3_ipc.h b/include/linux/wkup_m3_ipc.h index 2bc52c6381d5..b706eac58f92 100644 --- a/include/linux/wkup_m3_ipc.h +++ b/include/linux/wkup_m3_ipc.h @@ -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; From patchwork Sat Feb 19 21:53:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 12752435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D345BC43219 for ; Sat, 19 Feb 2022 21:56:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243203AbiBSV42 (ORCPT ); Sat, 19 Feb 2022 16:56:28 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243201AbiBSV4N (ORCPT ); Sat, 19 Feb 2022 16:56:13 -0500 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32390541BB for ; Sat, 19 Feb 2022 13:55:48 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id 12so7347225pgd.0 for ; Sat, 19 Feb 2022 13:55:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=65Eb1HUPdIjM8zVi86DKNREnJ4z9OvkieF1s3FEMLrI=; b=4VytRZT6CAyhgtB0WgTO1CmH6FyEiVE195+cE4dlZVCWFZ8iudpzgTS+gBHtUACxvT MIhY2IZkpmy+hYNGyiNLj9Y0MnvZ5oytRW9znNCeTPHETg9mvXJEBGHAHEdlGiJRuNLt D+NUYwS3fm0pLZSNi2C+PmG/A8uDIxZr9DmzK08CFnih9aSO6qES+NCnIBrB3KUMnrbm kpLLAwu2YKChJx0fZYrR3/P1jV9rMelaKyUtjcKN/EnWjFr8gf9C+6LL0fF+akcmtImi Bk0gAc2Jo5ISBuUh8e3VOK1t/cbq9ZGfd+0hq6z+P+AQypLHD1kIcNXwooUfd9dPHsB4 evUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=65Eb1HUPdIjM8zVi86DKNREnJ4z9OvkieF1s3FEMLrI=; b=LPKJAYCufJkp0Eh3NppT5i6zXXq0kbejB+06HGcO+gJIDIUzgKBnHTsFtKNxYwiTur PF8L1qfeM8u0JwNqLKFc2YYygx3580ECL3FEyyn18o0LtAznczDtB/z3n+D7EZlza/7A wQ819cquSs8Ylz6l/RQMLJxz8Ye7GBWDhJ2LXmO731aAHPLaNf0acDF7kMZVWXB9xTGc KQigo0PtE4+F1WANZCalgoGeO2kdxf18rFKlsjsAFlcHdYpX6JNtee8/DNdcIHm+OnLR T/Ni9V7+bUgyx5YZdmLamknju/wKoIlxKDHFqlk0l1jCTAoU/OZH0vj04nr9UgLimgrx dp6g== X-Gm-Message-State: AOAM532p5Fd/Kwq/8w3aNgZ7g/64JrG/lAEEGrf5bl5Fr+9ldRfNq9TD m9jhgyn2XqT2OQgjpTkNvuyxYFRerWNuKlnK X-Google-Smtp-Source: ABdhPJzR11qeGJpsKF8keWXr323YCIBX9Clo8mnHXsBsgwGyif8SWMepT1n0NinmAP+YMeQZ1Q2ZaA== X-Received: by 2002:a63:3f42:0:b0:363:c08a:8dfd with SMTP id m63-20020a633f42000000b00363c08a8dfdmr11119666pga.108.1645307747624; Sat, 19 Feb 2022 13:55:47 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1001:7090:31ab:1e81:9550:f30a]) by smtp.gmail.com with ESMTPSA id i17sm13447337pgn.82.2022.02.19.13.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 13:55:47 -0800 (PST) From: Drew Fustini To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Bjorn Andersson , Dave Gerlach , devicetree@vger.kernel.org, Drew Fustini , Keerthy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier , Nishanth Menon , Rob Herring , Santosh Shilimkar , Tony Lindgren , s-anna@ti.com, khilman@baylibre.com Subject: [PATCH 06/11] ARM: dts: am437x-gp-evm: Enable wkup_m3 control of IO isolation Date: Sat, 19 Feb 2022 13:53:23 -0800 Message-Id: <20220219215328.485660-7-dfustini@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219215328.485660-1-dfustini@baylibre.com> References: <20220219215328.485660-1-dfustini@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Dave Gerlach With this flag wkup_m3 is able to control IO isolation during suspend on the board. Signed-off-by: Dave Gerlach Signed-off-by: Keerthy Signed-off-by: Drew Fustini --- arch/arm/boot/dts/am437x-gp-evm.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts index 4416ddb559e4..91b67b428a06 100644 --- a/arch/arm/boot/dts/am437x-gp-evm.dts +++ b/arch/arm/boot/dts/am437x-gp-evm.dts @@ -1127,6 +1127,10 @@ &cpu { cpu0-supply = <&dcdc2>; }; +&wkup_m3_ipc { + ti,set-io-isolation; +}; + &pruss1_mdio { status = "disabled"; }; From patchwork Sat Feb 19 21:53:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 12752430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C18F0C433EF for ; Sat, 19 Feb 2022 21:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243238AbiBSV4Q (ORCPT ); Sat, 19 Feb 2022 16:56:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243213AbiBSV4N (ORCPT ); Sat, 19 Feb 2022 16:56:13 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8DA654686 for ; Sat, 19 Feb 2022 13:55:49 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id b8so11538533pjb.4 for ; Sat, 19 Feb 2022 13:55:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=CHkmrYvj5o3Fvy+E5fMWk8LislxIdO58ETqj8OSQKGc=; b=cS7KyWnM1357k+YCng24Fih0jgFnP+ZaK0QNBtuh0U98ESMyakH971ptDSZAKHJSqr gQiK+13pz5YcRpIRf9RLWnb01Yt+oAM/vBAH9WkXJS+x7fXTEXqU/HwzvznPNZx7EI4D +9PAorOQjHodo/XaFAH5lcDpJhWbS9fIuC/nTZdVsB3+ZhVecVhmFBld6hrdzc7Z08ke fQDx3Ur74vXYAoaz2En6XXWMzLCckz49CRwjfPsLHdUgW1cjMiHVSdQ/O8z4tZFeoK7K 7cutFt6sV8FRaf/7DP3/fmsfpXwFAdjFcwX2NO2pM5m3+KqUrUrp7gMiMq9sX2EuHaAw bbaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CHkmrYvj5o3Fvy+E5fMWk8LislxIdO58ETqj8OSQKGc=; b=AyOEyCRG7sIecj5VcSGzY7i3LJPYPV+aJQ14xGSE8qVB0e2mmMyUjqZDUNxWqdCj60 kQIuk+F7QKUJfGOrFVKHYQ8s6JQvTuVv/G92PeRBwp5hxuT0ahxB9r8EDMib135FSBCa 10PxvDC6+YOicYSkos3yYSB6GNrOXYYSxFCBoOdEQToEahg6XIqzxA3JuZwhWqaUdMa+ CSruPlr6pbU+lGTobIZpLTed1SU3z3g8kLGdOQ0wAp+OAf5Rw9hPfr+vBj9RRVoXYn80 8bKRmZegoksO23vQvlc0RBY+RE4XKFYibIdCQOMg50lNXvcSgGcL0MjNojCiMLiqQGQQ DUUA== X-Gm-Message-State: AOAM5331KnSR+LC/c0C2CuIYefZ0iGVkog3qaZTtFpvCeeNTCKeYKIVS G+8MQI8yeBPF549IJBT0elG1Dg== X-Google-Smtp-Source: ABdhPJwpaKlSS0zWq/DC5GlNZ7JnBiaOFnULT1QI8rhBXIzxuZrY1N+KNe6Y/5hmSg2nymovw4b1hg== X-Received: by 2002:a17:903:2311:b0:14e:eb4f:4559 with SMTP id d17-20020a170903231100b0014eeb4f4559mr13034737plh.138.1645307749017; Sat, 19 Feb 2022 13:55:49 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1001:7090:31ab:1e81:9550:f30a]) by smtp.gmail.com with ESMTPSA id i17sm13447337pgn.82.2022.02.19.13.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 13:55:48 -0800 (PST) From: Drew Fustini To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Bjorn Andersson , Dave Gerlach , devicetree@vger.kernel.org, Drew Fustini , Keerthy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier , Nishanth Menon , Rob Herring , Santosh Shilimkar , Tony Lindgren , s-anna@ti.com, khilman@baylibre.com Subject: [PATCH 07/11] dt-bindings: wkup_m3_ipc: Add scale-data-fw property Date: Sat, 19 Feb 2022 13:53:24 -0800 Message-Id: <20220219215328.485660-8-dfustini@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219215328.485660-1-dfustini@baylibre.com> References: <20220219215328.485660-1-dfustini@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Dave Gerlach Add documentation for scale-data-fw property on the wkup_m3_ipc node to enable I2C PMIC voltage scaling. The property contains the name of a binary file for the CM3 firmware to load. Based on previous work by Russ Dill. Signed-off-by: Dave Gerlach Signed-off-by: Keerthy [dfustini: split dt-binding change into separate patch] Signed-off-by: Drew Fustini --- .../devicetree/bindings/soc/ti/wkup_m3_ipc.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt index df6b600abf4c..01b78a9da943 100644 --- a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt +++ b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt @@ -56,6 +56,17 @@ Example: }; }; +Support for I2C PMIC Voltage Scaling +-------------------- +It is possible to pass the name of a binary file to laod to the CM3 firmware +in order to provide I2C sequences for the CM3 to send out to the PMIC during +low power mode entry. + +Optional properties: +-------------------- +- scale-data-fw: Name of the firmware binary in /lib/firmware to copy to m3 + aux data. + Support for VTT Toggle ================================== In order to enable the support for VTT toggle during Suspend/Resume From patchwork Sat Feb 19 21:53:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 12752433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADC89C43219 for ; Sat, 19 Feb 2022 21:56:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243223AbiBSV4W (ORCPT ); Sat, 19 Feb 2022 16:56:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243218AbiBSV4O (ORCPT ); Sat, 19 Feb 2022 16:56:14 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC76854194 for ; Sat, 19 Feb 2022 13:55:50 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id h7-20020a17090a648700b001b927560c2bso11684585pjj.1 for ; Sat, 19 Feb 2022 13:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=t+5B6LvYZGVsC3RYEHxmGkbftMOyxJbez7YJNLu0KHE=; b=aMZG0ids+uNPndh1cyCwh2vSTCkuG5aqqdJ/jVm8LjYLl/PohNxzF+Bogj1X01eGgA VUJkkonUSbHfr78kn1xUS+s/pWBSiBVxPpIUCQKQN3lktHeCcjIGCSI8wYw8aWvmH8AB SVj409alfkBwXv2gn0m0yrGFYcM2xyRYoroSjQJOvzEW5hzFN/2h9saJml6kiCUwnq8H saVqhc9PrFgce7gwLWT1mep+GWykmEEX+60Yqx9xFIN9PVguKVamO+mtptv9N46/4sDk b2721BTjA60KOxw53Y5NgZHXIJd+18O9FDcUdGVeth/54OsX022OQbfSxqFFHJkwcVC7 whqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t+5B6LvYZGVsC3RYEHxmGkbftMOyxJbez7YJNLu0KHE=; b=3CtSskR/bH6vcyuARSnYUSdXCy9UUgEnd1TCesSZFX/+R2s2vU0cSly/FzNRayWfGO DmX0sNcvjMSUuBuOjtXQjaptlicEMrsh5s4LfMUNGLeWk/OHlN2PeUPfc9/CPPo+p57w GWizDDHs1wkCNcn1GtOpYY4iQAE4u3GEr1PCLln+Vc88G8TucpddBiSmS1W5adFVJUEM ubO7wL8SVdNhStpGTcqWeRWkzBusXjdy1XS2m6zx8kAiTud3rV5vvppsa9TzbmQ5mKcf o5L4/9BuljnhQWODXKfdgXd/5FsLziEklJh8YB5rpakv/BkmhBM+VdzWFy5HbwIN/w/8 0CvQ== X-Gm-Message-State: AOAM530+vp3Sq5G9RQdohHkIjyK29T3k5Fxk5QD9uQSK31swJ52BNvtf xGTCeoBAa3c2pGemrUsKYvC6tA== X-Google-Smtp-Source: ABdhPJwyfHS3ghnsjIwEF90RzGT1P8dhDe8Avt9cgZIMwrN4JBt5Xp8oD5kaPGBxoAenuP43h80mhQ== X-Received: by 2002:a17:902:7892:b0:14e:c520:e47d with SMTP id q18-20020a170902789200b0014ec520e47dmr12728416pll.105.1645307750121; Sat, 19 Feb 2022 13:55:50 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1001:7090:31ab:1e81:9550:f30a]) by smtp.gmail.com with ESMTPSA id i17sm13447337pgn.82.2022.02.19.13.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 13:55:49 -0800 (PST) From: Drew Fustini To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Bjorn Andersson , Dave Gerlach , devicetree@vger.kernel.org, Drew Fustini , Keerthy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier , Nishanth Menon , Rob Herring , Santosh Shilimkar , Tony Lindgren , s-anna@ti.com, khilman@baylibre.com Subject: [PATCH 08/11] soc: ti: wkup_m3_ipc: Add support for i2c voltage scaling Date: Sat, 19 Feb 2022 13:53:25 -0800 Message-Id: <20220219215328.485660-9-dfustini@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219215328.485660-1-dfustini@baylibre.com> References: <20220219215328.485660-1-dfustini@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Dave Gerlach Allow loading of a binary containing i2c scaling sequences to be provided to the wkup_m3 firmware in order to properly scale voltage rails on the PMIC during low power modes like DeepSleep0. Proper binary format is determined by the FW in use. Code expects firmware to have 0x0C57 present as the first two bytes followed by one byte defining offset to sleep sequence followed by one byte defining offset to wake sequence and then lastly both sequences. Each sequence is a series of I2C transfers in the form: u8 length | u8 chip address | u8 byte0/reg address | u8 byte1 | u8 byteN .. The length indicates the number of bytes to transfer, including the register address. The length of each transfer is limited by the I2C buffer size of 32 bytes. Based on previous work by Russ Dill. Signed-off-by: Dave Gerlach Signed-off-by: Keerthy [dfustini: add NULL argument to rproc_da_to_va() call] [dfustini: replace FW_ACTION_HOTPLUG with FW_ACTION_UEVENT] Signed-off-by: Drew Fustini --- drivers/soc/ti/wkup_m3_ipc.c | 93 +++++++++++++++++++++++++++++++++++- include/linux/wkup_m3_ipc.h | 9 ++++ 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c index e7ae942b7014..5a1722c3bf1a 100644 --- a/drivers/soc/ti/wkup_m3_ipc.c +++ b/drivers/soc/ti/wkup_m3_ipc.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -55,6 +56,12 @@ #define M3_STATE_MSG_FOR_LP 3 #define M3_STATE_MSG_FOR_RESET 4 +#define WKUP_M3_SD_FW_MAGIC 0x570C + +#define WKUP_M3_DMEM_START 0x80000 +#define WKUP_M3_AUXDATA_OFFSET 0x1000 +#define WKUP_M3_AUXDATA_SIZE 0xFF + static struct wkup_m3_ipc *m3_ipc_state; static const struct wkup_m3_wakeup_src wakeups[] = { @@ -75,6 +82,81 @@ static const struct wkup_m3_wakeup_src wakeups[] = { {.irq_nr = 0, .src = "Unknown"}, }; +/** + * wkup_m3_copy_aux_data - Copy auxiliary data to special region of m3 dmem + * @data - pointer to data + * @sz - size of data to copy (limit 256 bytes) + * + * Copies any additional blob of data to the wkup_m3 dmem to be used by the + * firmware + */ +static unsigned long wkup_m3_copy_aux_data(struct wkup_m3_ipc *m3_ipc, + const void *data, int sz) +{ + unsigned long aux_data_dev_addr; + void *aux_data_addr; + + aux_data_dev_addr = WKUP_M3_DMEM_START + WKUP_M3_AUXDATA_OFFSET; + aux_data_addr = rproc_da_to_va(m3_ipc->rproc, + aux_data_dev_addr, + WKUP_M3_AUXDATA_SIZE, + NULL); + memcpy(aux_data_addr, data, sz); + + return WKUP_M3_AUXDATA_OFFSET; +} + +static void wkup_m3_scale_data_fw_cb(const struct firmware *fw, void *context) +{ + unsigned long val, aux_base; + struct wkup_m3_scale_data_header hdr; + struct wkup_m3_ipc *m3_ipc = context; + struct device *dev = m3_ipc->dev; + + if (!fw) { + dev_err(dev, "Voltage scale fw name given but file missing.\n"); + return; + } + + memcpy(&hdr, fw->data, sizeof(hdr)); + + if (hdr.magic != WKUP_M3_SD_FW_MAGIC) { + dev_err(dev, "PM: Voltage Scale Data binary does not appear valid.\n"); + goto release_sd_fw; + } + + aux_base = wkup_m3_copy_aux_data(m3_ipc, fw->data + sizeof(hdr), + fw->size - sizeof(hdr)); + + val = (aux_base + hdr.sleep_offset); + val |= ((aux_base + hdr.wake_offset) << 16); + + m3_ipc->volt_scale_offsets = val; + +release_sd_fw: + release_firmware(fw); +}; + +static int wkup_m3_init_scale_data(struct wkup_m3_ipc *m3_ipc, + struct device *dev) +{ + int ret = 0; + + /* + * If no name is provided, user has already been warned, pm will + * still work so return 0 + */ + + if (!m3_ipc->sd_fw_name) + return ret; + + ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_UEVENT, + m3_ipc->sd_fw_name, dev, GFP_ATOMIC, + m3_ipc, wkup_m3_scale_data_fw_cb); + + return ret; +} + static void am33xx_txev_eoi(struct wkup_m3_ipc *m3_ipc) { writel(AM33XX_M3_TXEV_ACK, @@ -139,6 +221,7 @@ static irqreturn_t wkup_m3_txev_handler(int irq, void *ipc_data) } m3_ipc->state = M3_STATE_INITED; + wkup_m3_init_scale_data(m3_ipc, dev); complete(&m3_ipc->sync_complete); break; case M3_STATE_MSG_FOR_RESET: @@ -300,12 +383,15 @@ static int wkup_m3_prepare_low_power(struct wkup_m3_ipc *m3_ipc, int state) switch (state) { case WKUP_M3_DEEPSLEEP: m3_power_state = IPC_CMD_DS0; + wkup_m3_ctrl_ipc_write(m3_ipc, m3_ipc->volt_scale_offsets, 5); break; case WKUP_M3_STANDBY: m3_power_state = IPC_CMD_STANDBY; + wkup_m3_ctrl_ipc_write(m3_ipc, DS_IPC_DEFAULT, 5); break; case WKUP_M3_IDLE: m3_power_state = IPC_CMD_IDLE; + wkup_m3_ctrl_ipc_write(m3_ipc, DS_IPC_DEFAULT, 5); break; default: return 1; @@ -319,7 +405,6 @@ static int wkup_m3_prepare_low_power(struct wkup_m3_ipc *m3_ipc, int state) 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); wkup_m3_ctrl_ipc_write(m3_ipc, DS_IPC_DEFAULT, 6); wkup_m3_ctrl_ipc_write(m3_ipc, DS_IPC_DEFAULT, 7); @@ -529,6 +614,12 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) if (of_find_property(np, "ti,set-io-isolation", NULL)) wkup_m3_set_io_isolation(m3_ipc); + ret = of_property_read_string(np, "ti,scale-data-fw", + &m3_ipc->sd_fw_name); + if (ret) { + dev_dbg(dev, "Voltage scaling data blob not provided from DT.\n"); + }; + /* * Wait for firmware loading completion in a thread so we * can boot the wkup_m3 as soon as it's ready without holding diff --git a/include/linux/wkup_m3_ipc.h b/include/linux/wkup_m3_ipc.h index b706eac58f92..fef0fac60f8c 100644 --- a/include/linux/wkup_m3_ipc.h +++ b/include/linux/wkup_m3_ipc.h @@ -37,6 +37,9 @@ struct wkup_m3_ipc { int isolation_conf; int state; + unsigned long volt_scale_offsets; + const char *sd_fw_name; + struct completion sync_complete; struct mbox_client mbox_client; struct mbox_chan *mbox; @@ -50,6 +53,12 @@ struct wkup_m3_wakeup_src { char src[10]; }; +struct wkup_m3_scale_data_header { + u16 magic; + u8 sleep_offset; + u8 wake_offset; +} __packed; + struct wkup_m3_ipc_ops { void (*set_mem_type)(struct wkup_m3_ipc *m3_ipc, int mem_type); void (*set_resume_address)(struct wkup_m3_ipc *m3_ipc, void *addr); From patchwork Sat Feb 19 21:53:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 12752434 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C39BC433FE for ; Sat, 19 Feb 2022 21:56:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243278AbiBSV41 (ORCPT ); Sat, 19 Feb 2022 16:56:27 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243178AbiBSV4O (ORCPT ); Sat, 19 Feb 2022 16:56:14 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4746E53B7F for ; Sat, 19 Feb 2022 13:55:52 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id om7so11523715pjb.5 for ; Sat, 19 Feb 2022 13:55:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=OQDRi6ED3yUR5t/CfNm3XcVMLYaE2vx+NvYgZhn41jM=; b=6GHSa5GF8BjEaY7vMtmInKxOt8TmNQ1d0610AcajUoKsN4RkwwGGvXzpTXU+LlFdTf xvzpqg2g6Cwcsj81sxu/k3JXw9k4tLb7CjnQY+ugOdUniG1g6cHXCOkRzbBIHxuJS+VG aZSjxlhb52B5hQJBE0qy9W0tEO9+qg6Zx/jSgP5UafDVAZpQL03Uo3aZWHy73i37mDfc Ahq8VTCdE6ansytJJY97wCGy1MD8Zq3xZUJ2EhXAqk1QMBrDHaMLQrTnCNamc9j1J1wo VfsjsWpsUE3MbTgya/9DLmrY7FkksAM8otYWCck9N/R6tBazGrqTef1YWyAqT74E82qL OuCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OQDRi6ED3yUR5t/CfNm3XcVMLYaE2vx+NvYgZhn41jM=; b=mIaPpG1Bt15t/nC8A0/ybtQRAiZ/TxLqy3EUFEI5swJKwjuBiNzd6+Dk/aGZJI8Q5g cf7Dhr/kqzZI3Lif0FBNIvdTKmnseykyj3SUhtkIGYmot1MqIVOQdNjdnJubsvuwTibR HrbtSM47nS1oyXZ3eJH7pJZ069aaS8b95ZjJjJPsf1GYypazA5Va0UiKFJBJPKTCaG8x dfno/8quhsPii26bBlnI+u2VO8D86Yti6gnqc25ZeqsHI6iEz35vQ1mld95j+bsoZzy0 SvTPTZq0i6ITd2GWQn790OclJjfFSHUK+tjzEWL65eTzso3m3RzB4SN9r+OlphITW9ZN 6E6Q== X-Gm-Message-State: AOAM531eJDMFG90bxsxCucAtrxhphew3zK1tW0uwAG8AyIkpnOfYgWRq o1joSuy3wz6Oepbm9iTFrvzzrA== X-Google-Smtp-Source: ABdhPJw0tEzcnvcnUL9jKO7VcMyldkWgIl50hqtyptCPIDfgsNjwWfxsyHfUYSMRG9qVpiLLUmxLoQ== X-Received: by 2002:a17:90b:2516:b0:1bb:f8e6:f568 with SMTP id ns22-20020a17090b251600b001bbf8e6f568mr4198555pjb.118.1645307751504; Sat, 19 Feb 2022 13:55:51 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1001:7090:31ab:1e81:9550:f30a]) by smtp.gmail.com with ESMTPSA id i17sm13447337pgn.82.2022.02.19.13.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 13:55:50 -0800 (PST) From: Drew Fustini To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Bjorn Andersson , Dave Gerlach , devicetree@vger.kernel.org, Drew Fustini , Keerthy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier , Nishanth Menon , Rob Herring , Santosh Shilimkar , Tony Lindgren , s-anna@ti.com, khilman@baylibre.com Subject: [PATCH 09/11] ARM: dts: am33xx: Add scale data fw to wkup_m3_ipc node Date: Sat, 19 Feb 2022 13:53:26 -0800 Message-Id: <20220219215328.485660-10-dfustini@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219215328.485660-1-dfustini@baylibre.com> References: <20220219215328.485660-1-dfustini@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Dave Gerlach Add appropriate scale-data-fw names for all am33xx platforms. Signed-off-by: Dave Gerlach [dfustini: modified line numbers to resolve conflict] Signed-off-by: Drew Fustini --- arch/arm/boot/dts/am335x-bone-common.dtsi | 4 ++++ arch/arm/boot/dts/am335x-evm.dts | 4 ++++ arch/arm/boot/dts/am335x-evmsk.dts | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi index 56ae5095a5b8..31b051651e4f 100644 --- a/arch/arm/boot/dts/am335x-bone-common.dtsi +++ b/arch/arm/boot/dts/am335x-bone-common.dtsi @@ -405,3 +405,7 @@ &rtc { &pruss_tm { status = "okay"; }; + +&wkup_m3_ipc { + ti,scale-data-fw = "am335x-bone-scale-data.bin"; +}; diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index 659e99eabe66..92941a3b1add 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts @@ -782,3 +782,7 @@ &rtc { &pruss_tm { status = "okay"; }; + +&wkup_m3_ipc { + ti,scale-data-fw = "am335x-evm-scale-data.bin"; +}; diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts index a2db65538e51..3986ed2a12d5 100644 --- a/arch/arm/boot/dts/am335x-evmsk.dts +++ b/arch/arm/boot/dts/am335x-evmsk.dts @@ -719,3 +719,7 @@ &rtc { &pruss_tm { status = "okay"; }; + +&wkup_m3_ipc { + ti,scale-data-fw = "am335x-evm-scale-data.bin"; +}; From patchwork Sat Feb 19 21:53:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 12752432 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68E8DC4321E for ; Sat, 19 Feb 2022 21:56:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231616AbiBSV4V (ORCPT ); Sat, 19 Feb 2022 16:56:21 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243223AbiBSV4O (ORCPT ); Sat, 19 Feb 2022 16:56:14 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F0E254699 for ; Sat, 19 Feb 2022 13:55:53 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id x18so5311938pfh.5 for ; Sat, 19 Feb 2022 13:55:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/Twze+jWTz4YOh5YSziAhocCfC52Co0EJtrbTTXd7Pg=; b=vG+JbMUigvy10tcTl88GkDpP8OmExegUMriyny+TvwZBp2EZ8MYdUDzDsDW+k5E7ST d5eAd26zzDX92/Tl2ElwHXXBDjJpK5/z5Vkz0YjOSMbonMsyPIl4pTTJRTG1Fe04XzSQ TD/Dtki5l8Eey8CyLMmED80b5ur24iDA+d86gs1HP+A+L0fqNjw6WNu1GkgDz5tQVozT qp1EuQxH2/gTPSdmSc0v8jlYHnrTo0RvGZNWW1r/S5q56l5xjDc3i2rapMZ1aKYqDOg1 d8mNp50h8HwwhOt4BMglIrIvaiu/0lT6uTBfb/hi5feQ5SLchwQlgZZAXIY4EdQBuIME SdJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/Twze+jWTz4YOh5YSziAhocCfC52Co0EJtrbTTXd7Pg=; b=HHAQWu72vAmDQkGbAPYJy5V9DcLNE37Cb599M0vxQirqp7pgTn3E+QK5o6yv6kqQYe R+QnfMXqNLHNYp18nZg9q39UKCqm0RATw5LI9RUpKdpdfeVDPUqP1PmVo/Uv8IJL3zM/ Yzi617/KemfROAPywXIPIbtwWZhbTbZ0xOpW7K2Q+9a9dSiumCaBEzNhzxjalwaIXWvV JlMQ0BbOHjcs/kkO/lYhfNd3pTYNNKRRQqKRPgMHXvT79BkNCzRcga9zdLcnPK8by0OI j4W7Qc2AuUXeW4zpnU4pVk4ggWMBBVHPR1+7nmrd7xGN/4xsAXCBsKU6km1Fuq7GGswj ymWw== X-Gm-Message-State: AOAM533aLN2ex3Z1E4zsiDeBGf4o8n/aKgwGBFSUtKzxe34ZwQeFvIy5 B0WyKNx2mr4z9sL0sMvmKeNuSw== X-Google-Smtp-Source: ABdhPJz6JLPuDNMFwxqmJ1GcafhE8zHgR7FEQxVDTVdvZhZXVSbw57wLOQgSHBaBl2SW/gE+cnHvNQ== X-Received: by 2002:a63:1d0f:0:b0:365:7d07:ac44 with SMTP id d15-20020a631d0f000000b003657d07ac44mr10967207pgd.526.1645307752940; Sat, 19 Feb 2022 13:55:52 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1001:7090:31ab:1e81:9550:f30a]) by smtp.gmail.com with ESMTPSA id i17sm13447337pgn.82.2022.02.19.13.55.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 13:55:52 -0800 (PST) From: Drew Fustini To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Bjorn Andersson , Dave Gerlach , devicetree@vger.kernel.org, Drew Fustini , Keerthy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier , Nishanth Menon , Rob Herring , Santosh Shilimkar , Tony Lindgren , s-anna@ti.com, khilman@baylibre.com Subject: [PATCH 10/11] ARM: dts: am43xx: Add scale data fw to wkup_m3_ipc node Date: Sat, 19 Feb 2022 13:53:27 -0800 Message-Id: <20220219215328.485660-11-dfustini@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219215328.485660-1-dfustini@baylibre.com> References: <20220219215328.485660-1-dfustini@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Dave Gerlach Add appropriate scale-data-fw names for all am43xx platforms. Signed-off-by: Dave Gerlach Signed-off-by: Keerthy Signed-off-by: Drew Fustini --- arch/arm/boot/dts/am437x-gp-evm.dts | 1 + arch/arm/boot/dts/am437x-sk-evm.dts | 4 ++++ arch/arm/boot/dts/am43x-epos-evm.dts | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts index 91b67b428a06..ad561f81af3a 100644 --- a/arch/arm/boot/dts/am437x-gp-evm.dts +++ b/arch/arm/boot/dts/am437x-gp-evm.dts @@ -1129,6 +1129,7 @@ &cpu { &wkup_m3_ipc { ti,set-io-isolation; + ti,scale-data-fw = "am43x-evm-scale-data.bin"; }; &pruss1_mdio { diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts b/arch/arm/boot/dts/am437x-sk-evm.dts index 20a34d2d85df..7b518aff5f8f 100644 --- a/arch/arm/boot/dts/am437x-sk-evm.dts +++ b/arch/arm/boot/dts/am437x-sk-evm.dts @@ -893,6 +893,10 @@ vpfe0_ep: endpoint { }; }; +&wkup_m3_ipc { + ti,scale-data-fw = "am43x-evm-scale-data.bin"; +}; + &pruss1_mdio { status = "disabled"; }; diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts index 2f4d2e4e9b3e..a734bdc5e126 100644 --- a/arch/arm/boot/dts/am43x-epos-evm.dts +++ b/arch/arm/boot/dts/am43x-epos-evm.dts @@ -1019,6 +1019,10 @@ &cpu { cpu0-supply = <&dcdc2>; }; +&wkup_m3_ipc { + ti,scale-data-fw = "am43x-evm-scale-data.bin"; +}; + &pruss1_mdio { status = "disabled"; }; From patchwork Sat Feb 19 21:53:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 12752431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 295C2C433EF for ; Sat, 19 Feb 2022 21:56:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243195AbiBSV4U (ORCPT ); Sat, 19 Feb 2022 16:56:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243236AbiBSV4P (ORCPT ); Sat, 19 Feb 2022 16:56:15 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94EC6541A7 for ; Sat, 19 Feb 2022 13:55:54 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id a11-20020a17090a740b00b001b8b506c42fso15469368pjg.0 for ; Sat, 19 Feb 2022 13:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ALItf1cmaYde5anKiXpaOkvR8+mXdj6IXy5l9T74CXY=; b=Fn3Ru8rk2m6UM8OQLbL67IIZ8/ISkk5RdEHaoDTmx+kgG1d3LaSWDLlgU5hpIz1l7O J7wJiWswQe2eiNiH9NK+KlcuyYwX5V/xk9AHURcL6gvv2KVTbN0ZXmOqjFP+Ymae+m6A XsyBw4215bt3cTNo+f3XJ9PD+lGYKgdRNXJuv4eDuVCSb1Kd3aWbB/DRxrG1zuO6qOK6 bmbXgCSMop4xAHAEGWRHJpJPJUIw19GqTB9pqV/e0IkSqhlP2Oz0sYn9UK88VS0LbwQK NDpXPd0nK3sJsBc29nP85v40SbCnUAjXVZumbtGJ7Ffb2doMS7kbn7u00qZ8C4AP5K39 rWYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ALItf1cmaYde5anKiXpaOkvR8+mXdj6IXy5l9T74CXY=; b=efz4znwqRnJJeQ5Cb9TxvHX5PnB/+8tSuNp32RlXmp93tRc/gTlgGPa3vUc51zoyhG lXJBHXNUlk0BKKYC7iwhtIFIcSFIcpF+6WNQR2KG7zEVILOy2+WqiUkwR9P8H3UYJWJl YYY1x+UtVL4tAwbMtoQgxPilrWKKZT3u+lmy+O0qrIlzjUu2vxJWhCqQEVnmTrPg2/xv OeVJwVX1CDJZpFlGHwkxLNJOHBCvxCDghJkapE4uo0nx5hDLAJo4diKhMv61mUV+/1Xp XGfzYkd1DObbDaYDS+Tb1B+JdodNcOC8x+6WALXDXP8uQo8Rh+QFoIHiBTilYtjVn/Pw rTCQ== X-Gm-Message-State: AOAM533c9hgdEdojkB2QdYF0yglLXU2oOOWZ4mvWbXWlYfdbK8WZCHRN dceDdv1MLaYUhNsrZBiBDGgwuQ== X-Google-Smtp-Source: ABdhPJxMLUiSjR9mcVV1iK9+hG/lKSlGmCHqWar1s22AM6LNq/uC41pK9n3kfEId/9Rjt1hG8v3Asg== X-Received: by 2002:a17:902:ba96:b0:14c:8407:8e4b with SMTP id k22-20020a170902ba9600b0014c84078e4bmr12646881pls.135.1645307754101; Sat, 19 Feb 2022 13:55:54 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1001:7090:31ab:1e81:9550:f30a]) by smtp.gmail.com with ESMTPSA id i17sm13447337pgn.82.2022.02.19.13.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 13:55:53 -0800 (PST) From: Drew Fustini To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Bjorn Andersson , Dave Gerlach , devicetree@vger.kernel.org, Drew Fustini , Keerthy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mathieu Poirier , Nishanth Menon , Rob Herring , Santosh Shilimkar , Tony Lindgren , s-anna@ti.com, khilman@baylibre.com Cc: Brad Griffis Subject: [PATCH 11/11] soc: ti: wkup_m3_ipc: Add debug option to halt m3 in suspend Date: Sat, 19 Feb 2022 13:53:28 -0800 Message-Id: <20220219215328.485660-12-dfustini@baylibre.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219215328.485660-1-dfustini@baylibre.com> References: <20220219215328.485660-1-dfustini@baylibre.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org From: Dave Gerlach Add a debugfs option to allow configurable halting of the wkup_m3 during suspend at the last possible point before low power mode entry. This condition can only be resolved through JTAG and advancing beyond the while loop in a8_lp_ds0_handler. Although this hangs the system it forces the system to remain active once it has been entirely configured for low power mode entry, allowing for register inspection through JTAG to help in debugging transition errors. Halt mode can be set using the enable_off_mode entry under wkup_m3_ipc in the debugfs. Suggested-by: Brad Griffis Signed-off-by: Dave Gerlach [dfustini: resolve trivial line conflicts] Signed-off-by: Drew Fustini --- drivers/soc/ti/wkup_m3_ipc.c | 78 +++++++++++++++++++++++++++++++++++- include/linux/wkup_m3_ipc.h | 2 + 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c index 5a1722c3bf1a..244bce3f52e8 100644 --- a/drivers/soc/ti/wkup_m3_ipc.c +++ b/drivers/soc/ti/wkup_m3_ipc.c @@ -7,6 +7,7 @@ * Dave Gerlach */ +#include #include #include #include @@ -50,6 +51,9 @@ #define IPC_IO_ISOLATION_STAT_SHIFT (10) #define IPC_IO_ISOLATION_STAT_MASK (0x1 << 10) +#define IPC_DBG_HALT_SHIFT (11) +#define IPC_DBG_HALT_MASK (0x1 << 11) + #define M3_STATE_UNKNOWN 0 #define M3_STATE_RESET 1 #define M3_STATE_INITED 2 @@ -137,6 +141,73 @@ static void wkup_m3_scale_data_fw_cb(const struct firmware *fw, void *context) release_firmware(fw); }; +#ifdef CONFIG_DEBUG_FS +static void wkup_m3_set_halt_late(bool enabled) +{ + if (enabled) + m3_ipc_state->halt = (1 << IPC_DBG_HALT_SHIFT); + else + m3_ipc_state->halt = 0; +} + +static int option_get(void *data, u64 *val) +{ + u32 *option = data; + + *val = *option; + + return 0; +} + +static int option_set(void *data, u64 val) +{ + u32 *option = data; + + *option = val; + + if (option == &m3_ipc_state->halt) { + if (val) + wkup_m3_set_halt_late(true); + else + wkup_m3_set_halt_late(false); + } + + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(wkup_m3_ipc_option_fops, option_get, option_set, + "%llu\n"); + +static int wkup_m3_ipc_dbg_init(struct wkup_m3_ipc *m3_ipc) +{ + m3_ipc->dbg_path = debugfs_create_dir("wkup_m3_ipc", NULL); + + if (!m3_ipc->dbg_path) + return -EINVAL; + + (void)debugfs_create_file("enable_late_halt", 0644, + m3_ipc->dbg_path, + &m3_ipc->halt, + &wkup_m3_ipc_option_fops); + + return 0; +} + +static inline void wkup_m3_ipc_dbg_destroy(struct wkup_m3_ipc *m3_ipc) +{ + debugfs_remove_recursive(m3_ipc->dbg_path); +} +#else +static inline int wkup_m3_ipc_dbg_init(struct wkup_m3_ipc *m3_ipc) +{ + return 0; +} + +static inline void wkup_m3_ipc_dbg_destroy(struct wkup_m3_ipc *m3_ipc) +{ +} +#endif /* CONFIG_DEBUG_FS */ + static int wkup_m3_init_scale_data(struct wkup_m3_ipc *m3_ipc, struct device *dev) { @@ -402,7 +473,8 @@ static int wkup_m3_prepare_low_power(struct wkup_m3_ipc *m3_ipc, int state) 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 | - m3_ipc->isolation_conf, 4); + m3_ipc->isolation_conf | + m3_ipc->halt, 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, 6); @@ -634,6 +706,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) goto err_put_rproc; } + wkup_m3_ipc_dbg_init(m3_ipc); + return 0; err_put_rproc: @@ -645,6 +719,8 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) static int wkup_m3_ipc_remove(struct platform_device *pdev) { + wkup_m3_ipc_dbg_destroy(m3_ipc_state); + mbox_free_channel(m3_ipc_state->mbox); rproc_shutdown(m3_ipc_state->rproc); diff --git a/include/linux/wkup_m3_ipc.h b/include/linux/wkup_m3_ipc.h index fef0fac60f8c..26d1eb058fa3 100644 --- a/include/linux/wkup_m3_ipc.h +++ b/include/linux/wkup_m3_ipc.h @@ -36,6 +36,7 @@ struct wkup_m3_ipc { int vtt_conf; int isolation_conf; int state; + u32 halt; unsigned long volt_scale_offsets; const char *sd_fw_name; @@ -46,6 +47,7 @@ struct wkup_m3_ipc { struct wkup_m3_ipc_ops *ops; int is_rtc_only; + struct dentry *dbg_path; }; struct wkup_m3_wakeup_src {