Skip to contentSkip to conversation

i2c: Add ACPI support for HJMC01

PATCH Applied hunter.yu 6 participants 23 messages Sep 26, 2024 – Aug 14

Subsystems (4)
lore
Share & tools
lore

hunter.yu

author
#0 lore raw

v2 cover i2c: Add ACPI support for HJMC01

Hi, everyone:

HJMC01 is an ARM-based server processor that contain a Designware I2C controller. This series add ACPI support for the Designware i2c controller.

v1->v2:
Adjust the order of ACPI HID according to the alphabetical order

hunter.yu (2):
ACPI: APD: Add clock frequency for HJMC01 I2C controller
i2c: designware: Add a new ACPI HID for HJMC01 I2C controller

 drivers/acpi/acpi_apd.c                     | 6 ++++++
 drivers/i2c/busses/i2c-designware-platdrv.c | 1 +
 2 files changed, 7 insertions(+)
Signature · 1 line
2.43.5
author
#1 lore raw

PATCH v2 1/2 ACPI: APD: Add clock frequency for HJMC01 I2C controller

I2C clock frequency for HJMC01 is 200M, define a new ACPI HID for it.

---
 drivers/acpi/acpi_apd.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/acpi/acpi_apd.c +6 -0
index 800f97868448..229e80a19664 100644
@@ -181,6 +181,11 @@ static const struct apd_device_desc hip08_spi_desc = {
 	.setup = acpi_apd_setup,
 	.fixed_clk_rate = 250000000,
 };
+
+static const struct apd_device_desc hjmc_i2c_desc = {
+	.setup = acpi_apd_setup,
+	.fixed_clk_rate = 200000000,
+};
 #endif /* CONFIG_ARM64 */
 
 #endif
@@ -251,6 +256,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
 	{ "HISI02A2", APD_ADDR(hip08_i2c_desc) },
 	{ "HISI02A3", APD_ADDR(hip08_lite_i2c_desc) },
 	{ "HISI0173", APD_ADDR(hip08_spi_desc) },
+	{ "HJMC3001", APD_ADDR(hjmc_i2c_desc) },
 	{ "NXP0001", APD_ADDR(nxp_i2c_desc) },
 #endif
 	{ }
Signature · 1 line
2.43.5
maintainer
#2 lore raw

Re: [PATCH v2 1/2] ACPI: APD: Add clock frequency for HJMC01 I2C controller

Quoted 4 lines · hunter.yu

I2C clock frequency for HJMC01 is 200M, define a new ACPI HID for it.

Do you want your name to be hunter.yu or Hunter Yu? I prefer the second and if you browse the git log, you can see that everyone uses Name Surnmae.

Andi

#3 lore raw

Re: [PATCH v2 1/2] ACPI: APD: Add clock frequency for HJMC01 I2C controller

Quoted 10 lines · Andi Shyti
Quoted 4 lines · hunter.yu

I2C clock frequency for HJMC01 is 200M, define a new ACPI HID for it.

Do you want your name to be hunter.yu or Hunter Yu? I prefer the second and if you browse the git log, you can see that everyone uses Name Surname.

It must be a real name as per submitting-patches.rst

The S-o-b is meaningless otherwise.

#4 lore raw

Re: [PATCH v2 1/2] ACPI: APD: Add clock frequency for HJMC01 I2C controller

Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines · Andi Shyti
Quoted 3 lines · hunter.yu

I2C clock frequency for HJMC01 is 200M, define a new ACPI HID for it.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Do you want your name to be hunter.yu or Hunter Yu? I prefer the second and if you browse the git log, you can see that everyone uses Name Surname.

It must be a real name as per submitting-patches.rst

Hasn't this been relaxed last year by the d4563201f33a ("Documentation:
simplify and clarify DCO contribution example language")?

Quoted 1 line

The S-o-b is meaningless otherwise.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw

Re: [PATCH v2 1/2] ACPI: APD: Add clock frequency for HJMC01 I2C controller

Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Rafael J. Wysocki
Quoted 6 lines · Andi Shyti
Quoted 4 lines · hunter.yu

I2C clock frequency for HJMC01 is 200M, define a new ACPI HID for it.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Do you want your name to be hunter.yu or Hunter Yu? I prefer the second and if you browse the git log, you can see that everyone uses Name Surname.

It must be a real name as per submitting-patches.rst

Hasn't this been relaxed last year by the d4563201f33a ("Documentation:
simplify and clarify DCO contribution example language")?

Note, I do not imply that the existing variant in this patch is ideal, I also, as Andi, prefer the proper spellings on the "name" parts.

Quoted 1 line
Quoted 1 line

The S-o-b is meaningless otherwise.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw

Re: [PATCH v2 1/2] ACPI: APD: Add clock frequency for HJMC01 I2C controller

Quoted 14 lines · Andy Shevchenko
Quoted 12 lines · Andy Shevchenko
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Andi Shyti
Quoted 4 lines · hunter.yu

I2C clock frequency for HJMC01 is 200M, define a new ACPI HID for it.

Do you want your name to be hunter.yu or Hunter Yu? I prefer the second and if you browse the git log, you can see that everyone uses Name Surname.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

It must be a real name as per submitting-patches.rst

Hasn't this been relaxed last year by the d4563201f33a ("Documentation:
simplify and clarify DCO contribution example language")?

Note, I do not imply that the existing variant in this patch is ideal, I also, as Andi, prefer the proper spellings on the "name" parts.

Good.

Now, the way I understand the "known identity" part of the document is that a misspelled name is not sufficient.

author
#7 lore raw

Re: [PATCH v2 1/2] ACPI: APD: Add clock frequency for HJMC01 I2C controller

In reply to Rafael J. Wysocki
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Andi Shyti
Quoted 4 lines · hunter.yu

I2C clock frequency for HJMC01 is 200M, define a new ACPI HID for it.

Quoted 8 lines
Quoted 3 lines

Do you want your name to be hunter.yu or Hunter Yu? I prefer the second and if you browse the git log, you can see that everyone uses Name Surname.

It must be a real name as per submitting-patches.rst

The S-o-b is meaningless otherwise.

Thanks for your help and advice. In our team, everyone have an alias name, which is the same as email address. I feel sorry for not noticing kernel community's requirement for real name. My real name is Xiangyang Yu, I will use the following format to send v3 patch later.

author
#8 lore raw

PATCH v2 2/2 i2c: designware: Add a new ACPI HID for HJMC01 I2C controller

In reply to hunter.yu

Define a new ACPI HID for HJMC01

---
 drivers/i2c/busses/i2c-designware-platdrv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/i2c/busses/i2c-designware-platdrv.c +1 -0
index 2d0c7348e491..701506e92380 100644
@@ -354,6 +354,7 @@ static const struct acpi_device_id dw_i2c_acpi_match[] = {
 	{ "HISI02A1", 0 },
 	{ "HISI02A2", 0 },
 	{ "HISI02A3", 0 },
+	{ "HJMC3001", 0 },
 	{ "HYGO0010", ACCESS_INTR_MASK },
 	{ "INT33C2", 0 },
 	{ "INT33C3", 0 },
Signature · 1 line
2.43.5
Acked-by on v2 2/2
#9 lore raw

Re: [PATCH v2 2/2] i2c: designware: Add a new ACPI HID for HJMC01 I2C controller

Quoted 12 lines · hunter.yu

Define a new ACPI HID for HJMC01

---
  drivers/i2c/busses/i2c-designware-platdrv.c | 1 +
  1 file changed, 1 insertion(+)
drivers/i2c/busses/i2c-designware-platdrv.c +0 -0
index 2d0c7348e491..701506e92380 100644

drivers/i2c/busses/i2c-designware-platdrv.c static const struct acpi_device_id dw_i2c_acpi_match[] = { · line 360

Quoted 7 lines
drivers/i2c/busses/i2c-designware-platdrv.c +1 -0
@@ -354,6 +354,7 @@ static const struct acpi_device_id dw_i2c_acpi_match[] = {
  	{ "HISI02A1", 0 },
  	{ "HISI02A2", 0 },
  	{ "HISI02A3", 0 },
+	{ "HJMC3001", 0 },
  	{ "HYGO0010", ACCESS_INTR_MASK },
  	{ "INT33C2", 0 },
  	{ "INT33C3", 0 },
maintainer Applied
#11 lore raw
In reply to hunter.yu

Hi Hunter,

Quoted 3 lines

hunter.yu (2):
ACPI: APD: Add clock frequency for HJMC01 I2C controller
i2c: designware: Add a new ACPI HID for HJMC01 I2C controller

Applied to i2c/i2c-host and I took the freedom to change "hunter.yu" with "Hunter Yu".

Thanks,
Andi

maintainer
#12 lore raw

Hi,

Quoted 6 lines · Andi Shyti
Quoted 3 lines

hunter.yu (2):
ACPI: APD: Add clock frequency for HJMC01 I2C controller
i2c: designware: Add a new ACPI HID for HJMC01 I2C controller

Applied to i2c/i2c-host and I took the freedom to change "hunter.yu" with "Hunter Yu".

I'm sorry, I mistakenly included this patch in my branch and removed it from the pull request.

Apologies, Rafael, for stepping on your toes. Passing the ball to you now.

Andi

#13 lore raw

PATCH v3 1/1 ACPI: APD: Add clock frequency for HJMC01 I2C controller

From: Xiangyang Yu <[email protected]>

I2C clock frequency for HJMC01 is 200MHz, define a new ACPI HID for it.

---
 drivers/acpi/acpi_apd.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/acpi/acpi_apd.c +6 -0
index 008bd0552cb7..a193d8a6538e 100644
@@ -192,6 +192,11 @@ static const struct apd_device_desc leca_i2c_desc = {
 	.fixed_clk_rate = 250000000,
 };
 
+static const struct apd_device_desc hjmc_i2c_desc = {
+	.setup = acpi_apd_setup,
+	.fixed_clk_rate = 200000000,
+};
+
 #endif /* CONFIG_ARM64 */
 
 #endif
@@ -264,6 +269,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
 	{ "HISI0173", APD_ADDR(hip08_spi_desc) },
 	{ "LECA0002", APD_ADDR(leca_spi_desc) },
 	{ "LECA0003", APD_ADDR(leca_i2c_desc) },
+	{ "HJMC3001", APD_ADDR(hjmc_i2c_desc) },
 	{ "NXP0001", APD_ADDR(nxp_i2c_desc) },
 #endif
 	{ }

--
2.55.0

#14 lore raw

Re: [PATCH v3] ACPI: APD: Add clock frequency for HJMC01 I2C controller

Quoted 2 lines · clarke.li

I2C clock frequency for HJMC01 is 200MHz, define a new ACPI HID for it.

...

drivers/acpi/acpi_apd.c static const struct apd_device_desc leca_i2c_desc = { · line 197

Quoted 1 line
drivers/acpi/acpi_apd.c +1 -0
+	.fixed_clk_rate = 200000000,

Can you at some point update these constants to use

	.fixed_clk_rate = 200 * HZ_PER_MHZ,

and so on?

...

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

Quoted 5 lines
drivers/acpi/acpi_apd.c +1 -0
 	{ "HISI0173", APD_ADDR(hip08_spi_desc) },
 	{ "LECA0002", APD_ADDR(leca_spi_desc) },
 	{ "LECA0003", APD_ADDR(leca_i2c_desc) },
+	{ "HJMC3001", APD_ADDR(hjmc_i2c_desc) },
 	{ "NXP0001", APD_ADDR(nxp_i2c_desc) },

Keep it sorted.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#15 lore raw

Re: [PATCH v3] ACPI: APD: Add clock frequency for HJMC01 I2C controller

Quoted 7 lines · Andy Shevchenko
Quoted 2 lines · clarke.li

I2C clock frequency for HJMC01 is 200MHz, define a new ACPI HID for it.

...

Quoted 7 lines

drivers/acpi/acpi_apd.c static const struct apd_device_desc leca_i2c_desc = { · line 197

Quoted 1 line
drivers/acpi/acpi_apd.c +1 -0
+	.fixed_clk_rate = 200000000,

Can you at some point update these constants to use

	.fixed_clk_rate = 200 * HZ_PER_MHZ,

and so on?

Thanks for the suggestion, I will use 200 * HZ_PER_MHZ in the next version.

By the way, do you also want me to convert the other fixed_clk_rate constants in acpi_apd.c to use HZ_PER_MHZ? If so, I can send it as a separate cleanup patch.

Quoted 9 lines

...

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

Quoted 5 lines
drivers/acpi/acpi_apd.c +1 -0
 	{ "HISI0173", APD_ADDR(hip08_spi_desc) },
 	{ "LECA0002", APD_ADDR(leca_spi_desc) },
 	{ "LECA0003", APD_ADDR(leca_i2c_desc) },
+	{ "HJMC3001", APD_ADDR(hjmc_i2c_desc) },
 	{ "NXP0001", APD_ADDR(nxp_i2c_desc) },

Keep it sorted.

You are right, HJMC3001 should be placed before LECA0002 alphabetically. I will fix the order in the next version.

--
Thanks,
Hongnan Li

#16 lore raw

Re: [PATCH v3] ACPI: APD: Add clock frequency for HJMC01 I2C controller

Quoted 2 lines · clarke.li
Quoted 1 line · Andy Shevchenko

On Wed, Jul 22, 2026 at 03:30:31PM +0800, clarke.li wrote:

...

Quoted 6 lines
Quoted 6 lines

drivers/acpi/acpi_apd.c static const struct apd_device_desc leca_i2c_desc = { · line 197

Quoted 1 line
drivers/acpi/acpi_apd.c +1 -0
+	.fixed_clk_rate = 200000000,

Can you at some point update these constants to use

	.fixed_clk_rate = 200 * HZ_PER_MHZ,
Quoted 8 lines
Quoted 1 line

and so on?

Thanks for the suggestion, I will use 200 * HZ_PER_MHZ in the next version.

By the way, do you also want me to convert the other fixed_clk_rate constants in acpi_apd.c to use HZ_PER_MHZ? If so, I can send it as a separate cleanup patch.

The idea is that you convert existing ones in a separate patch and then use a new format for the new hw support.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#17 lore raw

Re: [PATCH v3] ACPI: APD: Add clock frequency for HJMC01 I2C controller

Quoted 17 lines · Andy Shevchenko
Quoted 2 lines · clarke.li
Quoted 1 line · Andy Shevchenko

On Wed, Jul 22, 2026 at 03:30:31PM +0800, clarke.li wrote:

...

Quoted 11 lines
Quoted 7 lines

drivers/acpi/acpi_apd.c static const struct apd_device_desc leca_i2c_desc = { · line 197

Quoted 1 line
drivers/acpi/acpi_apd.c +1 -0
+	.fixed_clk_rate = 200000000,

Can you at some point update these constants to use

	.fixed_clk_rate = 200 * HZ_PER_MHZ,

and so on?

Thanks for the suggestion, I will use 200 * HZ_PER_MHZ in the next version.

Quoted 6 lines
Quoted 3 lines

By the way, do you also want me to convert the other fixed_clk_rate constants in acpi_apd.c to use HZ_PER_MHZ? If so, I can send it as a separate cleanup patch.

The idea is that you convert existing ones in a separate patch and then use a new format for the new hw support.

Understood. I will send the next revision as a two-patch series:

[PATCH v4 1/2] ACPI: APD: Convert fixed clock rates to HZ_PER_MHZ [PATCH v4 2/2] ACPI: APD: Add clock frequency for HJMC01 I2C controller

The first patch converts the existing fixed_clk_rate constants in acpi_apd.c to use HZ_PER_MHZ, and the second one adds the HJMC01 support using the new format (200 * HZ_PER_MHZ).

--
Thanks,
Hongnan Li

#18 lore raw

PATCH v4 1/2 ACPI: APD: Convert fixed clock rates to use HZ_PER_MHZ

In reply to clarke.li

From: Hongnan Li <[email protected]>

Use HZ_PER_MHZ multiplier for fixed_clk_rate values to improve readability.

---
 drivers/acpi/acpi_apd.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/acpi/acpi_apd.c +15 -14
index 008bd0552cb7..275027ebd01f 100644
@@ -14,6 +14,7 @@
 #include <linux/io.h>
 #include <linux/platform_data/clk-fch.h>
 #include <linux/platform_device.h>
+#include <linux/units.h>
 
 #include "internal.h"
 
@@ -110,17 +111,17 @@ static int fch_misc_setup(struct apd_private_data *pdata)
 
 static const struct apd_device_desc cz_i2c_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 133000000,
+	.fixed_clk_rate = 133 * HZ_PER_MHZ,
 };
 
 static const struct apd_device_desc wt_i2c_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 150000000,
+	.fixed_clk_rate = 150 * HZ_PER_MHZ,
 };
 
 static const struct apd_device_desc wt_i3c_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 125000000,
+	.fixed_clk_rate = 125 * HZ_PER_MHZ,
 };
 
 static struct property_entry uart_properties[] = {
@@ -132,7 +133,7 @@ static struct property_entry uart_properties[] = {
 
 static const struct apd_device_desc cz_uart_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 48000000,
+	.fixed_clk_rate = 48 * HZ_PER_MHZ,
 	.properties = uart_properties,
 };
 
@@ -144,52 +145,52 @@ static const struct apd_device_desc fch_misc_desc = {
 #ifdef CONFIG_ARM64
 static const struct apd_device_desc xgene_i2c_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 100000000,
+	.fixed_clk_rate = 100 * HZ_PER_MHZ,
 };
 
 static const struct apd_device_desc vulcan_spi_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 133000000,
+	.fixed_clk_rate = 133 * HZ_PER_MHZ,
 };
 
 static const struct apd_device_desc hip07_i2c_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 200000000,
+	.fixed_clk_rate = 200 * HZ_PER_MHZ,
 };
 
 static const struct apd_device_desc hip08_i2c_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 250000000,
+	.fixed_clk_rate = 250 * HZ_PER_MHZ,
 };
 
 static const struct apd_device_desc hip08_lite_i2c_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 125000000,
+	.fixed_clk_rate = 125 * HZ_PER_MHZ,
 };
 
 static const struct apd_device_desc thunderx2_i2c_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 125000000,
+	.fixed_clk_rate = 125 * HZ_PER_MHZ,
 };
 
 static const struct apd_device_desc nxp_i2c_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 350000000,
+	.fixed_clk_rate = 350 * HZ_PER_MHZ,
 };
 
 static const struct apd_device_desc hip08_spi_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 250000000,
+	.fixed_clk_rate = 250 * HZ_PER_MHZ,
 };
 
 static const struct apd_device_desc leca_spi_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 400000000,
+	.fixed_clk_rate = 400 * HZ_PER_MHZ,
 };
 
 static const struct apd_device_desc leca_i2c_desc = {
 	.setup = acpi_apd_setup,
-	.fixed_clk_rate = 250000000,
+	.fixed_clk_rate = 250 * HZ_PER_MHZ,
 };
 
 #endif /* CONFIG_ARM64 */
Signature · 1 line
2.55.0
reviewer Reviewed-by on v4 1/2
#19 lore raw

Re: [PATCH v4 1/2] ACPI: APD: Convert fixed clock rates to use HZ_PER_MHZ

Quoted 2 lines · clarke.li

Use HZ_PER_MHZ multiplier for fixed_clk_rate values to improve readability.

And actually increases robustness of the code as there is less chances to miss a 0 or have an extra one.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#20 lore raw

Re: [PATCH v4 1/2] ACPI: APD: Convert fixed clock rates to use HZ_PER_MHZ

Quoted 11 lines · Andy Shevchenko
Quoted 2 lines · clarke.li

Use HZ_PER_MHZ multiplier for fixed_clk_rate values to improve readability.

And actually increases robustness of the code as there is less chances to miss a 0 or have an extra one.

Applied along with the [2/2] as 7.3 material, thanks!

#21 lore raw

PATCH v4 2/2 ACPI: APD: Add clock frequency for HJMC01 I2C controller

In reply to clarke.li

From: Xiangyang Yu <[email protected]>

I2C clock frequency for HJMC01 is 200MHz, define a new ACPI HID for it.

---
 drivers/acpi/acpi_apd.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/acpi/acpi_apd.c +6 -0
index 275027ebd01f..e7366fcb76ee 100644
@@ -193,6 +193,11 @@ static const struct apd_device_desc leca_i2c_desc = {
 	.fixed_clk_rate = 250 * HZ_PER_MHZ,
 };
 
+static const struct apd_device_desc hjmc_i2c_desc = {
+	.setup = acpi_apd_setup,
+	.fixed_clk_rate = 200 * HZ_PER_MHZ,
+};
+
 #endif /* CONFIG_ARM64 */
 
 #endif
@@ -263,6 +268,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
 	{ "HISI02A2", APD_ADDR(hip08_i2c_desc) },
 	{ "HISI02A3", APD_ADDR(hip08_lite_i2c_desc) },
 	{ "HISI0173", APD_ADDR(hip08_spi_desc) },
+	{ "HJMC3001", APD_ADDR(hjmc_i2c_desc) },
 	{ "LECA0002", APD_ADDR(leca_spi_desc) },
 	{ "LECA0003", APD_ADDR(leca_i2c_desc) },
 	{ "NXP0001", APD_ADDR(nxp_i2c_desc) },
Signature · 1 line
2.55.0
reviewer Reviewed-by on v4 2/2
#22 lore raw

Re: [PATCH v4 2/2] ACPI: APD: Add clock frequency for HJMC01 I2C controller

Quoted 2 lines · clarke.li

I2C clock frequency for HJMC01 is 200MHz, define a new ACPI HID for it.

LGTM now,

...

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

Quoted 1 line
drivers/acpi/acpi_apd.c +1 -0
+	{ "HJMC3001", APD_ADDR(hjmc_i2c_desc) },

Vendor is in the official registry and ID is real, thanks for that!

Signature · 2 lines
With Best Regards,
Andy Shevchenko