Skip to contentSkip to conversation

i2c:dw: Add APM X-Gene ACPI I2C device support

PATCH Superseded Loc Ho 3 participants 9 messages Dec 8, 2015 – Dec 10, 2015

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Loc Ho

author
#0 lore raw

cover i2c:dw: Add APM X-Gene ACPI I2C device support

Add APM X-Gene ACPI I2C device support. These patches follow the same implementation as AMD I2C driver - changes in ACPI APD and Designware I2C drivers.

---
Loc Ho (2):
acpi:apd: Add APM X-Gene ACPI I2C device support i2c:dw: Add APM X-Gene ACPI I2C device support

 drivers/acpi/acpi_apd.c                     |    8 +++++++-
 drivers/i2c/busses/i2c-designware-platdrv.c |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)
author
#1 lore raw

PATCH 1/2 acpi:apd: Add APM X-Gene ACPI I2C device support

Add APM X-Gene ACPI I2C device support by hooks into existent ACPI apd driver. To fully enable support, require another patch to add the X-Gene ACPI node into the DW I2C driver.

---
 drivers/acpi/acpi_apd.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/acpi/acpi_apd.c +7 -1
index a450e7a..6a9cb8d 100644
@@ -51,7 +51,7 @@ struct apd_private_data {
 	const struct apd_device_desc *dev_desc;
 };
 
-#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
+#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64)
 #define APD_ADDR(desc)	((unsigned long)&desc)
 
 static int acpi_apd_setup(struct apd_private_data *pdata)
@@ -76,6 +76,11 @@ static struct apd_device_desc cz_i2c_desc = {
 	.fixed_clk_rate = 133000000,
 };
 
+static struct apd_device_desc xgene_i2c_desc = {
+	.setup = acpi_apd_setup,
+	.fixed_clk_rate = 100000000,
+};
+
 static struct apd_device_desc cz_uart_desc = {
 	.setup = acpi_apd_setup,
 	.fixed_clk_rate = 48000000,
@@ -135,6 +140,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
 	{ "AMD0010", APD_ADDR(cz_i2c_desc) },
 	{ "AMD0020", APD_ADDR(cz_uart_desc) },
 	{ "AMD0030", },
+	{ "APMC0D0F", APD_ADDR(xgene_i2c_desc) },
 	{ }
 };
 
Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH 1/2] acpi:apd: Add APM X-Gene ACPI I2C device support

Quoted 35 lines · Loc Ho

Add APM X-Gene ACPI I2C device support by hooks into existent ACPI apd driver. To fully enable support, require another patch to add the X-Gene ACPI node into the DW I2C driver.

---
 drivers/acpi/acpi_apd.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/acpi/acpi_apd.c +6 -1
index a450e7a..6a9cb8d 100644
@@ -51,7 +51,7 @@ struct apd_private_data {
 	const struct apd_device_desc *dev_desc;
 };
 
-#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
+#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64)
 #define APD_ADDR(desc)	((unsigned long)&desc)
 
 static int acpi_apd_setup(struct apd_private_data *pdata)
@@ -76,6 +76,11 @@ static struct apd_device_desc cz_i2c_desc = {
 	.fixed_clk_rate = 133000000,
 };
 
+static struct apd_device_desc xgene_i2c_desc = {
+	.setup = acpi_apd_setup,
+	.fixed_clk_rate = 100000000,
+};
+
 static struct apd_device_desc cz_uart_desc = {
 	.setup = acpi_apd_setup,
 	.fixed_clk_rate = 48000000,

drivers/acpi/acpi_apd.c static const struct acpi_device_id acpi_apd_device_ids[] = { · line 143

Quoted 4 lines
drivers/acpi/acpi_apd.c +1 -0
@@ -135,6 +140,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
 	{ "AMD0010", APD_ADDR(cz_i2c_desc) },
 	{ "AMD0020", APD_ADDR(cz_uart_desc) },
 	{ "AMD0030", },
+	{ "APMC0D0F", APD_ADDR(xgene_i2c_desc) },

It is better to split AMD devices and ARM devices with macros:
CONFIG_X86_AMD_PLATFORM_DEVICE and CONFIG_ARM64.

Quoted 3 lines
drivers/acpi/acpi_apd.c +0 -0
 	{ }
 };
 
author
#3 lore raw

Re: [PATCH 1/2] acpi:apd: Add APM X-Gene ACPI I2C device support

Hi Ken,

Quoted 28 lines · Ken Xue
Quoted 26 lines · Loc Ho

Add APM X-Gene ACPI I2C device support by hooks into existent ACPI apd driver. To fully enable support, require another patch to add the X-Gene ACPI node into the DW I2C driver.

---
 drivers/acpi/acpi_apd.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/acpi/acpi_apd.c +1 -1
index a450e7a..6a9cb8d 100644
@@ -51,7 +51,7 @@ struct apd_private_data {
      const struct apd_device_desc *dev_desc;
 };
 
-#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
+#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64)
 #define APD_ADDR(desc)       ((unsigned long)&desc)
 
 static int acpi_apd_setup(struct apd_private_data *pdata)
@@ -76,6 +76,11 @@ static struct apd_device_desc cz_i2c_desc = {
      .fixed_clk_rate = 133000000,
 };
 
Quoted 15 lines

drivers/acpi/acpi_apd.c static const struct acpi_device_id acpi_apd_device_ids[] = { · line 143

Quoted 13 lines
drivers/acpi/acpi_apd.c +6 -0
+static struct apd_device_desc xgene_i2c_desc = {
+     .setup = acpi_apd_setup,
+     .fixed_clk_rate = 100000000,
+};
+
 static struct apd_device_desc cz_uart_desc = {
      .setup = acpi_apd_setup,
      .fixed_clk_rate = 48000000,
@@ -135,6 +140,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
      { "AMD0010", APD_ADDR(cz_i2c_desc) },
      { "AMD0020", APD_ADDR(cz_uart_desc) },
      { "AMD0030", },
+     { "APMC0D0F", APD_ADDR(xgene_i2c_desc) },

It is better to split AMD devices and ARM devices with macros:
CONFIG_X86_AMD_PLATFORM_DEVICE and CONFIG_ARM64.

This gets pretty ugly to me with define as it would look like this:

#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64) #define APD_ADDR(desc) ((unsigned long)&desc)

static int acpi_apd_setup(struct apd_private_data *pdata) {
.....
}

#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE

static struct apd_device_desc cz_i2c_desc = {
    ....
};
static struct apd_device_desc xgene_i2c_desc = {
    ...
};

#endif

#ifdef CONFIG_ARM64

static struct apd_device_desc cz_uart_desc = {
    ....
};

#endif

#else

#define APD_ADDR(desc) (0UL)

#endif /* CONFIG_X86_AMD_PLATFORM_DEVICE */

And...

#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
{ "AMD0010", APD_ADDR(cz_i2c_desc) },
{ "AMD0020", APD_ADDR(cz_uart_desc) },
{ "AMD0030", },
#endif
#ifdef CONFIG_ARM64
{ "APMC0D0F", APD_ADDR(xgene_i2c_desc) },
#endif

Sure you want this?

-Loc

#4 lore raw

Re: [PATCH 1/2] acpi:apd: Add APM X-Gene ACPI I2C device support

Quoted 90 lines · Loc Ho

Hi Ken,

Quoted 28 lines · Ken Xue
Quoted 26 lines · Loc Ho

Add APM X-Gene ACPI I2C device support by hooks into existent ACPI apd driver. To fully enable support, require another patch to add the X-Gene ACPI node into the DW I2C driver.

---
 drivers/acpi/acpi_apd.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/acpi/acpi_apd.c +1 -1
index a450e7a..6a9cb8d 100644
@@ -51,7 +51,7 @@ struct apd_private_data {
      const struct apd_device_desc *dev_desc;
 };
 
-#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
+#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64)
 #define APD_ADDR(desc)       ((unsigned long)&desc)
 
 static int acpi_apd_setup(struct apd_private_data *pdata)
@@ -76,6 +76,11 @@ static struct apd_device_desc cz_i2c_desc = {
      .fixed_clk_rate = 133000000,
 };
 
Quoted 15 lines

drivers/acpi/acpi_apd.c static const struct acpi_device_id acpi_apd_device_ids[] = { · line 143

Quoted 13 lines
drivers/acpi/acpi_apd.c +6 -0
+static struct apd_device_desc xgene_i2c_desc = {
+     .setup = acpi_apd_setup,
+     .fixed_clk_rate = 100000000,
+};
+
 static struct apd_device_desc cz_uart_desc = {
      .setup = acpi_apd_setup,
      .fixed_clk_rate = 48000000,
@@ -135,6 +140,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
      { "AMD0010", APD_ADDR(cz_i2c_desc) },
      { "AMD0020", APD_ADDR(cz_uart_desc) },
      { "AMD0030", },
+     { "APMC0D0F", APD_ADDR(xgene_i2c_desc) },

It is better to split AMD devices and ARM devices with macros:
CONFIG_X86_AMD_PLATFORM_DEVICE and CONFIG_ARM64.

This gets pretty ugly to me with define as it would look like this:

#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64) #define APD_ADDR(desc) ((unsigned long)&desc)

static int acpi_apd_setup(struct apd_private_data *pdata)

{
   .....
}

#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE

static struct apd_device_desc cz_i2c_desc = {
    ....
};
static struct apd_device_desc xgene_i2c_desc = {
    ...
};

#endif

#ifdef CONFIG_ARM64

static struct apd_device_desc cz_uart_desc = {
    ....
};

#endif

#else

#define APD_ADDR(desc) (0UL)

#endif /* CONFIG_X86_AMD_PLATFORM_DEVICE */

And...

#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
{ "AMD0010", APD_ADDR(cz_i2c_desc) },
{ "AMD0020", APD_ADDR(cz_uart_desc) },
{ "AMD0030", },
#endif
#ifdef CONFIG_ARM64
{ "APMC0D0F", APD_ADDR(xgene_i2c_desc) },
#endif

Quoted 1 line

Sure you want this?

Yes. Even though it may look like too much macros for just several devices now. But I think AMD and other ARM socs may also try to leverage APD for more and more ACPI devices.
It is a good direction that 1)improve efficiency of matching ACPI handler 2) split devices and potential hook routines into different classes clearly

It also will be more convenient to move ARM devices out of APD if there is a new design for ARM ACPI device.

author
#5 lore raw

Re: [PATCH 1/2] acpi:apd: Add APM X-Gene ACPI I2C device support

Hi,

Quoted 99 lines · Ken Xue
Quoted 90 lines · Loc Ho

Hi Ken,

Quoted 28 lines · Ken Xue
Quoted 26 lines · Loc Ho

Add APM X-Gene ACPI I2C device support by hooks into existent ACPI apd driver. To fully enable support, require another patch to add the X-Gene ACPI node into the DW I2C driver.

---
 drivers/acpi/acpi_apd.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/acpi/acpi_apd.c +1 -1
index a450e7a..6a9cb8d 100644
@@ -51,7 +51,7 @@ struct apd_private_data {
      const struct apd_device_desc *dev_desc;
 };
 
-#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
+#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64)
 #define APD_ADDR(desc)       ((unsigned long)&desc)
 
 static int acpi_apd_setup(struct apd_private_data *pdata)
@@ -76,6 +76,11 @@ static struct apd_device_desc cz_i2c_desc = {
      .fixed_clk_rate = 133000000,
 };
 
Quoted 15 lines

drivers/acpi/acpi_apd.c static const struct acpi_device_id acpi_apd_device_ids[] = { · line 143

Quoted 13 lines
drivers/acpi/acpi_apd.c +6 -0
+static struct apd_device_desc xgene_i2c_desc = {
+     .setup = acpi_apd_setup,
+     .fixed_clk_rate = 100000000,
+};
+
 static struct apd_device_desc cz_uart_desc = {
      .setup = acpi_apd_setup,
      .fixed_clk_rate = 48000000,
@@ -135,6 +140,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
      { "AMD0010", APD_ADDR(cz_i2c_desc) },
      { "AMD0020", APD_ADDR(cz_uart_desc) },
      { "AMD0030", },
+     { "APMC0D0F", APD_ADDR(xgene_i2c_desc) },

It is better to split AMD devices and ARM devices with macros:
CONFIG_X86_AMD_PLATFORM_DEVICE and CONFIG_ARM64.

This gets pretty ugly to me with define as it would look like this:

#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64) #define APD_ADDR(desc) ((unsigned long)&desc)

static int acpi_apd_setup(struct apd_private_data *pdata)

{
   .....
}

#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE

static struct apd_device_desc cz_i2c_desc = {
    ....
};
static struct apd_device_desc xgene_i2c_desc = {
    ...
};

#endif

#ifdef CONFIG_ARM64

static struct apd_device_desc cz_uart_desc = {
    ....
};

#endif

#else

#define APD_ADDR(desc) (0UL)

#endif /* CONFIG_X86_AMD_PLATFORM_DEVICE */

And...

#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
{ "AMD0010", APD_ADDR(cz_i2c_desc) },
{ "AMD0020", APD_ADDR(cz_uart_desc) },
{ "AMD0030", },
#endif
#ifdef CONFIG_ARM64
{ "APMC0D0F", APD_ADDR(xgene_i2c_desc) },
#endif

Quoted 1 line

Sure you want this?

Yes. Even though it may look like too much macros for just several devices now. But I think AMD and other ARM socs may also try to leverage APD for more and more ACPI devices.
It is a good direction that 1)improve efficiency of matching ACPI handler 2) split devices and potential hook routines into different classes clearly

Quoted 3 lines

It also will be more convenient to move ARM devices out of APD if there is a new design for ARM ACPI device.

Okay... I will generate v2 when ready. One more question, does AMD ARM64 SoC need it later?

-Loc

#6 lore raw

Re: [PATCH 1/2] acpi:apd: Add APM X-Gene ACPI I2C device support

Quoted 8 lines · Loc Ho
Quoted 8 lines
Quoted 1 line

Sure you want this?

Yes. Even though it may look like too much macros for just several devices now. But I think AMD and other ARM socs may also try to leverage APD for more and more ACPI devices.
It is a good direction that 1)improve efficiency of matching ACPI handler 2) split devices and potential hook routines into different classes clearly

Quoted 7 lines
Quoted 3 lines

It also will be more convenient to move ARM devices out of APD if there is a new design for ARM ACPI device.

Okay... I will generate v2 when ready. One more question, does AMD ARM64 SoC need it later?

Thanks. I am not sure about driver design for AMD ARM64 SoC.

author
#7 lore raw

PATCH 2/2 i2c:dw: Add APM X-Gene ACPI I2C device support

In reply to Loc Ho

Enable APM X-Gene ACPI I2C device support by adding the corresponding ACPI ID. The platform ACPI APD corresponding change is required to provide the proper clock frequency input.

---
 drivers/i2c/busses/i2c-designware-platdrv.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/i2c/busses/i2c-designware-platdrv.c +1 -0
index 809579e..423371d 100644
@@ -117,6 +117,7 @@ static const struct acpi_device_id dw_i2c_acpi_match[] = {
 	{ "80860F41", 0 },
 	{ "808622C1", 0 },
 	{ "AMD0010", 0 },
+	{ "APMC0D0F", 0 },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match);
Signature · 1 line
1.7.1