* [PATCH v2] i2c: xgene-slimpro: Support v2
@ 2017-10-30 22:24 Hoan Tran
2017-10-31 9:14 ` Andy Shevchenko
2017-11-01 22:55 ` Wolfram Sang
0 siblings, 2 replies; 4+ messages in thread
From: Hoan Tran @ 2017-10-30 22:24 UTC (permalink / raw)
To: Wolfram Sang, Andy Shevchenko
Cc: linux-i2c, linux-kernel, Loc Ho, patches, Hoan Tran
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>
---
v2:
- Remove un-necessary ifdef CONFIG_ACPI
- Use acpi_match_table pointer from pdev
- Use MEMREMAP_WT for non-cachable memory
drivers/i2c/busses/i2c-xgene-slimpro.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c
index 7e89ba6..a7ac746 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 {
#define to_slimpro_i2c_dev(cl) \
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
*/
@@ -476,6 +481,15 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
}
} else {
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",
&ctx->mbox_idx))
@@ -514,9 +528,16 @@ static int xgene_slimpro_i2c_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);
+ if (version == XGENE_SLIMPRO_I2C_V2)
+ ctx->pcc_comm_addr = memremap(
+ 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 {
dev_err(&pdev->dev, "Failed to get PCC comm region\n");
rc = -ENOENT;
@@ -581,7 +602,8 @@ MODULE_DEVICE_TABLE(of, xgene_slimpro_i2c_dt_ids);
#ifdef CONFIG_ACPI
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);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] i2c: xgene-slimpro: Support v2
2017-10-30 22:24 [PATCH v2] i2c: xgene-slimpro: Support v2 Hoan Tran
@ 2017-10-31 9:14 ` Andy Shevchenko
2017-10-31 20:27 ` Hoan Tran
2017-11-01 22:55 ` Wolfram Sang
1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2017-10-31 9:14 UTC (permalink / raw)
To: Hoan Tran, Wolfram Sang; +Cc: linux-i2c, linux-kernel, Loc Ho, patches
On Mon, 2017-10-30 at 15:24 -0700, Hoan Tran wrote:
> This patch supports xgene-slimpro-i2c v2 which uses the non-cachable
> memory
> as the PCC shared memory.
>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
(I'm totally fine with ACPI bits here, for the rest I hope it had been
tested and works as expected)
> Signed-off-by: Hoan Tran <hotran@apm.com>
> ---
> v2:
> - Remove un-necessary ifdef CONFIG_ACPI
> - Use acpi_match_table pointer from pdev
> - Use MEMREMAP_WT for non-cachable memory
>
> drivers/i2c/busses/i2c-xgene-slimpro.c | 30
> ++++++++++++++++++++++++++----
> 1 file changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c
> b/drivers/i2c/busses/i2c-xgene-slimpro.c
> index 7e89ba6..a7ac746 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 {
> #define to_slimpro_i2c_dev(cl) \
> 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
> */
> @@ -476,6 +481,15 @@ static int xgene_slimpro_i2c_probe(struct
> platform_device *pdev)
> }
> } else {
> 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",
> &ctx->mbox_idx))
> @@ -514,9 +528,16 @@ static int xgene_slimpro_i2c_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);
> + if (version == XGENE_SLIMPRO_I2C_V2)
> + ctx->pcc_comm_addr = memremap(
> + 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 {
> dev_err(&pdev->dev, "Failed to get PCC comm
> region\n");
> rc = -ENOENT;
> @@ -581,7 +602,8 @@ MODULE_DEVICE_TABLE(of, xgene_slimpro_i2c_dt_ids);
>
> #ifdef CONFIG_ACPI
> 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);
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] i2c: xgene-slimpro: Support v2
2017-10-31 9:14 ` Andy Shevchenko
@ 2017-10-31 20:27 ` Hoan Tran
0 siblings, 0 replies; 4+ messages in thread
From: Hoan Tran @ 2017-10-31 20:27 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Wolfram Sang, linux-i2c, lkml, Loc Ho, patches
Hi Andy,
On Tue, Oct 31, 2017 at 2:14 AM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Mon, 2017-10-30 at 15:24 -0700, Hoan Tran wrote:
>> This patch supports xgene-slimpro-i2c v2 which uses the non-cachable
>> memory
>> as the PCC shared memory.
>>
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> (I'm totally fine with ACPI bits here, for the rest I hope it had been
> tested and works as expected)
Yes, it had been tested.
Thanks
Hoan
>
>> Signed-off-by: Hoan Tran <hotran@apm.com>
>> ---
>> v2:
>> - Remove un-necessary ifdef CONFIG_ACPI
>> - Use acpi_match_table pointer from pdev
>> - Use MEMREMAP_WT for non-cachable memory
>>
>> drivers/i2c/busses/i2c-xgene-slimpro.c | 30
>> ++++++++++++++++++++++++++----
>> 1 file changed, 26 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c
>> b/drivers/i2c/busses/i2c-xgene-slimpro.c
>> index 7e89ba6..a7ac746 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 {
>> #define to_slimpro_i2c_dev(cl) \
>> 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
>> */
>> @@ -476,6 +481,15 @@ static int xgene_slimpro_i2c_probe(struct
>> platform_device *pdev)
>> }
>> } else {
>> 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",
>> &ctx->mbox_idx))
>> @@ -514,9 +528,16 @@ static int xgene_slimpro_i2c_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);
>> + if (version == XGENE_SLIMPRO_I2C_V2)
>> + ctx->pcc_comm_addr = memremap(
>> + 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 {
>> dev_err(&pdev->dev, "Failed to get PCC comm
>> region\n");
>> rc = -ENOENT;
>> @@ -581,7 +602,8 @@ MODULE_DEVICE_TABLE(of, xgene_slimpro_i2c_dt_ids);
>>
>> #ifdef CONFIG_ACPI
>> 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);
>
> --
> Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Intel Finland Oy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] i2c: xgene-slimpro: Support v2
2017-10-30 22:24 [PATCH v2] i2c: xgene-slimpro: Support v2 Hoan Tran
2017-10-31 9:14 ` Andy Shevchenko
@ 2017-11-01 22:55 ` Wolfram Sang
1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2017-11-01 22:55 UTC (permalink / raw)
To: Hoan Tran; +Cc: Andy Shevchenko, linux-i2c, linux-kernel, Loc Ho, patches
[-- Attachment #1: Type: text/plain, Size: 251 bytes --]
On Mon, Oct 30, 2017 at 03:24:16PM -0700, Hoan Tran wrote:
> 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>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-01 22:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-30 22:24 [PATCH v2] i2c: xgene-slimpro: Support v2 Hoan Tran
2017-10-31 9:14 ` Andy Shevchenko
2017-10-31 20:27 ` Hoan Tran
2017-11-01 22:55 ` Wolfram Sang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.