Skip to contentSkip to conversation

Add UCSI I2C transport driver for ITE885x USB-C controllers

PATCH Superseded Edward Blair 2 participants 6 messages Aug 25 – Aug 29 1 message not in the archive

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add UCSI I2C transport driver for ITE885x USB-C controllers

Some ASUS desktop boards describe the same ITE USB-C controller twice in ACPI: as an MSFT8000 Resource Hub Proxy and as an ITE885x device at the same I2C address. If the RhProxy node claims the address first, the ITE device cannot be registered. Only the ITE node provides the interrupt required by this transport.

Patch 1 marks the RhProxy node absent only when its I2C resource exactly matches a supported ITE node which also has an interrupt.

Patch 2 adds the ITE885x UCSI transport. These controllers use ITE-specific offsets for CCI, MESSAGE_IN, CONTROL and interrupt handling. They do not expose a VERSION register or accept PPM_RESET over I2C.

The register layout and reset behaviour were checked against the ITE Windows driver supplied for this board.

Tested on an ASUS ROG Strix Z790-E Gaming WiFi with ITE8853:

- Built and booted on x86_64.
- ucsi_ite bound to ITE8853:00 without the previous -EBUSY failure.
- /sys/class/typec/port0 was registered.
- USB-C attachment detection worked.
- No UCSI, ITE or Type-C initialization errors were logged.

Suspend/resume and the ITE8800 through ITE8805 IDs have not been tested.

Changes since v1:

- Move the duplicate-device quirk from the I2C core to the ACPI x86 status-override code, as suggested by Mika and Heikki.
- Correctly identify MSFT8000 as a Resource Hub Proxy.
- Restrict the quirk to exact matching I2C resources.
- Use devm_request_threaded_irq(), as suggested by Heikki.
- Rebase onto Linux 7.2 and update for the current UCSI API.
- Read and cache complete UCSI events before acknowledging them.
- Match the vendor transport's MESSAGE_IN and PPM_RESET behaviour.

Edward Blair (2):
ACPI: x86: hide duplicate RhProxy node for ITE UCSI controllers
usb: typec: ucsi: add ITE885x I2C transport driver

 drivers/acpi/x86/utils.c          | 151 ++++++++++++
 drivers/usb/typec/ucsi/Kconfig    |  11 +
 drivers/usb/typec/ucsi/Makefile   |   1 +
 drivers/usb/typec/ucsi/ucsi_ite.c | 395 ++++++++++++++++++++++++++++++
 4 files changed, 558 insertions(+)
 create mode 100644 drivers/usb/typec/ucsi/ucsi_ite.c

base-commit: 66498c75b4f8017f62d720d9b59675bdf3abce91

Signature · 1 line
2.55.0
#1 lore raw

PATCH v2 1/2 ACPI: x86: hide duplicate RhProxy node for ITE UCSI controllers

Some desktop firmware describes the same ITE UCSI controller both as an MSFT8000 Resource Hub Proxy device and as an ITE885x device. Both nodes point to the same I2C address, so whichever is enumerated first prevents the other from registering. Only the ITE node provides the interrupt needed by the UCSI transport.

Override the RhProxy node status only when it contains exactly one I2C resource, contains no other resources, and a present ITE UCSI node has exactly one I2C resource, a usable interrupt, and matching controller, address, speed, slave mode, connection sharing and address mode. Keeping this in the ACPI status quirk layer handles initial enumeration and reconfiguration without affecting unrelated MSFT8000 devices.

---
 drivers/acpi/x86/utils.c | 151 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 151 insertions(+)
drivers/acpi/x86/utils.c +151 -0
index 418951639..8601b9713 100644
@@ -67,6 +67,144 @@ struct override_status_id {
 #define NOT_PRESENT_ENTRY_PATH(path, cpu_vfm, dmi...) \
 	ENTRY(0, "", NULL, path, cpu_vfm, dmi)
 
+struct acpi_i2c_resource_info {
+	acpi_handle device;
+	acpi_handle controller;
+	u32 connection_speed;
+	unsigned int i2c_resources;
+	unsigned int other_resources;
+	u16 address;
+	u8 slave_mode;
+	u8 connection_sharing;
+	u8 access_mode;
+	bool has_interrupt;
+	bool found;
+};
+
+static acpi_status acpi_get_i2c_resource(struct acpi_resource *ares,
+					 void *context)
+{
+	struct acpi_i2c_resource_info *info = context;
+	struct acpi_resource_i2c_serialbus *sb;
+
+	if (ares->type == ACPI_RESOURCE_TYPE_END_TAG)
+		return AE_OK;
+
+	if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) {
+		if ((ares->type == ACPI_RESOURCE_TYPE_IRQ &&
+		     ares->data.irq.interrupt_count) ||
+		    (ares->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ &&
+		     ares->data.extended_irq.interrupt_count) ||
+		    (ares->type == ACPI_RESOURCE_TYPE_GPIO &&
+		     ares->data.gpio.connection_type == ACPI_RESOURCE_GPIO_TYPE_INT &&
+		     ares->data.gpio.pin_table_length))
+			info->has_interrupt = true;
+		info->other_resources++;
+		return AE_OK;
+	}
+
+	sb = &ares->data.i2c_serial_bus;
+	if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_I2C) {
+		info->other_resources++;
+		return AE_OK;
+	}
+
+	info->i2c_resources++;
+	if (info->found)
+		return AE_OK;
+
+	if (ACPI_FAILURE(acpi_get_handle(info->device,
+					 sb->resource_source.string_ptr,
+					 &info->controller)))
+		return AE_OK;
+
+	info->address = sb->slave_address;
+	info->connection_speed = sb->connection_speed;
+	info->slave_mode = sb->slave_mode;
+	info->connection_sharing = sb->connection_sharing;
+	info->access_mode = sb->access_mode;
+	info->found = true;
+
+	return AE_OK;
+}
+
+static bool acpi_get_i2c_resource_info(acpi_handle handle,
+				       struct acpi_i2c_resource_info *info)
+{
+	acpi_status status;
+
+	memset(info, 0, sizeof(*info));
+	info->device = handle;
+	status = acpi_walk_resources(handle, METHOD_NAME__CRS,
+				     acpi_get_i2c_resource, info);
+
+	return ACPI_SUCCESS(status) && info->found;
+}
+
+struct acpi_ite_ucsi_duplicate_context {
+	const struct acpi_i2c_resource_info *rhproxy;
+	bool found;
+};
+
+static acpi_status acpi_match_ite_ucsi_duplicate(acpi_handle handle,
+						 u32 level, void *context,
+						 void **return_value)
+{
+	struct acpi_ite_ucsi_duplicate_context *match = context;
+	struct acpi_i2c_resource_info info;
+
+	if (!acpi_get_i2c_resource_info(handle, &info))
+		return AE_OK;
+	if (info.i2c_resources != 1 || !info.has_interrupt)
+		return AE_OK;
+
+	if (info.controller != match->rhproxy->controller ||
+	    info.address != match->rhproxy->address ||
+	    info.connection_speed != match->rhproxy->connection_speed ||
+	    info.slave_mode != match->rhproxy->slave_mode ||
+	    info.connection_sharing != match->rhproxy->connection_sharing ||
+	    info.access_mode != match->rhproxy->access_mode)
+		return AE_OK;
+
+	match->found = true;
+	return AE_CTRL_TERMINATE;
+}
+
+static bool acpi_has_ite_ucsi_duplicate(struct acpi_device *adev)
+{
+	static const char * const ite_ucsi_ids[] = {
+		"ITE8853",
+		"ITE8800",
+		"ITE8801",
+		"ITE8802",
+		"ITE8803",
+		"ITE8804",
+		"ITE8805",
+	};
+	struct acpi_ite_ucsi_duplicate_context match;
+	struct acpi_i2c_resource_info rhproxy;
+	unsigned int i;
+
+	if (!acpi_get_i2c_resource_info(adev->handle, &rhproxy))
+		return false;
+	if (rhproxy.i2c_resources != 1 || rhproxy.other_resources)
+		return false;
+
+	match.rhproxy = &rhproxy;
+	match.found = false;
+
+	for (i = 0; i < ARRAY_SIZE(ite_ucsi_ids) && !match.found; i++)
+		acpi_get_devices(ite_ucsi_ids[i], acpi_match_ite_ucsi_duplicate,
+				 &match, NULL);
+
+	return match.found;
+}
+
+static const struct acpi_device_id acpi_rhproxy_ids[] = {
+	{ "MSFT8000" },
+	{ }
+};
+
 static const struct override_status_id override_status_ids[] = {
 	/*
 	 * Bay / Cherry Trail PWM directly poked by GPU driver in win10,
@@ -182,6 +320,19 @@ bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *s
 	bool ret = false;
 	unsigned int i;
 
+	/*
+	 * Some firmware describes an ITE UCSI controller twice: once through
+	 * the Windows Resource Hub Proxy and once as a vendor-specific device.
+	 * Both nodes point at the same I2C address, but only the ITE node has
+	 * the interrupt resource required by the Linux driver. Hide only an
+	 * exact duplicate so unrelated Resource Hub Proxy devices keep working.
+	 */
+	if (!acpi_match_device_ids(adev, acpi_rhproxy_ids) &&
+	    acpi_has_ite_ucsi_duplicate(adev)) {
+		*status = 0;
+		return true;
+	}
+
 	for (i = 0; i < ARRAY_SIZE(override_status_ids); i++) {
 		if (!x86_match_cpu(override_status_ids[i].cpu_ids))
 			continue;
Signature · 1 line
2.55.0
#2 lore raw

PATCH v2 2/2 usb: typec: ucsi: add ITE885x I2C transport driver

In reply to Edward Blair

Add a UCSI transport driver for ITE8853 and ITE8800 through ITE8805 USB Type-C controllers found on desktop motherboards.

These controllers expose CCI, MESSAGE_IN and CONTROL at ITE-specific I2C offsets and signal UCSI and vendor events through a shared interrupt status register. Read and cache each complete UCSI event before acknowledging it so command data remains coherent between the interrupt handler and UCSI core.

The interface does not expose a VERSION register and does not accept PPM_RESET over I2C. Report UCSI 1.0, limit MESSAGE_IN to its 16-byte window and handle PPM_RESET locally, matching the vendor driver's behavior.

---
 drivers/usb/typec/ucsi/Kconfig    |  11 +
 drivers/usb/typec/ucsi/Makefile   |   1 +
 drivers/usb/typec/ucsi/ucsi_ite.c | 395 ++++++++++++++++++++++++++++++
 3 files changed, 407 insertions(+)
 create mode 100644 drivers/usb/typec/ucsi/ucsi_ite.c
drivers/usb/typec/ucsi/Kconfig +11 -0
index 87dd992a4..3819c4f73 100644
@@ -104,4 +104,15 @@ config UCSI_HUAWEI_GAOKUN
 	  To compile the driver as a module, choose M here: the module will be
 	  called ucsi_huawei_gaokun.
 
+config UCSI_ITE
+	tristate "UCSI Interface Driver for ITE885x"
+	depends on ACPI && I2C
+	help
+	  This driver enables UCSI support on platforms that expose an ITE8853
+	  or ITE8800-ITE8805 USB Type-C controller over I2C, commonly found
+	  on ASUS Z690/Z790/X670E motherboards.
+
+	  To compile the driver as a module, choose M here: the module will be
+	  called ucsi_ite.
+
 endif
drivers/usb/typec/ucsi/Makefile +1 -0
index c7e38bf01..9bc1d6bbb 100644
@@ -28,3 +28,4 @@ obj-$(CONFIG_UCSI_PMIC_GLINK)		+= ucsi_glink.o
 obj-$(CONFIG_CROS_EC_UCSI)		+= cros_ec_ucsi.o
 obj-$(CONFIG_UCSI_LENOVO_YOGA_C630)	+= ucsi_yoga_c630.o
 obj-$(CONFIG_UCSI_HUAWEI_GAOKUN)	+= ucsi_huawei_gaokun.o
+obj-$(CONFIG_UCSI_ITE)			+= ucsi_ite.o
drivers/usb/typec/ucsi/ucsi_ite.c new file +395 -0

395 lines not on this page · raw message

Signature · 1 line
2.55.0
#3 lore raw
In reply to Edward Blair

Am 25.08.26 um 22:14 schrieb Edward Blair:

Quoted 8 lines

Some ASUS desktop boards describe the same ITE USB-C controller twice in ACPI: as an MSFT8000 Resource Hub Proxy and as an ITE885x device at the same I2C address. If the RhProxy node claims the address first, the ITE device cannot be registered. Only the ITE node provides the interrupt required by this transport.

Patch 1 marks the RhProxy node absent only when its I2C resource exactly matches a supported ITE node which also has an interrupt.

AFAIK the MSFT8000 device is used to grant userspace applications under Windows access to I2C, SPI, UART and GPIO resources. Since we already provide those functions natively i suggest that we generally ignore MSFT8000 devices when checking for resource conflicts.

Thanks,
Armin Wolf

Quoted 44 lines

Patch 2 adds the ITE885x UCSI transport. These controllers use ITE-specific offsets for CCI, MESSAGE_IN, CONTROL and interrupt handling. They do not expose a VERSION register or accept PPM_RESET over I2C.

The register layout and reset behaviour were checked against the ITE Windows driver supplied for this board.

Tested on an ASUS ROG Strix Z790-E Gaming WiFi with ITE8853:

- Built and booted on x86_64.
- ucsi_ite bound to ITE8853:00 without the previous -EBUSY failure.
- /sys/class/typec/port0 was registered.
- USB-C attachment detection worked.
- No UCSI, ITE or Type-C initialization errors were logged.

Suspend/resume and the ITE8800 through ITE8805 IDs have not been tested.

Changes since v1:

- Move the duplicate-device quirk from the I2C core to the ACPI x86 status-override code, as suggested by Mika and Heikki.
- Correctly identify MSFT8000 as a Resource Hub Proxy.
- Restrict the quirk to exact matching I2C resources.
- Use devm_request_threaded_irq(), as suggested by Heikki.
- Rebase onto Linux 7.2 and update for the current UCSI API.
- Read and cache complete UCSI events before acknowledging them.
- Match the vendor transport's MESSAGE_IN and PPM_RESET behaviour.

Edward Blair (2):
ACPI: x86: hide duplicate RhProxy node for ITE UCSI controllers
usb: typec: ucsi: add ITE885x I2C transport driver

  drivers/acpi/x86/utils.c          | 151 ++++++++++++
  drivers/usb/typec/ucsi/Kconfig    |  11 +
  drivers/usb/typec/ucsi/Makefile   |   1 +
  drivers/usb/typec/ucsi/ucsi_ite.c | 395 ++++++++++++++++++++++++++++++
  4 files changed, 558 insertions(+)

create mode 100644 drivers/usb/typec/ucsi/ucsi_ite.c

base-commit: 66498c75b4f8017f62d720d9b59675bdf3abce91

#5 lore raw
In reply to a message not in the archive

Let's try that again.. without gmail's html...

Thanks, that makes sense. I can rework patch 1 to add MSFT8000 to ignore_serial_bus_ids[] in acpi_device_enumeration_by_parent(). This keeps the ACPI device present while preventing its SerialBus resources from being instantiated as bus clients.

If that sounds reasonable, it seems like a good middle ground between v1 and v2: it preserves v1's enumeration behaviour while handling the device generically in the ACPI core, without the ITE-specific x86 status override added in v2.

Thanks,
Edward

Quoted 73 lines · Edward Blair

Thanks, that makes sense. I can rework patch 1 to add MSFT8000 to ignore_serial_bus_ids[] in acpi_device_enumeration_by_parent(). This keeps the ACPI device present while preventing its SerialBus resources from being instantiated as bus clients.

If that sounds reasonable, it seems like a good middle ground between v1 and v2: it preserves v1's enumeration behaviour while handling the device generically in the ACPI core, without the ITE-specific x86 status override added in v2.

Thanks,
Edward

Quoted 64 lines · Armin Wolf

Am 25.08.26 um 22:14 schrieb Edward Blair:

Quoted 8 lines

Some ASUS desktop boards describe the same ITE USB-C controller twice in ACPI: as an MSFT8000 Resource Hub Proxy and as an ITE885x device at the same I2C address. If the RhProxy node claims the address first, the ITE device cannot be registered. Only the ITE node provides the interrupt required by this transport.

Patch 1 marks the RhProxy node absent only when its I2C resource exactly matches a supported ITE node which also has an interrupt.

AFAIK the MSFT8000 device is used to grant userspace applications under Windows access to I2C, SPI, UART and GPIO resources. Since we already provide those functions natively i suggest that we generally ignore MSFT8000 devices when checking for resource conflicts.

Thanks,
Armin Wolf

Quoted 44 lines

Patch 2 adds the ITE885x UCSI transport. These controllers use ITE-specific offsets for CCI, MESSAGE_IN, CONTROL and interrupt handling. They do not expose a VERSION register or accept PPM_RESET over I2C.

The register layout and reset behaviour were checked against the ITE Windows driver supplied for this board.

Tested on an ASUS ROG Strix Z790-E Gaming WiFi with ITE8853:

- Built and booted on x86_64.
- ucsi_ite bound to ITE8853:00 without the previous -EBUSY failure.
- /sys/class/typec/port0 was registered.
- USB-C attachment detection worked.
- No UCSI, ITE or Type-C initialization errors were logged.

Suspend/resume and the ITE8800 through ITE8805 IDs have not been tested.

Changes since v1:

- Move the duplicate-device quirk from the I2C core to the ACPI x86 status-override code, as suggested by Mika and Heikki.
- Correctly identify MSFT8000 as a Resource Hub Proxy.
- Restrict the quirk to exact matching I2C resources.
- Use devm_request_threaded_irq(), as suggested by Heikki.
- Rebase onto Linux 7.2 and update for the current UCSI API.
- Read and cache complete UCSI events before acknowledging them.
- Match the vendor transport's MESSAGE_IN and PPM_RESET behaviour.

Edward Blair (2):
ACPI: x86: hide duplicate RhProxy node for ITE UCSI controllers
usb: typec: ucsi: add ITE885x I2C transport driver

  drivers/acpi/x86/utils.c          | 151 ++++++++++++
  drivers/usb/typec/ucsi/Kconfig    |  11 +
  drivers/usb/typec/ucsi/Makefile   |   1 +
  drivers/usb/typec/ucsi/ucsi_ite.c | 395 ++++++++++++++++++++++++++++++
  4 files changed, 558 insertions(+)

create mode 100644 drivers/usb/typec/ucsi/ucsi_ite.c

base-commit: 66498c75b4f8017f62d720d9b59675bdf3abce91

#6 lore raw

Am 28.08.26 um 03:04 schrieb Edward Blair:

Quoted 7 lines

Let's try that again.. without gmail's html...

Thanks, that makes sense. I can rework patch 1 to add MSFT8000 to ignore_serial_bus_ids[] in acpi_device_enumeration_by_parent(). This keeps the ACPI device present while preventing its SerialBus resources from being instantiated as bus clients.

Quoted 7 lines

If that sounds reasonable, it seems like a good middle ground between v1 and v2: it preserves v1's enumeration behaviour while handling the device generically in the ACPI core, without the ITE-specific x86 status override added in v2.

Thanks,
Edward

Sound reasonable to me, just add a small comment explaining why MSFT8000 had to be added to that list.

Thanks,
Armin Wolf

Quoted 72 lines · Edward Blair
Quoted 70 lines

Thanks, that makes sense. I can rework patch 1 to add MSFT8000 to ignore_serial_bus_ids[] in acpi_device_enumeration_by_parent(). This keeps the ACPI device present while preventing its SerialBus resources from being instantiated as bus clients.

If that sounds reasonable, it seems like a good middle ground between v1 and v2: it preserves v1's enumeration behaviour while handling the device generically in the ACPI core, without the ITE-specific x86 status override added in v2.

Thanks,
Edward

Quoted 62 lines · Armin Wolf

Am 25.08.26 um 22:14 schrieb Edward Blair:

Quoted 8 lines

Some ASUS desktop boards describe the same ITE USB-C controller twice in ACPI: as an MSFT8000 Resource Hub Proxy and as an ITE885x device at the same I2C address. If the RhProxy node claims the address first, the ITE device cannot be registered. Only the ITE node provides the interrupt required by this transport.

Patch 1 marks the RhProxy node absent only when its I2C resource exactly matches a supported ITE node which also has an interrupt.

AFAIK the MSFT8000 device is used to grant userspace applications under Windows access to I2C, SPI, UART and GPIO resources. Since we already provide those functions natively i suggest that we generally ignore MSFT8000 devices when checking for resource conflicts.

Thanks,
Armin Wolf

Quoted 44 lines

Patch 2 adds the ITE885x UCSI transport. These controllers use ITE-specific offsets for CCI, MESSAGE_IN, CONTROL and interrupt handling. They do not expose a VERSION register or accept PPM_RESET over I2C.

The register layout and reset behaviour were checked against the ITE Windows driver supplied for this board.

Tested on an ASUS ROG Strix Z790-E Gaming WiFi with ITE8853:

- Built and booted on x86_64.
- ucsi_ite bound to ITE8853:00 without the previous -EBUSY failure.
- /sys/class/typec/port0 was registered.
- USB-C attachment detection worked.
- No UCSI, ITE or Type-C initialization errors were logged.

Suspend/resume and the ITE8800 through ITE8805 IDs have not been tested.

Changes since v1:

- Move the duplicate-device quirk from the I2C core to the ACPI x86 status-override code, as suggested by Mika and Heikki.
- Correctly identify MSFT8000 as a Resource Hub Proxy.
- Restrict the quirk to exact matching I2C resources.
- Use devm_request_threaded_irq(), as suggested by Heikki.
- Rebase onto Linux 7.2 and update for the current UCSI API.
- Read and cache complete UCSI events before acknowledging them.
- Match the vendor transport's MESSAGE_IN and PPM_RESET behaviour.

Edward Blair (2):
ACPI: x86: hide duplicate RhProxy node for ITE UCSI controllers
usb: typec: ucsi: add ITE885x I2C transport driver

   drivers/acpi/x86/utils.c          | 151 ++++++++++++
   drivers/usb/typec/ucsi/Kconfig    |  11 +
   drivers/usb/typec/ucsi/Makefile   |   1 +
   drivers/usb/typec/ucsi/ucsi_ite.c | 395 ++++++++++++++++++++++++++++++
   4 files changed, 558 insertions(+)

create mode 100644 drivers/usb/typec/ucsi/ucsi_ite.c

base-commit: 66498c75b4f8017f62d720d9b59675bdf3abce91