From patchwork Fri May 31 23:47:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 165558 Delivered-To: patches@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1428330ili; Fri, 31 May 2019 16:47:44 -0700 (PDT) X-Received: by 2002:a17:90a:a593:: with SMTP id b19mr12454594pjq.31.1559346463947; Fri, 31 May 2019 16:47:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559346463; cv=none; d=google.com; s=arc-20160816; b=KJtczZhFebSl9OPfVoX/CREaKzyTzVnebLRTO0A1TVPmoKa4o0gsPT3WMFkDoeHzm4 RFsZ/VF24xLkTgDmnBWfkIDMeEVuXvhlw0nSbSUE+xdTOJ7aMXkGnv2UxhbKTNFv3+ue VfhD5Ijx3ZRZoMuLNIAM5U8PT1dDF8yhv89ETzeBjeuNHd/WJj7wrxWf42/Zsc5Y2BBZ PCH3ltAMQhDzJ2KLQHJ/yrucrqWsOCOlPN15oeGQfwSQHQmtV8tcmBXTdIhJScPSRgpB spM1Zt6L5jgge80tDW3pPlgN8JgFmUSE9behaIJY/xn1hw3IiRpn/RBP+rIR5fExffmC aoWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Xt6/4+wEKiWtFL2dtOEhVMVadBdWF2iE7jN+ABlj+7w=; b=E3g8Ukl8UwB5EmM2iXgFYtKMHaY/7dBmmj7ggrSQBZMnPMJsUR1ik/+4VTIggEeGu4 mOUcbEIeFRyaPxSCmR7e/mjUGNn8w4XmJvEweni2E87TQKmHEzmMP2xFfzbfMMBQw9ac FL4UWoNQRb0RFqQsj5OmflVBvcJ1IhlaF/EGPBSVUqK7A6YqT74ftRJlcFXZ0eQy32vW JPOBUSNO0uL7jHkYf+LRMt5XlQegtMSpsv/jZZ5l5seluBcbiFXD6m5cLSJzRhyO6A5t dxsWyxSFpK3R8OwrUsU3T6Ekzil4pf0wzcYtc4CeZDrfd82PqYy9z06NjssnKCvCDp+E GzRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LV3JljYI; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id x12sor8588165pjt.17.2019.05.31.16.47.43 for (Google Transport Security); Fri, 31 May 2019 16:47:43 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LV3JljYI; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=Xt6/4+wEKiWtFL2dtOEhVMVadBdWF2iE7jN+ABlj+7w=; b=LV3JljYIRpW8saWBIJ4KRfsILfhBVVqe7dSepvgV6YpX/7rp9RwVGYJpXloE2liJsQ n5ozpVzBBaStN1xvWSn1tNxVMYwgiSoaOGdjrgW3eLlk3dlAQZTd0ciSEGHGIciz9HSz TLx1B4gCB8OWQDvQvlTQPsfr12gf+4vO2S9s9BXqftNWcSTcVO/qrIGVjCqreLoApKiq MW6czC6dBVBytHaHNbzmnSfeuQZQxC58GNvJaku92zkd3ve1lAWpoliB9zytXJ9SiKS2 BvQpbNaM9IYEpsfMcZt4x2MRtPG5oo77wi0OS46154SJWojVuHc2O2V8noz4yhZdx/2s 8kwQ== 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=Xt6/4+wEKiWtFL2dtOEhVMVadBdWF2iE7jN+ABlj+7w=; b=DcfkmWqoffiQJQGKpstnXFQawnLraF98rpP9nM/HWKPiu12R09ue7mwENcWcaXNq38 RA4SM3gODEeQJDD8abJzTr6u59JOtqP99S8HlgNmMI28+q41NaMjyGSnRdFIL9ki4IvD yFErWh88VanVkjhDN8Ban3Q8uobx0r0lr+noSepq1SVCRR/aRD7GN7CgGw5DZ9qso3ek nAAiiCEV080glhfH46l/MyMwV51JLhEPp9ZwHCuBJpdnFeGN3zH9QAGP4e4iHXsLiANO ww+gdpRy/1MSEexr21neIc1AhkUnf+Wtdq+zlQ7T8jCy3knVdS0kUtsAQwH0PLNN6oeA zAbA== X-Gm-Message-State: APjAAAVpX3umfXRlXiHko+reaeBYrveAXwNc+N3NtgEgiogGFeKI19F+ TqqyC4evCZKuE3oVZihQkb5SK9Yw X-Google-Smtp-Source: APXvYqzr+AoHprjP8ts3wc4y0LIgd/T0gtnPdfKjniQJ+Grqlo/2X9FmKDtLb0saCt3OnKkgzRJbsA== X-Received: by 2002:a17:90a:fa15:: with SMTP id cm21mr12525364pjb.122.1559346463481; Fri, 31 May 2019 16:47:43 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y191sm7056843pfb.179.2019.05.31.16.47.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 May 2019 16:47:42 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Andy Gross , David Brown , Bjorn Andersson , Amit Pundir , Rob Herring , Mark Rutland , Sebastian Reichel , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Subject: [RFC][PATCH 2/2] reset: qcom-pon: Add support for gen2 pon Date: Fri, 31 May 2019 23:47:34 +0000 Message-Id: <20190531234734.102842-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190531234734.102842-1-john.stultz@linaro.org> References: <20190531234734.102842-1-john.stultz@linaro.org> Add support for gen2 pon register so "reboot bootloader" can work on pixel3 and db845. Cc: Andy Gross Cc: David Brown Cc: Bjorn Andersson Cc: Amit Pundir Cc: Rob Herring Cc: Mark Rutland Cc: Sebastian Reichel Cc: linux-arm-msm@vger.kernel.org Cc: devicetree@vger.kernel.org Signed-off-by: John Stultz --- arch/arm64/boot/dts/qcom/pm8998.dtsi | 2 +- drivers/power/reset/qcom-pon.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/arch/arm64/boot/dts/qcom/pm8998.dtsi b/arch/arm64/boot/dts/qcom/pm8998.dtsi index d3ca35a940fb..051a52df80f9 100644 --- a/arch/arm64/boot/dts/qcom/pm8998.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8998.dtsi @@ -39,7 +39,7 @@ #size-cells = <0>; pm8998_pon: pon@800 { - compatible = "qcom,pm8916-pon"; + compatible = "qcom,pm8998-pon"; reg = <0x800>; mode-bootloader = <0x2>; diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c index 3fa1642d4c54..d0336a1612a4 100644 --- a/drivers/power/reset/qcom-pon.c +++ b/drivers/power/reset/qcom-pon.c @@ -14,11 +14,15 @@ #define PON_SOFT_RB_SPARE 0x8f +#define GEN1_REASON_SHIFT 2 +#define GEN2_REASON_SHIFT 1 + struct pm8916_pon { struct device *dev; struct regmap *regmap; u32 baseaddr; struct reboot_mode_driver reboot_mode; + long reason_shift; }; static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot, @@ -30,15 +34,18 @@ static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot, ret = regmap_update_bits(pon->regmap, pon->baseaddr + PON_SOFT_RB_SPARE, - 0xfc, magic << 2); + 0xfc, magic << pon->reason_shift); if (ret < 0) dev_err(pon->dev, "update reboot mode bits failed\n"); return ret; } +static const struct of_device_id pm8916_pon_id_table[]; + static int pm8916_pon_probe(struct platform_device *pdev) { + const struct of_device_id *match; struct pm8916_pon *pon; int error; @@ -60,6 +67,7 @@ static int pm8916_pon_probe(struct platform_device *pdev) return error; pon->reboot_mode.dev = &pdev->dev; + pon->reason_shift = of_device_get_match_data(&pdev->dev); pon->reboot_mode.write = pm8916_reboot_mode_write; error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode); if (error) { @@ -73,8 +81,9 @@ static int pm8916_pon_probe(struct platform_device *pdev) } static const struct of_device_id pm8916_pon_id_table[] = { - { .compatible = "qcom,pm8916-pon" }, - { .compatible = "qcom,pms405-pon" }, + { .compatible = "qcom,pm8916-pon", .data = (void *)GEN1_REASON_SHIFT }, + { .compatible = "qcom,pms405-pon", .data = (void *)GEN1_REASON_SHIFT }, + { .compatible = "qcom,pm8998-pon", .data = (void *)GEN2_REASON_SHIFT }, { } }; MODULE_DEVICE_TABLE(of, pm8916_pon_id_table);