hwmon: xgene: Support hwmon v2
cover hwmon: xgene: Support hwmon v2
This patch supports xgene-hwmon v2 which uses the non-cachable memory as the PCC shared memory.
Hoan Tran (2):
hwmon: xgene: Support hwmon v2
hwmon: xgene: Support PCC shared memory in IO region
drivers/hwmon/xgene-hwmon.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 hwmon: xgene: Support hwmon v2
This patch supports xgene-hwmon v2 which uses the non-cachable memory as the PCC shared memory.
--- drivers/hwmon/xgene-hwmon.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/xgene-hwmon.c +1 -0
@@ -761,6 +761,7 @@ static int xgene_hwmon_remove(struct platform_device *pdev)#ifdef CONFIG_ACPI static const struct acpi_device_id xgene_hwmon_acpi_match[] = { {"APMC0D29" ,0 }, + {"APMC0D8A" ,0 }, {}, };MODULE_DEVICE_TABLE (acpi, xgene_hwmon_acpi_match);
Signature · 1 line
1.9.1
PATCH 2/2 hwmon: xgene: Support PCC shared memory in IO region
In reply to Hoan TranAs the PCC shared memory could be in IO region which doesn't support caching, this patch simply uses ioremap() for IO region.
--- drivers/hwmon/xgene-hwmon.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/hwmon/xgene-hwmon.c +11 -3
@@ -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 ;
Signature · 1 line
1.9.1
Quoted 4 lines · hotran
This patch supports xgene-hwmon v2 which uses the non-cachable memory as the PCC shared memory.
Signed-off-by Hoan Tran <[email protected]>
Applied to hwmon-next.
Thanks,
Guenter
Quoted 16 lines
--- drivers/hwmon/xgene-hwmon.c | 1 + 1 file changed, 1 insertion(+)drivers/hwmon/xgene-hwmon.c +1
-0@@ -761,6 +761,7 @@ static int xgene_hwmon_remove(struct platform_device *pdev)#ifdef CONFIG_ACPI static const struct acpi_device_id xgene_hwmon_acpi_match[] = { {"APMC0D29" ,0 }, + {"APMC0D8A" ,0 }, {}, };MODULE_DEVICE_TABLE (acpi, xgene_hwmon_acpi_match);
Re: [2/2] hwmon: xgene: Support PCC shared memory in IO region
In reply to Hoan TranQuoted 4 lines · hotran
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 <[email protected]>
Applied to hwmon-next.
Thanks,
Guenter
Quoted 43 lines
--- drivers/hwmon/xgene-hwmon.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/hwmon/xgene-hwmon.c +11
-3@@ -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 ;
Guenter Roeck
maintainerRe: [2/2] hwmon: xgene: Support PCC shared memory in IO region
Quoted 8 lines · Guenter Roeck
Quoted 4 lines · hotran
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 <[email protected]>Applied to hwmon-next.
Turns out this doesn't work. memblock_is_memory() is not exported and marked __init_memblock, and thus not qavailable for modules. Dropped.
Guenter
Quoted 46 lines
Thanks,
GuenterQuoted 43 lines
--- drivers/hwmon/xgene-hwmon.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/hwmon/xgene-hwmon.c +11
-3@@ -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 ;