Skip to contentSkip to conversation

USB Type-C fixes for usb-next

PATCH In review Heikki Krogerus 2 participants 6 messages Sep 16, 2020 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Heikki Krogerus

author maintainer
#0 lore raw

v2 cover USB Type-C fixes for usb-next

Hi,

So these Intel PMC mux driver fixes out of my original series [1] are all for your usb-next.

[1] https://lore.kernel.org/linux-usb/[email protected]/

Azhar Shaikh (1):
usb: typec: intel_pmc_mux: Pass correct USB Type-C port number to SoC

Heikki Krogerus (1):
usb: typec: intel_pmc_mux: Add dependency on ACPI

Madhusudanarao Amara (1):
usb: typec: intel_pmc_mux: Handle SCU IPC error conditions

 drivers/usb/typec/mux/Kconfig         |  1 +
 drivers/usb/typec/mux/intel_pmc_mux.c | 19 +++++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
Signature · 1 line
2.28.0
author maintainer
#1 lore raw

PATCH v2 1/3 usb: typec: intel_pmc_mux: Add dependency on ACPI

Since the driver now needs to find the IOM ACPI node, the driver depends on ACPI. Without the dependency set, the driver will only fail to compile when ACPI is not enabled.

Fixes 43d596e32276 ("usb: typec: intel_pmc_mux: Check the port status before connect")
---
 drivers/usb/typec/mux/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/typec/mux/Kconfig +1 -0
index a4dbd11f8ee26..edead555835e2 100644
@@ -11,6 +11,7 @@ config TYPEC_MUX_PI3USB30532
 
 config TYPEC_MUX_INTEL_PMC
 	tristate "Intel PMC mux control"
+	depends on ACPI
 	depends on INTEL_SCU_IPC
 	select USB_ROLE_SWITCH
 	help
Signature · 1 line
2.28.0
author maintainer
#2 lore raw

PATCH v2 2/3 usb: typec: intel_pmc_mux: Pass correct USB Type-C port number to SoC

In reply to Heikki Krogerus

From: Azhar Shaikh <[email protected]>

The SoC expects the USB Type-C ports numbers to be starting with 0. If the port number is passed as it is, the IOM status will not be updated. The IOM port status check fails which will eventually lead to PMC IPC communication failure.

Fixes 43d596e32276 ("usb: typec: intel_pmc_mux: Check the port status before connect")
---
 drivers/usb/typec/mux/intel_pmc_mux.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/typec/mux/intel_pmc_mux.c +6 -1
index 307830b374ec7..109c1a796e844 100644
@@ -148,8 +148,13 @@ struct pmc_usb {
 
 static void update_port_status(struct pmc_usb_port *port)
 {
+	u8 port_num;
+
+	/* SoC expects the USB Type-C port numbers to start with 0 */
+	port_num = port->usb3_port - 1;
+
 	port->iom_status = readl(port->pmc->iom_base + IOM_PORT_STATUS_OFFSET +
-				 port->usb3_port * sizeof(u32));
+				 port_num * sizeof(u32));
 }
 
 static int sbu_orientation(struct pmc_usb_port *port)
Signature · 1 line
2.28.0
author maintainer
#3 lore raw

PATCH v2 3/3 usb: typec: intel_pmc_mux: Handle SCU IPC error conditions

In reply to Heikki Krogerus

From: Madhusudanarao Amara <[email protected]>

Check and return if there are errors. The response bits are valid only on no errors.

Fixes b7404a29cd3d ("usb: typec: intel_pmc_mux: Definitions for response status bits")
---
 drivers/usb/typec/mux/intel_pmc_mux.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/usb/typec/mux/intel_pmc_mux.c +9 -3
index 109c1a796e844..d7f63b74c6b14 100644
@@ -176,13 +176,19 @@ static int hsl_orientation(struct pmc_usb_port *port)
 static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
 {
 	u8 response[4];
+	int ret;
 
 	/*
 	 * Error bit will always be 0 with the USBC command.
-	 * Status can be checked from the response message.
+	 * Status can be checked from the response message if the
+	 * function intel_scu_ipc_dev_command succeeds.
 	 */
-	intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg, len,
-				  response, sizeof(response));
+	ret = intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg,
+					len, response, sizeof(response));
+
+	if (ret)
+		return ret;
+
 	if (response[2] & PMC_USB_RESP_STATUS_FAILURE) {
 		if (response[2] & PMC_USB_RESP_STATUS_FATAL)
 			return -EIO;
Signature · 1 line
2.28.0
#4 lore raw

Re: [PATCH 3/3] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions

Quoted 6 lines · Heikki Krogerus

From: Madhusudanarao Amara <[email protected]>

Check and return if there are errors. The response bits are valid only on no errors.

Fixes b7404a29cd3d ("usb: typec: intel_pmc_mux: Definitions for response status bits")

This is in 5.9-rc4, so shouldn't it go in for 5.9-final?

thanks,

greg k-h

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [PATCH 3/3] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions

Quoted 4 lines · Heikki Krogerus
Quoted 3 lines · Greg Kroah-Hartman
Quoted 2 lines · Heikki Krogerus

From: Madhusudanarao Amara <[email protected]>

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Check and return if there are errors. The response bits are valid only on no errors.

Fixes b7404a29cd3d ("usb: typec: intel_pmc_mux: Definitions for response status bits")

This is in 5.9-rc4, so shouldn't it go in for 5.9-final?

You are correct. I'm sorry about that. Do you want me to resend?

No worries, I'll take it in the correct branch now, thanks!

greg k-h