Commit da24b824 authored by Hoan Tran's avatar Hoan Tran Committed by Wolfram Sang

i2c: xgene-slimpro: Support v2

This patch supports xgene-slimpro-i2c v2 which uses the non-cachable memory
as the PCC shared memory.
Signed-off-by: default avatarHoan Tran <hotran@apm.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent af336675
...@@ -129,6 +129,11 @@ struct slimpro_i2c_dev { ...@@ -129,6 +129,11 @@ struct slimpro_i2c_dev {
#define to_slimpro_i2c_dev(cl) \ #define to_slimpro_i2c_dev(cl) \
container_of(cl, struct slimpro_i2c_dev, mbox_client) container_of(cl, struct slimpro_i2c_dev, mbox_client)
enum slimpro_i2c_version {
XGENE_SLIMPRO_I2C_V1 = 0,
XGENE_SLIMPRO_I2C_V2 = 1,
};
/* /*
* This function tests and clears a bitmask then returns its old value * This function tests and clears a bitmask then returns its old value
*/ */
...@@ -476,6 +481,15 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev) ...@@ -476,6 +481,15 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
} }
} else { } else {
struct acpi_pcct_hw_reduced *cppc_ss; struct acpi_pcct_hw_reduced *cppc_ss;
const struct acpi_device_id *acpi_id;
int version = XGENE_SLIMPRO_I2C_V1;
acpi_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
&pdev->dev);
if (!acpi_id)
return -EINVAL;
version = (int)acpi_id->driver_data;
if (device_property_read_u32(&pdev->dev, "pcc-channel", if (device_property_read_u32(&pdev->dev, "pcc-channel",
&ctx->mbox_idx)) &ctx->mbox_idx))
...@@ -514,9 +528,16 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev) ...@@ -514,9 +528,16 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
*/ */
ctx->comm_base_addr = cppc_ss->base_address; ctx->comm_base_addr = cppc_ss->base_address;
if (ctx->comm_base_addr) { if (ctx->comm_base_addr) {
ctx->pcc_comm_addr = memremap(ctx->comm_base_addr, if (version == XGENE_SLIMPRO_I2C_V2)
cppc_ss->length, ctx->pcc_comm_addr = memremap(
MEMREMAP_WB); ctx->comm_base_addr,
cppc_ss->length,
MEMREMAP_WT);
else
ctx->pcc_comm_addr = memremap(
ctx->comm_base_addr,
cppc_ss->length,
MEMREMAP_WB);
} else { } else {
dev_err(&pdev->dev, "Failed to get PCC comm region\n"); dev_err(&pdev->dev, "Failed to get PCC comm region\n");
rc = -ENOENT; rc = -ENOENT;
...@@ -581,7 +602,8 @@ MODULE_DEVICE_TABLE(of, xgene_slimpro_i2c_dt_ids); ...@@ -581,7 +602,8 @@ MODULE_DEVICE_TABLE(of, xgene_slimpro_i2c_dt_ids);
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
static const struct acpi_device_id xgene_slimpro_i2c_acpi_ids[] = { static const struct acpi_device_id xgene_slimpro_i2c_acpi_ids[] = {
{"APMC0D40", 0}, {"APMC0D40", XGENE_SLIMPRO_I2C_V1},
{"APMC0D8B", XGENE_SLIMPRO_I2C_V2},
{} {}
}; };
MODULE_DEVICE_TABLE(acpi, xgene_slimpro_i2c_acpi_ids); MODULE_DEVICE_TABLE(acpi, xgene_slimpro_i2c_acpi_ids);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment