From: Hoan Tran <hotran@apm.com>
To: Guenter Roeck <linux@roeck-us.net>, Jean Delvare <jdelvare@suse.com>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
Itaru Kitayama <itaru.kitayama@riken.jp>,
lho@apm.com, kdinh@apm.com, patches@apm.com,
Hoan Tran <hotran@apm.com>
Subject: [PATCH 2/2] hwmon: xgene: Support PCC shared memory in IO region
Date: Thu, 21 Sep 2017 10:17:10 -0700 [thread overview]
Message-ID: <1506014230-13933-3-git-send-email-hotran@apm.com> (raw)
In-Reply-To: <1506014230-13933-1-git-send-email-hotran@apm.com>
As the PCC shared memory could be in IO region which doesn't
support caching, this patch simply uses ioremap() for IO region.
Signed-off-by: Hoan Tran <hotran@apm.com>
---
drivers/hwmon/xgene-hwmon.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/xgene-hwmon.c b/drivers/hwmon/xgene-hwmon.c
index 5cd327e..2dac1ed 100644
--- a/drivers/hwmon/xgene-hwmon.c
+++ b/drivers/hwmon/xgene-hwmon.c
@@ -32,6 +32,7 @@
#include <linux/kfifo.h>
#include <linux/mailbox_controller.h>
#include <linux/mailbox_client.h>
+#include <linux/memblock.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
@@ -135,6 +136,14 @@ static u16 xgene_word_tst_and_clr(u16 *addr, u16 mask)
return ret;
}
+static void __iomem *pcc_ioremap(phys_addr_t phys, size_t size)
+{
+ if (!memblock_is_memory(phys))
+ return ioremap(phys, size);
+
+ return memremap(phys, size, MEMREMAP_WB);
+}
+
static int xgene_hwmon_pcc_rd(struct xgene_hwmon_dev *ctx, u32 *msg)
{
struct acpi_pcct_shared_memory *generic_comm_base = ctx->pcc_comm_addr;
@@ -690,9 +699,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
*/
ctx->comm_base_addr = cppc_ss->base_address;
if (ctx->comm_base_addr) {
- ctx->pcc_comm_addr = memremap(ctx->comm_base_addr,
- cppc_ss->length,
- MEMREMAP_WB);
+ ctx->pcc_comm_addr = pcc_ioremap(ctx->comm_base_addr,
+ cppc_ss->length);
} else {
dev_err(&pdev->dev, "Failed to get PCC comm region\n");
rc = -ENODEV;
--
1.9.1
next prev parent reply other threads:[~2017-09-21 17:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-21 17:17 [PATCH 0/2] hwmon: xgene: Support hwmon v2 Hoan Tran
2017-09-21 17:17 ` [PATCH 1/2] " Hoan Tran
2017-10-01 14:30 ` [1/2] " Guenter Roeck
2017-09-21 17:17 ` Hoan Tran [this message]
2017-10-01 14:31 ` [2/2] hwmon: xgene: Support PCC shared memory in IO region Guenter Roeck
2017-10-01 19:46 ` Guenter Roeck
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=1506014230-13933-3-git-send-email-hotran@apm.com \
--to=hotran@apm.com \
--cc=itaru.kitayama@riken.jp \
--cc=jdelvare@suse.com \
--cc=kdinh@apm.com \
--cc=lho@apm.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=patches@apm.com \
/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®