aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHoan Tran <hotran@apm.com>2017-10-30 18:24:16 -0400
committerWolfram Sang <wsa@the-dreams.de>2017-11-01 18:54:53 -0400
commitda24b8240fe6afdeef388a2ef1da662b25675a5a (patch)
tree78fe8a6ace957ec64b4822ba77a7260b81603fe8
parentaf3366753fb530528349e05e0953b7357504084a (diff)
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: Hoan Tran <hotran@apm.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r--drivers/i2c/busses/i2c-xgene-slimpro.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c
index 7e89ba6fcf6f..a7ac746018ad 100644
--- a/drivers/i2c/busses/i2c-xgene-slimpro.c
+++ b/drivers/i2c/busses/i2c-xgene-slimpro.c
@@ -129,6 +129,11 @@ struct slimpro_i2c_dev {
129#define to_slimpro_i2c_dev(cl) \ 129#define to_slimpro_i2c_dev(cl) \
130 container_of(cl, struct slimpro_i2c_dev, mbox_client) 130 container_of(cl, struct slimpro_i2c_dev, mbox_client)
131 131
132enum slimpro_i2c_version {
133 XGENE_SLIMPRO_I2C_V1 = 0,
134 XGENE_SLIMPRO_I2C_V2 = 1,
135};
136
132/* 137/*
133 * This function tests and clears a bitmask then returns its old value 138 * This function tests and clears a bitmask then returns its old value
134 */ 139 */
@@ -476,6 +481,15 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
476 } 481 }
477 } else { 482 } else {
478 struct acpi_pcct_hw_reduced *cppc_ss; 483 struct acpi_pcct_hw_reduced *cppc_ss;
484 const struct acpi_device_id *acpi_id;
485 int version = XGENE_SLIMPRO_I2C_V1;
486
487 acpi_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
488 &pdev->dev);
489 if (!acpi_id)
490 return -EINVAL;
491
492 version = (int)acpi_id->driver_data;
479 493
480 if (device_property_read_u32(&pdev->dev, "pcc-channel", 494 if (device_property_read_u32(&pdev->dev, "pcc-channel",
481 &ctx->mbox_idx)) 495 &ctx->mbox_idx))
@@ -514,9 +528,16 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
514 */ 528 */
515 ctx->comm_base_addr = cppc_ss->base_address; 529 ctx->comm_base_addr = cppc_ss->base_address;
516 if (ctx->comm_base_addr) { 530 if (ctx->comm_base_addr) {
517 ctx->pcc_comm_addr = memremap(ctx->comm_base_addr, 531 if (version == XGENE_SLIMPRO_I2C_V2)
518 cppc_ss->length, 532 ctx->pcc_comm_addr = memremap(
519 MEMREMAP_WB); 533 ctx->comm_base_addr,
534 cppc_ss->length,
535 MEMREMAP_WT);
536 else
537 ctx->pcc_comm_addr = memremap(
538 ctx->comm_base_addr,
539 cppc_ss->length,
540 MEMREMAP_WB);
520 } else { 541 } else {
521 dev_err(&pdev->dev, "Failed to get PCC comm region\n"); 542 dev_err(&pdev->dev, "Failed to get PCC comm region\n");
522 rc = -ENOENT; 543 rc = -ENOENT;
@@ -581,7 +602,8 @@ MODULE_DEVICE_TABLE(of, xgene_slimpro_i2c_dt_ids);
581 602
582#ifdef CONFIG_ACPI 603#ifdef CONFIG_ACPI
583static const struct acpi_device_id xgene_slimpro_i2c_acpi_ids[] = { 604static const struct acpi_device_id xgene_slimpro_i2c_acpi_ids[] = {
584 {"APMC0D40", 0}, 605 {"APMC0D40", XGENE_SLIMPRO_I2C_V1},
606 {"APMC0D8B", XGENE_SLIMPRO_I2C_V2},
585 {} 607 {}
586}; 608};
587MODULE_DEVICE_TABLE(acpi, xgene_slimpro_i2c_acpi_ids); 609MODULE_DEVICE_TABLE(acpi, xgene_slimpro_i2c_acpi_ids);