From: Feng Kan <fkan@apm.com>
To: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-acpi@vger.kernel.org
Cc: Feng Kan <fkan@apm.com>
Subject: [PATCH V2 5/6] power: reset: change xgene reboot driver to use both acpi and dts resource for reboot.
Date: Tue, 7 Jan 2014 14:50:40 -0800 [thread overview]
Message-ID: <1389135041-16062-6-git-send-email-fkan@apm.com> (raw)
In-Reply-To: <1389135041-16062-1-git-send-email-fkan@apm.com>
Enable the X-Gene reboot driver to use either the ACPI or the DTS
resource using the platform driver method.
Signed-off-by: Feng Kan <fkan@apm.com>
---
drivers/power/reset/xgene-reboot.c | 33 ++++++++++++++++++++++++++++-----
1 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/drivers/power/reset/xgene-reboot.c b/drivers/power/reset/xgene-reboot.c
index 683238c..e3223c2 100644
--- a/drivers/power/reset/xgene-reboot.c
+++ b/drivers/power/reset/xgene-reboot.c
@@ -30,6 +30,8 @@
#include <linux/platform_device.h>
#include <linux/stat.h>
#include <linux/slab.h>
+#include <linux/acpi.h>
+#include <linux/efi.h>
#include <asm/system_misc.h>
struct xgene_reboot_context {
@@ -59,6 +61,14 @@ static void xgene_restart(enum reboot_mode reboot_mode, const char *cmd)
static int xgene_reboot_probe(struct platform_device *pdev)
{
struct xgene_reboot_context *ctx;
+ struct resource *res;
+ int rc;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
+ dev_err(&pdev->dev, "no resource address\n");
+ return -ENODEV;
+ }
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx) {
@@ -66,20 +76,27 @@ static int xgene_reboot_probe(struct platform_device *pdev)
return -ENODEV;
}
- ctx->csr = of_iomap(pdev->dev.of_node, 0);
+ ctx->csr = devm_ioremap_resource(&pdev->dev, res);
if (!ctx->csr) {
- devm_kfree(&pdev->dev, ctx);
- dev_err(&pdev->dev, "can not map resource\n");
- return -ENODEV;
+ dev_err(&pdev->dev, "can't map CSR resource\n");
+ rc = -ENOMEM;
+ goto error;
}
ctx->mask = 0x1;
+ dev_info(&pdev->dev, "X-Gene register reboot driver\n");
+
ctx->pdev = pdev;
arm_pm_restart = xgene_restart;
xgene_restart_ctx = ctx;
-
return 0;
+
+error:
+ if (ctx->csr)
+ devm_iounmap(&pdev->dev, ctx->csr);
+ devm_kfree(&pdev->dev, ctx);
+ return rc;
}
static struct of_device_id xgene_reboot_of_match[] = {
@@ -87,11 +104,17 @@ static struct of_device_id xgene_reboot_of_match[] = {
{}
};
+static const struct acpi_device_id xgene_reset_acpi_ids[] = {
+ { "APMC0D08", 0 },
+ {}
+};
+
static struct platform_driver xgene_reboot_driver = {
.probe = xgene_reboot_probe,
.driver = {
.name = "xgene-reboot",
.of_match_table = xgene_reboot_of_match,
+ .acpi_match_table = ACPI_PTR(xgene_reset_acpi_ids),
},
};
--
1.7.6.1
next prev parent reply other threads:[~2014-01-07 22:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 22:50 [PATCH V2 0/6] Enable X-Gene platform reboot driver Feng Kan
2014-01-07 22:50 ` [PATCH V2 1/6] Documentation: add dts binding for X-Gene reboot dts node Feng Kan
2014-01-08 10:05 ` Mark Rutland
2014-01-08 10:08 ` Arnd Bergmann
2014-01-09 22:51 ` Feng Kan
2014-01-13 15:19 ` Arnd Bergmann
2014-01-13 19:25 ` Feng Kan
2014-01-13 19:43 ` Arnd Bergmann
2014-01-14 0:42 ` Feng Kan
2014-01-14 6:06 ` Arnd Bergmann
2014-01-14 18:35 ` Feng Kan
2014-01-14 18:42 ` Arnd Bergmann
2014-01-11 1:11 ` Feng Kan
2014-01-07 22:50 ` [PATCH V2 2/6] arm64: add missing dts entry for X-Gene platform Feng Kan
2014-01-07 22:50 ` [PATCH V2 3/6] arm64: Enable system reset via arch Kconfig for X-Gene system Feng Kan
2014-01-07 22:50 ` [PATCH V2 4/6] power: reset: removed use of the dts mask and use fixed value for reset Feng Kan
2014-01-08 21:45 ` Arnd Bergmann
2014-01-07 22:50 ` Feng Kan [this message]
2014-01-08 21:43 ` [PATCH V2 5/6] power: reset: change xgene reboot driver to use both acpi and dts resource for reboot Arnd Bergmann
2014-01-09 22:48 ` Feng Kan
2014-01-13 15:03 ` Arnd Bergmann
2014-01-07 22:50 ` [PATCH V2 6/6] acpi: platform: add ACPI code for X-Gene reboot platform driver Feng Kan
2014-01-14 16:07 ` [PATCH V2 0/6] Enable X-Gene platform reboot driver Matthew Garrett
2014-01-15 17:39 ` Feng Kan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1389135041-16062-6-git-send-email-fkan@apm.com \
--to=fkan@apm.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®