From patchwork Sun Jul 4 07:40:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 470357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDD2EC07E9A for ; Sun, 4 Jul 2021 07:41:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3CB96135D for ; Sun, 4 Jul 2021 07:41:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229543AbhGDHns (ORCPT ); Sun, 4 Jul 2021 03:43:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229540AbhGDHns (ORCPT ); Sun, 4 Jul 2021 03:43:48 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 814B0C061762 for ; Sun, 4 Jul 2021 00:41:12 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id j199so13126296pfd.7 for ; Sun, 04 Jul 2021 00:41:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BVkVvoLhlvv3KppO1b0TRg6fddRYWUrnF61FALx2Tlg=; b=L104DLL8FcAW/cRK4M1tuNWAZxySEdyg7SYSbJBWAGDXZfpbvHFajRY/8sKBUgXWKm FCMOVrvRf1PmvmNIwaPoQBV6tTwpyqhMQklB5lCJPall/PgB+ctWH87wNjuyIz46yh1c UelpuJJMgvmUCjHHpErgWIKL1p+s3f/ykwUyvolIZCsY8vAI2y+jWPT6LUenekoGd89a e7AduzCvwA1mnFLMMA5YuSut8G/Ji8KrIvTCH08ybVPikuA4kiQV89/AsbX/in0YRnup iXte75oOPu+9uJ8NAqCaecHxRMU8Zmn7FWOGOaYuZYtJJsQ6qq2gudbsvOtxItC/n1r8 sAHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BVkVvoLhlvv3KppO1b0TRg6fddRYWUrnF61FALx2Tlg=; b=hOp6eJ4BITNmR08dQfVoYA+ytSYnK3v1Uc1mX7kJ3vOX8rboyjXRn/l2Z4HiEz4b4K Hv1So8yvNJFvKm2Pn89w66c2Nk6966oGfP6Tl53TqbLjinYQ5YFz80Q/GO6c1+4qyDOA 5F5k6peMYPPwDvjQdqsoNysGOW7M23HxNmJOHsI92Ras3GyUZisuBZYXxG65alrR4LyZ 8MdmLLOJdqpHBX9OIUbidbdUZeQfXAcClN8vsucpSwWLkkC9mXYeL4nqk1kVKqtC3Mqz t7i+9AD1OecB7MCq1R5jpW7P0ujeBVWGgPr1qBfeqp6Hm7BNKBX1jhQCmgklyE2uRswj WLSA== X-Gm-Message-State: AOAM532s6hUPJhvbsKmX9UTubTyLFEHz7uyfMSgk5Dc19MKVTaTiJ2J0 KZ7VuGyLy00mKPQbu/s2s8r9tw== X-Google-Smtp-Source: ABdhPJxMsKdlrrke3nZmg678vp0ECRSg02fRH0TGnsIwhRe9oCS96zdfgouNd+A453lg26+DSpieqA== X-Received: by 2002:aa7:86c4:0:b029:316:98ff:30c with SMTP id h4-20020aa786c40000b029031698ff030cmr8605594pfo.66.1625384472105; Sun, 04 Jul 2021 00:41:12 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id gz24sm7052956pjb.0.2021.07.04.00.41.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 00:41:11 -0700 (PDT) From: Shawn Guo To: Sebastian Reichel Cc: Rob Herring , Vinod Koul , Bjorn Andersson , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, Shawn Guo Subject: [PATCH 1/3] dt-bindings: power: reset: Convert qcom, pon to DT schema Date: Sun, 4 Jul 2021 15:40:43 +0800 Message-Id: <20210704074045.21643-2-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210704074045.21643-1-shawn.guo@linaro.org> References: <20210704074045.21643-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org It converts qcom,pon DT bindings from legacy bare text to YAML format. Signed-off-by: Shawn Guo --- .../bindings/power/reset/qcom,pon.txt | 49 ------------------- .../bindings/power/reset/qcom,pon.yaml | 49 +++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) delete mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.txt create mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.yaml diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt b/Documentation/devicetree/bindings/power/reset/qcom,pon.txt deleted file mode 100644 index 0c0dc3a1e693..000000000000 --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt +++ /dev/null @@ -1,49 +0,0 @@ -Qualcomm PON Device - -The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey -and resin along with the Android reboot-mode. - -This DT node has pwrkey and resin as sub nodes. - -Required Properties: --compatible: Must be one of: - "qcom,pm8916-pon" - "qcom,pms405-pon" - "qcom,pm8998-pon" - --reg: Specifies the physical address of the pon register - -Optional subnode: --pwrkey: Specifies the subnode pwrkey and should follow the - qcom,pm8941-pwrkey.txt description. --resin: Specifies the subnode resin and should follow the - qcom,pm8xxx-pwrkey.txt description. - -The rest of the properties should follow the generic reboot-mode description -found in reboot-mode.txt - -Example: - - pon@800 { - compatible = "qcom,pm8916-pon"; - - reg = <0x800>; - mode-bootloader = <0x2>; - mode-recovery = <0x1>; - - pwrkey { - compatible = "qcom,pm8941-pwrkey"; - interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>; - debounce = <15625>; - bias-pull-up; - linux,code = ; - }; - - resin { - compatible = "qcom,pm8941-resin"; - interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>; - debounce = <15625>; - bias-pull-up; - linux,code = ; - }; - }; diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml new file mode 100644 index 000000000000..7764c804af1d --- /dev/null +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/reset/qcom,pon.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm PON Device + +maintainers: + - Vinod Koul + +description: | + The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey + and resin along with the Android reboot-mode. + +properties: + compatible: + enum: + - qcom,pm8916-pon + - qcom,pms405-pon + - qcom,pm8998-pon + + reg: + maxItems: 1 + +patternProperties: + "^mode-.+": + $ref: /schemas/types.yaml#/definitions/uint32 + description: Vendor-specific mode value written to the mode register + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + pmic { + #address-cells = <1>; + #size-cells = <0>; + + pon@800 { + compatible = "qcom,pm8916-pon"; + reg = <0x800>; + mode-bootloader = <0x2>; + mode-recovery = <0x1>; + }; + }; From patchwork Sun Jul 4 07:40:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 470120 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A20D9C07E9C for ; Sun, 4 Jul 2021 07:41:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A5C061374 for ; Sun, 4 Jul 2021 07:41:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbhGDHnu (ORCPT ); Sun, 4 Jul 2021 03:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbhGDHnt (ORCPT ); Sun, 4 Jul 2021 03:43:49 -0400 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 169B9C061765 for ; Sun, 4 Jul 2021 00:41:15 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id 22-20020a17090a0c16b0290164a5354ad0so12477638pjs.2 for ; Sun, 04 Jul 2021 00:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y2JvDwp3TfASNY2nYjyfxKqjVkgvIs8uvDCzlvHG2AA=; b=cbrduWjiQDcg1zBJYNfFqJlwRhenjmvi02OUBwr8M4hyh8/l3aDFwt2Vy1ZRblRZ6K 1SOfwbZhNI/1AhuNfkurXrnNtEIQp0pcEel+V7xEswXE8qJW3b2gSmIDaTxUNi7RLeca vfuEVL191zztFFkSQ7e2PTS+A641GNx76vDII+QCNt7DEsLVNNUpVsKel1P5tcA6s/6e BlLVFtK3093ZAiV7/rjobH8nig1pxRbCgsTXE9da1w3CHhbvHP6cP1yKOjXN1nRWUNEW F+Hi1pGWY9ajJzGRZdf4BU4PFhVynDvZm5FRQNSz08BY0JrxQ4LfyJzv5zGRDnzVsZhj GwgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Y2JvDwp3TfASNY2nYjyfxKqjVkgvIs8uvDCzlvHG2AA=; b=bjdLnZHaIa7DJ2YRoOP3r/x/fRaZNUxL6cIyc+vdojNwuogE9HZVjrRodbdKbuPmTe XyRFTo1jI3t2RJzlVc87sVuwh2F+/IGovK8kNXLXSjQvOgqS4xItGXBtWsCtzq9uH314 0it6a7Ar0TKMoeSQRtJdYZfq21Vq20Mw7F3DBp+pGkwTswAXsMZyV4MHRyQfSe6QXd0s 9o9MZ1rEOpyb4mXuEXoM9mB6YYL7yd+x1rA4vGFHJikX7YnkzERjCgvd3pFEp0X/neis 6QL6GgcnlfOb7spavk1vXAnXzCRQyaGrFQUnqeTJ1fWEZxTAgbZks2gQYeLqe/2GOXGb FR5g== X-Gm-Message-State: AOAM532W6UuuFKlRd7/R893mJlY+9vI67ym5KkOSfb+iNT0rRpEMPd3a a2UTnYhi884GgVWsOosALZwJEA== X-Google-Smtp-Source: ABdhPJwGmTyodmzASq3EdwqjQVy7NsyVqG3mZlScAbL5o9KQK27DmKnTNeCgdySHHZLmg2TcVtdRPw== X-Received: by 2002:a17:90a:d506:: with SMTP id t6mr8292715pju.26.1625384474616; Sun, 04 Jul 2021 00:41:14 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id gz24sm7052956pjb.0.2021.07.04.00.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 00:41:14 -0700 (PDT) From: Shawn Guo To: Sebastian Reichel Cc: Rob Herring , Vinod Koul , Bjorn Andersson , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, Shawn Guo Subject: [PATCH 2/3] dt-bindings: qcom,pon: Add 'qcom,mode-in-imem' support Date: Sun, 4 Jul 2021 15:40:44 +0800 Message-Id: <20210704074045.21643-3-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210704074045.21643-1-shawn.guo@linaro.org> References: <20210704074045.21643-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org It's not always the case that reboot mode value gets stored in PON register. For example, Sony Xperia M4 Aqua phone (MSM8939) uses a different set of mode value and stores them in IMEM. Add property 'qcom,mode-in-imem' to distinguish this mechanism from the existing one. Signed-off-by: Shawn Guo --- .../bindings/power/reset/qcom,pon.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml index 7764c804af1d..a6270e39b7a2 100644 --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml @@ -23,6 +23,10 @@ properties: reg: maxItems: 1 + qcom,mode-in-imem: + description: Reboot mode is stored in IMEM rather than PON register + type: boolean + patternProperties: "^mode-.+": $ref: /schemas/types.yaml#/definitions/uint32 @@ -35,6 +39,7 @@ required: additionalProperties: false examples: + # Example 1: Reboot mode is stored in PON register - | pmic { #address-cells = <1>; @@ -47,3 +52,17 @@ examples: mode-recovery = <0x1>; }; }; + # Example 2: Reboot mode is stored in IMEM + - | + pmic { + #address-cells = <1>; + #size-cells = <0>; + + pon@800 { + compatible = "qcom,pm8916-pon"; + reg = <0x860065c>; + qcom,mode-in-imem; + mode-bootloader = <0x77665500>; + mode-recovery = <0x77665502>; + }; + }; From patchwork Sun Jul 4 07:40:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 470356 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3D96C07E9A for ; Sun, 4 Jul 2021 07:41:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 980E861361 for ; Sun, 4 Jul 2021 07:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229573AbhGDHnw (ORCPT ); Sun, 4 Jul 2021 03:43:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229540AbhGDHnw (ORCPT ); Sun, 4 Jul 2021 03:43:52 -0400 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 9B732C061765 for ; Sun, 4 Jul 2021 00:41:17 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id 22-20020a17090a0c16b0290164a5354ad0so12477666pjs.2 for ; Sun, 04 Jul 2021 00:41:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HDIrJvvsYWuc6ETGsLx0yysZhuZFRshLStXAyTVxX4g=; b=G9buf/mi2kfYFqNAooOgyOcPIo1rXsZbVNvtetH9l8NOmQEN5UgVNjEQLaufuxZBct C6NoODOdpBytyS5VVR7o7isLsfrIQ0cHw6I+H057eDB/oVKE7g6xMp2ivmAHOrtmmK3x o+wkarBQqhC9//45GRpSVZpUEIwO3UxUfnCN/fEtXH3W+v3fMecfCrkBjzaNBFHy26O8 01pQ2MqU4ibhIhQkRzllM8uSZJpjShNXUonMqxVhi7/K+Rnv/wdLO5SmRi/nnWThqmiZ v2yp/rwEtZEa8FL6uzM1bn2yviBSJn36D+YVh9T5lVSq2ckIH9N28JEyHIORogWctRgJ zx+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HDIrJvvsYWuc6ETGsLx0yysZhuZFRshLStXAyTVxX4g=; b=jfDcOBsYgJ2UjyAKwqUCJlr0JsOr1cV1HnT+uZADPnvJE+nwwPKAywPDCXyk8hbndT 7czPiZbJUjIOt2E4cjgJckoXg+VeyitPlrfWwEyzoPGfUx+5+3b0svW7ONQE/nkZ7NMj fRewL74z9XDZXWaKX5P+bN4qUQrrww1rE3SUkiMYrDZukbsP9uR0gFKWV3ARfMRy6m1N sqqmcMy5+w5HfRc1cjC3zfj4d/DsQnSPZaHg2BzeyZrk5feRwXtOY4daJJUeekBBTaNX wd/jX8YPS3bh5AzJA0cWFd0FOuX+tRxFBdgBSdYyKa2YNbpCG04v+/tY80gDg5PwpMs5 LaFg== X-Gm-Message-State: AOAM5320q+gfTEpRwtQOkIy+yPQpX2uhUEQxgsuZmdQVP9ybcgHzyCA0 fuPoFM53fCahQFsBkWEMzjQaMQ== X-Google-Smtp-Source: ABdhPJzEyyuaiMSgs2qvy6BH1qMn/CvKTYdpLqMmpQi/HCaX7JNhwS1XTVdpaFoqucne6QjasGQBMg== X-Received: by 2002:a17:902:d217:b029:105:e265:65c7 with SMTP id t23-20020a170902d217b0290105e26565c7mr7290765ply.16.1625384477169; Sun, 04 Jul 2021 00:41:17 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id gz24sm7052956pjb.0.2021.07.04.00.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 00:41:16 -0700 (PDT) From: Shawn Guo To: Sebastian Reichel Cc: Rob Herring , Vinod Koul , Bjorn Andersson , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, Shawn Guo Subject: [PATCH 3/3] power: reset: qcom-pon: Add support for 'qcom, mode-in-imem' Date: Sun, 4 Jul 2021 15:40:45 +0800 Message-Id: <20210704074045.21643-4-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210704074045.21643-1-shawn.guo@linaro.org> References: <20210704074045.21643-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add support for DT property 'qcom,mode-in-imem', which is used on devices like Sony Xperia M4 Aqua phone (MSM8939) to store a different set of mode values IMEM rather than PON register. Signed-off-by: Shawn Guo --- drivers/power/reset/qcom-pon.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c index 4a688741a88a..f63d49c72f55 100644 --- a/drivers/power/reset/qcom-pon.c +++ b/drivers/power/reset/qcom-pon.c @@ -42,6 +42,24 @@ static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot, return ret; } +static int pm8916_reboot_mode_write_imem(struct reboot_mode_driver *reboot, + unsigned int magic) +{ + struct pm8916_pon *pon = container_of(reboot, struct pm8916_pon, + reboot_mode); + void __iomem *imem; + + imem = devm_ioremap(pon->dev, pon->baseaddr, 4); + if (!imem) { + dev_err(pon->dev, "failed to map imem\n"); + return -ENOMEM; + } + + writel(magic, imem); + + return 0; +} + static int pm8916_pon_probe(struct platform_device *pdev) { struct pm8916_pon *pon; @@ -66,7 +84,12 @@ static int pm8916_pon_probe(struct platform_device *pdev) pon->reboot_mode.dev = &pdev->dev; pon->reason_shift = (long)of_device_get_match_data(&pdev->dev); - pon->reboot_mode.write = pm8916_reboot_mode_write; + + if (device_property_present(&pdev->dev, "qcom,mode-in-imem")) + pon->reboot_mode.write = pm8916_reboot_mode_write_imem; + else + pon->reboot_mode.write = pm8916_reboot_mode_write; + error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode); if (error) { dev_err(&pdev->dev, "can't register reboot mode\n");